[PATCH] D28295: [libunwind] [cmake] Support overriding LLVM_CMAKE_PATH

2017-01-06 Thread Michał Górny via Phabricator via cfe-commits
mgorny planned changes to this revision.
mgorny added a comment.

Since https://reviews.llvm.org/D26894 was accepted, I will be preparing a patch 
using that instead.


https://reviews.llvm.org/D28295



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


[PATCH] D28304: [compiler-rt] [cmake] Disable appending -msse4.2 flag implicitly

2017-01-06 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL291217: [cmake] Disable appending -msse4.2 flag implicitly 
(authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D28304?vs=83298&id=83347#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28304

Files:
  compiler-rt/trunk/cmake/config-ix.cmake
  compiler-rt/trunk/lib/scudo/CMakeLists.txt


Index: compiler-rt/trunk/lib/scudo/CMakeLists.txt
===
--- compiler-rt/trunk/lib/scudo/CMakeLists.txt
+++ compiler-rt/trunk/lib/scudo/CMakeLists.txt
@@ -4,7 +4,6 @@
 
 set(SCUDO_CFLAGS ${SANITIZER_COMMON_CFLAGS})
 append_rtti_flag(OFF SCUDO_CFLAGS)
-append_list_if(COMPILER_RT_HAS_MSSE4_2_FLAG -msse4.2 SCUDO_CFLAGS)
 
 set(SCUDO_SOURCES
   scudo_allocator.cpp
Index: compiler-rt/trunk/cmake/config-ix.cmake
===
--- compiler-rt/trunk/cmake/config-ix.cmake
+++ compiler-rt/trunk/cmake/config-ix.cmake
@@ -29,7 +29,6 @@
 check_cxx_compiler_flag(-ftls-model=initial-exec 
COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
 check_cxx_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)
 check_cxx_compiler_flag("-Werror -msse3" COMPILER_RT_HAS_MSSE3_FLAG)
-check_cxx_compiler_flag("-Werror -msse4.2"   COMPILER_RT_HAS_MSSE4_2_FLAG)
 check_cxx_compiler_flag(--sysroot=.  COMPILER_RT_HAS_SYSROOT_FLAG)
 
 if(NOT WIN32 AND NOT CYGWIN)


Index: compiler-rt/trunk/lib/scudo/CMakeLists.txt
===
--- compiler-rt/trunk/lib/scudo/CMakeLists.txt
+++ compiler-rt/trunk/lib/scudo/CMakeLists.txt
@@ -4,7 +4,6 @@
 
 set(SCUDO_CFLAGS ${SANITIZER_COMMON_CFLAGS})
 append_rtti_flag(OFF SCUDO_CFLAGS)
-append_list_if(COMPILER_RT_HAS_MSSE4_2_FLAG -msse4.2 SCUDO_CFLAGS)
 
 set(SCUDO_SOURCES
   scudo_allocator.cpp
Index: compiler-rt/trunk/cmake/config-ix.cmake
===
--- compiler-rt/trunk/cmake/config-ix.cmake
+++ compiler-rt/trunk/cmake/config-ix.cmake
@@ -29,7 +29,6 @@
 check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
 check_cxx_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)
 check_cxx_compiler_flag("-Werror -msse3" COMPILER_RT_HAS_MSSE3_FLAG)
-check_cxx_compiler_flag("-Werror -msse4.2"   COMPILER_RT_HAS_MSSE4_2_FLAG)
 check_cxx_compiler_flag(--sysroot=.  COMPILER_RT_HAS_SYSROOT_FLAG)
 
 if(NOT WIN32 AND NOT CYGWIN)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26900: [cmake] Obtain LLVM_CMAKE_PATH from llvm-config

2017-01-06 Thread Michał Górny via Phabricator via cfe-commits
mgorny added reviewers: EricWF, mclow.lists, phosek, compnerd, Hahnfeld.
mgorny added a comment.

Little ping here. This is quite trivial, and since 
https://reviews.llvm.org/D26894 has been committed already I'd like to start 
adding changes like this one to all LLVM projects using llvm-config in 
stand-alone build.


https://reviews.llvm.org/D26900



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


[PATCH] D28320: [Driver] Driver changes to support CUDA compilation on Windows.

2017-01-06 Thread NAKAMURA Takumi via Phabricator via cfe-commits
chapuni added a comment.

It fails with LLVM_DEFAULT_TARGET_TRIPLE=i686-pc-win32, on linux.
http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/33445
Seems it assumes Windows' layout even if the host is not Windows.

  128838 stat64("/path/to/llvm-project/clang/test/Driver/Inputs/CUDA/Program 
Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0", 0xffc9bdc0) = -1 ENOENT (No such 
file or directory)

If you wouldn't consider such a configuration, I could add exclusion to lit.cfg.


Repository:
  rL LLVM

https://reviews.llvm.org/D28320



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


[PATCH] D28349: [Frontend] The macro that describes the Objective-C bool type should be defined in C as well

2017-01-06 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman updated this revision to Diff 83354.
arphaman added a comment.

Set the macro unconditionally.


Repository:
  rL LLVM

https://reviews.llvm.org/D28349

Files:
  lib/Frontend/InitPreprocessor.cpp
  test/Frontend/objc-bool-is-bool.m


Index: test/Frontend/objc-bool-is-bool.m
===
--- test/Frontend/objc-bool-is-bool.m
+++ test/Frontend/objc-bool-is-bool.m
@@ -1,13 +1,13 @@
 // RUN: %clang_cc1 -fsyntax-only -E -dM -triple=armv7k-apple-watchos %s | 
FileCheck --check-prefix=BOOL %s
 // RUN: %clang_cc1 -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s | 
FileCheck --check-prefix=CHAR %s
-// RUN: %clang_cc1 -x c -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s 
| FileCheck --check-prefix=NONE %s
+// RUN: %clang_cc1 -x c -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s 
| FileCheck --check-prefix=CHAR %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -E -dM 
-triple=x86_64-apple-darwin16 %s | FileCheck --check-prefix=CHAR %s
+// RUN: %clang_cc1 -x c++ -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 
%s | FileCheck --check-prefix=CHAR %s
 
 // rdar://21170440
 
 // BOOL: #define __OBJC_BOOL_IS_BOOL 1
 // BOOL-NOT: #define __OBJC_BOOL_IS_BOOL 0
 
 // CHAR: #define __OBJC_BOOL_IS_BOOL 0
 // CHAR-NOT: #define __OBJC_BOOL_IS_BOOL 1
-
-// NONE-NOT: __OBJC_BOOL_IS_BOOL
Index: lib/Frontend/InitPreprocessor.cpp
===
--- lib/Frontend/InitPreprocessor.cpp
+++ lib/Frontend/InitPreprocessor.cpp
@@ -593,9 +593,6 @@
 Builder.defineMacro("OBJC_ZEROCOST_EXCEPTIONS");
 }
 
-Builder.defineMacro("__OBJC_BOOL_IS_BOOL",
-Twine(TI.useSignedCharForObjCBool() ? "0" : "1"));
-
 if (LangOpts.getGC() != LangOptions::NonGC)
   Builder.defineMacro("__OBJC_GC__");
 
@@ -626,6 +623,11 @@
 Builder.defineMacro("IB_DESIGNABLE", "");
   }
 
+  // Define a macro that describes the Objective-C boolean type even for C
+  // and C++ since BOOL can be used from non Objective-C code.
+  Builder.defineMacro("__OBJC_BOOL_IS_BOOL",
+  Twine(TI.useSignedCharForObjCBool() ? "0" : "1"));
+
   if (LangOpts.CPlusPlus)
 InitializeCPlusPlusFeatureTestMacros(LangOpts, Builder);
 


Index: test/Frontend/objc-bool-is-bool.m
===
--- test/Frontend/objc-bool-is-bool.m
+++ test/Frontend/objc-bool-is-bool.m
@@ -1,13 +1,13 @@
 // RUN: %clang_cc1 -fsyntax-only -E -dM -triple=armv7k-apple-watchos %s | FileCheck --check-prefix=BOOL %s
 // RUN: %clang_cc1 -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s | FileCheck --check-prefix=CHAR %s
-// RUN: %clang_cc1 -x c -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s | FileCheck --check-prefix=NONE %s
+// RUN: %clang_cc1 -x c -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s | FileCheck --check-prefix=CHAR %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s | FileCheck --check-prefix=CHAR %s
+// RUN: %clang_cc1 -x c++ -fsyntax-only -E -dM -triple=x86_64-apple-darwin16 %s | FileCheck --check-prefix=CHAR %s
 
 // rdar://21170440
 
 // BOOL: #define __OBJC_BOOL_IS_BOOL 1
 // BOOL-NOT: #define __OBJC_BOOL_IS_BOOL 0
 
 // CHAR: #define __OBJC_BOOL_IS_BOOL 0
 // CHAR-NOT: #define __OBJC_BOOL_IS_BOOL 1
-
-// NONE-NOT: __OBJC_BOOL_IS_BOOL
Index: lib/Frontend/InitPreprocessor.cpp
===
--- lib/Frontend/InitPreprocessor.cpp
+++ lib/Frontend/InitPreprocessor.cpp
@@ -593,9 +593,6 @@
 Builder.defineMacro("OBJC_ZEROCOST_EXCEPTIONS");
 }
 
-Builder.defineMacro("__OBJC_BOOL_IS_BOOL",
-Twine(TI.useSignedCharForObjCBool() ? "0" : "1"));
-
 if (LangOpts.getGC() != LangOptions::NonGC)
   Builder.defineMacro("__OBJC_GC__");
 
@@ -626,6 +623,11 @@
 Builder.defineMacro("IB_DESIGNABLE", "");
   }
 
+  // Define a macro that describes the Objective-C boolean type even for C
+  // and C++ since BOOL can be used from non Objective-C code.
+  Builder.defineMacro("__OBJC_BOOL_IS_BOOL",
+  Twine(TI.useSignedCharForObjCBool() ? "0" : "1"));
+
   if (LangOpts.CPlusPlus)
 InitializeCPlusPlusFeatureTestMacros(LangOpts, Builder);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28349: [Frontend] The macro that describes the Objective-C bool type should be defined in C as well

2017-01-06 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

In https://reviews.llvm.org/D28349#636968, @doug.gregor wrote:

> The "!LangOpts.CPlusPlus" doesn't make sense to me. You're presumably 
> defining this macro in C because the Objective-C runtime is usable from C, 
> but that same logic applies to C++ code. It seems like we should be defining 
> this macro unconditionally.


That's true. I was initially reluctant to define it for C++ as well since this 
macro is available on all platforms, but I guess there's no way around this.


Repository:
  rL LLVM

https://reviews.llvm.org/D28349



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


r291230 - Constify UsingPackDecl::getInstantiatedFromUsingDecl(), NFC.

2017-01-06 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Fri Jan  6 05:15:57 2017
New Revision: 291230

URL: http://llvm.org/viewvc/llvm-project?rev=291230&view=rev
Log:
Constify UsingPackDecl::getInstantiatedFromUsingDecl(), NFC.


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

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=291230&r1=291229&r2=291230&view=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Fri Jan  6 05:15:57 2017
@@ -3181,7 +3181,7 @@ public:
   /// Get the using declaration from which this was instantiated. This will
   /// always be an UnresolvedUsingValueDecl or an UnresolvedUsingTypenameDecl
   /// that is a pack expansion.
-  NamedDecl *getInstantiatedFromUsingDecl() { return InstantiatedFrom; }
+  NamedDecl *getInstantiatedFromUsingDecl() const { return InstantiatedFrom; }
 
   /// Get the set of using declarations that this pack expanded into. Note that
   /// some of these may still be unresolved.


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


r291231 - [ObjC] The declarator for a block literal should be a definition

2017-01-06 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Fri Jan  6 05:31:12 2017
New Revision: 291231

URL: http://llvm.org/viewvc/llvm-project?rev=291231&view=rev
Log:
[ObjC] The declarator for a block literal should be a definition

This change avoids the -Wstrict-prototypes warning for block literals with an
empty argument list or without argument lists.

rdar://15060615

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

Modified:
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/test/Sema/warn-strict-prototypes.m
cfe/trunk/test/SemaObjC/block-omitted-return-type.m

Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=291231&r1=291230&r2=291231&view=diff
==
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Fri Jan  6 05:31:12 2017
@@ -2751,6 +2751,7 @@ void Parser::ParseBlockId(SourceLocation
 
   // Parse the block-declarator.
   Declarator DeclaratorInfo(DS, Declarator::BlockLiteralContext);
+  DeclaratorInfo.setFunctionDefinitionKind(FDK_Definition);
   ParseDeclarator(DeclaratorInfo);
 
   MaybeParseGNUAttributes(DeclaratorInfo);
@@ -2789,6 +2790,7 @@ ExprResult Parser::ParseBlockLiteralExpr
   // Parse the return type if present.
   DeclSpec DS(AttrFactory);
   Declarator ParamInfo(DS, Declarator::BlockLiteralContext);
+  ParamInfo.setFunctionDefinitionKind(FDK_Definition);
   // FIXME: Since the return type isn't actually parsed, it can't be used to
   // fill ParamInfo with an initial valid range, so do it manually.
   ParamInfo.SetSourceRange(SourceRange(Tok.getLocation(), Tok.getLocation()));

Modified: cfe/trunk/test/Sema/warn-strict-prototypes.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-strict-prototypes.m?rev=291231&r1=291230&r2=291231&view=diff
==
--- cfe/trunk/test/Sema/warn-strict-prototypes.m (original)
+++ cfe/trunk/test/Sema/warn-strict-prototypes.m Fri Jan  6 05:31:12 2017
@@ -14,7 +14,8 @@ void foo() {
   void (^block)() = // expected-warning {{this function declaration is not a 
prototype}}
 ^void(int arg) { // no warning
   };
-  void (^block2)(void) = // no warning
- ^void() { // expected-warning {{this function 
declaration is not a prototype}}
+  void (^block2)(void) = ^void() { // no warning
+  };
+  void (^block3)(void) = ^ { // no warning
   };
 }

Modified: cfe/trunk/test/SemaObjC/block-omitted-return-type.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/block-omitted-return-type.m?rev=291231&r1=291230&r2=291231&view=diff
==
--- cfe/trunk/test/SemaObjC/block-omitted-return-type.m (original)
+++ cfe/trunk/test/SemaObjC/block-omitted-return-type.m Fri Jan  6 05:31:12 2017
@@ -24,7 +24,7 @@
 return;
   };
   void (^simpleBlock5)() = ^ const void { //expected-error {{incompatible 
block pointer types initializing 'void (^)()' with an expression of type 'const 
void (^)(void)'}}
-return;
+return; // expected-warning@-1 {{function cannot return qualified void 
type 'const void'}}
   };
   void (^simpleBlock6)() = ^ const (void) { //expected-warning {{'const' 
qualifier on omitted return type '' has no effect}}
 return;


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


[PATCH] D28296: [ObjC] The declarator for a block literal should be a definition

2017-01-06 Thread Alex Lorenz via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL291231: [ObjC] The declarator for a block literal should be 
a definition (authored by arphaman).

Changed prior to commit:
  https://reviews.llvm.org/D28296?vs=83061&id=83355#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28296

Files:
  cfe/trunk/lib/Parse/ParseExpr.cpp
  cfe/trunk/test/Sema/warn-strict-prototypes.m
  cfe/trunk/test/SemaObjC/block-omitted-return-type.m


Index: cfe/trunk/test/Sema/warn-strict-prototypes.m
===
--- cfe/trunk/test/Sema/warn-strict-prototypes.m
+++ cfe/trunk/test/Sema/warn-strict-prototypes.m
@@ -14,7 +14,8 @@
   void (^block)() = // expected-warning {{this function declaration is not a 
prototype}}
 ^void(int arg) { // no warning
   };
-  void (^block2)(void) = // no warning
- ^void() { // expected-warning {{this function 
declaration is not a prototype}}
+  void (^block2)(void) = ^void() { // no warning
+  };
+  void (^block3)(void) = ^ { // no warning
   };
 }
Index: cfe/trunk/test/SemaObjC/block-omitted-return-type.m
===
--- cfe/trunk/test/SemaObjC/block-omitted-return-type.m
+++ cfe/trunk/test/SemaObjC/block-omitted-return-type.m
@@ -24,7 +24,7 @@
 return;
   };
   void (^simpleBlock5)() = ^ const void { //expected-error {{incompatible 
block pointer types initializing 'void (^)()' with an expression of type 'const 
void (^)(void)'}}
-return;
+return; // expected-warning@-1 {{function cannot return qualified void 
type 'const void'}}
   };
   void (^simpleBlock6)() = ^ const (void) { //expected-warning {{'const' 
qualifier on omitted return type '' has no effect}}
 return;
Index: cfe/trunk/lib/Parse/ParseExpr.cpp
===
--- cfe/trunk/lib/Parse/ParseExpr.cpp
+++ cfe/trunk/lib/Parse/ParseExpr.cpp
@@ -2751,6 +2751,7 @@
 
   // Parse the block-declarator.
   Declarator DeclaratorInfo(DS, Declarator::BlockLiteralContext);
+  DeclaratorInfo.setFunctionDefinitionKind(FDK_Definition);
   ParseDeclarator(DeclaratorInfo);
 
   MaybeParseGNUAttributes(DeclaratorInfo);
@@ -2789,6 +2790,7 @@
   // Parse the return type if present.
   DeclSpec DS(AttrFactory);
   Declarator ParamInfo(DS, Declarator::BlockLiteralContext);
+  ParamInfo.setFunctionDefinitionKind(FDK_Definition);
   // FIXME: Since the return type isn't actually parsed, it can't be used to
   // fill ParamInfo with an initial valid range, so do it manually.
   ParamInfo.SetSourceRange(SourceRange(Tok.getLocation(), Tok.getLocation()));


Index: cfe/trunk/test/Sema/warn-strict-prototypes.m
===
--- cfe/trunk/test/Sema/warn-strict-prototypes.m
+++ cfe/trunk/test/Sema/warn-strict-prototypes.m
@@ -14,7 +14,8 @@
   void (^block)() = // expected-warning {{this function declaration is not a prototype}}
 ^void(int arg) { // no warning
   };
-  void (^block2)(void) = // no warning
- ^void() { // expected-warning {{this function declaration is not a prototype}}
+  void (^block2)(void) = ^void() { // no warning
+  };
+  void (^block3)(void) = ^ { // no warning
   };
 }
Index: cfe/trunk/test/SemaObjC/block-omitted-return-type.m
===
--- cfe/trunk/test/SemaObjC/block-omitted-return-type.m
+++ cfe/trunk/test/SemaObjC/block-omitted-return-type.m
@@ -24,7 +24,7 @@
 return;
   };
   void (^simpleBlock5)() = ^ const void { //expected-error {{incompatible block pointer types initializing 'void (^)()' with an expression of type 'const void (^)(void)'}}
-return;
+return; // expected-warning@-1 {{function cannot return qualified void type 'const void'}}
   };
   void (^simpleBlock6)() = ^ const (void) { //expected-warning {{'const' qualifier on omitted return type '' has no effect}}
 return;
Index: cfe/trunk/lib/Parse/ParseExpr.cpp
===
--- cfe/trunk/lib/Parse/ParseExpr.cpp
+++ cfe/trunk/lib/Parse/ParseExpr.cpp
@@ -2751,6 +2751,7 @@
 
   // Parse the block-declarator.
   Declarator DeclaratorInfo(DS, Declarator::BlockLiteralContext);
+  DeclaratorInfo.setFunctionDefinitionKind(FDK_Definition);
   ParseDeclarator(DeclaratorInfo);
 
   MaybeParseGNUAttributes(DeclaratorInfo);
@@ -2789,6 +2790,7 @@
   // Parse the return type if present.
   DeclSpec DS(AttrFactory);
   Declarator ParamInfo(DS, Declarator::BlockLiteralContext);
+  ParamInfo.setFunctionDefinitionKind(FDK_Definition);
   // FIXME: Since the return type isn't actually parsed, it can't be used to
   // fill ParamInfo with an initial valid range, so do it manually.
   ParamInfo.SetSourceRange(SourceRange(Tok.getLocation(), Tok.getLocation()));
___
cfe-com

[PATCH] D26034: [CodeCompletion] Block property setters: Use dynamic priority heuristic

2017-01-06 Thread Alex Lorenz via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL291232: [CodeCompletion] Block property setters: Use dynamic 
priority heuristic (authored by arphaman).

Changed prior to commit:
  https://reviews.llvm.org/D26034?vs=82866&id=83356#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26034

Files:
  cfe/trunk/lib/Sema/SemaCodeComplete.cpp
  cfe/trunk/test/Index/complete-block-properties.m
  cfe/trunk/test/Index/complete-block-property-assignment.m


Index: cfe/trunk/test/Index/complete-block-properties.m
===
--- cfe/trunk/test/Index/complete-block-properties.m
+++ cfe/trunk/test/Index/complete-block-properties.m
@@ -43,7 +43,7 @@
 //CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText 
block}{LeftParen (}{RightParen )} (35)
 //CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void (^)()}{TypedText 
block}{Equal  = }{Placeholder ^(void)} (38)
 //CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Foo}{TypedText 
blocker}{LeftParen (}{Placeholder int x}{Comma , }{Placeholder Foo y}{Comma , 
}{Placeholder ^(Foo *someParameter)foo}{RightParen )} (35)
-//CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Foo (^)(int, Foo, 
FooBlock)}{TypedText blocker}{Equal  = }{Placeholder ^Foo(int x, Foo y, 
FooBlock foo)} (38)
+//CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Foo (^)(int, Foo, 
FooBlock)}{TypedText blocker}{Equal  = }{Placeholder ^Foo(int x, Foo y, 
FooBlock foo)} (32)
 //CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText foo} (35)
 //CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText 
fooBlock}{LeftParen (}{Placeholder Foo *someParameter}{RightParen )} (35)
 //CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Test *}{TypedText 
getObject}{LeftParen (}{Placeholder int index}{RightParen )} (35)
Index: cfe/trunk/test/Index/complete-block-property-assignment.m
===
--- cfe/trunk/test/Index/complete-block-property-assignment.m
+++ cfe/trunk/test/Index/complete-block-property-assignment.m
@@ -15,6 +15,7 @@
 @interface Test : Obj
 @property (readwrite, nonatomic, copy) FooBlock onEventHandler;
 @property (readonly, nonatomic, copy) void (^onReadonly)(int *someParameter);
+@property (readwrite, nonatomic, copy) int (^processEvent)(int eventCode);
 @property (readonly, nonatomic, strong) Obj *obj;
 @end
 
@@ -29,17 +30,19 @@
   SELFY.foo = 2
 }
 
-// RUN: c-index-test -code-completion-at=%s:26:8 %s | FileCheck 
-check-prefix=CHECK-CC1 %s
-// RUN: c-index-test -code-completion-at=%s:27:27 %s | FileCheck 
-check-prefix=CHECK-CC1 %s
-// RUN: c-index-test -code-completion-at=%s:28:22 %s | FileCheck 
-check-prefix=CHECK-CC1 %s
-// RUN: c-index-test -code-completion-at=%s:29:9 %s | FileCheck 
-check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:27:8 %s | FileCheck 
-check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:28:27 %s | FileCheck 
-check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:29:22 %s | FileCheck 
-check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:30:9 %s | FileCheck 
-check-prefix=CHECK-CC1 %s
 // CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText foo} (35)
 // CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Obj *}{TypedText obj} (35)
 // CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText 
onAction}{LeftParen (}{Placeholder Obj *object}{RightParen )} (35)
 // CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void (^)(Obj *)}{TypedText 
onAction}{Equal  = }{Placeholder ^(Obj *object)} (38)
 // CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText 
onEventHandler}{LeftParen (}{Placeholder Foo *someParameter}{RightParen )} (35)
 // CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType FooBlock}{TypedText 
onEventHandler}{Equal  = }{Placeholder ^(Foo *someParameter)} (38)
 // CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText 
onReadonly}{LeftParen (}{Placeholder int *someParameter}{RightParen )} (35)
+// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText 
processEvent}{LeftParen (}{Placeholder int eventCode}{RightParen )} (35)
+// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType int (^)(int)}{TypedText 
processEvent}{Equal  = }{Placeholder ^int(int eventCode)} (32)
 
 - (void) takeInt:(int)x { }
 
@@ -53,16 +56,17 @@
   return self.foo;
 }
 
-// RUN: c-index-test -code-completion-at=%s:47:9 %s | FileCheck 
-check-prefix=CHECK-NO %s
-// RUN: c-index-test -code-completion-at=%s:48:16 %s | FileCheck 
-check-prefix=CHECK-NO %s
-// RUN: c-index-test -code-completion-at=%s:49:23 %s | FileCheck 
-check-prefix=CHECK-NO %s
-// RUN: c-index-test -code-completion-at=%s:50:12 %s | FileCheck 
-check-prefix=CHECK-NO %s
-// RUN: c-index-test -code-completion-at=%s:51:15 %s | FileCheck 
-check-prefix=CHECK-NO %s
-// RUN: c-index-test -code-completion-at=%s:53:15 %s | FileCheck 
-check-prefix=CHECK-NO %s
+// RUN: c-index-test -code-completion-at=%s:50:9 %s | 

r291232 - [CodeCompletion] Block property setters: Use dynamic priority heuristic

2017-01-06 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Fri Jan  6 06:00:44 2017
New Revision: 291232

URL: http://llvm.org/viewvc/llvm-project?rev=291232&view=rev
Log:
[CodeCompletion] Block property setters: Use dynamic priority heuristic

Now when completing blocks properties that return void the block call completion
result shows up before the setter, otherwise the setter completion shows up
before the block call completion. We normally want to use the result of the
block call, so one typically wouldn't call a block that returns a non-void type
in a standalone statement.

rdar://28846153

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

Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/Index/complete-block-properties.m
cfe/trunk/test/Index/complete-block-property-assignment.m

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=291232&r1=291231&r2=291232&view=diff
==
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Jan  6 06:00:44 2017
@@ -3720,9 +3720,17 @@ static void AddObjCProperties(
   Builder.AddPlaceholderChunk(
   Builder.getAllocator().CopyString(PlaceholderStr));
 
+  // When completing blocks properties that return void the default
+  // property completion result should show up before the setter,
+  // otherwise the setter completion should show up before the default
+  // property completion, as we normally want to use the result of the
+  // call.
   Results.MaybeAddResult(
   Result(Builder.TakeString(), P,
- Results.getBasePriority(P) + CCD_BlockPropertySetter),
+ Results.getBasePriority(P) +
+ (BlockLoc.getTypePtr()->getReturnType()->isVoidType()
+  ? CCD_BlockPropertySetter
+  : -CCD_BlockPropertySetter)),
   CurContext);
 }
   };

Modified: cfe/trunk/test/Index/complete-block-properties.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-block-properties.m?rev=291232&r1=291231&r2=291232&view=diff
==
--- cfe/trunk/test/Index/complete-block-properties.m (original)
+++ cfe/trunk/test/Index/complete-block-properties.m Fri Jan  6 06:00:44 2017
@@ -43,7 +43,7 @@ typedef int (^BarBlock)(int *);
 //CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText 
block}{LeftParen (}{RightParen )} (35)
 //CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void (^)()}{TypedText 
block}{Equal  = }{Placeholder ^(void)} (38)
 //CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Foo}{TypedText 
blocker}{LeftParen (}{Placeholder int x}{Comma , }{Placeholder Foo y}{Comma , 
}{Placeholder ^(Foo *someParameter)foo}{RightParen )} (35)
-//CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Foo (^)(int, Foo, 
FooBlock)}{TypedText blocker}{Equal  = }{Placeholder ^Foo(int x, Foo y, 
FooBlock foo)} (38)
+//CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Foo (^)(int, Foo, 
FooBlock)}{TypedText blocker}{Equal  = }{Placeholder ^Foo(int x, Foo y, 
FooBlock foo)} (32)
 //CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText foo} (35)
 //CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText 
fooBlock}{LeftParen (}{Placeholder Foo *someParameter}{RightParen )} (35)
 //CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Test *}{TypedText 
getObject}{LeftParen (}{Placeholder int index}{RightParen )} (35)

Modified: cfe/trunk/test/Index/complete-block-property-assignment.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-block-property-assignment.m?rev=291232&r1=291231&r2=291232&view=diff
==
--- cfe/trunk/test/Index/complete-block-property-assignment.m (original)
+++ cfe/trunk/test/Index/complete-block-property-assignment.m Fri Jan  6 
06:00:44 2017
@@ -15,6 +15,7 @@ typedef void (^FooBlock)(Foo *someParame
 @interface Test : Obj
 @property (readwrite, nonatomic, copy) FooBlock onEventHandler;
 @property (readonly, nonatomic, copy) void (^onReadonly)(int *someParameter);
+@property (readwrite, nonatomic, copy) int (^processEvent)(int eventCode);
 @property (readonly, nonatomic, strong) Obj *obj;
 @end
 
@@ -29,10 +30,10 @@ typedef void (^FooBlock)(Foo *someParame
   SELFY.foo = 2
 }
 
-// RUN: c-index-test -code-completion-at=%s:26:8 %s | FileCheck 
-check-prefix=CHECK-CC1 %s
-// RUN: c-index-test -code-completion-at=%s:27:27 %s | FileCheck 
-check-prefix=CHECK-CC1 %s
-// RUN: c-index-test -code-completion-at=%s:28:22 %s | FileCheck 
-check-prefix=CHECK-CC1 %s
-// RUN: c-index-test -code-completion-at=%s:29:9 %s | FileCheck 
-check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:27:8 %s | FileCheck 
-check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completi

LLVM build fix for VS2017 RC (19.00.24215.1)

2017-01-06 Thread Andrew Rogers via cfe-commits
Hi,

I just downloaded VS2017 RC on a clean Win10 machine, checked out LLVM &
clang and tried to build clang.

The following code in
\tools\clang\utils\TableGen\ClangDiagnosticsEmitter.cpp failed to compile:

RecordSet DiagsInPedanticSet;
RecordSet GroupsInPedanticSet;
InferPedantic inferPedantic(DGParentMap, Diags, DiagGroups,
DiagsInGroup);
inferPedantic.compute(&DiagsInPedanticSet, &GroupsInPedanticSet);
auto &PedDiags = DiagsInGroup["pedantic"];
// Put the diagnostics into a deterministic order.
RecordVec DiagsInPedantic(DiagsInPedanticSet.begin(),
  DiagsInPedanticSet.end());

because the RecordSet iterators created by DiagsInPedanticSet.begin() and
DiagsInPedanticSet.end() are not const iterators and the VS2017 vector code
tries to use (binary) operator* with one of these iterators, and expects  to
get a const ValueT but the compiler can currently only resolve the non-const
operator* on the DenseSet iterator. The patch implements operator* and
operator-> for const ValueT on the iterators in include/llvm/ADT/DenseSet.h.

The attached patch resolves the VS2017 build failure for me - do I need to
run further checks before someone can review/commit it for me?

Note: the fix is in the LLVM repository, not the clang repository.

Thanks, Andrew R


llvm-2017-build-fix.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r291123 - CodeGen: plumb header search down to the IAS

2017-01-06 Thread Hal Finkel via cfe-commits


On 01/05/2017 08:30 PM, Eric Christopher via cfe-commits wrote:
Ok, thanks. I agree that it's a problem. I'm definitely open for 
testing ideas here. There are a few other things in the 
TargetOptions/MCTargetOptions area that are already problematic to test.


I think that we need to add serialization for these structures, and a 
printing option for them, so that we can test these kinds of things. 
That having been said, a lot of these things need to end up in 
attributes so that they work correctly with LTO. Is this one of them?


 -Hal



-eric

On Thu, Jan 5, 2017 at 6:27 PM Saleem Abdulrasool 
mailto:compn...@compnerd.org>> wrote:


This was certainly the problem that I had.  The test really needs
a way to check that the field was set.  As you state, this is a
problematic area.  The backend already has a test to ensure that
the paths are honored, but, I didn't see any way to actually
ensure that it was getting sent to the backend otherwise.

The module itself doesnt encode the search path, nor is the
information in the command line. I can see the argument that the
test itself doesn't add much value especially with the backend
side testing that the processing of the inclusion does occur
correctly. I'll go ahead and remove the test (which already has
ended up being a pain to test).

On Thu, Jan 5, 2017 at 6:11 PM, Eric Christopher
mailto:echri...@gmail.com>> wrote:

Hi Saleem,

Love that you wanted to add a test for it, but I'd really
prefer that you not engage the backend here in order to do it.
You can verify some of it from the backend and just that the
module is correct via the front end if you'd like. Ensuring
the paths are correct is a bit of a sticky problem, but this
is an API boundary that we just have problems with.

TL;DR: Would you mind splitting this test into front end and
back end tests and avoid using the backend in clang's test
harness?

Thanks!

-eric

On Thu, Jan 5, 2017 at 8:13 AM Saleem Abdulrasool via
cfe-commits mailto:cfe-commits@lists.llvm.org>> wrote:

Author: compnerd
Date: Thu Jan  5 10:02:32 2017
New Revision: 291123

URL: http://llvm.org/viewvc/llvm-project?rev=291123&view=rev
Log:
CodeGen: plumb header search down to the IAS

inline assembly may use the `.include` directive to
include other
content into the file.  Without the integrated assembler,
the `-I` group
gets passed to the assembler.  Emulate this by collecting
the header
search paths and passing them to the IAS.

Resolves PR24811!

Added:
cfe/trunk/test/CodeGen/include/
cfe/trunk/test/CodeGen/include/function.x
cfe/trunk/test/CodeGen/include/module.x
cfe/trunk/test/CodeGen/inline-asm-inclusion.c
Modified:
cfe/trunk/include/clang/CodeGen/BackendUtil.h
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/CodeGen/CodeGenAction.cpp
cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp

Modified: cfe/trunk/include/clang/CodeGen/BackendUtil.h
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/BackendUtil.h?rev=291123&r1=291122&r2=291123&view=diff

==
--- cfe/trunk/include/clang/CodeGen/BackendUtil.h (original)
+++ cfe/trunk/include/clang/CodeGen/BackendUtil.h Thu Jan 
5 10:02:32 2017

@@ -21,6 +21,7 @@ namespace llvm {

 namespace clang {
   class DiagnosticsEngine;
+  class HeaderSearchOptions;
   class CodeGenOptions;
   class TargetOptions;
   class LangOptions;
@@ -34,7 +35,8 @@ namespace clang {
 Backend_EmitObj///< Emit native object files
   };

-  void EmitBackendOutput(DiagnosticsEngine &Diags, const
CodeGenOptions &CGOpts,
+  void EmitBackendOutput(DiagnosticsEngine &Diags, const
HeaderSearchOptions &,
+ const CodeGenOptions &CGOpts,
  const TargetOptions &TOpts,
const LangOptions &LOpts,
  const llvm::DataLayout &TDesc,
llvm::Module *M,
  BackendAction Action,

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL:

http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=291123&r1=291122&r2=291123&view=diff

=

[PATCH] D28242: [ubsan] Minimize size of data for type_mismatch (Redo of D19667)

2017-01-06 Thread Filipe Cabecinhas via Phabricator via cfe-commits
filcab accepted this revision.
filcab added a reviewer: filcab.
filcab added a comment.
This revision is now accepted and ready to land.

Since Richard has already LGTMed the previous version, and this is a trivial 
change, I'll go ahead with committing.


https://reviews.llvm.org/D28242



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


r291236 - [ubsan] Minimize size of data for type_mismatch (Redo of D19667)

2017-01-06 Thread Filipe Cabecinhas via cfe-commits
Author: filcab
Date: Fri Jan  6 08:40:12 2017
New Revision: 291236

URL: http://llvm.org/viewvc/llvm-project?rev=291236&view=rev
Log:
[ubsan] Minimize size of data for type_mismatch (Redo of D19667)

Summary:
This patch makes the type_mismatch static data 7 bytes smaller (and it
ends up being 16 bytes smaller due to alignment restrictions, at least
on some x86-64 environments).

It revs up the type_mismatch handler version since we're breaking binary
compatibility. I will soon post a patch for the compiler-rt side.

Reviewers: rsmith, kcc, vitalybuka, pgousseau, gbedwell

Subscribers: llvm-commits

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

Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/test/CodeGen/catch-undef-behavior.c
cfe/trunk/test/CodeGen/sanitize-recover.c
cfe/trunk/test/CodeGenCXX/ubsan-vtable-checks.cpp

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=291236&r1=291235&r2=291236&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Jan  6 08:40:12 2017
@@ -604,12 +604,13 @@ void CodeGenFunction::EmitTypeCheck(Type
   }
 
   if (Checks.size() > 0) {
+// Make sure we're not losing information. Alignment needs to be a power of
+// 2
+assert(!AlignVal || (uint64_t)1 << llvm::Log2_64(AlignVal) == AlignVal);
 llvm::Constant *StaticData[] = {
- EmitCheckSourceLocation(Loc),
-  EmitCheckTypeDescriptor(Ty),
-  llvm::ConstantInt::get(SizeTy, AlignVal),
-  llvm::ConstantInt::get(Int8Ty, TCK)
-};
+EmitCheckSourceLocation(Loc), EmitCheckTypeDescriptor(Ty),
+llvm::ConstantInt::get(Int8Ty, AlignVal ? llvm::Log2_64(AlignVal) : 1),
+llvm::ConstantInt::get(Int8Ty, TCK)};
 EmitCheck(Checks, SanitizerHandler::TypeMismatch, StaticData, Ptr);
   }
 

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=291236&r1=291235&r2=291236&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Fri Jan  6 08:40:12 2017
@@ -120,7 +120,7 @@ enum TypeEvaluationKind {
   SANITIZER_CHECK(OutOfBounds, out_of_bounds, 0)   
\
   SANITIZER_CHECK(ShiftOutOfBounds, shift_out_of_bounds, 0)
\
   SANITIZER_CHECK(SubOverflow, sub_overflow, 0)
\
-  SANITIZER_CHECK(TypeMismatch, type_mismatch, 0)  
\
+  SANITIZER_CHECK(TypeMismatch, type_mismatch, 1)  
\
   SANITIZER_CHECK(VLABoundNotPositive, vla_bound_not_positive, 0)
 
 enum SanitizerHandler {

Modified: cfe/trunk/test/CodeGen/catch-undef-behavior.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/catch-undef-behavior.c?rev=291236&r1=291235&r2=291236&view=diff
==
--- cfe/trunk/test/CodeGen/catch-undef-behavior.c (original)
+++ cfe/trunk/test/CodeGen/catch-undef-behavior.c Fri Jan  6 08:40:12 2017
@@ -6,16 +6,16 @@
 // CHECK-UBSAN: @[[INT:.*]] = private unnamed_addr constant { i16, i16, [6 x 
i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }
 
 // FIXME: When we only emit each type once, use [[INT]] more below.
-// CHECK-UBSAN: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 
100, i32 5 {{.*}} @[[INT]], i64 4, i8 1
-// CHECK-UBSAN: @[[LINE_200:.*]] = {{.*}}, i32 200, i32 10 {{.*}}, i64 4, i8 0
+// CHECK-UBSAN: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 
100, i32 5 {{.*}} @[[INT]], i8 2, i8 1
+// CHECK-UBSAN: @[[LINE_200:.*]] = {{.*}}, i32 200, i32 10 {{.*}}, i8 2, i8 0
 // CHECK-UBSAN: @[[LINE_300:.*]] = {{.*}}, i32 300, i32 12 {{.*}} @{{.*}}, 
{{.*}} @{{.*}}
 // CHECK-UBSAN: @[[LINE_400:.*]] = {{.*}}, i32 400, i32 12 {{.*}} @{{.*}}, 
{{.*}} @{{.*}}
-// CHECK-UBSAN: @[[LINE_500:.*]] = {{.*}}, i32 500, i32 10 {{.*}} @{{.*}}, i64 
4, i8 0 }
-// CHECK-UBSAN: @[[LINE_600:.*]] = {{.*}}, i32 600, i32 3 {{.*}} @{{.*}}, i64 
4, i8 1 }
+// CHECK-UBSAN: @[[LINE_500:.*]] = {{.*}}, i32 500, i32 10 {{.*}} @{{.*}}, i8 
2, i8 0 }
+// CHECK-UBSAN: @[[LINE_600:.*]] = {{.*}}, i32 600, i32 3 {{.*}} @{{.*}}, i8 
2, i8 1 }
 
 // CHECK-UBSAN: @[[STRUCT_S:.*]] = private unnamed_addr constant { i16, i16, 
[11 x i8] } { i16 -1, i16 0, [11 x i8] c"'struct S'\00" }
 
-// CHECK-UBSAN: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} 
@[[STRUCT_S]], i64 4, i8 3 }
+// CHECK-UBSAN: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} 
@[[STRUCT_S]], i8 2, i8 3 }
 // CHECK-UBSAN: @[[LINE_800:.*]] = {{.*}}, i32 800, i32 12 {{.*}} @{{.*}} }
 // CHECK-UBSAN: @[[LINE_900:.*]] = {{.*}}, i32 900, i32 11 {{.*}} @{{.*}} }
 // CHECK-UBSAN: @[[LIN

[PATCH] D28242: [ubsan] Minimize size of data for type_mismatch (Redo of D19667)

2017-01-06 Thread Filipe Cabecinhas via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL291236: [ubsan] Minimize size of data for type_mismatch 
(Redo of D19667) (authored by filcab).

Changed prior to commit:
  https://reviews.llvm.org/D28242?vs=82913&id=83362#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28242

Files:
  cfe/trunk/lib/CodeGen/CGExpr.cpp
  cfe/trunk/lib/CodeGen/CodeGenFunction.h
  cfe/trunk/test/CodeGen/catch-undef-behavior.c
  cfe/trunk/test/CodeGen/sanitize-recover.c
  cfe/trunk/test/CodeGenCXX/ubsan-vtable-checks.cpp

Index: cfe/trunk/test/CodeGenCXX/ubsan-vtable-checks.cpp
===
--- cfe/trunk/test/CodeGenCXX/ubsan-vtable-checks.cpp
+++ cfe/trunk/test/CodeGenCXX/ubsan-vtable-checks.cpp
@@ -21,7 +21,7 @@
   // CHECK-NULL-NOT: load {{.*}} (%struct.T*{{.*}})**, {{.*}} (%struct.T*{{.*}})***
   // CHECK-NULL: [[UBSAN_CMP_RES:%[0-9]+]] = icmp ne %struct.T* %{{[_a-z0-9]+}}, null
   // CHECK-NULL-NEXT: br i1 [[UBSAN_CMP_RES]], label %{{.*}}, label %{{.*}}
-  // CHECK-NULL: call void @__ubsan_handle_type_mismatch_abort
+  // CHECK-NULL: call void @__ubsan_handle_type_mismatch_v1_abort
   // Second, we check that vtable is actually loaded once the type check is done.
   // CHECK-NULL: load {{.*}} (%struct.T*{{.*}})**, {{.*}} (%struct.T*{{.*}})***
   return t->v();
Index: cfe/trunk/test/CodeGen/sanitize-recover.c
===
--- cfe/trunk/test/CodeGen/sanitize-recover.c
+++ cfe/trunk/test/CodeGen/sanitize-recover.c
@@ -33,7 +33,7 @@
   // PARTIAL:  br i1 %[[CHECK012]], {{.*}} !prof ![[WEIGHT_MD:.*]], !nosanitize
 
   // PARTIAL:  br i1 %[[CHECK02]], {{.*}}
-  // PARTIAL:  call void @__ubsan_handle_type_mismatch_abort(
+  // PARTIAL:  call void @__ubsan_handle_type_mismatch_v1_abort(
   // PARTIAL-NEXT: unreachable
-  // PARTIAL:  call void @__ubsan_handle_type_mismatch(
+  // PARTIAL:  call void @__ubsan_handle_type_mismatch_v1(
 }
Index: cfe/trunk/test/CodeGen/catch-undef-behavior.c
===
--- cfe/trunk/test/CodeGen/catch-undef-behavior.c
+++ cfe/trunk/test/CodeGen/catch-undef-behavior.c
@@ -6,16 +6,16 @@
 // CHECK-UBSAN: @[[INT:.*]] = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" }
 
 // FIXME: When we only emit each type once, use [[INT]] more below.
-// CHECK-UBSAN: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 100, i32 5 {{.*}} @[[INT]], i64 4, i8 1
-// CHECK-UBSAN: @[[LINE_200:.*]] = {{.*}}, i32 200, i32 10 {{.*}}, i64 4, i8 0
+// CHECK-UBSAN: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 100, i32 5 {{.*}} @[[INT]], i8 2, i8 1
+// CHECK-UBSAN: @[[LINE_200:.*]] = {{.*}}, i32 200, i32 10 {{.*}}, i8 2, i8 0
 // CHECK-UBSAN: @[[LINE_300:.*]] = {{.*}}, i32 300, i32 12 {{.*}} @{{.*}}, {{.*}} @{{.*}}
 // CHECK-UBSAN: @[[LINE_400:.*]] = {{.*}}, i32 400, i32 12 {{.*}} @{{.*}}, {{.*}} @{{.*}}
-// CHECK-UBSAN: @[[LINE_500:.*]] = {{.*}}, i32 500, i32 10 {{.*}} @{{.*}}, i64 4, i8 0 }
-// CHECK-UBSAN: @[[LINE_600:.*]] = {{.*}}, i32 600, i32 3 {{.*}} @{{.*}}, i64 4, i8 1 }
+// CHECK-UBSAN: @[[LINE_500:.*]] = {{.*}}, i32 500, i32 10 {{.*}} @{{.*}}, i8 2, i8 0 }
+// CHECK-UBSAN: @[[LINE_600:.*]] = {{.*}}, i32 600, i32 3 {{.*}} @{{.*}}, i8 2, i8 1 }
 
 // CHECK-UBSAN: @[[STRUCT_S:.*]] = private unnamed_addr constant { i16, i16, [11 x i8] } { i16 -1, i16 0, [11 x i8] c"'struct S'\00" }
 
-// CHECK-UBSAN: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} @[[STRUCT_S]], i64 4, i8 3 }
+// CHECK-UBSAN: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 14 {{.*}} @[[STRUCT_S]], i8 2, i8 3 }
 // CHECK-UBSAN: @[[LINE_800:.*]] = {{.*}}, i32 800, i32 12 {{.*}} @{{.*}} }
 // CHECK-UBSAN: @[[LINE_900:.*]] = {{.*}}, i32 900, i32 11 {{.*}} @{{.*}} }
 // CHECK-UBSAN: @[[LINE_1000:.*]] = {{.*}}, i32 1000, i32 10 {{.*}} @{{.*}} }
@@ -54,15 +54,15 @@
   // CHECK-TRAP:  br i1 %[[OK]], {{.*}}
 
   // CHECK-UBSAN:  %[[ARG:.*]] = ptrtoint {{.*}} %[[PTR]] to i64
-  // CHECK-UBSAN-NEXT: call void @__ubsan_handle_type_mismatch(i8* bitcast ({{.*}} @[[LINE_100]] to i8*), i64 %[[ARG]])
+  // CHECK-UBSAN-NEXT: call void @__ubsan_handle_type_mismatch_v1(i8* bitcast ({{.*}} @[[LINE_100]] to i8*), i64 %[[ARG]])
 
   // CHECK-TRAP:  call void @llvm.trap() [[NR_NUW:#[0-9]+]]
   // CHECK-TRAP-NEXT: unreachable
 
   // With -fsanitize=null, only perform the null check.
   // CHECK-NULL: %[[NULL:.*]] = icmp ne {{.*}}, null
   // CHECK-NULL: br i1 %[[NULL]]
-  // CHECK-NULL: call void @__ubsan_handle_type_mismatch(i8* bitcast ({{.*}} @[[LINE_100]] to i8*), i64 %{{.*}})
+  // CHECK-NULL: call void @__ubsan_handle_type_mismatch_v1(i8* bitcast ({{.*}} @[[LINE_100]] to i8*), i64 %{{.*}})
 #line 100
   u.i=1;
 }
@@ -77,7 +77,7 @@
   // CHECK-COMMON-NEXT: icmp eq i64 %[[MISALIGN]], 0
 
   // CHECK-UBSAN:  %[[ARG:.*]] = ptrtoint
-  // CHECK-UBSAN-NEXT: call void @__ubsan

[PATCH] D28399: PR31469: Don't add friend template class decls to redecl chain in dependent contexts.

2017-01-06 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev created this revision.
v.g.vassilev added a reviewer: rsmith.
v.g.vassilev added a subscriber: cfe-commits.
v.g.vassilev set the repository for this revision to rL LLVM.

Fixes a crash in modules where the template class decl becomes the most recent 
decl in the redeclaration chain and forcing the template instantiator try to 
instantiate the friend declaration, rather than the template definition.

In practice, A::list produces a TemplateSpecializationType 
A::__1::list >' failing to replace to 
subsitute the default argument to allocator.


Repository:
  rL LLVM

https://reviews.llvm.org/D28399

Files:
  include/clang/AST/DeclTemplate.h
  lib/AST/ASTImporter.cpp
  lib/AST/DeclTemplate.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  test/Misc/ast-dump-decl.cpp
  test/Modules/Inputs/PR31469/empty.h
  test/Modules/Inputs/PR31469/module.modulemap
  test/Modules/Inputs/PR31469/textual.h
  test/Modules/Inputs/PR31469/textual_file_shadow.h
  test/Modules/pr31469.cpp

Index: test/Modules/pr31469.cpp
===
--- /dev/null
+++ test/Modules/pr31469.cpp
@@ -0,0 +1,15 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -std=c++11 -I%S/Inputs/PR31469 -verify %s
+// RUN: %clang_cc1 -std=c++11 -I%S/Inputs/PR31469 -fmodules -fmodules-local-submodule-visibility \
+// RUN:-fimplicit-module-maps -fmodules-cache-path=%t  -verify %s
+
+#include "textual.h"
+#include "empty.h"
+
+namespace A {
+  template  void f();
+}
+
+A::list use;
+
+// expected-no-diagnostics
Index: test/Modules/Inputs/PR31469/textual_file_shadow.h
===
--- /dev/null
+++ test/Modules/Inputs/PR31469/textual_file_shadow.h
@@ -0,0 +1,2 @@
+#include "textual.h"
+
Index: test/Modules/Inputs/PR31469/textual.h
===
--- /dev/null
+++ test/Modules/Inputs/PR31469/textual.h
@@ -0,0 +1,17 @@
+namespace A {
+inline
+namespace __1 {
+  template  class allocator;
+  template > class list;
+  template  class __list_iterator {
+//template  friend class list; // causes another crash in ASTDeclReader::attachPreviousDecl
+template  friend class list;
+  };
+  template  class __list_imp {};
+  template  class list : __list_imp<_Tp, _Alloc> {
+  public:
+list() {}
+  };
+  template  void f(list<_Tp>);
+}
+}
Index: test/Modules/Inputs/PR31469/module.modulemap
===
--- /dev/null
+++ test/Modules/Inputs/PR31469/module.modulemap
@@ -0,0 +1,5 @@
+module M {
+  module "textual_shadow" { header "textual_file_shadow.h" export *}
+  module "trigger" { header "empty.h" export * }
+  export *
+}
Index: test/Modules/Inputs/PR31469/empty.h
===
--- /dev/null
+++ test/Modules/Inputs/PR31469/empty.h
@@ -0,0 +1 @@
+// This file is triggers loading of module M.
Index: test/Misc/ast-dump-decl.cpp
===
--- test/Misc/ast-dump-decl.cpp
+++ test/Misc/ast-dump-decl.cpp
@@ -336,7 +336,6 @@
   // CHECK-NEXT:   ClassTemplateDecl{{.*}} TestClassTemplate
   // CHECK-NEXT: TemplateTypeParmDecl
   // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate
-  // CHECK-NEXT: ClassTemplateSpecialization{{.*}} 'TestClassTemplate'
   // CHECK-NEXT:   ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate
   // CHECK-NEXT: TemplateArgument{{.*}}A
   // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate
Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1193,8 +1193,10 @@
 
   ClassTemplateDecl *Inst
 = ClassTemplateDecl::Create(SemaRef.Context, DC, D->getLocation(),
-D->getIdentifier(), InstParams, RecordInst,
-PrevClassTemplate);
+D->getIdentifier(), InstParams, RecordInst);
+  assert(!(isFriend && Owner->isDependentContext()));
+  Inst->setPreviousDecl(PrevClassTemplate);
+
   RecordInst->setDescribedClassTemplate(Inst);
 
   if (isFriend) {
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -1230,7 +1230,16 @@
   ClassTemplateDecl *NewTemplate
 = ClassTemplateDecl::Create(Context, SemanticContext, NameLoc,
 DeclarationName(Name), TemplateParams,
-NewClass, PrevClassTemplate);
+NewClass);
+
+  // If this is a templated friend in a dependent context we should not put it
+  // on the redecl chain. In some cases, the templated friend can be the most
+  // recent declaration tricking the t

[PATCH] D27898: [compiler-rt] [builtins] Implement __floattitf() & __floatuntitf()

2017-01-06 Thread Michał Górny via Phabricator via cfe-commits
mgorny added inline comments.



Comment at: lib/builtins/floattitf.c:65
+if (a & ((tu_int)1 << LDBL_MANT_DIG)) {
+a >>= 1;
+++e;

scanon wrote:
> mgorny wrote:
> > scanon wrote:
> > > Strictly speaking there's no need to adjust `a` here. If we rounded up 
> > > into a new binade, then `a` is necessarily `0b1000...0`, and the leading 
> > > 1 bit will get killed by the mask when we assemble `fb.u.high.all` 
> > > regardless of its position. Same comment applies to floatuntitf.
> > I'm sorry but I don't feel confident changing that. AFAIU if the 
> > LDBL_MANT_DIG+1 bit is set, this code shifts it lower, so it won't actually 
> > be killed by the mask.
> In binary128, as in all IEEE 754 binary interchange format encodings, the 
> leading bit of the significand is implicit. The only way to end up in this 
> code path is `0b111...1` rounding up to `0b100...00`, meaning that the 
> significand is 1.0, which is stored as all-zeros (i.e. the leading bit is 
> necessarily masked).
> 
> To be more explicit, LDBL_MANT_DIG is 113. If this shift happens, after the 
> shift bit 112 is set, and bits 111:0 are zero. The mask `((a >> 64) & 
> 0xLL)` discards bit 112 (= 64 + 48).
Well, I've tried removing this and it causes one of the tests to fail:

`error in __floatuntitf(0x) = 0X1P+127, 
expected 0X1P+128`


https://reviews.llvm.org/D27898



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


[PATCH] D27898: [compiler-rt] [builtins] Implement __floattitf() & __floatuntitf()

2017-01-06 Thread Steve Canon via Phabricator via cfe-commits
scanon added inline comments.



Comment at: lib/builtins/floattitf.c:65
+if (a & ((tu_int)1 << LDBL_MANT_DIG)) {
+a >>= 1;
+++e;

mgorny wrote:
> scanon wrote:
> > mgorny wrote:
> > > scanon wrote:
> > > > Strictly speaking there's no need to adjust `a` here. If we rounded up 
> > > > into a new binade, then `a` is necessarily `0b1000...0`, and the 
> > > > leading 1 bit will get killed by the mask when we assemble 
> > > > `fb.u.high.all` regardless of its position. Same comment applies to 
> > > > floatuntitf.
> > > I'm sorry but I don't feel confident changing that. AFAIU if the 
> > > LDBL_MANT_DIG+1 bit is set, this code shifts it lower, so it won't 
> > > actually be killed by the mask.
> > In binary128, as in all IEEE 754 binary interchange format encodings, the 
> > leading bit of the significand is implicit. The only way to end up in this 
> > code path is `0b111...1` rounding up to `0b100...00`, meaning that the 
> > significand is 1.0, which is stored as all-zeros (i.e. the leading bit is 
> > necessarily masked).
> > 
> > To be more explicit, LDBL_MANT_DIG is 113. If this shift happens, after the 
> > shift bit 112 is set, and bits 111:0 are zero. The mask `((a >> 64) & 
> > 0xLL)` discards bit 112 (= 64 + 48).
> Well, I've tried removing this and it causes one of the tests to fail:
> 
> `error in __floatuntitf(0x) = 0X1P+127, 
> expected 0X1P+128`
This sounds like you removed the exponent adjustment (`++e`) as well as (or 
instead of) the shift (`a >>= 1`). Without seeing the change, I can't be 
certain, of course.


https://reviews.llvm.org/D27898



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


[PATCH] D28400: [AArch64] Use generic bitreverse intrinsic, rather than AArch64 specific.

2017-01-06 Thread Chad Rosier via Phabricator via cfe-commits
mcrosier created this revision.
mcrosier added reviewers: jmolloy, t.p.northover, gberry, RKSimon, rengolin.
mcrosier added a subscriber: cfe-commits.
Herald added a subscriber: aemerson.

Per the title, this patch replaces the target-specific intrinsic with a 
target-independent equivalent.

This requires the LLVM side change here: https://reviews.llvm.org/D28379.

In https://reviews.llvm.org/D28379, making the bitreverse intrinsic legal for 
AArch64 and lowering to a rbit instruction accordingly.

Chad


https://reviews.llvm.org/D28400

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/arm_acle.c
  test/CodeGen/builtins-arm64.c


Index: test/CodeGen/builtins-arm64.c
===
--- test/CodeGen/builtins-arm64.c
+++ test/CodeGen/builtins-arm64.c
@@ -10,12 +10,12 @@
 // CHECK: call {{.*}} @llvm.thread.pointer()
 }
 
-// CHECK: call {{.*}} @llvm.aarch64.rbit.i32(i32 %a)
+// CHECK: call {{.*}} @llvm.bitreverse.i32(i32 %a)
 unsigned rbit(unsigned a) {
   return __builtin_arm_rbit(a);
 }
 
-// CHECK: call {{.*}} @llvm.aarch64.rbit.i64(i64 %a)
+// CHECK: call {{.*}} @llvm.bitreverse.i64(i64 %a)
 unsigned long long rbit64(unsigned long long a) {
   return __builtin_arm_rbit64(a);
 }
Index: test/CodeGen/arm_acle.c
===
--- test/CodeGen/arm_acle.c
+++ test/CodeGen/arm_acle.c
@@ -245,22 +245,22 @@
 
 // ARM-LABEL: test_rbit
 // AArch32: call i32 @llvm.arm.rbit
-// AArch64: call i32 @llvm.aarch64.rbit.i32
+// AArch64: call i32 @llvm.bitreverse.i32
 uint32_t test_rbit(uint32_t t) {
   return __rbit(t);
 }
 
 // ARM-LABEL: test_rbitl
 // AArch32: call i32 @llvm.arm.rbit
-// AArch64: call i64 @llvm.aarch64.rbit.i64
+// AArch64: call i64 @llvm.bitreverse.i64
 long test_rbitl(long t) {
   return __rbitl(t);
 }
 
 // ARM-LABEL: test_rbitll
 // AArch32: call i32 @llvm.arm.rbit
 // AArch32: call i32 @llvm.arm.rbit
-// AArch64: call i64 @llvm.aarch64.rbit.i64
+// AArch64: call i64 @llvm.bitreverse.i64
 uint64_t test_rbitll(uint64_t t) {
   return __rbitll(t);
 }
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -5221,14 +5221,14 @@
"rbit of unusual size!");
 llvm::Value *Arg = EmitScalarExpr(E->getArg(0));
 return Builder.CreateCall(
-CGM.getIntrinsic(Intrinsic::aarch64_rbit, Arg->getType()), Arg, 
"rbit");
+CGM.getIntrinsic(Intrinsic::bitreverse, Arg->getType()), Arg, "rbit");
   }
   if (BuiltinID == AArch64::BI__builtin_arm_rbit64) {
 assert((getContext().getTypeSize(E->getType()) == 64) &&
"rbit of unusual size!");
 llvm::Value *Arg = EmitScalarExpr(E->getArg(0));
 return Builder.CreateCall(
-CGM.getIntrinsic(Intrinsic::aarch64_rbit, Arg->getType()), Arg, 
"rbit");
+CGM.getIntrinsic(Intrinsic::bitreverse, Arg->getType()), Arg, "rbit");
   }
 
   if (BuiltinID == AArch64::BI__clear_cache) {


Index: test/CodeGen/builtins-arm64.c
===
--- test/CodeGen/builtins-arm64.c
+++ test/CodeGen/builtins-arm64.c
@@ -10,12 +10,12 @@
 // CHECK: call {{.*}} @llvm.thread.pointer()
 }
 
-// CHECK: call {{.*}} @llvm.aarch64.rbit.i32(i32 %a)
+// CHECK: call {{.*}} @llvm.bitreverse.i32(i32 %a)
 unsigned rbit(unsigned a) {
   return __builtin_arm_rbit(a);
 }
 
-// CHECK: call {{.*}} @llvm.aarch64.rbit.i64(i64 %a)
+// CHECK: call {{.*}} @llvm.bitreverse.i64(i64 %a)
 unsigned long long rbit64(unsigned long long a) {
   return __builtin_arm_rbit64(a);
 }
Index: test/CodeGen/arm_acle.c
===
--- test/CodeGen/arm_acle.c
+++ test/CodeGen/arm_acle.c
@@ -245,22 +245,22 @@
 
 // ARM-LABEL: test_rbit
 // AArch32: call i32 @llvm.arm.rbit
-// AArch64: call i32 @llvm.aarch64.rbit.i32
+// AArch64: call i32 @llvm.bitreverse.i32
 uint32_t test_rbit(uint32_t t) {
   return __rbit(t);
 }
 
 // ARM-LABEL: test_rbitl
 // AArch32: call i32 @llvm.arm.rbit
-// AArch64: call i64 @llvm.aarch64.rbit.i64
+// AArch64: call i64 @llvm.bitreverse.i64
 long test_rbitl(long t) {
   return __rbitl(t);
 }
 
 // ARM-LABEL: test_rbitll
 // AArch32: call i32 @llvm.arm.rbit
 // AArch32: call i32 @llvm.arm.rbit
-// AArch64: call i64 @llvm.aarch64.rbit.i64
+// AArch64: call i64 @llvm.bitreverse.i64
 uint64_t test_rbitll(uint64_t t) {
   return __rbitll(t);
 }
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -5221,14 +5221,14 @@
"rbit of unusual size!");
 llvm::Value *Arg = EmitScalarExpr(E->getArg(0));
 return Builder.CreateCall(
-CGM.getIntrinsic(Intrinsic::aarch64_rbit, Arg->getType()), Arg, "rbit");
+CGM.getIntrinsic(Intrinsic::bitreverse, Arg->getType()), Arg, "rbit");
   }
   if (BuiltinID == AArch64::BI

[PATCH] D28381: [WebAssembly] Always inline atomics

2017-01-06 Thread Dan Gohman via Phabricator via cfe-commits
sunfish added a comment.

Since we may soon have people prototyping actual atomics, I'd prefer to find a 
less invasive way to fix this.

Would it be difficult to enable atomic.c in Emscripten's compiler-rt build, to 
define these libcalls (assuming that the problem is just that they're not 
currently defined)?

Alternatively, could we make the change in the patch guarded by `if 
(CodeGenOpts.ThreadModel == "single")` or so, so that it doesn't affect the 
"posix" case?


https://reviews.llvm.org/D28381



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


r291243 - [OpenCL] Re-enable supported core extensions based on opencl version when disabling all extensions using pragma

2017-01-06 Thread Konstantin Zhuravlyov via cfe-commits
Author: kzhuravl
Date: Fri Jan  6 10:14:41 2017
New Revision: 291243

URL: http://llvm.org/viewvc/llvm-project?rev=291243&view=rev
Log:
[OpenCL] Re-enable supported core extensions based on opencl version when 
disabling all extensions using pragma

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

Modified:
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/test/SemaOpenCL/extensions.cl

Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=291243&r1=291242&r2=291243&view=diff
==
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Fri Jan  6 10:14:41 2017
@@ -506,10 +506,12 @@ void Parser::HandlePragmaOpenCLExtension
   // overriding all previously issued extension directives, but only if the
   // behavior is set to disable."
   if (Name == "all") {
-if (State == Disable)
+if (State == Disable) {
   Opt.disableAll();
-else
+  Opt.enableSupportedCore(getLangOpts().OpenCLVersion);
+} else {
   PP.Diag(NameLoc, diag::warn_pragma_expected_predicate) << 1;
+}
   } else if (State == Begin) {
 if (!Opt.isKnown(Name) ||
 !Opt.isSupported(Name, getLangOpts().OpenCLVersion)) {

Modified: cfe/trunk/test/SemaOpenCL/extensions.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/extensions.cl?rev=291243&r1=291242&r2=291243&view=diff
==
--- cfe/trunk/test/SemaOpenCL/extensions.cl (original)
+++ cfe/trunk/test/SemaOpenCL/extensions.cl Fri Jan  6 10:14:41 2017
@@ -22,6 +22,17 @@
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic 
-fsyntax-only -cl-ext=-all -cl-ext=+cl_khr_fp64 -cl-ext=+cl_khr_fp16 
-cl-ext=-cl_khr_fp64 -DNOFP64
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic 
-fsyntax-only -cl-ext=-all -cl-ext=+cl_khr_fp64,-cl_khr_fp64,+cl_khr_fp16 
-DNOFP64
 
+// Test with -finclude-default-header, which includes opencl-c.h. opencl-c.h
+// disables all extensions by default, but supported core extensions for a
+// particular OpenCL version must be re-enabled (for example, cl_khr_fp64 is
+// enabled by default with -cl-std=CL2.0).
+//
+// RUN: %clang_cc1 %s -triple amdgcn-unknown-unknown -verify -pedantic 
-fsyntax-only -cl-std=CL2.0 -finclude-default-header
+
+#ifdef _OPENCL_H_
+// expected-no-diagnostics
+#endif
+
 #ifdef FP64
 // expected-no-diagnostics
 #endif
@@ -33,6 +44,7 @@ void f1(double da) { // expected-error {
 }
 #endif
 
+#ifndef _OPENCL_H_
 int isnan(float x) {
 return __builtin_isnan(x);
 }
@@ -40,6 +52,7 @@ int isnan(float x) {
 int isfinite(float x) {
 return __builtin_isfinite(x);
 }
+#endif
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 #ifdef NOFP64


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


[PATCH] D28257: [OpenCL] Re-enable supported core extensions based on opencl version when disabling all extensions using pragma

2017-01-06 Thread Konstantin Zhuravlyov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL291243: [OpenCL] Re-enable supported core extensions based 
on opencl version when… (authored by kzhuravl).

Changed prior to commit:
  https://reviews.llvm.org/D28257?vs=82956&id=83369#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28257

Files:
  cfe/trunk/lib/Parse/ParsePragma.cpp
  cfe/trunk/test/SemaOpenCL/extensions.cl


Index: cfe/trunk/lib/Parse/ParsePragma.cpp
===
--- cfe/trunk/lib/Parse/ParsePragma.cpp
+++ cfe/trunk/lib/Parse/ParsePragma.cpp
@@ -506,10 +506,12 @@
   // overriding all previously issued extension directives, but only if the
   // behavior is set to disable."
   if (Name == "all") {
-if (State == Disable)
+if (State == Disable) {
   Opt.disableAll();
-else
+  Opt.enableSupportedCore(getLangOpts().OpenCLVersion);
+} else {
   PP.Diag(NameLoc, diag::warn_pragma_expected_predicate) << 1;
+}
   } else if (State == Begin) {
 if (!Opt.isKnown(Name) ||
 !Opt.isSupported(Name, getLangOpts().OpenCLVersion)) {
Index: cfe/trunk/test/SemaOpenCL/extensions.cl
===
--- cfe/trunk/test/SemaOpenCL/extensions.cl
+++ cfe/trunk/test/SemaOpenCL/extensions.cl
@@ -22,6 +22,17 @@
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic 
-fsyntax-only -cl-ext=-all -cl-ext=+cl_khr_fp64 -cl-ext=+cl_khr_fp16 
-cl-ext=-cl_khr_fp64 -DNOFP64
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic 
-fsyntax-only -cl-ext=-all -cl-ext=+cl_khr_fp64,-cl_khr_fp64,+cl_khr_fp16 
-DNOFP64
 
+// Test with -finclude-default-header, which includes opencl-c.h. opencl-c.h
+// disables all extensions by default, but supported core extensions for a
+// particular OpenCL version must be re-enabled (for example, cl_khr_fp64 is
+// enabled by default with -cl-std=CL2.0).
+//
+// RUN: %clang_cc1 %s -triple amdgcn-unknown-unknown -verify -pedantic 
-fsyntax-only -cl-std=CL2.0 -finclude-default-header
+
+#ifdef _OPENCL_H_
+// expected-no-diagnostics
+#endif
+
 #ifdef FP64
 // expected-no-diagnostics
 #endif
@@ -33,13 +44,15 @@
 }
 #endif
 
+#ifndef _OPENCL_H_
 int isnan(float x) {
 return __builtin_isnan(x);
 }
 
 int isfinite(float x) {
 return __builtin_isfinite(x);
 }
+#endif
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 #ifdef NOFP64


Index: cfe/trunk/lib/Parse/ParsePragma.cpp
===
--- cfe/trunk/lib/Parse/ParsePragma.cpp
+++ cfe/trunk/lib/Parse/ParsePragma.cpp
@@ -506,10 +506,12 @@
   // overriding all previously issued extension directives, but only if the
   // behavior is set to disable."
   if (Name == "all") {
-if (State == Disable)
+if (State == Disable) {
   Opt.disableAll();
-else
+  Opt.enableSupportedCore(getLangOpts().OpenCLVersion);
+} else {
   PP.Diag(NameLoc, diag::warn_pragma_expected_predicate) << 1;
+}
   } else if (State == Begin) {
 if (!Opt.isKnown(Name) ||
 !Opt.isSupported(Name, getLangOpts().OpenCLVersion)) {
Index: cfe/trunk/test/SemaOpenCL/extensions.cl
===
--- cfe/trunk/test/SemaOpenCL/extensions.cl
+++ cfe/trunk/test/SemaOpenCL/extensions.cl
@@ -22,6 +22,17 @@
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-all -cl-ext=+cl_khr_fp64 -cl-ext=+cl_khr_fp16 -cl-ext=-cl_khr_fp64 -DNOFP64
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only -cl-ext=-all -cl-ext=+cl_khr_fp64,-cl_khr_fp64,+cl_khr_fp16 -DNOFP64
 
+// Test with -finclude-default-header, which includes opencl-c.h. opencl-c.h
+// disables all extensions by default, but supported core extensions for a
+// particular OpenCL version must be re-enabled (for example, cl_khr_fp64 is
+// enabled by default with -cl-std=CL2.0).
+//
+// RUN: %clang_cc1 %s -triple amdgcn-unknown-unknown -verify -pedantic -fsyntax-only -cl-std=CL2.0 -finclude-default-header
+
+#ifdef _OPENCL_H_
+// expected-no-diagnostics
+#endif
+
 #ifdef FP64
 // expected-no-diagnostics
 #endif
@@ -33,13 +44,15 @@
 }
 #endif
 
+#ifndef _OPENCL_H_
 int isnan(float x) {
 return __builtin_isnan(x);
 }
 
 int isfinite(float x) {
 return __builtin_isfinite(x);
 }
+#endif
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 #ifdef NOFP64
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28381: [WebAssembly] Always inline atomics

2017-01-06 Thread Derek Schuff via Phabricator via cfe-commits
dschuff added a comment.

Making it guarded by thread model makes sense, although I'm not exactly sure 
whether emscripten sets that or not. But even when we do start prototyping 
actual atomics, I had assumed we'd be defining i64 atomics symmetrically along 
with i32 atomics, in which case we wouldn't be emitting libcalls anyway.


https://reviews.llvm.org/D28381



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


[PATCH] D28381: [WebAssembly] Always inline atomics

2017-01-06 Thread Derek Schuff via Phabricator via cfe-commits
dschuff added inline comments.



Comment at: test/Preprocessor/init.c:8613
 // WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_INT_LOCK_FREE 2
-// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_LLONG_LOCK_FREE 1
+// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_LLONG_LOCK_FREE 2
 // WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_LONG_LOCK_FREE 2

I'm not sure we actually want to set this; it's possible that even if 64-bit 
atomics are specified by the wasm platform we may not promise that they have to 
be lock-free.


https://reviews.llvm.org/D28381



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


[PATCH] D20428: Tracking exception specification source locations

2017-01-06 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

I think that these changes look good to me, and I noticed Richard signed off on 
the other review for the exception spec changes (thank you for working on 
that!), so I think this is ready to commit.


https://reviews.llvm.org/D20428



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


[PATCH] D28315: Update tools to use new getStyle API

2017-01-06 Thread Antonio Maiorano via Phabricator via cfe-commits
amaiorano added a comment.

In https://reviews.llvm.org/D28315#636888, @hokein wrote:

> In https://reviews.llvm.org/D28315#636821, @amaiorano wrote:
>
> > Is there a way to run tests without ninja? I'm on Windows. If not, I'll use 
> > my Linux VM.
>
>
> It is not related to the build system. There should be a `check-clang-tools` 
> project, you can run tests by building it.  For example, if you are using 
> make, just run `make check-clang-tools`; If you are using Visual Studio, 
> build the `check-clang-tools` project.


Yes, thanks for that. Unfortunately, the tests don't all pass when run using 
Visual Studio. I installed the requisite GNU utils, but get 25 failures. Will 
investigate a bit more, otherwise will use Linux.


https://reviews.llvm.org/D28315



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


[PATCH] D20693: [clang-tidy] New checker to replace dynamic exception specifications

2017-01-06 Thread don hinton via Phabricator via cfe-commits
hintonda updated this revision to Diff 83371.
hintonda added a comment.
Herald added subscribers: JDevlieghere, mgorny.

Updated patch.


https://reviews.llvm.org/D20693

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseNoexceptCheck.cpp
  clang-tidy/modernize/UseNoexceptCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-noexcept.rst
  test/clang-tidy/modernize-use-noexcept-macro.cpp
  test/clang-tidy/modernize-use-noexcept.cpp

Index: test/clang-tidy/modernize-use-noexcept.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-noexcept.cpp
@@ -0,0 +1,56 @@
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \
+// RUN:   -- -std=c++11
+
+class A {};
+class B {};
+
+void foo() throw();
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void foo() noexcept;
+
+void bar() throw(...);
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw(...)' [modernize-use-noexcept]
+// CHECK-FIXES: void bar() noexcept(false);
+
+void k() throw(int(int));
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: found dynamic exception specification 'throw(int(int))' [modernize-use-noexcept]
+// CHECK-FIXES: void k() noexcept(false);
+
+void foobar() throw(A, B)
+{}
+// CHECK-MESSAGES: :[[@LINE-2]]:15: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+// CHECK-FIXES: void foobar() noexcept(false)
+
+void baz(int = (throw A(), 0)) throw(A, B) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+// CHECK-FIXES: void baz(int = (throw A(), 0)) noexcept(false) {}
+
+void g(void (*fp)(void) throw());
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void g(void (*fp)(void) noexcept);
+
+void f(void (*fp)(void) throw(int)) throw(char);
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: found dynamic exception specification 'throw(int)' [modernize-use-noexcept]
+// CHECK-MESSAGES: :[[@LINE-2]]:37: warning: found dynamic exception specification 'throw(char)' [modernize-use-noexcept]
+// CHECK-FIXES: void f(void (*fp)(void) noexcept(false)) noexcept(false);
+
+void j() throw(int(int) throw(void(void) throw(int)));
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: found dynamic exception specification 'throw(int(int) throw(void(void) throw(int)))' [modernize-use-noexcept]
+// CHECK-FIXES: void j() noexcept(false);
+
+class Y {
+  Y() throw() = default;
+};
+// CHECK-MESSAGES: :[[@LINE-2]]:7: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: Y() noexcept = default;
+
+// Should not trigger a replacement.
+void titi() noexcept {}
+void toto() noexcept(true) {}
+
+// Should not trigger a replacement.
+void bad()
+#if !__has_feature(cxx_noexcept)
+throw()
+#endif
+;
Index: test/clang-tidy/modernize-use-noexcept-macro.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-noexcept-macro.cpp
@@ -0,0 +1,24 @@
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \
+// RUN:   -config="{CheckOptions: [{key: modernize-use-noexcept.ReplacementString, value: 'NOEXCEPT'}]}" \
+// RUN:   -- -std=c++11
+
+// Example definition of NOEXCEPT -- simplified test to see if noexcept is supported. 
+#if (__has_feature(cxx_noexcept))
+#define NOEXCEPT noexcept
+#else
+#define NOEXCEPT throw()
+#endif
+
+void bar() throw() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void bar() NOEXCEPT {}
+
+// Should not trigger a FixItHint, since macros only support noexcept, and this
+// case throws.
+class A {};
+class B {};
+void foobar() throw(A, B);
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+
+// Should not trigger a replacement.
+void foo() noexcept(true);
Index: docs/clang-tidy/checks/modernize-use-noexcept.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-use-noexcept.rst
@@ -0,0 +1,55 @@
+.. title:: clang-tidy - modernize-use-noexcept
+
+modernize-use-noexcept
+==
+
+The check converts dynamic exception specifications, e.g., ``throw()``,
+``throw([,...])``, or ``throw(...)`` to ``noexcept``, ``noexcept(false)``,
+or a user defined macro.
+
+Example
+---
+
+.. code-block:: c++
+
+  void foo() throw();
+	void bar() throw(int) {}
+
+transforms to:
+
+.. code-block:: c++
+
+  void foo() noexcept;
+	void bar() noexcept(false) {}
+
+
+User defined macros
+---
+
+By default thi

[PATCH] D20693: [clang-tidy] New checker to replace dynamic exception specifications

2017-01-06 Thread Malcolm Parsons via Phabricator via cfe-commits
malcolm.parsons added inline comments.



Comment at: clang-tidy/modernize/UseNoexceptCheck.h:19
+
+using CandidateSet = llvm::StringSet;
+

Unused?



Comment at: docs/clang-tidy/checks/modernize-use-noexcept.rst:38
+
+Please note that since ``throw(int)`` is equivelent to
+``noexcept(false)`` not ``noexcept``, this check will detect, but not

typo: equivelent -> equivalent.


https://reviews.llvm.org/D20693



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


Re: [PATCH] D28320: [Driver] Driver changes to support CUDA compilation on Windows.

2017-01-06 Thread Justin Lebar via cfe-commits
That test should be updated to explicitly specify the triple, that
should also fix the problem.  I'll spin that change as soon as I can.

I agree that using the triple to determine the expected directory
layout is kind of bogus.  I have no idea if cross-compiling CUDA is
even going to work...

Do we have prior art for looking at the host (not the host triple, but
the host OS itself) to determine file paths?  If so maybe I should
just do that.

On Fri, Jan 6, 2017 at 2:26 AM, NAKAMURA Takumi via Phabricator
 wrote:
> chapuni added a comment.
>
> It fails with LLVM_DEFAULT_TARGET_TRIPLE=i686-pc-win32, on linux.
> http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/33445
> Seems it assumes Windows' layout even if the host is not Windows.
>
>   128838 stat64("/path/to/llvm-project/clang/test/Driver/Inputs/CUDA/Program 
> Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0", 0xffc9bdc0) = -1 ENOENT (No 
> such file or directory)
>
> If you wouldn't consider such a configuration, I could add exclusion to 
> lit.cfg.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D28320
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27898: [compiler-rt] [builtins] Implement __floattitf() & __floatuntitf()

2017-01-06 Thread Michał Górny via Phabricator via cfe-commits
mgorny added inline comments.



Comment at: lib/builtins/floattitf.c:65
+if (a & ((tu_int)1 << LDBL_MANT_DIG)) {
+a >>= 1;
+++e;

scanon wrote:
> mgorny wrote:
> > scanon wrote:
> > > mgorny wrote:
> > > > scanon wrote:
> > > > > Strictly speaking there's no need to adjust `a` here. If we rounded 
> > > > > up into a new binade, then `a` is necessarily `0b1000...0`, and the 
> > > > > leading 1 bit will get killed by the mask when we assemble 
> > > > > `fb.u.high.all` regardless of its position. Same comment applies to 
> > > > > floatuntitf.
> > > > I'm sorry but I don't feel confident changing that. AFAIU if the 
> > > > LDBL_MANT_DIG+1 bit is set, this code shifts it lower, so it won't 
> > > > actually be killed by the mask.
> > > In binary128, as in all IEEE 754 binary interchange format encodings, the 
> > > leading bit of the significand is implicit. The only way to end up in 
> > > this code path is `0b111...1` rounding up to `0b100...00`, meaning that 
> > > the significand is 1.0, which is stored as all-zeros (i.e. the leading 
> > > bit is necessarily masked).
> > > 
> > > To be more explicit, LDBL_MANT_DIG is 113. If this shift happens, after 
> > > the shift bit 112 is set, and bits 111:0 are zero. The mask `((a >> 64) & 
> > > 0xLL)` discards bit 112 (= 64 + 48).
> > Well, I've tried removing this and it causes one of the tests to fail:
> > 
> > `error in __floatuntitf(0x) = 0X1P+127, 
> > expected 0X1P+128`
> This sounds like you removed the exponent adjustment (`++e`) as well as (or 
> instead of) the shift (`a >>= 1`). Without seeing the change, I can't be 
> certain, of course.
Yes, I did that. Now that you state that plainly, I finally understand what you 
meant ;-). However, if I were to do that, I would rather to do that separately, 
either in all relevant files or post unifying the code into one logical .inc. 
This would keep the history of changes cleaner.


https://reviews.llvm.org/D27898



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


[PATCH] D20693: [clang-tidy] New checker to replace dynamic exception specifications

2017-01-06 Thread don hinton via Phabricator via cfe-commits
hintonda added inline comments.



Comment at: clang-tidy/modernize/UseNoexceptCheck.h:19
+
+using CandidateSet = llvm::StringSet;
+

malcolm.parsons wrote:
> Unused?
Good catch -- left over from a previous version.



Comment at: docs/clang-tidy/checks/modernize-use-noexcept.rst:38
+
+Please note that since ``throw(int)`` is equivelent to
+``noexcept(false)`` not ``noexcept``, this check will detect, but not

malcolm.parsons wrote:
> typo: equivelent -> equivalent.
Thanks!  Spelling isn't my strong suit.


https://reviews.llvm.org/D20693



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


[PATCH] D28402: [OpenMP] support the 'is_device_ptr' clause with 'target parallel for simd' pragma

2017-01-06 Thread Kelvin Li via Phabricator via cfe-commits
kkwli0 created this revision.
kkwli0 added reviewers: ABataev, sfantao, carlo.bertolli, arpith-jacob, 
mikerice, hfinkel.
kkwli0 added a subscriber: cfe-commits.

This patch is to add support of the 'is_device_ptr' clause in the 'target 
parallel for simd' pragma.


https://reviews.llvm.org/D28402

Files:
  include/clang/Basic/OpenMPKinds.def
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp
  test/OpenMP/target_parallel_for_simd_is_device_ptr_messages.cpp

Index: test/OpenMP/target_parallel_for_simd_is_device_ptr_messages.cpp
===
--- /dev/null
+++ test/OpenMP/target_parallel_for_simd_is_device_ptr_messages.cpp
@@ -0,0 +1,337 @@
+// RUN: %clang_cc1 -std=c++11 -verify -fopenmp %s
+struct ST {
+  int *a;
+};
+typedef int arr[10];
+typedef ST STarr[10];
+struct SA {
+  const int d = 5;
+  const int da[5] = { 0 };
+  ST e;
+  ST g[10];
+  STarr &rg = g;
+  int i;
+  int &j = i;
+  int *k = &j;
+  int *&z = k;
+  int aa[10];
+  arr &raa = aa;
+  void func(int arg) {
+#pragma omp target parallel for simd is_device_ptr // expected-error {{expected '(' after 'is_device_ptr'}}
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr() // expected-error {{expected expression}}
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(arg // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(i) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(j) // expected-error {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(k) // OK
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(z) // OK
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(aa) // OK
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(raa) // OK
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(e) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(g) // OK
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(rg) // OK
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(k,i,j) // expected-error2 {{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(d) // expected-error{{expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'}}
+  for (int i=0; i<100; i++)
+;
+#pragma omp target parallel for simd is_device_ptr(da) // OK
+  for (int i=0; i<100; i++)
+;
+  return;
+ }
+};
+struct SB {
+  unsigned A;
+  unsigned B;
+  float Arr[100];
+  float *Ptr;
+  float *foo() {
+return &Arr[0];
+  }
+};
+
+struct SC {
+  unsigned A : 2;
+  unsigned B : 3;
+  unsigned C;
+  unsigned D;
+  float Arr[100];
+  SB S;
+  SB ArrS[100];
+  SB *PtrS;
+  SB *&RPtrS;
+  float *Ptr;
+
+  SC(SB *&_RPtrS) : RPtrS(_RPtrS) {}
+};
+
+union SD {
+  unsigned A;
+  float B;
+};
+
+struct S1;
+extern S1 a;
+class S2 {
+  mutable int a;
+public:
+  S2():a(0) { }
+  S2(S2 &s2):a(s2.a) { }
+  static float S2s;
+  static const float S2sc;
+};
+const float S2::S2sc = 0;
+const S2 b;
+const S2 ba[5];
+class S3 {
+  int a;
+public:
+  S3():a(0) { }
+  S3(S3 &s3):a(s3.a) { }
+};
+const S3 c;
+const S3 ca[5];
+extern const int f;
+class S4 {
+  int a;
+  S4();
+  S4(const S4 &s4);
+public:
+  S4(int v):a(v) { }
+};
+class S5 {
+  int a;
+  S5():a(0) {}
+  S5(const S5 &s5):a(s5.a) { }
+public:
+  S5(int v):a(v) { }
+};
+
+S3 h;
+#pragma omp threadprivate(h)
+
+typedef struct {
+  int a;
+} S6;
+
+template 
+T tmain(T argc) {
+  const T d = 5;
+  const T da[5] = { 0 };
+  S4 e(4);
+  S5 g(5);
+  S6 h[10];
+  auto &rh = h;
+  T i;
+  T &j = i;
+  T *k = &j;
+  T *&z = k;
+  T aa[10];
+  auto &raa = aa;
+  S6 *ps;
+#pragma omp target parallel for simd i

[PATCH] D20428: Tracking exception specification source locations

2017-01-06 Thread don hinton via Phabricator via cfe-commits
hintonda added a comment.

Great, thanks.  Spoke to Richard about it last night and believe he's 
comfortable with this change, but I'll let him weigh in...


https://reviews.llvm.org/D20428



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


[PATCH] D28381: [WebAssembly] Always inline atomics

2017-01-06 Thread Dan Gohman via Phabricator via cfe-commits
sunfish added a comment.

(Emscripten does set the thread model.)

Whether WebAssembly should provide 64-bit atomics when on hardware where 
they're not lock-free is an interesting wasm design question, and the code here 
and in target-independent parts of clang may need to be changed as a result 
(right now, clang's target-independent code automatically defines 
__GCC_ATOMIC_LLONG_LOCK_FREE to 2 with this patch, which is incorrect).

So that's a separate topic. I'd like to keep changes meant to fix the 
-mthread-model single case.


https://reviews.llvm.org/D28381



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


[PATCH] D20693: [clang-tidy] New checker to replace dynamic exception specifications

2017-01-06 Thread don hinton via Phabricator via cfe-commits
hintonda updated this revision to Diff 83375.
hintonda added a comment.

- Addressed comments.


https://reviews.llvm.org/D20693

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseNoexceptCheck.cpp
  clang-tidy/modernize/UseNoexceptCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-noexcept.rst
  test/clang-tidy/modernize-use-noexcept-macro.cpp
  test/clang-tidy/modernize-use-noexcept.cpp

Index: test/clang-tidy/modernize-use-noexcept.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-noexcept.cpp
@@ -0,0 +1,56 @@
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \
+// RUN:   -- -std=c++11
+
+class A {};
+class B {};
+
+void foo() throw();
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void foo() noexcept;
+
+void bar() throw(...);
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw(...)' [modernize-use-noexcept]
+// CHECK-FIXES: void bar() noexcept(false);
+
+void k() throw(int(int));
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: found dynamic exception specification 'throw(int(int))' [modernize-use-noexcept]
+// CHECK-FIXES: void k() noexcept(false);
+
+void foobar() throw(A, B)
+{}
+// CHECK-MESSAGES: :[[@LINE-2]]:15: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+// CHECK-FIXES: void foobar() noexcept(false)
+
+void baz(int = (throw A(), 0)) throw(A, B) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+// CHECK-FIXES: void baz(int = (throw A(), 0)) noexcept(false) {}
+
+void g(void (*fp)(void) throw());
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void g(void (*fp)(void) noexcept);
+
+void f(void (*fp)(void) throw(int)) throw(char);
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: found dynamic exception specification 'throw(int)' [modernize-use-noexcept]
+// CHECK-MESSAGES: :[[@LINE-2]]:37: warning: found dynamic exception specification 'throw(char)' [modernize-use-noexcept]
+// CHECK-FIXES: void f(void (*fp)(void) noexcept(false)) noexcept(false);
+
+void j() throw(int(int) throw(void(void) throw(int)));
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: found dynamic exception specification 'throw(int(int) throw(void(void) throw(int)))' [modernize-use-noexcept]
+// CHECK-FIXES: void j() noexcept(false);
+
+class Y {
+  Y() throw() = default;
+};
+// CHECK-MESSAGES: :[[@LINE-2]]:7: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: Y() noexcept = default;
+
+// Should not trigger a replacement.
+void titi() noexcept {}
+void toto() noexcept(true) {}
+
+// Should not trigger a replacement.
+void bad()
+#if !__has_feature(cxx_noexcept)
+throw()
+#endif
+;
Index: test/clang-tidy/modernize-use-noexcept-macro.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-noexcept-macro.cpp
@@ -0,0 +1,24 @@
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \
+// RUN:   -config="{CheckOptions: [{key: modernize-use-noexcept.ReplacementString, value: 'NOEXCEPT'}]}" \
+// RUN:   -- -std=c++11
+
+// Example definition of NOEXCEPT -- simplified test to see if noexcept is supported. 
+#if (__has_feature(cxx_noexcept))
+#define NOEXCEPT noexcept
+#else
+#define NOEXCEPT throw()
+#endif
+
+void bar() throw() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void bar() NOEXCEPT {}
+
+// Should not trigger a FixItHint, since macros only support noexcept, and this
+// case throws.
+class A {};
+class B {};
+void foobar() throw(A, B);
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+
+// Should not trigger a replacement.
+void foo() noexcept(true);
Index: docs/clang-tidy/checks/modernize-use-noexcept.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-use-noexcept.rst
@@ -0,0 +1,55 @@
+.. title:: clang-tidy - modernize-use-noexcept
+
+modernize-use-noexcept
+==
+
+The check converts dynamic exception specifications, e.g., ``throw()``,
+``throw([,...])``, or ``throw(...)`` to ``noexcept``, ``noexcept(false)``,
+or a user defined macro.
+
+Example
+---
+
+.. code-block:: c++
+
+  void foo() throw();
+	void bar() throw(int) {}
+
+transforms to:
+
+.. code-block:: c++
+
+  void foo() noexcept;
+	void bar() noexcept(false) {}
+
+
+User defined macros
+---
+
+By default this check will only replace ``throw()`` wit

[PATCH] D28238: [Driver] Add openSuse AArch64 Triple

2017-01-06 Thread Kostya Kortchinsky via Phabricator via cfe-commits
cryptoad updated this revision to Diff 83376.
cryptoad added a comment.

Adding tests to test/Driver.


https://reviews.llvm.org/D28238

Files:
  lib/Driver/ToolChains.cpp
  test/Driver/Inputs/opensuse_42.2_aarch64_tree/
  test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/
  test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/
  test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crt1.o
  test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crti.o
  test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/crtn.o
  test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/
  
test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/
  
test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8/
  
test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8/crtbegin.o
  
test/Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8/crtend.o
  test/Driver/linux-ld.c


Index: test/Driver/linux-ld.c
===
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -618,6 +618,26 @@
 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/lib/../lib64"
 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/../lib64"
 //
+// Check openSuse Leap 42.2 on AArch64
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=arm64-unknown-linux-gnu \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/opensuse_42.2_aarch64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-42-2-AARCH64 %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=aarch64-unknown-linux-gnu \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/opensuse_42.2_aarch64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-42-2-AARCH64 %s
+// CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}ld{{(.exe)?}}" 
"--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-OPENSUSE-42-2-AARCH64: 
"{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64{{/|}}crt1.o"
+// CHECK-OPENSUSE-42-2-AARCH64: 
"{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64{{/|}}crti.o"
+// CHECK-OPENSUSE-42-2-AARCH64: 
"{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8{{/|}}crtbegin.o"
+// CHECK-OPENSUSE-42-2-AARCH64: 
"-L[[SYSROOT]]/usr/lib64/gcc/aarch64-suse-linux/4.8"
+// CHECK-OPENSUSE-42-2-AARCH64: 
"-L[[SYSROOT]]/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64"
+// CHECK-OPENSUSE-42-2-AARCH64: 
"{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8{{/|}}crtend.o"
+// CHECK-OPENSUSE-42-2-AARCH64: 
"{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64{{/|}}crtn.o"
+//
 // Check dynamic-linker for different archs
 // RUN: %clang %s -### -o %t.o 2>&1 \
 // RUN: --target=arm-linux-gnueabi \
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1531,7 +1531,7 @@
   static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
   static const char *const AArch64Triples[] = {
   "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-linux-android",
-  "aarch64-redhat-linux"};
+  "aarch64-redhat-linux", "aarch64-suse-linux"};
   static const char *const AArch64beLibDirs[] = {"/lib"};
   static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
  "aarch64_be-linux-gnu"};


Index: test/Driver/linux-ld.c
===
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -618,6 +618,26 @@
 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/lib/../lib64"
 // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/../lib64"
 //
+// Check openSuse Leap 42.2 on AArch64
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=arm64-unknown-linux-gnu \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/opensuse_42.2_aarch64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-42-2-AARCH64 %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=aarch64-unknown-linux-gnu \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/opensuse_42.2_aarch64_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-42-2-AARCH64 %s
+// CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64{{/|}}crt1.o"
+// CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64{{/|}}crti.o"
+// CHECK-OPENSUSE-42-2-AARCH64: "{{.*}}/usr/lib64/gcc/aarch64-suse-linux/4.8{{/|}}crtbegin.o"
+// CHECK-OPENSUSE-42-2-AARCH64: "-L[[SYSROOT]]/usr/lib64/gcc/aarch64-suse-linux/4.8"
+// CHECK-OPENSUSE-42-2-AARCH64: "-L[[SYSROOT]]/usr/lib64/gcc/aarch64-suse-linux/4.8/../../../../lib64"
+// CHECK-OPENSUSE-42-

[PATCH] D28238: [Driver] Add openSuse AArch64 Triple

2017-01-06 Thread Renato Golin via Phabricator via cfe-commits
rengolin added inline comments.



Comment at: test/Driver/linux-ld.c:623
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=arm64-unknown-linux-gnu \
+// RUN: --gcc-toolchain="" \

shouldn't you have used your triple?


https://reviews.llvm.org/D28238



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


[PATCH] D28399: PR31469: Don't add friend template class decls to redecl chain in dependent contexts.

2017-01-06 Thread Kim Gräsman via Phabricator via cfe-commits
kimgr added a comment.

I think we're seeing similar new behavior in IWYU, I've been meaning to bring 
it up on cfe-dev. But since it might be relevant here, I'll add our 
observations.

To us, it looks like friends in templates form their own redecl chain. An 
example:

  // template.h
  void foo();
  
  template
  struct Template {
friend void foo();
  };
  
  // foo.h
  inline void foo() {
  }
  
  // main.cpp
  #include "template.h"
  #include "foo.h"
  
  Template i;
  
  int main() {
foo();  // attributed to Template::foo
  }

This behavior changed in r283207.

We never got to the bottom of whether the redecl shuffling is correct or not, 
so we decided to just work around it, our code here:
https://github.com/include-what-you-use/include-what-you-use/blob/master/iwyu_ast_util.cc#L842

Relevant to this patch, I wonder if you're also about to work around a more 
central problem?


Repository:
  rL LLVM

https://reviews.llvm.org/D28399



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


Re: r291131 - [Driver] Driver changes to support CUDA compilation on Windows.

2017-01-06 Thread Reid Kleckner via cfe-commits
cuda-version-check.cu seems to be failing since this change:
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/1768

The relevant failing part:

$
"C:/b/slave/clang-x86-windows-msvc2015/clang-x86-windows-msvc2015/stage1/./bin/clang.EXE"
"-v" "-###" "--cuda-gpu-arch=sm_60"
"--sysroot=C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\llvm\tools\clang\test\Driver/Inputs/CUDA"
"C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\llvm\tools\clang\test\Driver\
cuda-version-check.cu"
$
"C:/b/slave/clang-x86-windows-msvc2015/clang-x86-windows-msvc2015/stage1/./bin\FileCheck.EXE"
"C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\llvm\tools\clang\test\Driver\
cuda-version-check.cu" "--check-prefix=ERR_SM60"
# command stderr:
C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\llvm\tools\clang\test\Driver\cuda-version-check.cu:56:14:
error: expected string not found in input
// ERR_SM60: error: GPU arch sm_60 {{.*}}
 ^
:1:1: note: scanning from here
clang version 4.0.0 (trunk 291142)
^
:5:12: note: possible intended match here
clang.EXE: error: cannot find libdevice for sm_60. Provide path to
different CUDA installation via --cuda-path, or pass -nocudalib to build
without linking with libdevice.
   ^

On Thu, Jan 5, 2017 at 8:52 AM, Justin Lebar via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jlebar
> Date: Thu Jan  5 10:52:29 2017
> New Revision: 291131
>
> URL: http://llvm.org/viewvc/llvm-project?rev=291131&view=rev
> Log:
> [Driver] Driver changes to support CUDA compilation on Windows.
>
> Summary:
> For the most part this is straightforward: Just add a CudaInstallation
> object to the MSVC and MinGW toolchains.
>
> CudaToolChain has to override computeMSVCVersion so that
> Clang::constructJob passes the right version flag to cc1.  We have to
> modify IsWindowsMSVC and friends in Clang::constructJob to be true when
> compiling CUDA device code on Windows for the same reason.
>
> Depends on: D28319
>
> Reviewers: tra
>
> Subscribers: cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D28320
>
> Added:
> cfe/trunk/test/Driver/Inputs/CUDA-windows/
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
> Computing Toolkit/
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
> Computing Toolkit/CUDA/
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
> Computing Toolkit/CUDA/v8.0/
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
> Computing Toolkit/CUDA/v8.0/bin/
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
> Computing Toolkit/CUDA/v8.0/bin/.keep
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
> Computing Toolkit/CUDA/v8.0/include/
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
> Computing Toolkit/CUDA/v8.0/include/.keep
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
> Computing Toolkit/CUDA/v8.0/lib/
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
> Computing Toolkit/CUDA/v8.0/lib/.keep
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
> Computing Toolkit/CUDA/v8.0/nvvm/
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
> Computing Toolkit/CUDA/v8.0/nvvm/libdevice/
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
> Computing Toolkit/CUDA/v8.0/nvvm/libdevice/libdevice.compute_30.10.bc
> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
> Computing Toolkit/CUDA/v8.0/nvvm/libdevice/libdevice.compute_35.10.bc
> cfe/trunk/test/Driver/cuda-windows.cu
> Modified:
> cfe/trunk/include/clang/Driver/ToolChain.h
> cfe/trunk/lib/Driver/MSVCToolChain.cpp
> cfe/trunk/lib/Driver/MinGWToolChain.cpp
> cfe/trunk/lib/Driver/ToolChains.cpp
> cfe/trunk/lib/Driver/ToolChains.h
> cfe/trunk/lib/Driver/Tools.cpp
>
> Modified: cfe/trunk/include/clang/Driver/ToolChain.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Driver/ToolChain.h?rev=291131&r1=291130&r2=291131&view=diff
> 
> ==
> --- cfe/trunk/include/clang/Driver/ToolChain.h (original)
> +++ cfe/trunk/include/clang/Driver/ToolChain.h Thu Jan  5 10:52:29 2017
> @@ -139,6 +139,13 @@ public:
>vfs::FileSystem &getVFS() const;
>const llvm::Triple &getTriple() const { return Triple; }
>
> +  /// Get the toolchain's aux triple, if it has one.
> +  ///
> +  /// Exactly what the aux triple represents depends on the toolchain,
> but for
> +  /// example when compiling CUDA code for the GPU, the triple might be
> NVPTX,
> +  /// while the aux triple is the host (CPU) toolchain, e.g.
> x86-linux-gnu.
> +  virtual const llvm::Triple *getAuxTriple() const { return nullptr; }
> +
>  

[PATCH] D28399: PR31469: Don't add friend template class decls to redecl chain in dependent contexts.

2017-01-06 Thread Yaron Keren via Phabricator via cfe-commits
yaron.keren added a comment.

While at it,  llvm.org/pr30994


Repository:
  rL LLVM

https://reviews.llvm.org/D28399



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


r291249 - Revert "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCompleteConsumer"

2017-01-06 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Fri Jan  6 11:47:10 2017
New Revision: 291249

URL: http://llvm.org/viewvc/llvm-project?rev=291249&view=rev
Log:
Revert "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and 
CodeCompleteConsumer"

Caused a memory leak reported by asan. Reverting while I investigate.

This reverts commit r291184.

Modified:
cfe/trunk/include/clang/Frontend/ASTUnit.h
cfe/trunk/include/clang/Frontend/CompilerInstance.h
cfe/trunk/include/clang/Frontend/CompilerInvocation.h
cfe/trunk/include/clang/Frontend/Utils.h
cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h
cfe/trunk/include/clang/Tooling/Tooling.h
cfe/trunk/lib/ARCMigrate/ARCMT.cpp
cfe/trunk/lib/Frontend/ASTUnit.cpp
cfe/trunk/lib/Frontend/ChainedIncludesSource.cpp
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
cfe/trunk/lib/Tooling/Tooling.cpp
cfe/trunk/tools/c-index-test/core_main.cpp
cfe/trunk/tools/clang-import-test/clang-import-test.cpp
cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp
cfe/trunk/tools/libclang/CXTranslationUnit.h
cfe/trunk/tools/libclang/Indexing.cpp
cfe/trunk/unittests/AST/ExternalASTSourceTest.cpp
cfe/trunk/unittests/Frontend/CodeGenActionTest.cpp
cfe/trunk/unittests/Frontend/FrontendActionTest.cpp

Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=291249&r1=291248&r2=291249&view=diff
==
--- cfe/trunk/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTUnit.h Fri Jan  6 11:47:10 2017
@@ -108,8 +108,8 @@ private:
 
   /// Optional owned invocation, just used to make the invocation used in
   /// LoadFromCommandLine available.
-  std::shared_ptr Invocation;
-
+  IntrusiveRefCntPtr Invocation;
+  
   // OnlyLocalDecls - when true, walking this AST should only visit 
declarations
   // that come from the AST itself, not from included precompiled headers.
   // FIXME: This is temporary; eventually, CIndex will always do this.
@@ -358,21 +358,22 @@ public:
   }
   
   /// \brief Retrieve the allocator used to cache global code completions.
-  std::shared_ptr
+  IntrusiveRefCntPtr
   getCachedCompletionAllocator() {
 return CachedCompletionAllocator;
   }
 
   CodeCompletionTUInfo &getCodeCompletionTUInfo() {
 if (!CCTUInfo)
-  CCTUInfo = llvm::make_unique(
-  std::make_shared());
+  CCTUInfo.reset(new CodeCompletionTUInfo(
+new 
GlobalCodeCompletionAllocator));
 return *CCTUInfo;
   }
 
 private:
   /// \brief Allocator used to store cached code completions.
-  std::shared_ptr CachedCompletionAllocator;
+  IntrusiveRefCntPtr
+CachedCompletionAllocator;
 
   std::unique_ptr CCTUInfo;
 
@@ -701,11 +702,11 @@ public:
   /// remapped contents of that file.
   typedef std::pair RemappedFile;
 
-  /// \brief Create a ASTUnit. Gets ownership of the passed CompilerInvocation.
-  static std::unique_ptr
-  create(std::shared_ptr CI,
- IntrusiveRefCntPtr Diags, bool CaptureDiagnostics,
- bool UserFilesAreVolatile);
+  /// \brief Create a ASTUnit. Gets ownership of the passed 
CompilerInvocation. 
+  static ASTUnit *create(CompilerInvocation *CI,
+ IntrusiveRefCntPtr Diags,
+ bool CaptureDiagnostics,
+ bool UserFilesAreVolatile);
 
   /// \brief Create a ASTUnit from an AST file.
   ///
@@ -770,7 +771,7 @@ public:
   /// created ASTUnit was passed in \p Unit then the caller can check that.
   ///
   static ASTUnit *LoadFromCompilerInvocationAction(
-  std::shared_ptr CI,
+  CompilerInvocation *CI,
   std::shared_ptr PCHContainerOps,
   IntrusiveRefCntPtr Diags,
   FrontendAction *Action = nullptr, ASTUnit *Unit = nullptr,
@@ -797,7 +798,7 @@ public:
   // FIXME: Move OnlyLocalDecls, UseBumpAllocator to setters on the ASTUnit, we
   // shouldn't need to specify them at construction time.
   static std::unique_ptr LoadFromCompilerInvocation(
-  std::shared_ptr CI,
+  CompilerInvocation *CI,
   std::shared_ptr PCHContainerOps,
   IntrusiveRefCntPtr Diags, FileManager *FileMgr,
   bool OnlyLocalDecls = false, bool CaptureDiagnostics = false,

Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=291249&r1=291248&r2=291249&view=diff
==
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/trunk/include

[clang-tools-extra] r291251 - Revert "Fix for shared_ptrification in Clang"

2017-01-06 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Fri Jan  6 11:47:19 2017
New Revision: 291251

URL: http://llvm.org/viewvc/llvm-project?rev=291251&view=rev
Log:
Revert "Fix for shared_ptrification in Clang"

The original commit caused an asan-detected memory leak in Clang.
Reverting while I investigate.

This reverts commit r291186.

Modified:
clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
clang-tools-extra/trunk/include-fixer/IncludeFixer.h

Modified: clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp?rev=291251&r1=291250&r2=291251&view=diff
==
--- clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp Fri Jan  6 11:47:19 
2017
@@ -82,15 +82,14 @@ IncludeFixerActionFactory::IncludeFixerA
 IncludeFixerActionFactory::~IncludeFixerActionFactory() = default;
 
 bool IncludeFixerActionFactory::runInvocation(
-std::shared_ptr Invocation,
-clang::FileManager *Files,
+clang::CompilerInvocation *Invocation, clang::FileManager *Files,
 std::shared_ptr PCHContainerOps,
 clang::DiagnosticConsumer *Diagnostics) {
   assert(Invocation->getFrontendOpts().Inputs.size() == 1);
 
   // Set up Clang.
   clang::CompilerInstance Compiler(PCHContainerOps);
-  Compiler.setInvocation(std::move(Invocation));
+  Compiler.setInvocation(Invocation);
   Compiler.setFileManager(Files);
 
   // Create the compiler's actual diagnostics engine. We want to drop all

Modified: clang-tools-extra/trunk/include-fixer/IncludeFixer.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/IncludeFixer.h?rev=291251&r1=291250&r2=291251&view=diff
==
--- clang-tools-extra/trunk/include-fixer/IncludeFixer.h (original)
+++ clang-tools-extra/trunk/include-fixer/IncludeFixer.h Fri Jan  6 11:47:19 
2017
@@ -42,7 +42,7 @@ public:
   ~IncludeFixerActionFactory() override;
 
   bool
-  runInvocation(std::shared_ptr Invocation,
+  runInvocation(clang::CompilerInvocation *Invocation,
 clang::FileManager *Files,
 std::shared_ptr PCHContainerOps,
 clang::DiagnosticConsumer *Diagnostics) override;


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


[PATCH] D27898: [compiler-rt] [builtins] Implement __floattitf() & __floatuntitf()

2017-01-06 Thread Steve Canon via Phabricator via cfe-commits
scanon accepted this revision.
scanon added a comment.
This revision is now accepted and ready to land.

OK, I'm satisfied with that.


https://reviews.llvm.org/D27898



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


r291252 - Revert "Fix examples for recent shared_ptrification"

2017-01-06 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Fri Jan  6 11:50:34 2017
New Revision: 291252

URL: http://llvm.org/viewvc/llvm-project?rev=291252&view=rev
Log:
Revert "Fix examples for recent shared_ptrification"

(should've rolled in to this revert of the CompilerInstance change in
the first place... anyway)

This reverts commit r291185.

Modified:
cfe/trunk/examples/clang-interpreter/main.cpp

Modified: cfe/trunk/examples/clang-interpreter/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang-interpreter/main.cpp?rev=291252&r1=291251&r2=291252&view=diff
==
--- cfe/trunk/examples/clang-interpreter/main.cpp (original)
+++ cfe/trunk/examples/clang-interpreter/main.cpp Fri Jan  6 11:50:34 2017
@@ -145,7 +145,7 @@ int main(int argc, const char **argv, ch
 
   // Create a compiler instance to handle the actual work.
   CompilerInstance Clang;
-  Clang.setInvocation(std::move(CI));
+  Clang.setInvocation(CI.release());
 
   // Create the compilers actual diagnostics engine.
   Clang.createDiagnostics();


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


r291253 - Make ASTContext::getDeclAlign return the correct alignment for

2017-01-06 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Fri Jan  6 11:56:15 2017
New Revision: 291253

URL: http://llvm.org/viewvc/llvm-project?rev=291253&view=rev
Log:
Make ASTContext::getDeclAlign return the correct alignment for
FunctionDecls.

This commit silences an incorrect warning that is issued when a function
pointer is cast to another function pointer type. The warning gets
issued because alignments of the source and destination do not match in
Sema::CheckCastAlign, which happens because ASTContext::getTypeInfoImpl
and ASTContext::getDeclAlign return different values for functions (the
former returns 4 while the latter returns 1).

This should fix PR31558.

rdar://problem/29533528

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

Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/Sema/warn-cast-align.c

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=291253&r1=291252&r2=291253&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Jan  6 11:56:15 2017
@@ -1458,7 +1458,9 @@ CharUnits ASTContext::getDeclAlign(const
 T = getPointerType(RT->getPointeeType());
 }
 QualType BaseT = getBaseElementType(T);
-if (!BaseT->isIncompleteType() && !T->isFunctionType()) {
+if (T->isFunctionType())
+  Align = getTypeInfoImpl(T.getTypePtr()).Align;
+else if (!BaseT->isIncompleteType()) {
   // Adjust alignments of declarations with array type by the
   // large-array alignment on the target.
   if (const ArrayType *arrayType = getAsArrayType(T)) {

Modified: cfe/trunk/test/Sema/warn-cast-align.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-cast-align.c?rev=291253&r1=291252&r2=291253&view=diff
==
--- cfe/trunk/test/Sema/warn-cast-align.c (original)
+++ cfe/trunk/test/Sema/warn-cast-align.c Fri Jan  6 11:56:15 2017
@@ -59,3 +59,11 @@ void test4() {
   i = (int *)&s.s0;
   i = (int *)a;
 }
+
+// No warnings.
+typedef int (*FnTy)(void);
+unsigned int func5(void);
+
+FnTy test5(void) {
+  return (FnTy)&func5;
+}


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


[PATCH] D27478: Make ASTContext::getDeclAlign return the correct alignment for FunctionDecls

2017-01-06 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL291253: Make ASTContext::getDeclAlign return the correct 
alignment for (authored by ahatanak).

Changed prior to commit:
  https://reviews.llvm.org/D27478?vs=80464&id=83378#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27478

Files:
  cfe/trunk/lib/AST/ASTContext.cpp
  cfe/trunk/test/Sema/warn-cast-align.c


Index: cfe/trunk/test/Sema/warn-cast-align.c
===
--- cfe/trunk/test/Sema/warn-cast-align.c
+++ cfe/trunk/test/Sema/warn-cast-align.c
@@ -59,3 +59,11 @@
   i = (int *)&s.s0;
   i = (int *)a;
 }
+
+// No warnings.
+typedef int (*FnTy)(void);
+unsigned int func5(void);
+
+FnTy test5(void) {
+  return (FnTy)&func5;
+}
Index: cfe/trunk/lib/AST/ASTContext.cpp
===
--- cfe/trunk/lib/AST/ASTContext.cpp
+++ cfe/trunk/lib/AST/ASTContext.cpp
@@ -1458,7 +1458,9 @@
 T = getPointerType(RT->getPointeeType());
 }
 QualType BaseT = getBaseElementType(T);
-if (!BaseT->isIncompleteType() && !T->isFunctionType()) {
+if (T->isFunctionType())
+  Align = getTypeInfoImpl(T.getTypePtr()).Align;
+else if (!BaseT->isIncompleteType()) {
   // Adjust alignments of declarations with array type by the
   // large-array alignment on the target.
   if (const ArrayType *arrayType = getAsArrayType(T)) {


Index: cfe/trunk/test/Sema/warn-cast-align.c
===
--- cfe/trunk/test/Sema/warn-cast-align.c
+++ cfe/trunk/test/Sema/warn-cast-align.c
@@ -59,3 +59,11 @@
   i = (int *)&s.s0;
   i = (int *)a;
 }
+
+// No warnings.
+typedef int (*FnTy)(void);
+unsigned int func5(void);
+
+FnTy test5(void) {
+  return (FnTy)&func5;
+}
Index: cfe/trunk/lib/AST/ASTContext.cpp
===
--- cfe/trunk/lib/AST/ASTContext.cpp
+++ cfe/trunk/lib/AST/ASTContext.cpp
@@ -1458,7 +1458,9 @@
 T = getPointerType(RT->getPointeeType());
 }
 QualType BaseT = getBaseElementType(T);
-if (!BaseT->isIncompleteType() && !T->isFunctionType()) {
+if (T->isFunctionType())
+  Align = getTypeInfoImpl(T.getTypePtr()).Align;
+else if (!BaseT->isIncompleteType()) {
   // Adjust alignments of declarations with array type by the
   // large-array alignment on the target.
   if (const ArrayType *arrayType = getAsArrayType(T)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r291131 - [Driver] Driver changes to support CUDA compilation on Windows.

2017-01-06 Thread Justin Lebar via cfe-commits
chapuni pointed it out in the review thread a few minutes ago --
ongoing discussion there, would actually appreciate a pointer or two.

-Justin

On Fri, Jan 6, 2017 at 9:46 AM, Reid Kleckner  wrote:
> cuda-version-check.cu seems to be failing since this change:
> http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/1768
>
> The relevant failing part:
>
> $
> "C:/b/slave/clang-x86-windows-msvc2015/clang-x86-windows-msvc2015/stage1/./bin/clang.EXE"
> "-v" "-###" "--cuda-gpu-arch=sm_60"
> "--sysroot=C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\llvm\tools\clang\test\Driver/Inputs/CUDA"
> "C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\llvm\tools\clang\test\Driver\cuda-version-check.cu"
> $
> "C:/b/slave/clang-x86-windows-msvc2015/clang-x86-windows-msvc2015/stage1/./bin\FileCheck.EXE"
> "C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\llvm\tools\clang\test\Driver\cuda-version-check.cu"
> "--check-prefix=ERR_SM60"
> # command stderr:
> C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\llvm\tools\clang\test\Driver\cuda-version-check.cu:56:14:
> error: expected string not found in input
> // ERR_SM60: error: GPU arch sm_60 {{.*}}
>  ^
> :1:1: note: scanning from here
> clang version 4.0.0 (trunk 291142)
> ^
> :5:12: note: possible intended match here
> clang.EXE: error: cannot find libdevice for sm_60. Provide path to different
> CUDA installation via --cuda-path, or pass -nocudalib to build without
> linking with libdevice.
>^
>
> On Thu, Jan 5, 2017 at 8:52 AM, Justin Lebar via cfe-commits
>  wrote:
>>
>> Author: jlebar
>> Date: Thu Jan  5 10:52:29 2017
>> New Revision: 291131
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=291131&view=rev
>> Log:
>> [Driver] Driver changes to support CUDA compilation on Windows.
>>
>> Summary:
>> For the most part this is straightforward: Just add a CudaInstallation
>> object to the MSVC and MinGW toolchains.
>>
>> CudaToolChain has to override computeMSVCVersion so that
>> Clang::constructJob passes the right version flag to cc1.  We have to
>> modify IsWindowsMSVC and friends in Clang::constructJob to be true when
>> compiling CUDA device code on Windows for the same reason.
>>
>> Depends on: D28319
>>
>> Reviewers: tra
>>
>> Subscribers: cfe-commits
>>
>> Differential Revision: https://reviews.llvm.org/D28320
>>
>> Added:
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
>> Computing Toolkit/
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
>> Computing Toolkit/CUDA/
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
>> Computing Toolkit/CUDA/v8.0/
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
>> Computing Toolkit/CUDA/v8.0/bin/
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
>> Computing Toolkit/CUDA/v8.0/bin/.keep
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
>> Computing Toolkit/CUDA/v8.0/include/
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
>> Computing Toolkit/CUDA/v8.0/include/.keep
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
>> Computing Toolkit/CUDA/v8.0/lib/
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
>> Computing Toolkit/CUDA/v8.0/lib/.keep
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
>> Computing Toolkit/CUDA/v8.0/nvvm/
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
>> Computing Toolkit/CUDA/v8.0/nvvm/libdevice/
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
>> Computing Toolkit/CUDA/v8.0/nvvm/libdevice/libdevice.compute_30.10.bc
>> cfe/trunk/test/Driver/Inputs/CUDA-windows/Program Files/NVIDIA GPU
>> Computing Toolkit/CUDA/v8.0/nvvm/libdevice/libdevice.compute_35.10.bc
>> cfe/trunk/test/Driver/cuda-windows.cu
>> Modified:
>> cfe/trunk/include/clang/Driver/ToolChain.h
>> cfe/trunk/lib/Driver/MSVCToolChain.cpp
>> cfe/trunk/lib/Driver/MinGWToolChain.cpp
>> cfe/trunk/lib/Driver/ToolChains.cpp
>> cfe/trunk/lib/Driver/ToolChains.h
>> cfe/trunk/lib/Driver/Tools.cpp
>>
>> Modified: cfe/trunk/include/clang/Driver/ToolChain.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=291131&r1=291130&r2=291131&view=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Driver/ToolChain.h (original)
>> +++ cfe/trunk/include/clang/Driver/ToolChain.h Thu Jan  5 10:52:29 2017
>> @@ -139,6 +139,13 @@ public:
>>vfs::FileSystem &getVFS() const;
>>const llvm::Triple &getTriple() const { return Triple; }
>>
>> +  /// Get the toolchain's aux triple, if it has one.
>> +  ///
>> +  /// Exactly what the au

[PATCH] D28348: [analyzer] Taught the analyzer about Glib API to check Memory-leak

2017-01-06 Thread Anna Zaks via Phabricator via cfe-commits
zaks.anna added a comment.

Phabricator still says that context is not available. Please, pass -U when 
generating the patch.

Thanks!
Anna




Comment at: test/Analysis/gmalloc.c:1
+// RUN: %clang_cc1 -analyze 
-analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,debug.ExprInspection
 -analyzer-store=region -verify %s
+

Please, just include core checkers and the Malloc checker. There is no need for 
UnreachableCode, CastSize and ExprInspection here.



Comment at: test/Analysis/gmalloc.c:43
+  g_free(g2);
+  g_free(g2); // g2 Double-free
+  g_free(g3);

This test will fail. For example, I am getting:
$ 
/Volumes/Data/ws/build/Ninja-DebugAssert+cmark-ReleaseAssert/llvm-macosx-x86_64/./bin/clang
 -cc1 -internal-isystem 
/Volumes/Data/ws/build/Ninja-DebugAssert+cmark-ReleaseAssert/llvm-macosx-x86_64/bin/../lib/clang/4.0.0/include
 -nostdsysteminc -analyze -analyzer-checker=osx.SecKeychainAPI,unix.Malloc 
-fblocks /Volumes/Data/ws/clang/test/Analysis/gmalloc.c -verify
error: no expected directives found: consider use of 'expected-no-diagnostics'
error: 'warning' diagnostics seen but not expected: 
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 43: Attempt to free 
released memory
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 70: Use of memory 
after it is freed
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 79: Potential leak 
of memory pointed to by 'g4'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 82: Potential leak 
of memory pointed to by 'g6'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 83: Potential leak 
of memory pointed to by 'g5'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 85: Potential leak 
of memory pointed to by 'g8'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 87: Potential leak 
of memory pointed to by 'g7'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 106: Potential leak 
of memory pointed to by 'g6'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 107: Potential leak 
of memory pointed to by 'g5'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 109: Potential leak 
of memory pointed to by 'g8'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 111: Potential leak 
of memory pointed to by 'g7'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 130: Potential leak 
of memory pointed to by 'g6'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 131: Potential leak 
of memory pointed to by 'g5'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 133: Potential leak 
of memory pointed to by 'g8'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 135: Potential leak 
of memory pointed to by 'g7'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 155: Potential leak 
of memory pointed to by 'g5'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 157: Potential leak 
of memory pointed to by 'g8'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 159: Potential leak 
of memory pointed to by 'g7'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 179: Potential leak 
of memory pointed to by 'g5'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 181: Potential leak 
of memory pointed to by 'g8'
  File /Volumes/Data/ws/clang/test/Analysis/gmalloc.c Line 183: Potential leak 
of memory pointed to by 'g7'
22 errors generated.


The "-verify" option you pass on command line to the test checks that every 
warning/analyzer issue matches a comment with a specific pattern: 
// expected-warning {"Text of warning here"}

You should run the tests to make sure all of them pass after your patch. If you 
build with ninja, you's run "ninja check-clang" if you build with make, you can 
follow instructions here 
http://clang-analyzer.llvm.org/checker_dev_manual.html#testing


Repository:
  rL LLVM

https://reviews.llvm.org/D28348



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


r291255 - [CUDA] Add a host target triple to cuda-version-check.cu

2017-01-06 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Fri Jan  6 12:16:03 2017
New Revision: 291255

URL: http://llvm.org/viewvc/llvm-project?rev=291255&view=rev
Log:
[CUDA] Add a host target triple to cuda-version-check.cu

It passes --sysroot for the Linux CUDA installation. To make this test
pass when targetting Windows, you would need to pass
--sysroot=Inputs/CUDA-windows.

Modified:
cfe/trunk/test/Driver/cuda-version-check.cu

Modified: cfe/trunk/test/Driver/cuda-version-check.cu
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cuda-version-check.cu?rev=291255&r1=291254&r2=291255&view=diff
==
--- cfe/trunk/test/Driver/cuda-version-check.cu (original)
+++ cfe/trunk/test/Driver/cuda-version-check.cu Fri Jan  6 12:16:03 2017
@@ -2,40 +2,40 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: nvptx-registered-target
 
-// RUN: %clang -v -### --cuda-gpu-arch=sm_20 --sysroot=%S/Inputs/CUDA 2>&1 %s 
| \
+// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_20 
--sysroot=%S/Inputs/CUDA 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=OK
-// RUN: %clang -v -### --cuda-gpu-arch=sm_20 --sysroot=%S/Inputs/CUDA_80 2>&1 
%s | \
+// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_20 
--sysroot=%S/Inputs/CUDA_80 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=OK
-// RUN: %clang -v -### --cuda-gpu-arch=sm_60 --sysroot=%S/Inputs/CUDA_80 2>&1 
%s | \
+// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 
--sysroot=%S/Inputs/CUDA_80 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=OK
 
 // The installation at Inputs/CUDA is CUDA 7.0, which doesn't support sm_60.
-// RUN: %clang -v -### --cuda-gpu-arch=sm_60 --sysroot=%S/Inputs/CUDA 2>&1 %s 
| \
+// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 
--sysroot=%S/Inputs/CUDA 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=ERR_SM60
 
 // This should only complain about sm_60, not sm_35.
-// RUN: %clang -v -### --cuda-gpu-arch=sm_60 --cuda-gpu-arch=sm_35 \
+// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 
--cuda-gpu-arch=sm_35 \
 // RUN:--sysroot=%S/Inputs/CUDA 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=ERR_SM60 --check-prefix=OK_SM35
 
 // We should get two errors here, one for sm_60 and one for sm_61.
-// RUN: %clang -v -### --cuda-gpu-arch=sm_60 --cuda-gpu-arch=sm_61 \
+// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 
--cuda-gpu-arch=sm_61 \
 // RUN:--sysroot=%S/Inputs/CUDA 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=ERR_SM60 --check-prefix=ERR_SM61
 
 // We should still get an error if we pass -nocudainc, because this compilation
 // would invoke ptxas, and we do a version check on that, too.
-// RUN: %clang -v -### --cuda-gpu-arch=sm_60 -nocudainc 
--sysroot=%S/Inputs/CUDA 2>&1 %s | \
+// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 -nocudainc 
--sysroot=%S/Inputs/CUDA 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=ERR_SM60
 
 // If with -nocudainc and -E, we don't touch the CUDA install, so we
 // shouldn't get an error.
-// RUN: %clang -v -### -E --cuda-device-only --cuda-gpu-arch=sm_60 -nocudainc \
+// RUN: %clang --target=x86_64-linux -v -### -E --cuda-device-only 
--cuda-gpu-arch=sm_60 -nocudainc \
 // RUN:--sysroot=%S/Inputs/CUDA 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=OK
 
 // --no-cuda-version-check should suppress all of these errors.
-// RUN: %clang -v -### --cuda-gpu-arch=sm_60 --sysroot=%S/Inputs/CUDA 2>&1 \
+// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 
--sysroot=%S/Inputs/CUDA 2>&1 \
 // RUN:--no-cuda-version-check %s | \
 // RUN:FileCheck %s --check-prefix=OK
 
@@ -43,9 +43,9 @@
 // therefore we should not get an error in host-only mode. We use the -S here
 // to avoid the error being produced in case by the assembler tool, which does
 // the same check.
-// RUN: %clang -v -### --cuda-gpu-arch=sm_60 --cuda-host-only 
--sysroot=%S/Inputs/CUDA -S 2>&1 %s | \
+// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 
--cuda-host-only --sysroot=%S/Inputs/CUDA -S 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=OK
-// RUN: %clang -v -### --cuda-gpu-arch=sm_60 --cuda-device-only 
--sysroot=%S/Inputs/CUDA -S 2>&1 %s | \
+// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 
--cuda-device-only --sysroot=%S/Inputs/CUDA -S 2>&1 %s | \
 // RUN:FileCheck %s --check-prefix=ERR_SM60
 
 // OK-NOT: error: GPU arch


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


[PATCH] D28320: [Driver] Driver changes to support CUDA compilation on Windows.

2017-01-06 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

I went ahead and landed https://reviews.llvm.org/rL291255 to try to fix 
forward. Take a look and let me know if that's not the right fix.


Repository:
  rL LLVM

https://reviews.llvm.org/D28320



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


[PATCH] D28399: PR31469: Don't add friend template class decls to redecl chain in dependent contexts.

2017-01-06 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment.

@kimgr, here is the discussion about the change in r283207 
https://reviews.llvm.org/D16989


Repository:
  rL LLVM

https://reviews.llvm.org/D28399



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


[PATCH] D27898: [compiler-rt] [builtins] Implement __floattitf() & __floatuntitf()

2017-01-06 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL291259: [builtins] Implement __floattitf() & __floatuntitf() 
(authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D27898?vs=82414&id=83385#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27898

Files:
  compiler-rt/trunk/lib/builtins/CMakeLists.txt
  compiler-rt/trunk/lib/builtins/floattitf.c
  compiler-rt/trunk/lib/builtins/floatuntitf.c
  compiler-rt/trunk/test/builtins/Unit/floattitf_test.c
  compiler-rt/trunk/test/builtins/Unit/floatuntitf_test.c

Index: compiler-rt/trunk/test/builtins/Unit/floatuntitf_test.c
===
--- compiler-rt/trunk/test/builtins/Unit/floatuntitf_test.c
+++ compiler-rt/trunk/test/builtins/Unit/floatuntitf_test.c
@@ -0,0 +1,220 @@
+//===-- floatuntitf.c - Test __floatuntitf ===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file tests __floatuntitf for the compiler_rt library.
+//
+//===--===//
+
+#define QUAD_PRECISION
+#include "fp_lib.h"
+#include "int_lib.h"
+#include 
+#include 
+
+#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT)
+
+/* Returns: convert a tu_int to a fp_t, rounding toward even. */
+
+/* Assumption: fp_t is a IEEE 128 bit floating point type
+ * tu_int is a 128 bit integral type
+ */
+
+/* seee        |         |
+ *         |        
+ */
+
+COMPILER_RT_ABI fp_t __floatuntitf(tu_int a);
+
+int test__floatuntitf(tu_int a, fp_t expected) {
+fp_t x = __floatuntitf(a);
+if (x != expected) {
+utwords at;
+at.all = a;
+printf("error in __floatuntitf(0x%.16llX%.16llX) = %LA, expected %LA\n",
+   at.s.high, at.s.low, x, expected);
+}
+return x != expected;
+}
+
+char assumption_1[sizeof(tu_int) == 2*sizeof(du_int)] = {0};
+char assumption_2[sizeof(tu_int)*CHAR_BIT == 128] = {0};
+char assumption_3[sizeof(fp_t)*CHAR_BIT == 128] = {0};
+
+#endif
+
+int main() {
+#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT)
+if (test__floatuntitf(0, 0.0))
+return 1;
+
+if (test__floatuntitf(1, 1.0))
+return 1;
+if (test__floatuntitf(2, 2.0))
+return 1;
+if (test__floatuntitf(20, 20.0))
+return 1;
+
+if (test__floatuntitf(0x7F80ULL, 0x1.FEp+62))
+return 1;
+if (test__floatuntitf(0x7800ULL, 0x1.Ep+62))
+return 1;
+if (test__floatuntitf(0x7F00ULL, 0x1.FCp+62))
+return 1;
+if (test__floatuntitf(0x7000ULL, 0x1.Cp+62))
+return 1;
+if (test__floatuntitf(0x7FFFULL, 0xF.FFEp+59L))
+return 1;
+if (test__floatuntitf(0xFFFEULL, 0xF.FFEp+60L))
+return 1;
+if (test__floatuntitf(0xULL, 0xF.FFFp+60L))
+return 1;
+
+if (test__floatuntitf(0x8080ULL, 0x8.08p+60))
+return 1;
+if (test__floatuntitf(0x8800ULL, 0x8.8p+60))
+return 1;
+if (test__floatuntitf(0x8100ULL, 0x8.1p+60))
+return 1;
+if (test__floatuntitf(0x80001000ULL, 0x8.0001p+60))
+return 1;
+
+if (test__floatuntitf(0x8000ULL, 0x8p+60))
+return 1;
+if (test__floatuntitf(0x8001ULL, 0x8.001p+60L))
+return 1;
+
+if (test__floatuntitf(0x0007FB72E800LL, 0x1.FEDCBAp+50))
+return 1;
+
+if (test__floatuntitf(0x0007FB72EA00LL, 0x1.FEDCBA8p+50))
+return 1;
+if (test__floatuntitf(0x0007FB72EB00LL, 0x1.FEDCBACp+50))
+return 1;
+if (test__floatuntitf(0x0007FB72EBFFLL, 0x1.FEDCBAFFCp+50))
+return 1;
+if (test__floatuntitf(0x0007FB72EC00LL, 0x1.FEDCBBp+50))
+return 1;
+if (test__floatuntitf(0x0007FB72E801LL, 0x1.FEDCBA004p+50))
+return 1;
+
+if (test__floatuntitf(0x0007FB72E600LL, 0x1.FEDCB98p+50))
+return 1;
+if (test__floatuntitf(0x0007FB72E700LL, 0x1.FEDCB9Cp+50))
+return 1;
+if (test__floatuntitf(0x0007FB72E7FFLL, 0x1.FEDCB9FFCp+50))
+return 1;
+if (test__floatuntitf(0x0007FB72E401LL, 0x1.FEDCB9004p+50))
+return 1;
+if (test__floatuntitf(0x0007FB72E400LL, 0x1.FEDCB9p+50))
+return 1;
+
+if (test__floatuntitf(0x023479FD0E092DC0LL, 0x1.1A3CFE870496Ep+57))
+return 1;
+if (test_

r291260 - [OpenMP] fix typo - the standalone 'distribute' pragma should be 'teams distribute' pragma

2017-01-06 Thread Kelvin Li via cfe-commits
Author: kli
Date: Fri Jan  6 12:49:49 2017
New Revision: 291260

URL: http://llvm.org/viewvc/llvm-project?rev=291260&view=rev
Log:
[OpenMP] fix typo - the standalone 'distribute' pragma should be 'teams 
distribute' pragma

Modified:
cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp

Modified: cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp?rev=291260&r1=291259&r2=291260&view=diff
==
--- cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp Fri Jan  6 
12:49:49 2017
@@ -66,7 +66,8 @@ T tmain(T argc, S **argv) { //expected-n
   for (int i = ST; i < N; i++)
 argv[0][i] = argv[0][i] - argv[0][i-ST];
 
-#pragma omp distribute collapse (S) // expected-error {{'S' does not refer to 
a value}}
+#pragma omp target
+#pragma omp teams distribute collapse (S) // expected-error {{'S' does not 
refer to a value}}
   for (int i = ST; i < N; i++)
 argv[0][i] = argv[0][i] - argv[0][i-ST];
 


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


r291264 - Clean up redundant isa before getAs. NFC.

2017-01-06 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Fri Jan  6 13:10:48 2017
New Revision: 291264

URL: http://llvm.org/viewvc/llvm-project?rev=291264&view=rev
Log:
Clean up redundant isa before getAs. NFC.

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

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=291264&r1=291263&r2=291264&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Jan  6 13:10:48 2017
@@ -393,15 +393,13 @@ CodeGenTypes::arrangeFunctionDeclaration
 
   // When declaring a function without a prototype, always use a
   // non-variadic type.
-  if (isa(FTy)) {
-CanQual noProto = FTy.getAs();
+  if (CanQual noProto = FTy.getAs()) 
{
 return arrangeLLVMFunctionInfo(
 noProto->getReturnType(), /*instanceMethod=*/false,
 /*chainCall=*/false, None, noProto->getExtInfo(), 
{},RequiredArgs::All);
   }
 
-  assert(isa(FTy));
-  return arrangeFreeFunctionType(FTy.getAs(), FD);
+  return arrangeFreeFunctionType(FTy.castAs(), FD);
 }
 
 /// Arrange the argument and result information for the declaration or


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


[PATCH] D20693: [clang-tidy] New checker to replace dynamic exception specifications

2017-01-06 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment.

Hi,
this is a good idea for a check.

I would prefer when the FixIt just removes throw(A,B) specifier, instead of 
replacing it by noexcept(false),
because noexcept(false) means the same things as having no noexcept specifier 
at all.
And less code to read means its easier to understand.


https://reviews.llvm.org/D20693



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


[PATCH] D28404: IRGen: Add optnone attribute on function during O0

2017-01-06 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini created this revision.
mehdi_amini added reviewers: chandlerc, rsmith.
mehdi_amini added subscribers: cfe-commits, dexonsmith.
Herald added a reviewer: tstellarAMD.
Herald added a subscriber: nhaehnle.

Amongst other, this will help LTO to correctly handle/honor files
compiled with O0, helping debugging failures.
It also seems in line with how we handle other options, like how
`-fnoinline` add the appropriate attribute as well.


https://reviews.llvm.org/D28404

Files:
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Frontend/CodeGenOptions.def
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/aarch64-neon-2velem.c
  clang/test/CodeGen/aarch64-neon-3v.c
  clang/test/CodeGen/aarch64-neon-across.c
  clang/test/CodeGen/aarch64-neon-fcvt-intrinsics.c
  clang/test/CodeGen/aarch64-neon-fma.c
  clang/test/CodeGen/aarch64-neon-intrinsics.c
  clang/test/CodeGen/aarch64-neon-ldst-one.c
  clang/test/CodeGen/aarch64-neon-misc.c
  clang/test/CodeGen/aarch64-neon-perm.c
  clang/test/CodeGen/aarch64-neon-scalar-copy.c
  clang/test/CodeGen/aarch64-neon-scalar-x-indexed-elem.c
  clang/test/CodeGen/aarch64-neon-shifts.c
  clang/test/CodeGen/aarch64-neon-tbl.c
  clang/test/CodeGen/aarch64-neon-vcombine.c
  clang/test/CodeGen/aarch64-neon-vget-hilo.c
  clang/test/CodeGen/aarch64-neon-vget.c
  clang/test/CodeGen/aarch64-poly64.c
  clang/test/CodeGen/address-safety-attr-kasan.cpp
  clang/test/CodeGen/address-safety-attr.cpp
  clang/test/CodeGen/arm-crc32.c
  clang/test/CodeGen/arm-neon-directed-rounding.c
  clang/test/CodeGen/arm-neon-fma.c
  clang/test/CodeGen/arm-neon-numeric-maxmin.c
  clang/test/CodeGen/arm-neon-vcvtX.c
  clang/test/CodeGen/arm-neon-vget.c
  clang/test/CodeGen/arm64-lanes.c
  clang/test/CodeGen/arm64_vcopy.c
  clang/test/CodeGen/arm64_vdupq_n_f64.c
  clang/test/CodeGen/attr-coldhot.c
  clang/test/CodeGen/builtins-arm-exclusive.c
  clang/test/CodeGen/builtins-arm.c
  clang/test/CodeGen/builtins-arm64.c
  clang/test/CodeGen/noduplicate-cxx11-test.cpp
  clang/test/CodeGen/pragma-weak.c
  clang/test/CodeGen/unwind-attr.c
  clang/test/CodeGenCXX/apple-kext-indirect-virtual-dtor-call.cpp
  clang/test/CodeGenCXX/apple-kext-linkage.cpp
  clang/test/CodeGenCXX/apple-kext-no-staticinit-section.cpp
  clang/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
  clang/test/CodeGenCXX/optnone-templates.cpp
  clang/test/CodeGenCXX/static-init-wasm.cpp
  clang/test/CodeGenCXX/thunks.cpp
  clang/test/CodeGenObjC/attr-minsize.m
  clang/test/CodeGenObjC/gnu-exceptions.m
  clang/test/CodeGenOpenCL/amdgpu-attrs.cl
  clang/test/Driver/darwin-iphone-defaults.m
  clang/test/OpenMP/nvptx_teams_codegen.cpp

Index: clang/test/OpenMP/nvptx_teams_codegen.cpp
===
--- clang/test/OpenMP/nvptx_teams_codegen.cpp
+++ clang/test/OpenMP/nvptx_teams_codegen.cpp
@@ -1,8 +1,8 @@
 // Test target codegen - host bc file has to be created first.
-// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
-// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
-// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc
-// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -disable-O0-optnone -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -disable-O0-optnone -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -disable-O0-optnone -emit-llvm-bc %s -o %t-x86-host.bc
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -disable-O0-optnone -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
 // expected-no-diagnostics
 #ifndef HEADER
 #define HEADER
@@ -60,10 +60,10 @@
 #endif // CK1
 
 // Test target codegen - host bc file has to be created first.
-// RUN: %clang_cc1 -DCK2 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx

[PATCH] D28404: IRGen: Add optnone attribute on function during O0

2017-01-06 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini updated this revision to Diff 83391.
mehdi_amini added a comment.
Herald added a subscriber: wdng.

Remove spurious change


https://reviews.llvm.org/D28404

Files:
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Frontend/CodeGenOptions.def
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/aarch64-neon-2velem.c
  clang/test/CodeGen/aarch64-neon-3v.c
  clang/test/CodeGen/aarch64-neon-across.c
  clang/test/CodeGen/aarch64-neon-fcvt-intrinsics.c
  clang/test/CodeGen/aarch64-neon-fma.c
  clang/test/CodeGen/aarch64-neon-intrinsics.c
  clang/test/CodeGen/aarch64-neon-ldst-one.c
  clang/test/CodeGen/aarch64-neon-misc.c
  clang/test/CodeGen/aarch64-neon-perm.c
  clang/test/CodeGen/aarch64-neon-scalar-copy.c
  clang/test/CodeGen/aarch64-neon-scalar-x-indexed-elem.c
  clang/test/CodeGen/aarch64-neon-shifts.c
  clang/test/CodeGen/aarch64-neon-tbl.c
  clang/test/CodeGen/aarch64-neon-vcombine.c
  clang/test/CodeGen/aarch64-neon-vget-hilo.c
  clang/test/CodeGen/aarch64-neon-vget.c
  clang/test/CodeGen/aarch64-poly64.c
  clang/test/CodeGen/address-safety-attr-kasan.cpp
  clang/test/CodeGen/address-safety-attr.cpp
  clang/test/CodeGen/arm-crc32.c
  clang/test/CodeGen/arm-neon-directed-rounding.c
  clang/test/CodeGen/arm-neon-fma.c
  clang/test/CodeGen/arm-neon-numeric-maxmin.c
  clang/test/CodeGen/arm-neon-vcvtX.c
  clang/test/CodeGen/arm-neon-vget.c
  clang/test/CodeGen/arm64-lanes.c
  clang/test/CodeGen/arm64_vcopy.c
  clang/test/CodeGen/arm64_vdupq_n_f64.c
  clang/test/CodeGen/attr-coldhot.c
  clang/test/CodeGen/builtins-arm-exclusive.c
  clang/test/CodeGen/builtins-arm.c
  clang/test/CodeGen/builtins-arm64.c
  clang/test/CodeGen/noduplicate-cxx11-test.cpp
  clang/test/CodeGen/pragma-weak.c
  clang/test/CodeGen/unwind-attr.c
  clang/test/CodeGenCXX/apple-kext-indirect-virtual-dtor-call.cpp
  clang/test/CodeGenCXX/apple-kext-linkage.cpp
  clang/test/CodeGenCXX/apple-kext-no-staticinit-section.cpp
  clang/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
  clang/test/CodeGenCXX/optnone-templates.cpp
  clang/test/CodeGenCXX/static-init-wasm.cpp
  clang/test/CodeGenCXX/thunks.cpp
  clang/test/CodeGenObjC/attr-minsize.m
  clang/test/CodeGenObjC/gnu-exceptions.m
  clang/test/CodeGenOpenCL/amdgpu-attrs.cl
  clang/test/Driver/darwin-iphone-defaults.m
  clang/test/OpenMP/nvptx_teams_codegen.cpp

Index: clang/test/OpenMP/nvptx_teams_codegen.cpp
===
--- clang/test/OpenMP/nvptx_teams_codegen.cpp
+++ clang/test/OpenMP/nvptx_teams_codegen.cpp
@@ -1,8 +1,8 @@
 // Test target codegen - host bc file has to be created first.
-// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
-// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
-// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc
-// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -disable-O0-optnone -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -disable-O0-optnone -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -disable-O0-optnone -emit-llvm-bc %s -o %t-x86-host.bc
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -disable-O0-optnone -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
 // expected-no-diagnostics
 #ifndef HEADER
 #define HEADER
@@ -60,10 +60,10 @@
 #endif // CK1
 
 // Test target codegen - host bc file has to be created first.
-// RUN: %clang_cc1 -DCK2 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
-// RUN: %clang_cc1 -DCK2 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-64
-// RUN: %clang_cc1 -DCK2 -verify -

[PATCH] D28383: build: add a heuristic to determine the C++ ABI

2017-01-06 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

In https://reviews.llvm.org/D28383#637672, @compnerd wrote:

> @rnk happy to add such a macro.  Would `__cpp_abi_itanium` and 
> `__cpp_abi_microsoft` be palatable?


I would love these macros. I would prefer if the stock `__config` worked for 
all but the rarest of configurations.


Repository:
  rL LLVM

https://reviews.llvm.org/D28383



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


[PATCH] D20693: [clang-tidy] New checker to replace dynamic exception specifications

2017-01-06 Thread don hinton via Phabricator via cfe-commits
hintonda added a comment.

I could be wrong (please let me know if I am), but my understanding is:

// Does not throw
throw() --> noexcept == noexcept(true)

// Does throw
throw(something) --> noexcept(false)

Please see http://en.cppreference.com/w/cpp/language/noexcept_spec


https://reviews.llvm.org/D20693



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


[PATCH] D28407: Refer to _LIBCPP_MSVC macro where applicable

2017-01-06 Thread Dave Lee via Phabricator via cfe-commits
kastiglione created this revision.
kastiglione added reviewers: mclow.lists, EricWF, compnerd, smeenai.
kastiglione added a subscriber: cfe-commits.

Replace preprocess conditions of `defined(_MSC_VER) && !defined(__clang__)` with
`defined(_LIBCPP_MSVC)`.

No functional change.


https://reviews.llvm.org/D28407

Files:
  include/__config
  include/__undef___deallocate
  include/__undef_min_max
  include/ext/hash_map
  include/ext/hash_set
  src/exception.cpp
  src/include/atomic_support.h
  src/thread.cpp
  utils/google-benchmark/include/benchmark/macros.h

Index: utils/google-benchmark/include/benchmark/macros.h
===
--- utils/google-benchmark/include/benchmark/macros.h
+++ utils/google-benchmark/include/benchmark/macros.h
@@ -33,7 +33,7 @@
 #define BENCHMARK_ALWAYS_INLINE __attribute__((always_inline))
 #define BENCHMARK_NOEXCEPT noexcept
 #define BENCHMARK_NOEXCEPT_OP(x) noexcept(x)
-#elif defined(_MSC_VER) && !defined(__clang__)
+#elif defined(_LIBCPP_MSVC)
 #define BENCHMARK_UNUSED
 #define BENCHMARK_ALWAYS_INLINE __forceinline
 #if _MSC_VER >= 1900
Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -99,7 +99,7 @@
 #else  // defined(CTL_HW) && defined(HW_NCPU)
 // TODO: grovel through /proc or check cpuid on x86 and similar
 // instructions on other architectures.
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("hardware_concurrency not yet implemented")
 #   else
 #   warning hardware_concurrency not yet implemented
Index: src/include/atomic_support.h
===
--- src/include/atomic_support.h
+++ src/include/atomic_support.h
@@ -29,7 +29,7 @@
 #endif
 
 #if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
-# if defined(_MSC_VER) && !defined(__clang__)
+# if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported")
 # else
 #   warning Building libc++ without __atomic builtins is unsupported
Index: src/exception.cpp
===
--- src/exception.cpp
+++ src/exception.cpp
@@ -116,7 +116,7 @@
 return __cxa_uncaught_exception() ? 1 : 0;
 # endif
 #else  // __APPLE__
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("uncaught_exceptions not yet implemented")
 #   else
 #   warning uncaught_exception not yet implemented
@@ -189,7 +189,7 @@
 #elif defined(__GLIBCXX__)
 reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr();
 #else
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("exception_ptr not yet implemented")
 #   else
 #   warning exception_ptr not yet implemented
@@ -208,7 +208,7 @@
 new (reinterpret_cast(this)) __exception_ptr::exception_ptr(
 reinterpret_cast(other));
 #else
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("exception_ptr not yet implemented")
 #   else
 #   warning exception_ptr not yet implemented
@@ -233,7 +233,7 @@
 reinterpret_cast(other);
 return *this;
 #else
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("exception_ptr not yet implemented")
 #   else
 #   warning exception_ptr not yet implemented
@@ -277,7 +277,7 @@
 ptr.__ptr_ = __cxa_current_primary_exception();
 return ptr;
 #else
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING( "exception_ptr not yet implemented" )
 #   else
 #   warning exception_ptr not yet implemented
@@ -299,7 +299,7 @@
 #elif defined(__GLIBCXX__)
 rethrow_exception(reinterpret_cast<__exception_ptr::exception_ptr&>(p));
 #else
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("exception_ptr not yet implemented")
 #   else
 #   warning exception_ptr not yet implemented
Index: include/ext/hash_set
===
--- include/ext/hash_set
+++ include/ext/hash_set
@@ -199,7 +199,7 @@
 #include 
 
 #if __DEPRECATED
-#if defined(_MSC_VER) && ! defined(__clang__)
+#if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("Use of the header  is deprecated.  Migrate to ")
 #else
 #   warning Use of the header  is deprecated.  Migrate to 
Index: include/ext/hash_map
===
--- include/ext/hash_map
+++ include/ext/hash_map
@@ -207,7 +207,7 @@
 #include 
 
 #if __DEPRECATED
-#if defined(_MSC_VER) && ! defined(__clang__)
+#if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("Use of the header  is deprecated.  Migrate to ")
 #else
 #   warning Use of the header  i

[PATCH] D20693: [clang-tidy] New checker to replace dynamic exception specifications

2017-01-06 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In https://reviews.llvm.org/D20693#638062, @mgehre wrote:

> Hi,
>  this is a good idea for a check.
>
> I would prefer when the FixIt just removes throw(A,B) specifier, instead of 
> replacing it by noexcept(false),
>  because noexcept(false) means the same things as having no noexcept 
> specifier at all.
>  And less code to read means its easier to understand.


If the API designer explicitly specified "this function can throw A or B", I 
think a more helpful FixIt is to specify `noexcept(false)` explicitly rather 
than leave off any information about the exception specification. The explicit 
nature of the dynamic exception specification suggests the API designer 
intended for the user to know more information about whether the function 
throws or not, so it's a bit hostile to replace that with no information about 
whether the function throws or not (even if it's functionally equivalent).


https://reviews.llvm.org/D20693



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


[clang-tools-extra] r291272 - Reapply "Fix for shared_ptrification in Clang"

2017-01-06 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Fri Jan  6 13:49:09 2017
New Revision: 291272

URL: http://llvm.org/viewvc/llvm-project?rev=291272&view=rev
Log:
Reapply "Fix for shared_ptrification in Clang"

Aleksey Shlyapnikov pointed out the memory leak I'd introduced, so
recommitted the clang change with a fix for that.

This reapplies r291186, reverted in r291251.

Modified:
clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
clang-tools-extra/trunk/include-fixer/IncludeFixer.h

Modified: clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp?rev=291272&r1=291271&r2=291272&view=diff
==
--- clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp Fri Jan  6 13:49:09 
2017
@@ -82,14 +82,15 @@ IncludeFixerActionFactory::IncludeFixerA
 IncludeFixerActionFactory::~IncludeFixerActionFactory() = default;
 
 bool IncludeFixerActionFactory::runInvocation(
-clang::CompilerInvocation *Invocation, clang::FileManager *Files,
+std::shared_ptr Invocation,
+clang::FileManager *Files,
 std::shared_ptr PCHContainerOps,
 clang::DiagnosticConsumer *Diagnostics) {
   assert(Invocation->getFrontendOpts().Inputs.size() == 1);
 
   // Set up Clang.
   clang::CompilerInstance Compiler(PCHContainerOps);
-  Compiler.setInvocation(Invocation);
+  Compiler.setInvocation(std::move(Invocation));
   Compiler.setFileManager(Files);
 
   // Create the compiler's actual diagnostics engine. We want to drop all

Modified: clang-tools-extra/trunk/include-fixer/IncludeFixer.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/IncludeFixer.h?rev=291272&r1=291271&r2=291272&view=diff
==
--- clang-tools-extra/trunk/include-fixer/IncludeFixer.h (original)
+++ clang-tools-extra/trunk/include-fixer/IncludeFixer.h Fri Jan  6 13:49:09 
2017
@@ -42,7 +42,7 @@ public:
   ~IncludeFixerActionFactory() override;
 
   bool
-  runInvocation(clang::CompilerInvocation *Invocation,
+  runInvocation(std::shared_ptr Invocation,
 clang::FileManager *Files,
 std::shared_ptr PCHContainerOps,
 clang::DiagnosticConsumer *Diagnostics) override;


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


r291270 - Reapply "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCompleteConsumer"

2017-01-06 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Fri Jan  6 13:49:01 2017
New Revision: 291270

URL: http://llvm.org/viewvc/llvm-project?rev=291270&view=rev
Log:
Reapply "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and 
CodeCompleteConsumer"

Aleksey Shlypanikov pointed out my mistake in migrating an explicit
unique_ptr to auto - I was expecting the function returned a unique_ptr,
but instead it returned a raw pointer - introducing a leak.

Thanks Aleksey!

This reapplies r291184, reverted in r291249.

Modified:
cfe/trunk/examples/clang-interpreter/main.cpp
cfe/trunk/include/clang/Frontend/ASTUnit.h
cfe/trunk/include/clang/Frontend/CompilerInstance.h
cfe/trunk/include/clang/Frontend/CompilerInvocation.h
cfe/trunk/include/clang/Frontend/Utils.h
cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h
cfe/trunk/include/clang/Tooling/Tooling.h
cfe/trunk/lib/ARCMigrate/ARCMT.cpp
cfe/trunk/lib/Frontend/ASTUnit.cpp
cfe/trunk/lib/Frontend/ChainedIncludesSource.cpp
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
cfe/trunk/lib/Tooling/Tooling.cpp
cfe/trunk/tools/c-index-test/core_main.cpp
cfe/trunk/tools/clang-import-test/clang-import-test.cpp
cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp
cfe/trunk/tools/libclang/CXTranslationUnit.h
cfe/trunk/tools/libclang/Indexing.cpp
cfe/trunk/unittests/AST/ExternalASTSourceTest.cpp
cfe/trunk/unittests/Frontend/CodeGenActionTest.cpp
cfe/trunk/unittests/Frontend/FrontendActionTest.cpp

Modified: cfe/trunk/examples/clang-interpreter/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang-interpreter/main.cpp?rev=291270&r1=291269&r2=291270&view=diff
==
--- cfe/trunk/examples/clang-interpreter/main.cpp (original)
+++ cfe/trunk/examples/clang-interpreter/main.cpp Fri Jan  6 13:49:01 2017
@@ -145,7 +145,7 @@ int main(int argc, const char **argv, ch
 
   // Create a compiler instance to handle the actual work.
   CompilerInstance Clang;
-  Clang.setInvocation(CI.release());
+  Clang.setInvocation(std::move(CI));
 
   // Create the compilers actual diagnostics engine.
   Clang.createDiagnostics();

Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=291270&r1=291269&r2=291270&view=diff
==
--- cfe/trunk/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTUnit.h Fri Jan  6 13:49:01 2017
@@ -108,8 +108,8 @@ private:
 
   /// Optional owned invocation, just used to make the invocation used in
   /// LoadFromCommandLine available.
-  IntrusiveRefCntPtr Invocation;
-  
+  std::shared_ptr Invocation;
+
   // OnlyLocalDecls - when true, walking this AST should only visit 
declarations
   // that come from the AST itself, not from included precompiled headers.
   // FIXME: This is temporary; eventually, CIndex will always do this.
@@ -358,22 +358,21 @@ public:
   }
   
   /// \brief Retrieve the allocator used to cache global code completions.
-  IntrusiveRefCntPtr
+  std::shared_ptr
   getCachedCompletionAllocator() {
 return CachedCompletionAllocator;
   }
 
   CodeCompletionTUInfo &getCodeCompletionTUInfo() {
 if (!CCTUInfo)
-  CCTUInfo.reset(new CodeCompletionTUInfo(
-new 
GlobalCodeCompletionAllocator));
+  CCTUInfo = llvm::make_unique(
+  std::make_shared());
 return *CCTUInfo;
   }
 
 private:
   /// \brief Allocator used to store cached code completions.
-  IntrusiveRefCntPtr
-CachedCompletionAllocator;
+  std::shared_ptr CachedCompletionAllocator;
 
   std::unique_ptr CCTUInfo;
 
@@ -702,11 +701,11 @@ public:
   /// remapped contents of that file.
   typedef std::pair RemappedFile;
 
-  /// \brief Create a ASTUnit. Gets ownership of the passed 
CompilerInvocation. 
-  static ASTUnit *create(CompilerInvocation *CI,
- IntrusiveRefCntPtr Diags,
- bool CaptureDiagnostics,
- bool UserFilesAreVolatile);
+  /// \brief Create a ASTUnit. Gets ownership of the passed CompilerInvocation.
+  static std::unique_ptr
+  create(std::shared_ptr CI,
+ IntrusiveRefCntPtr Diags, bool CaptureDiagnostics,
+ bool UserFilesAreVolatile);
 
   /// \brief Create a ASTUnit from an AST file.
   ///
@@ -771,7 +770,7 @@ public:
   /// created ASTUnit was passed in \p Unit then the caller can check that.
   ///
   static ASTUnit *LoadFromCompilerInvocationAction(
-  CompilerInvocation *CI,
+  std::shared_ptr CI,
   std::shared_

[PATCH] D28407: Refer to _LIBCPP_MSVC macro where applicable

2017-01-06 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM. Although Ironically we can no longer support MSVC due to our use of 
`#include_next` which MSVC doesn't support.




Comment at: utils/google-benchmark/include/benchmark/macros.h:28
   TypeName(const TypeName&) = delete;\
   TypeName& operator=(const TypeName&) = delete
 #endif

Please don't patch this file. It isn't actually part of libc++. It's just an 
import of Google Benchmark.


https://reviews.llvm.org/D28407



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


[PATCH] D28407: Refer to _LIBCPP_MSVC macro where applicable

2017-01-06 Thread Dave Lee via Phabricator via cfe-commits
kastiglione updated this revision to Diff 83400.
kastiglione added a comment.

Revert change to Google Benchmark


https://reviews.llvm.org/D28407

Files:
  include/__config
  include/__undef___deallocate
  include/__undef_min_max
  include/ext/hash_map
  include/ext/hash_set
  src/exception.cpp
  src/include/atomic_support.h
  src/thread.cpp

Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -99,7 +99,7 @@
 #else  // defined(CTL_HW) && defined(HW_NCPU)
 // TODO: grovel through /proc or check cpuid on x86 and similar
 // instructions on other architectures.
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("hardware_concurrency not yet implemented")
 #   else
 #   warning hardware_concurrency not yet implemented
Index: src/include/atomic_support.h
===
--- src/include/atomic_support.h
+++ src/include/atomic_support.h
@@ -29,7 +29,7 @@
 #endif
 
 #if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
-# if defined(_MSC_VER) && !defined(__clang__)
+# if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported")
 # else
 #   warning Building libc++ without __atomic builtins is unsupported
Index: src/exception.cpp
===
--- src/exception.cpp
+++ src/exception.cpp
@@ -116,7 +116,7 @@
 return __cxa_uncaught_exception() ? 1 : 0;
 # endif
 #else  // __APPLE__
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("uncaught_exceptions not yet implemented")
 #   else
 #   warning uncaught_exception not yet implemented
@@ -189,7 +189,7 @@
 #elif defined(__GLIBCXX__)
 reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr();
 #else
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("exception_ptr not yet implemented")
 #   else
 #   warning exception_ptr not yet implemented
@@ -208,7 +208,7 @@
 new (reinterpret_cast(this)) __exception_ptr::exception_ptr(
 reinterpret_cast(other));
 #else
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("exception_ptr not yet implemented")
 #   else
 #   warning exception_ptr not yet implemented
@@ -233,7 +233,7 @@
 reinterpret_cast(other);
 return *this;
 #else
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("exception_ptr not yet implemented")
 #   else
 #   warning exception_ptr not yet implemented
@@ -277,7 +277,7 @@
 ptr.__ptr_ = __cxa_current_primary_exception();
 return ptr;
 #else
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING( "exception_ptr not yet implemented" )
 #   else
 #   warning exception_ptr not yet implemented
@@ -299,7 +299,7 @@
 #elif defined(__GLIBCXX__)
 rethrow_exception(reinterpret_cast<__exception_ptr::exception_ptr&>(p));
 #else
-#   if defined(_MSC_VER) && ! defined(__clang__)
+#   if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("exception_ptr not yet implemented")
 #   else
 #   warning exception_ptr not yet implemented
Index: include/ext/hash_set
===
--- include/ext/hash_set
+++ include/ext/hash_set
@@ -199,7 +199,7 @@
 #include 
 
 #if __DEPRECATED
-#if defined(_MSC_VER) && ! defined(__clang__)
+#if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("Use of the header  is deprecated.  Migrate to ")
 #else
 #   warning Use of the header  is deprecated.  Migrate to 
Index: include/ext/hash_map
===
--- include/ext/hash_map
+++ include/ext/hash_map
@@ -207,7 +207,7 @@
 #include 
 
 #if __DEPRECATED
-#if defined(_MSC_VER) && ! defined(__clang__)
+#if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("Use of the header  is deprecated.  Migrate to ")
 #else
 #   warning Use of the header  is deprecated.  Migrate to 
Index: include/__undef_min_max
===
--- include/__undef_min_max
+++ include/__undef_min_max
@@ -10,7 +10,7 @@
 
 #ifdef min
 #if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
-#if defined(_MSC_VER) && ! defined(__clang__)
+#if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("macro min is incompatible with C++.  Try #define NOMINMAX "
 "before any Windows header. #undefing min")
 #else
@@ -22,7 +22,7 @@
 
 #ifdef max
 #if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
-#if defined(_MSC_VER) && ! defined(__clang__)
+#if defined(_LIBCPP_MSVC)
 _LIBCPP_WARNING("macro max is incompatible with C++.  Try #define NOMINMAX "
 "before any Windows header. #undefing max")

[PATCH] D28316: [libc++] Cleanup and document <__threading_support>

2017-01-06 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 83399.
EricWF added a comment.

- Merge with master


https://reviews.llvm.org/D28316

Files:
  CMakeLists.txt
  docs/DesignDocs/ThreadingSupportAPI.rst
  docs/index.rst
  include/__config
  include/__config_site.in
  include/__threading_support
  lib/CMakeLists.txt
  test/CMakeLists.txt
  test/lit.site.cfg.in
  test/support/external_threads.cpp

Index: test/support/external_threads.cpp
===
--- test/support/external_threads.cpp
+++ test/support/external_threads.cpp
@@ -6,5 +6,5 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===--===//
-#define _LIBCPP_BUILDING_THREAD_API_EXTERNAL_PTHREAD
+#define _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL
 #include <__threading_support>
Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -28,7 +28,7 @@
 config.use_libatomic= "@LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB@"
 
 config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@"
-config.cxx_ext_threads  = "@LIBCXX_HAS_EXTERNAL_THREAD_API@"
+config.cxx_ext_threads  = "@LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY@"
 
 # Let the main config do the real work.
 config.loaded_site_config = True
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -34,7 +34,7 @@
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
 pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
 pythonize_bool(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
-pythonize_bool(LIBCXX_HAS_EXTERNAL_THREAD_API)
+pythonize_bool(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
 
 # By default, for non-standalone builds, libcxx and libcxxabi share a library
 # directory.
Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -275,7 +275,7 @@
   )
 endif()
 
-if (LIBCXX_HAS_EXTERNAL_THREAD_API)
+if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
   file(GLOB LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES ../test/support/external_threads.cpp)
 
   if (LIBCXX_ENABLE_SHARED)
Index: include/__threading_support
===
--- include/__threading_support
+++ include/__threading_support
@@ -17,48 +17,25 @@
 #pragma GCC system_header
 #endif
 
-#ifndef _LIBCPP_HAS_NO_THREADS
-
-#ifndef __libcpp_has_include
-  #ifndef __has_include
-#define __libcpp_has_include(x) 0
-  #else
-#define __libcpp_has_include(x) __has_include(x)
-  #endif
-#endif
-
-#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) && \
-!__libcpp_has_include(<__external_threading>)
-// If the <__external_threading> header is absent, build libc++ against a
-// pthread-oriented thread api but leave out its implementation. This setup
-// allows building+testing of an externally-threaded library variant (on any
-// platform that supports pthreads). Here, an 'externally-threaded' library
-// variant is one where the implementation of the libc++ thread api is provided
-// as a separate library.
-#define _LIBCPP_HAS_THREAD_API_EXTERNAL_PTHREAD
-#endif
-
-#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) && \
-__libcpp_has_include(<__external_threading>)
-#include <__external_threading>
-#else
+#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+# include <__external_threading>
+#elif !defined(_LIBCPP_HAS_NO_THREADS)
 
-#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \
-defined(_LIBCPP_HAS_THREAD_API_EXTERNAL_PTHREAD)
-#include 
-#include 
+#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
+# include 
+# include 
 #endif
 
-#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
+defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)
 #define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS
 #else
 #define _LIBCPP_THREAD_ABI_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
 #endif
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \
-defined(_LIBCPP_HAS_THREAD_API_EXTERNAL_PTHREAD)
+#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
 // Mutex
 typedef pthread_mutex_t __libcpp_mutex_t;
 #define _LIBCPP_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
@@ -175,8 +152,10 @@
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
 
-#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \
-defined(_LIBCPP_BUILDING_THREAD_API_EXTERNAL_PTHREAD)
+#if !defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
+defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)
+
+#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
 
 int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
 {
@@ -344,10 +323,10 @@
 
 #endif // _LIBCPP_HAS_THREAD_API_PTHREAD
 
-_LIBCPP_END_NAMESPACE_STD
+#endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL
 
-#endif // !_LIBCPP_HAS_THREA

[libcxx] r291275 - [libc++] Cleanup and document <__threading_support>

2017-01-06 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jan  6 14:05:40 2017
New Revision: 291275

URL: http://llvm.org/viewvc/llvm-project?rev=291275&view=rev
Log:
[libc++] Cleanup and document <__threading_support>

Summary:
This patch attempts to clean up the macro configuration mess in 
`<__threading_support>`, specifically the mess involving external threading 
variants. Additionally this patch adds design documentation for 
`<__threading_support>` and the configuration macros it uses.

The primary change in this patch is separating the idea of an "external API" 
provided by `<__external_threading>` and the idea of having an external 
threading library. Now `_LIBCPP_HAS_THREAD_API_EXTERNAL` means that libc++ 
should use `<__external_threading>` and that the header is expected to exist.  
Additionally the new macro `_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL` is now used to 
configure for using an "external library"  with the default threading API.

Reviewers: compnerd, rmaprath

Subscribers: smeenai, cfe-commits, mgorny

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

Added:
libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst
Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/docs/index.rst
libcxx/trunk/include/__config
libcxx/trunk/include/__config_site.in
libcxx/trunk/include/__threading_support
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/test/CMakeLists.txt
libcxx/trunk/test/lit.site.cfg.in
libcxx/trunk/test/support/external_threads.cpp

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=291275&r1=291274&r2=291275&view=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Fri Jan  6 14:05:40 2017
@@ -169,6 +169,9 @@ option(LIBCXX_HAS_PTHREAD_API "Ignore au
 option(LIBCXX_HAS_EXTERNAL_THREAD_API
   "Build libc++ with an externalized threading API.
This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON." OFF)
+option(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY
+"Build libc++ with an externalized threading library.
+ This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON" OFF)
 
 # Misc options 
 # FIXME: Turn -pedantic back ON. It is currently off because it warns
@@ -230,6 +233,17 @@ if(NOT LIBCXX_ENABLE_THREADS)
 message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set to ON"
 " when LIBCXX_ENABLE_THREADS is also set to ON.")
   endif()
+  if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
+message(FATAL_ERROR "LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY can only be set "
+"to ON when LIBCXX_ENABLE_THREADS is also set to ON.")
+  endif()
+
+endif()
+
+if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY AND LIBCXX_HAS_EXTERNAL_THREAD_API)
+  message(FATAL_ERROR "The options LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY and "
+  "LIBCXX_HAS_EXTERNAL_THREAD_API cannot both be ON at "
+  "the same time")
 endif()
 
 if(LIBCXX_HAS_PTHREAD_API AND LIBCXX_HAS_EXTERNAL_THREAD_API)
@@ -520,6 +534,7 @@ config_define_if_not(LIBCXX_ENABLE_THREA
 
 config_define_if(LIBCXX_HAS_PTHREAD_API _LIBCPP_HAS_THREAD_API_PTHREAD)
 config_define_if(LIBCXX_HAS_EXTERNAL_THREAD_API 
_LIBCPP_HAS_THREAD_API_EXTERNAL)
+config_define_if(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY 
_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL)
 config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC)
 
 # By default libc++ on Windows expects to use a shared library, which requires

Added: libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst?rev=291275&view=auto
==
--- libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst (added)
+++ libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst Fri Jan  6 14:05:40 
2017
@@ -0,0 +1,70 @@
+=
+Threading Support API
+=
+
+.. contents::
+   :local:
+
+Overview
+
+
+Libc++ supports using multiple different threading models and configurations
+to implement the threading parts of libc++, including  and 
.
+These different models provide entirely different interfaces from each
+other. To address this libc++ wraps the underlying threading API in a new and
+consistent API, which it uses internally to implement threading primitives.
+
+The ``<__threading_support>`` header is where libc++ defines its internal
+threading interface. It contains forward declarations of the internal threading
+interface as well as definitions for the interface.
+
+External Threading API and the ``<__external_threading>`` header
+
+
+In order to support vendors with custom threading API's libc++ allows the
+entire internal threading interf

[PATCH] D27872: [APFloat] Switch from (PPCDoubleDoubleImpl, IEEEdouble) layout to (IEEEdouble, IEEEdouble)

2017-01-06 Thread Tim Shen via Phabricator via cfe-commits
timshen added a comment.

Friendly ping :)

Is there anyone else I can add as a reviewer, if no one feels comfortable 
reviewing the semantic?


https://reviews.llvm.org/D27872



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


[PATCH] D28220: provide Win32 native threading

2017-01-06 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF requested changes to this revision.
EricWF added a comment.
This revision now requires changes to proceed.

This needs to be rebased following the `<__threading_support>` cleanup in 
r291275.


Repository:
  rL LLVM

https://reviews.llvm.org/D28220



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


[PATCH] D28212: typeinfo: provide a partial implementation for Win32

2017-01-06 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

This isn't applying against master. Could you rebase?




Comment at: include/typeinfo:109
 protected:
+#if defined(_LIBCPP_HAS_MS_ABI_TYPEINFO)
+#else

Don't we need a constructor here?


Repository:
  rL LLVM

https://reviews.llvm.org/D28212



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


[PATCH] D28212: typeinfo: provide a partial implementation for Win32

2017-01-06 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

Nevermind. Missed the dependency. Would you be willing to kill that dependency 
for now and we can fix it once we get Clang support?


Repository:
  rL LLVM

https://reviews.llvm.org/D28212



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


[PATCH] D27429: [Chrono][Darwin] On Darwin use CLOCK_UPTIME_RAW instead of CLOCK_MONOTONIC

2017-01-06 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D27429#637507, @bruno wrote:

> @EricWF ok to commit?


Yes sorry This LGTM.  (I thought I had approved this yesterday, but I forgot to 
hit enter).




Comment at: src/chrono.cpp:218
+#error "Never use CLOCK_MONOTONIC for steady_clock::now on Apple platforms"
+#endif
+

howard.hinnant wrote:
> Nice, thanks!
This code is currently dead due to the structure of the `#ifdef`s. However I 
think it's great documentation and great future proofing!


https://reviews.llvm.org/D27429



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


[PATCH] D28344: [AVR] Add support for the full set of inline asm constraints

2017-01-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

Test case?




Comment at: lib/Basic/Targets.cpp:8506
+  case 'N': // Integer constant (Range: -1)
+Info.setRequiresImmediate(-1);
+  case 'O': // Integer constant (Range: 8, 16, 24)

Is this meant to fall through or do you need a "break" here?


https://reviews.llvm.org/D28344



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


[PATCH] D20693: [clang-tidy] New checker to replace dynamic exception specifications

2017-01-06 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment.

I'm working on code bases where their is no manually written noexcept(false) 
anywhere,
and I don't think the FixIt should look different than manually written code.
At least a configuration option for the check would be nice.


https://reviews.llvm.org/D20693



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


[PATCH] D28409: Use CodegenOpts::less when creating a TargetMachine for clang `-O1`

2017-01-06 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini created this revision.
mehdi_amini added reviewers: echristo, chandlerc.
mehdi_amini added a subscriber: cfe-commits.

Clang was initializing the TargetMachine with CodeGenOpt::Default
for https://reviews.llvm.org/owners/package/1/. This change is aligning it on 
llc:

-O0: OptLevel = CodeGenOpt::None
-O1: OptLevel = CodeGenOpt::Less
-O2 -Os -Oz: OptLevel = CodeGenOpt::Default
-O3: OptLevel = CodeGenOpt::Aggressive


https://reviews.llvm.org/D28409

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -514,11 +514,14 @@
.Case("dynamic-no-pic", llvm::Reloc::DynamicNoPIC);
   assert(RM.hasValue() && "invalid PIC model!");
 
-  CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
+  CodeGenOpt::Level OptLevel;
   switch (CodeGenOpts.OptimizationLevel) {
-  default: break;
-  case 0: OptLevel = CodeGenOpt::None; break;
-  case 3: OptLevel = CodeGenOpt::Aggressive; break;
+default:
+  llvm_unreachable("Invalid optimization level!");
+case 0: OptLevel = CodeGenOpt::None; break;
+case 1: OptLevel = CodeGenOpt::Less; break;
+case 2: OptLevel = CodeGenOpt::Default; break; // O2/Os/Oz
+case 3: OptLevel = CodeGenOpt::Aggressive; break;
   }
 
   llvm::TargetOptions Options;


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -514,11 +514,14 @@
.Case("dynamic-no-pic", llvm::Reloc::DynamicNoPIC);
   assert(RM.hasValue() && "invalid PIC model!");
 
-  CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
+  CodeGenOpt::Level OptLevel;
   switch (CodeGenOpts.OptimizationLevel) {
-  default: break;
-  case 0: OptLevel = CodeGenOpt::None; break;
-  case 3: OptLevel = CodeGenOpt::Aggressive; break;
+default:
+  llvm_unreachable("Invalid optimization level!");
+case 0: OptLevel = CodeGenOpt::None; break;
+case 1: OptLevel = CodeGenOpt::Less; break;
+case 2: OptLevel = CodeGenOpt::Default; break; // O2/Os/Oz
+case 3: OptLevel = CodeGenOpt::Aggressive; break;
   }
 
   llvm::TargetOptions Options;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28409: Use CodegenOpts::less when creating a TargetMachine for clang `-O1`

2017-01-06 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini updated this revision to Diff 83404.
mehdi_amini added a comment.

clang-format


https://reviews.llvm.org/D28409

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -514,11 +514,22 @@
.Case("dynamic-no-pic", llvm::Reloc::DynamicNoPIC);
   assert(RM.hasValue() && "invalid PIC model!");
 
-  CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
+  CodeGenOpt::Level OptLevel;
   switch (CodeGenOpts.OptimizationLevel) {
-  default: break;
-  case 0: OptLevel = CodeGenOpt::None; break;
-  case 3: OptLevel = CodeGenOpt::Aggressive; break;
+  default:
+llvm_unreachable("Invalid optimization level!");
+  case 0:
+OptLevel = CodeGenOpt::None;
+break;
+  case 1:
+OptLevel = CodeGenOpt::Less;
+break;
+  case 2:
+OptLevel = CodeGenOpt::Default;
+break; // O2/Os/Oz
+  case 3:
+OptLevel = CodeGenOpt::Aggressive;
+break;
   }
 
   llvm::TargetOptions Options;


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -514,11 +514,22 @@
.Case("dynamic-no-pic", llvm::Reloc::DynamicNoPIC);
   assert(RM.hasValue() && "invalid PIC model!");
 
-  CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
+  CodeGenOpt::Level OptLevel;
   switch (CodeGenOpts.OptimizationLevel) {
-  default: break;
-  case 0: OptLevel = CodeGenOpt::None; break;
-  case 3: OptLevel = CodeGenOpt::Aggressive; break;
+  default:
+llvm_unreachable("Invalid optimization level!");
+  case 0:
+OptLevel = CodeGenOpt::None;
+break;
+  case 1:
+OptLevel = CodeGenOpt::Less;
+break;
+  case 2:
+OptLevel = CodeGenOpt::Default;
+break; // O2/Os/Oz
+  case 3:
+OptLevel = CodeGenOpt::Aggressive;
+break;
   }
 
   llvm::TargetOptions Options;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28362: [ThinLTO] Optionally ignore empty index file

2017-01-06 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added inline comments.



Comment at: lib/CodeGen/BackendUtil.cpp:65
+"Ignore an empty index file and perform non-ThinLTO compilation"),
+llvm::cl::init(false));
+

tejohnson wrote:
> mehdi_amini wrote:
> > Is it common to do this in clang?
> Doesn't look common, but I see one other LLVM internal option (in 
> CodeGenPGO.cpp), and a few other uses in tests. Is there a better way to do 
> internal options in clang?
Since this doesn't look like something commonly done in clang, I am splitting 
this into 2 patches, one in LLVM and one here. LLVM will instead contain the 
option, and return a nullptr from llvm::getModuleSummaryIndexForFile when the 
option is enabled and the file is empty. The clang side can just proceed to 
normal compilation if a nullptr CombinedIndex is returned (if the option is not 
enabled, LLVM would return an error instead).


https://reviews.llvm.org/D28362



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


[PATCH] D28362: [ThinLTO] Optionally ignore empty index file

2017-01-06 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson updated this revision to Diff 83405.
tejohnson added a comment.

Move option to LLVM.


https://reviews.llvm.org/D28362

Files:
  lib/CodeGen/BackendUtil.cpp
  test/CodeGen/thinlto_backend.ll


Index: test/CodeGen/thinlto_backend.ll
===
--- test/CodeGen/thinlto_backend.ll
+++ test/CodeGen/thinlto_backend.ll
@@ -12,6 +12,14 @@
 ; RUN: %clang -O2 -o %t4.o -x ir %t1.o -c -fthinlto-index=bad.thinlto.bc 2>&1 
| FileCheck %s -check-prefix=CHECK-ERROR1
 ; CHECK-ERROR1: Error loading index file 'bad.thinlto.bc'
 
+; Ensure we ignore empty index file under -ignore-empty-index-file, and run
+; non-ThinLTO compilation which would not import f2
+; RUN: touch %t4.thinlto.bc
+; RUN: %clang -O2 -o %t4.o -x ir %t1.o -c -fthinlto-index=%t4.thinlto.bc 
-mllvm -ignore-empty-index-file
+; RUN: llvm-nm %t4.o | FileCheck --check-prefix=CHECK-OBJ-IGNORE-EMPTY %s
+; CHECK-OBJ-IGNORE-EMPTY: T f1
+; CHECK-OBJ-IGNORE-EMPTY: U f2
+
 ; Ensure f2 was imported
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t3.o -x ir %t1.o -c 
-fthinlto-index=%t.thinlto.bc
 ; RUN: llvm-nm %t3.o | FileCheck --check-prefix=CHECK-OBJ %s
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -837,21 +837,8 @@
   }
 }
 
-static void runThinLTOBackend(const CodeGenOptions &CGOpts, Module *M,
+static void runThinLTOBackend(ModuleSummaryIndex *CombinedIndex, Module *M,
   std::unique_ptr OS) {
-  // If we are performing a ThinLTO importing compile, load the function index
-  // into memory and pass it into thinBackend, which will run the function
-  // importer and invoke LTO passes.
-  Expected> IndexOrErr =
-  llvm::getModuleSummaryIndexForFile(CGOpts.ThinLTOIndexFile);
-  if (!IndexOrErr) {
-logAllUnhandledErrors(IndexOrErr.takeError(), errs(),
-  "Error loading index file '" +
-  CGOpts.ThinLTOIndexFile + "': ");
-return;
-  }
-  std::unique_ptr CombinedIndex = std::move(*IndexOrErr);
-
   StringMap>
   ModuleToDefinedGVSummaries;
   
CombinedIndex->collectDefinedGVSummariesPerModule(ModuleToDefinedGVSummaries);
@@ -935,8 +922,26 @@
   Module *M, BackendAction Action,
   std::unique_ptr OS) {
   if (!CGOpts.ThinLTOIndexFile.empty()) {
-runThinLTOBackend(CGOpts, M, std::move(OS));
-return;
+// If we are performing a ThinLTO importing compile, load the function 
index
+// into memory and pass it into runThinLTOBackend, which will run the
+// function importer and invoke LTO passes.
+Expected> IndexOrErr =
+llvm::getModuleSummaryIndexForFile(CGOpts.ThinLTOIndexFile);
+if (!IndexOrErr) {
+  logAllUnhandledErrors(IndexOrErr.takeError(), errs(),
+"Error loading index file '" +
+CGOpts.ThinLTOIndexFile + "': ");
+  return;
+}
+std::unique_ptr CombinedIndex = std::move(*IndexOrErr);
+// A null CombinedIndex means we should skip ThinLTO compilation
+// (LLVM will optionally ignore empty index files, returning null instead
+// of an error).
+bool DoThinLTOBackend = CombinedIndex != nullptr;
+if (DoThinLTOBackend) {
+  runThinLTOBackend(CombinedIndex.get(), M, std::move(OS));
+  return;
+}
   }
 
   EmitAssemblyHelper AsmHelper(Diags, CGOpts, TOpts, LOpts, M);


Index: test/CodeGen/thinlto_backend.ll
===
--- test/CodeGen/thinlto_backend.ll
+++ test/CodeGen/thinlto_backend.ll
@@ -12,6 +12,14 @@
 ; RUN: %clang -O2 -o %t4.o -x ir %t1.o -c -fthinlto-index=bad.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-ERROR1
 ; CHECK-ERROR1: Error loading index file 'bad.thinlto.bc'
 
+; Ensure we ignore empty index file under -ignore-empty-index-file, and run
+; non-ThinLTO compilation which would not import f2
+; RUN: touch %t4.thinlto.bc
+; RUN: %clang -O2 -o %t4.o -x ir %t1.o -c -fthinlto-index=%t4.thinlto.bc -mllvm -ignore-empty-index-file
+; RUN: llvm-nm %t4.o | FileCheck --check-prefix=CHECK-OBJ-IGNORE-EMPTY %s
+; CHECK-OBJ-IGNORE-EMPTY: T f1
+; CHECK-OBJ-IGNORE-EMPTY: U f2
+
 ; Ensure f2 was imported
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t3.o -x ir %t1.o -c -fthinlto-index=%t.thinlto.bc
 ; RUN: llvm-nm %t3.o | FileCheck --check-prefix=CHECK-OBJ %s
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -837,21 +837,8 @@
   }
 }
 
-static void runThinLTOBackend(const CodeGenOptions &CGOpts, Module *M,
+static void runThinLTOBackend(ModuleSummaryIndex *CombinedIndex, Module *M,
   std::unique_ptr OS) {
-  // If we are performing a ThinLTO importing compile, load the function

[PATCH] D28409: Use CodegenOpts::less when creating a TargetMachine for clang `-O1`

2017-01-06 Thread Eric Christopher via Phabricator via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

Sounds fine to me. I want to modify https://reviews.llvm.org/owners/package/1/ 
at some point, but there's nothing wrong with consistency for now.


https://reviews.llvm.org/D28409



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


[PATCH] D28362: [ThinLTO] Optionally ignore empty index file

2017-01-06 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini accepted this revision.
mehdi_amini added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D28362



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


r291276 - Use CodegenOpts::less when creating a TargetMachine for clang `-O1`

2017-01-06 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Jan  6 14:52:30 2017
New Revision: 291276

URL: http://llvm.org/viewvc/llvm-project?rev=291276&view=rev
Log:
Use CodegenOpts::less when creating a TargetMachine for clang `-O1`

Summary:
Clang was initializing the TargetMachine with CodeGenOpt::Default
for O1. This change is aligning it on llc:

-O0: OptLevel = CodeGenOpt::None
-O1: OptLevel = CodeGenOpt::Less
-O2 -Os -Oz: OptLevel = CodeGenOpt::Default
-O3: OptLevel = CodeGenOpt::Aggressive

Reviewers: echristo, chandlerc

Subscribers: cfe-commits

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

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

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=291276&r1=291275&r2=291276&view=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Jan  6 14:52:30 2017
@@ -519,11 +519,22 @@ void EmitAssemblyHelper::CreateTargetMac
.Case("dynamic-no-pic", llvm::Reloc::DynamicNoPIC);
   assert(RM.hasValue() && "invalid PIC model!");
 
-  CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
+  CodeGenOpt::Level OptLevel;
   switch (CodeGenOpts.OptimizationLevel) {
-  default: break;
-  case 0: OptLevel = CodeGenOpt::None; break;
-  case 3: OptLevel = CodeGenOpt::Aggressive; break;
+  default:
+llvm_unreachable("Invalid optimization level!");
+  case 0:
+OptLevel = CodeGenOpt::None;
+break;
+  case 1:
+OptLevel = CodeGenOpt::Less;
+break;
+  case 2:
+OptLevel = CodeGenOpt::Default;
+break; // O2/Os/Oz
+  case 3:
+OptLevel = CodeGenOpt::Aggressive;
+break;
   }
 
   llvm::TargetOptions Options;


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


[PATCH] D28409: Use CodegenOpts::less when creating a TargetMachine for clang `-O1`

2017-01-06 Thread Mehdi AMINI via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL291276: Use CodegenOpts::less when creating a TargetMachine 
for clang `-O1` (authored by mehdi_amini).

Changed prior to commit:
  https://reviews.llvm.org/D28409?vs=83404&id=83408#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28409

Files:
  cfe/trunk/lib/CodeGen/BackendUtil.cpp


Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp
===
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp
@@ -519,11 +519,22 @@
.Case("dynamic-no-pic", llvm::Reloc::DynamicNoPIC);
   assert(RM.hasValue() && "invalid PIC model!");
 
-  CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
+  CodeGenOpt::Level OptLevel;
   switch (CodeGenOpts.OptimizationLevel) {
-  default: break;
-  case 0: OptLevel = CodeGenOpt::None; break;
-  case 3: OptLevel = CodeGenOpt::Aggressive; break;
+  default:
+llvm_unreachable("Invalid optimization level!");
+  case 0:
+OptLevel = CodeGenOpt::None;
+break;
+  case 1:
+OptLevel = CodeGenOpt::Less;
+break;
+  case 2:
+OptLevel = CodeGenOpt::Default;
+break; // O2/Os/Oz
+  case 3:
+OptLevel = CodeGenOpt::Aggressive;
+break;
   }
 
   llvm::TargetOptions Options;


Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp
===
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp
@@ -519,11 +519,22 @@
.Case("dynamic-no-pic", llvm::Reloc::DynamicNoPIC);
   assert(RM.hasValue() && "invalid PIC model!");
 
-  CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
+  CodeGenOpt::Level OptLevel;
   switch (CodeGenOpts.OptimizationLevel) {
-  default: break;
-  case 0: OptLevel = CodeGenOpt::None; break;
-  case 3: OptLevel = CodeGenOpt::Aggressive; break;
+  default:
+llvm_unreachable("Invalid optimization level!");
+  case 0:
+OptLevel = CodeGenOpt::None;
+break;
+  case 1:
+OptLevel = CodeGenOpt::Less;
+break;
+  case 2:
+OptLevel = CodeGenOpt::Default;
+break; // O2/Os/Oz
+  case 3:
+OptLevel = CodeGenOpt::Aggressive;
+break;
   }
 
   llvm::TargetOptions Options;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28404: IRGen: Add optnone attribute on function during O0

2017-01-06 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a comment.

Maybe instead, pass a flag to enable setting optnone on everything when the 
driver sees `-O0 -flto`?  The patch as-is obviously has a massive testing cost, 
and it's easy to imagine people being tripped up by this in the future.


https://reviews.llvm.org/D28404



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


[PATCH] D28404: IRGen: Add optnone attribute on function during O0

2017-01-06 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

In https://reviews.llvm.org/D28404#638217, @probinson wrote:

> Maybe instead, pass a flag to enable setting optnone on everything when the 
> driver sees `-O0 -flto`?


I'm not fond of this: limiting discrepancy between LTO and non-LTO reduces the 
LTO specific bugs and reduces the maintenance of LTO.

> The patch as-is obviously has a massive testing cost, and it's easy to 
> imagine people being tripped up by this in the future.

Can you clarify what massive testing cost you're referring to?


https://reviews.llvm.org/D28404



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


[libcxx] r291278 - Replace _LIBCPP_HAS_NO_DELETED_FUNCTIONS with _LIBCPP_CXX03_LANG

2017-01-06 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jan  6 14:58:25 2017
New Revision: 291278

URL: http://llvm.org/viewvc/llvm-project?rev=291278&view=rev
Log:
Replace _LIBCPP_HAS_NO_DELETED_FUNCTIONS with _LIBCPP_CXX03_LANG

Added:

libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp
Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/__debug
libcxx/trunk/include/__functional_base
libcxx/trunk/include/atomic
libcxx/trunk/include/istream
libcxx/trunk/include/ostream
libcxx/trunk/include/type_traits
libcxx/trunk/test/libcxx/iterators/trivial_iterators.pass.cpp

libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
libcxx/trunk/test/support/test_iterators.h

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=291278&r1=291277&r2=291278&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Jan  6 14:58:25 2017
@@ -275,10 +275,6 @@ typedef __char32_t char32_t;
 #  define _LIBCPP_NORETURN __attribute__ ((noreturn))
 #endif
 
-#if !(__has_feature(cxx_deleted_functions))
-#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
-#endif  // !(__has_feature(cxx_deleted_functions))
-
 #if !(__has_feature(cxx_lambdas))
 #define _LIBCPP_HAS_NO_LAMBDAS
 #endif
@@ -431,7 +427,6 @@ namespace std {
 
 #ifndef __GXX_EXPERIMENTAL_CXX0X__
 #define _LIBCPP_HAS_NO_DECLTYPE
-#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
 #define _LIBCPP_HAS_NO_NULLPTR
 #define _LIBCPP_HAS_NO_UNICODE_CHARS
 #define _LIBCPP_HAS_NO_VARIADICS
@@ -448,7 +443,6 @@ namespace std {
 
 #if _GNUC_VER < 404
 #define _LIBCPP_HAS_NO_DECLTYPE
-#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
 #define _LIBCPP_HAS_NO_UNICODE_CHARS
 #define _LIBCPP_HAS_NO_VARIADICS
 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
@@ -483,7 +477,6 @@ using namespace _LIBCPP_NAMESPACE __attr
 #if _MSC_VER <= 1800
 #define _LIBCPP_HAS_NO_UNICODE_CHARS
 #endif
-#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
 #define _LIBCPP_HAS_NO_NOEXCEPT
 #define __alignof__ __alignof
 #define _LIBCPP_NORETURN __declspec(noreturn)
@@ -739,7 +732,7 @@ template  struct __static_asse
 #define _LIBCPP_DEFAULT = default;
 #endif
 
-#ifdef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#ifdef _LIBCPP_CXX03_LANG
 #define _LIBCPP_EQUAL_DELETE
 #else
 #define _LIBCPP_EQUAL_DELETE = delete

Modified: libcxx/trunk/include/__debug
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__debug?rev=291278&r1=291277&r2=291278&view=diff
==
--- libcxx/trunk/include/__debug (original)
+++ libcxx/trunk/include/__debug Fri Jan  6 14:58:25 2017
@@ -122,7 +122,7 @@ struct _LIBCPP_TYPE_VIS __i_node
 __i_node* __next_;
 __c_node* __c_;
 
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#ifndef _LIBCPP_CXX03_LANG
 __i_node(const __i_node&) = delete;
 __i_node& operator=(const __i_node&) = delete;
 #else
@@ -145,7 +145,7 @@ struct _LIBCPP_TYPE_VIS __c_node
 __i_node** end_;
 __i_node** cap_;
 
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#ifndef _LIBCPP_CXX03_LANG
 __c_node(const __c_node&) = delete;
 __c_node& operator=(const __c_node&) = delete;
 #else
@@ -232,7 +232,7 @@ class _LIBCPP_TYPE_VIS __libcpp_db
 
 __libcpp_db();
 public:
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#ifndef _LIBCPP_CXX03_LANG
 __libcpp_db(const __libcpp_db&) = delete;
 __libcpp_db& operator=(const __libcpp_db&) = delete;
 #else

Modified: libcxx/trunk/include/__functional_base
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__functional_base?rev=291278&r1=291277&r2=291278&view=diff
==
--- libcxx/trunk/include/__functional_base (original)
+++ libcxx/trunk/include/__functional_base Fri Jan  6 14:58:25 2017
@@ -552,23 +552,10 @@ cref(reference_wrapper<_Tp> __t) _NOEXCE
 return cref(__t.get());
 }
 
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
-
+#ifndef _LIBCPP_CXX03_LANG
 template  void ref(const _Tp&&) = delete;
 template  void cref(const _Tp&&) = delete;
-
-#else  // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
-
-template  void ref(const _Tp&&);// = delete;
-template  void cref(const _Tp&&);// = delete;
-
-#endif  // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
-
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif
 
 #if _LIBCPP_STD_VER > 11
 template 

Modified: libcxx/trunk/include/atomic
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/atomic?rev=291278&r1=291277&r2=291278&view=diff
==
--- libcxx/trunk/include/a

[PATCH] D26796: [Driver] Use arch type to find compiler-rt libraries (on Linux)

2017-01-06 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

@compnerd, ping. Do you really think this is a real issue? As I said on the 
other patch, the only case when compiler-rt would generate i686-suffixed 
library is if the builder specifically used `-march=i686` for the compiler-rt 
build, and in that case the i386 variant (which is identical to the i686 
variant since both are built with the same flags) is built anyway.


https://reviews.llvm.org/D26796



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


[PATCH] D28362: [ThinLTO] Optionally ignore empty index file

2017-01-06 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added a comment.

In https://reviews.llvm.org/D28362#638203, @mehdi_amini wrote:

> LGTM


Thanks, let me know if the llvm companion patch 
(https://reviews.llvm.org/D28410) is ok as well.


https://reviews.llvm.org/D28362



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


[PATCH] D28365: [Driver] Updated for Visual Studio 2017

2017-01-06 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

The new MSVC layout suggests to me that we should look try looking at the path 
of cl.exe before we open the exe and try to check its version. We'd change this 
code to inspect the path before looking in the exe:

  VersionTuple MSVCToolChain::computeMSVCVersion(const Driver *D,
 const ArgList &Args) const {
bool IsWindowsMSVC = getTriple().isWindowsMSVCEnvironment();
VersionTuple MSVT = ToolChain::computeMSVCVersion(D, Args);
if (MSVT.empty()) MSVT = getMSVCVersionFromTriple();
if (MSVT.empty() && IsWindowsMSVC) MSVT = getMSVCVersionFromExe();
if (MSVT.empty() &&
Args.hasFlag(options::OPT_fms_extensions, 
options::OPT_fno_ms_extensions,
 IsWindowsMSVC)) {
  // -fms-compatibility-version=18.00 is default.
  // FIXME: Consider bumping this to 19 (MSVC2015) soon.
  MSVT = VersionTuple(18);
}
return MSVT;
  }

That can definitely be a separate change, though.




Comment at: lib/Driver/MSVCToolChain.cpp:76
+// Attempts to find the "best" usable VC toolchain.
+static bool findVCToolChainPath(std::string &Path, bool &IsVS2017OrNewer) {
+  // Check the environment first, since that's probably the user telling us

Thanks for rewriting this, the logic here seems much clearer.



Comment at: lib/Driver/MSVCToolChain.cpp:186
+// this scope.
+_set_com_error_handler([](HRESULT, IErrorInfo *) { });
+std::unique_ptr

This is a very surprising use of unique_ptr. I think it would be clearer 
written this way:
  struct RestoreCOMErrorHandler {
~RestoreCOMErrorHandler() { _set_com_error_handler(_com_raise_error); }
  } COMErrorRestorer;



Comment at: lib/Driver/MSVCToolChain.cpp:352
+// to the corresponding subdirectory name.
+static const char *llvmArchToSubDirectoryName(llvm::Triple::ArchType Arch) {
+  using ArchType = llvm::Triple::ArchType;

Think there's a better name for this than "SubDirectoryName"? It sounds like 
these are common to the Win8+ SDk and the VC2017+ tools. We could still call it 
the "WindowsSDKArch", since that's the package that initially adopted this 
naming convention.



Comment at: lib/Driver/MSVCToolChain.cpp:370
+std::string MSVCToolChain::getSubDirectoryPath(SubDirectoryType Type) const {
+  auto llvmArchToLegacyVCSubDirectoryName =
+  [](llvm::Triple::ArchType Arch) -> const char * {

For consistency, please make this a static helper like the helper above.


https://reviews.llvm.org/D28365



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


[PATCH] D28362: [ThinLTO] Optionally ignore empty index file

2017-01-06 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

> In order to simplify distributed build system integration, where actions

may be scheduled before the Thin Link which determines the list of
objects selected by the linker. The gold plugin currently will emit
0-sized index files for objects not selected by the link, to enable
checking for expected output files by the build system. If the build
system then schedules a backend action for these bitcode files, we want
to be able to fall back to normal compilation instead of failing.

Just thought about it: why not emit an empty *index* instead of an empty file?


https://reviews.llvm.org/D28362



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


[PATCH] D28362: [ThinLTO] Optionally ignore empty index file

2017-01-06 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added a comment.

In https://reviews.llvm.org/D28362#638260, @mehdi_amini wrote:

> > In order to simplify distributed build system integration, where actions
> >  may be scheduled before the Thin Link which determines the list of
> >  objects selected by the linker. The gold plugin currently will emit
> >  0-sized index files for objects not selected by the link, to enable
> >  checking for expected output files by the build system. If the build
> >  system then schedules a backend action for these bitcode files, we want
> >  to be able to fall back to normal compilation instead of failing.
>
> Just thought about it: why not emit an empty *index* instead of an empty file?


I thought about that initially. But it will also need some special handling as 
e.g. FunctionImportGlobalProcessing::shouldPromoteLocalToGlobal on the module 
being compiled will complain when it doesn't find summaries for the GVs in that 
module. There might be other places too, that's the first one I found when I 
was thinking about this approach.


https://reviews.llvm.org/D28362



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


[libcxx] r291286 - Add _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] macros.

2017-01-06 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jan  6 15:42:58 2017
New Revision: 291286

URL: http://llvm.org/viewvc/llvm-project?rev=291286&view=rev
Log:
Add _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] macros.

This patch refactors the compiler detection done in `__config` by creating a
set of `_LIBCPP_COMPILER_` macros. The goal of this patch is to make
it easier to detect what compiler is being used outside of `__config`.

Additionally this patch removes workarounds for GCC in `__bit_reference`. I
tested GCC 4.8 and 4.9 without the workaround and neither seemed to need it
anymore.

Modified:
libcxx/trunk/include/__bit_reference
libcxx/trunk/include/__config
libcxx/trunk/include/support/win32/support.h
libcxx/trunk/include/type_traits
libcxx/trunk/src/locale.cpp

Modified: libcxx/trunk/include/__bit_reference
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__bit_reference?rev=291286&r1=291285&r2=291286&view=diff
==
--- libcxx/trunk/include/__bit_reference (original)
+++ libcxx/trunk/include/__bit_reference Fri Jan  6 15:42:58 2017
@@ -40,11 +40,8 @@ class __bit_reference
 __storage_pointer __seg_;
 __storage_type__mask_;
 
-#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
 friend typename _Cp::__self;
-#else
-friend class _Cp::__self;
-#endif
+
 friend class __bit_const_reference<_Cp>;
 friend class __bit_iterator<_Cp, false>;
 public:
@@ -130,11 +127,7 @@ class __bit_const_reference
 __storage_pointer__seg_;
 __storage_type __mask_;
 
-#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
 friend typename _Cp::__self;
-#else
-friend class _Cp::__self;
-#endif
 friend class __bit_iterator<_Cp, true>;
 public:
 _LIBCPP_INLINE_VISIBILITY
@@ -1221,11 +1214,8 @@ private:
 __bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
 : __seg_(__s), __ctz_(__ctz) {}
 
-#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
 friend typename _Cp::__self;
-#else
-friend class _Cp::__self;
-#endif
+
 friend class __bit_reference<_Cp>;
 friend class __bit_const_reference<_Cp>;
 friend class __bit_iterator<_Cp, true>;

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=291286&r1=291285&r2=291286&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Jan  6 15:42:58 2017
@@ -101,6 +101,16 @@
 #define __is_identifier(__x) 1
 #endif
 
+#if defined(__clang__)
+#define _LIBCPP_COMPILER_CLANG
+#elif defined(__GNUC__)
+#define _LIBCPP_COMPILER_GCC
+#elif defined(_MSC_VER)
+#define _LIBCPP_COMPILER_MSVC
+#elif defined(__IBMCPP__)
+#define _LIBCPP_COMPILER_IBM
+#endif
+
 // Need to detect which libc we're using if we're on Linux.
 #if defined(__linux__)
 #include 
@@ -164,16 +174,7 @@
 #  define _LIBCPP_LITTLE_ENDIAN 1
 #  define _LIBCPP_BIG_ENDIAN0
 #  define _LIBCPP_SHORT_WCHAR   1
-// Compiler intrinsics (MSVC)
-#  if defined(_MSC_VER) && _MSC_VER >= 1400
-#define _LIBCPP_HAS_IS_BASE_OF
-#  endif
-#  if defined(_MSC_VER) && !defined(__clang__)
-#define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
-#define _LIBCPP_TOSTRING2(x) #x
-#define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
-#define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" 
_LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
-#  endif
+
 // If mingw not explicitly detected, assume using MS C runtime only.
 #  ifndef __MINGW32__
 #define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
@@ -230,7 +231,7 @@
 #define _LIBCPP_NO_CFI
 #endif
 
-#if defined(__clang__)
+#if defined(_LIBCPP_COMPILER_CLANG)
 
 // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
 // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
@@ -386,7 +387,7 @@ namespace std {
 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK 
__attribute__((__no_sanitize__("unsigned-integer-overflow")))
 #endif 
 
-#elif defined(__GNUC__)
+#elif defined(_LIBCPP_COMPILER_GCC)
 
 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x
@@ -469,8 +470,17 @@ using namespace _LIBCPP_NAMESPACE __attr
 #define _LIBCPP_HAS_NO_ASAN
 #endif
 
-#elif defined(_LIBCPP_MSVC)
+#elif defined(_LIBCPP_COMPILER_MSVC)
 
+#define _LIBCPP_TOSTRING2(x) #x
+#define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
+#define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" 
_LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
+
+#if _MSC_VER < 1900
+#error "MSVC versions prior to Visual Studio 2015 are not supported"
+#endif
+
+#define _LIBCPP_HAS_IS_BASE_OF
 #define _LIBCPP_HAS_NO_CONSTEXPR
 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
@@ -493,7 +503,7 @@ namespace std {

[PATCH] D28404: IRGen: Add optnone attribute on function during O0

2017-01-06 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a comment.

In https://reviews.llvm.org/D28404#638221, @mehdi_amini wrote:

> In https://reviews.llvm.org/D28404#638217, @probinson wrote:
>
> > The patch as-is obviously has a massive testing cost, and it's easy to 
> > imagine people being tripped up by this in the future.
>
>
> Can you clarify what massive testing cost you're referring to?


Well, you just had to modify around 50 tests, and I'd expect some future tests 
to have to deal with it too.  Maybe "massive" is overstating it but it seemed 
like an unusually large number.

I don't know that just slapping the option on all these tests is really the 
most appropriate fix, either, in some cases.  I'll look at it more.


https://reviews.llvm.org/D28404



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


[PATCH] D28220: provide Win32 native threading

2017-01-06 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd updated this revision to Diff 83430.
compnerd marked an inline comment as done.
compnerd added a comment.

rebase, address negative timeouts, fix thunking for `__libcpp_tls_create`


Repository:
  rL LLVM

https://reviews.llvm.org/D28220

Files:
  include/__config
  include/__threading_support
  include/thread

Index: include/thread
===
--- include/thread
+++ include/thread
@@ -148,7 +148,8 @@
 __thread_specific_ptr(const __thread_specific_ptr&);
 __thread_specific_ptr& operator=(const __thread_specific_ptr&);
 
-static void __at_thread_exit(void*);
+static void _LIBCPP_TLS_DESTRUCTOR_CC __at_thread_exit(void*);
+
 public:
 typedef _Tp* pointer;
 
@@ -164,21 +165,19 @@
 };
 
 template 
-void
+void _LIBCPP_TLS_DESTRUCTOR_CC
 __thread_specific_ptr<_Tp>::__at_thread_exit(void* __p)
 {
 delete static_cast(__p);
 }
 
 template 
 __thread_specific_ptr<_Tp>::__thread_specific_ptr()
 {
-int __ec = __libcpp_tls_create(
-&__key_,
-&__thread_specific_ptr::__at_thread_exit);
-if (__ec)
-__throw_system_error(__ec,
-   "__thread_specific_ptr construction failed");
+  int __ec =
+  __libcpp_tls_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
+  if (__ec)
+__throw_system_error(__ec, "__thread_specific_ptr construction failed");
 }
 
 template 
Index: include/__threading_support
===
--- include/__threading_support
+++ include/__threading_support
@@ -47,6 +47,14 @@
 defined(_LIBCPP_HAS_THREAD_API_EXTERNAL_PTHREAD)
 #include 
 #include 
+#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
+#include 
+#define WIN32_LEAN_AND_MEAN
+#include 
+#include 
+#include 
+
+#include 
 #endif
 
 #if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
@@ -81,6 +89,33 @@
 
 // Thrad Local Storage
 typedef pthread_key_t __libcpp_tls_key;
+
+#define _LIBCPP_TLS_DESTRUCTOR_CC
+#else
+// Mutex
+typedef SRWLOCK __libcpp_mutex_t;
+#define _LIBCPP_MUTEX_INITIALIZER SRWLOCK_INIT
+
+typedef CRITICAL_SECTION __libcpp_recursive_mutex_t;
+
+// Condition Variable
+typedef CONDITION_VARIABLE __libcpp_condvar_t;
+#define _LIBCPP_CONDVAR_INITIALIZER CONDITION_VARIABLE_INIT
+
+// Execute Once
+typedef INIT_ONCE __libcpp_exec_once_flag;
+#define _LIBCPP_EXEC_ONCE_INITIALIZER INIT_ONCE_STATIC_INIT
+
+// Thread ID
+typedef DWORD __libcpp_thread_id;
+
+// Thread
+typedef HANDLE __libcpp_thread_t;
+
+// Thread Local Storage
+typedef DWORD __libcpp_tls_key;
+
+#define _LIBCPP_TLS_DESTRUCTOR_CC WINAPI
 #endif
 
 // Mutex
@@ -342,6 +377,249 @@
 return pthread_setspecific(__key, __p);
 }
 
+#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
+
+// Mutex
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
+{
+  InitializeCriticalSection(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
+{
+  EnterCriticalSection(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
+{
+  TryEnterCriticalSection(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m)
+{
+  LeaveCriticalSection(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m)
+{
+  static_cast(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
+{
+  AcquireSRWLockExclusive(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
+{
+  TryAcquireSRWLockExclusive(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
+{
+  ReleaseSRWLockExclusive(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_mutex_destroy(__libcpp_mutex_t *__m)
+{
+  static_cast(__m);
+  return 0;
+}
+
+// Condition Variable
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_condvar_signal(__libcpp_condvar_t *__cv)
+{
+  WakeConditionVariable(__cv);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv)
+{
+  WakeAllConditionVariable(__cv);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)
+{
+  SleepConditionVariableSRW(__cv, __m, INFINITE, 0);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
+   timespec *__ts)
+{
+  using namespace _VSTD::chrono;
+
+  auto duration = seconds(__ts->tv_sec) + nanoseconds(__ts->tv_nsec);
+  auto abstime =
+  system_clock::time_point(duration_cast(duration));
+  auto timeout_ms = duration_cast(abstime - system_clock::now());
+
+  if (!SleepConditionVariableSRW(__cv, __m,
+ timeout_ms.count() > 0 ? timeout_ms.count()
+ 

[PATCH] D26900: [cmake] Obtain LLVM_CMAKE_PATH from llvm-config

2017-01-06 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

Is there a way to write this patch so that old `llvm-config`'s continue to 
work, at least for a little while until everybody upgrades?


https://reviews.llvm.org/D26900



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


[PATCH] D28315: Update tools to use new getStyle API

2017-01-06 Thread Antonio Maiorano via Phabricator via cfe-commits
amaiorano added a comment.

@ioeric Okay, check-clang-tools passes with my changes.

FYI, tests were originally failing for me (without my changes) because I use 
Git, and it's configured to convert line endings to Windows (crlf) on checkout, 
but some of the tools tests specify extract offsets into source files, which 
end up being incorrect if you've got an extra byte per line ;) I'll open a 
ticket/discussion about it separately.

So if you give me the go ahead, I'll submit this change _after_ submitting 
https://reviews.llvm.org/D28081.


https://reviews.llvm.org/D28315



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


[PATCH] D26900: [cmake] Obtain LLVM_CMAKE_PATH from llvm-config

2017-01-06 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

In https://reviews.llvm.org/D26900#638328, @EricWF wrote:

> Is there a way to write this patch so that old `llvm-config`'s continue to 
> work, at least for a little while until everybody upgrades?


Technically it's possible but I think it would add a lot of complexity. So if 
you believe that to be a major issue, I'd rather just wait a few days before 
applying the change. However, I don't think we really have a big market for 
people doing stand-alone builds ;-).


https://reviews.llvm.org/D26900



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


[PATCH] D28220: provide Win32 native threading

2017-01-06 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd removed rL LLVM as the repository for this revision.
compnerd updated this revision to Diff 83432.
compnerd added a comment.

rebase


https://reviews.llvm.org/D28220

Files:
  include/__config
  include/__threading_support
  include/thread

Index: include/thread
===
--- include/thread
+++ include/thread
@@ -148,7 +148,8 @@
 __thread_specific_ptr(const __thread_specific_ptr&);
 __thread_specific_ptr& operator=(const __thread_specific_ptr&);
 
-static void __at_thread_exit(void*);
+static void _LIBCPP_TLS_DESTRUCTOR_CC __at_thread_exit(void*);
+
 public:
 typedef _Tp* pointer;
 
@@ -164,21 +165,19 @@
 };
 
 template 
-void
+void _LIBCPP_TLS_DESTRUCTOR_CC
 __thread_specific_ptr<_Tp>::__at_thread_exit(void* __p)
 {
 delete static_cast(__p);
 }
 
 template 
 __thread_specific_ptr<_Tp>::__thread_specific_ptr()
 {
-int __ec = __libcpp_tls_create(
-&__key_,
-&__thread_specific_ptr::__at_thread_exit);
-if (__ec)
-__throw_system_error(__ec,
-   "__thread_specific_ptr construction failed");
+  int __ec =
+  __libcpp_tls_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
+  if (__ec)
+__throw_system_error(__ec, "__thread_specific_ptr construction failed");
 }
 
 template 
Index: include/__threading_support
===
--- include/__threading_support
+++ include/__threading_support
@@ -24,6 +24,14 @@
 #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
 # include 
 # include 
+#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
+#include 
+#define WIN32_LEAN_AND_MEAN
+#include 
+#include 
+#include 
+
+#include 
 #endif
 
 #if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
@@ -58,6 +66,33 @@
 
 // Thrad Local Storage
 typedef pthread_key_t __libcpp_tls_key;
+
+#define _LIBCPP_TLS_DESTRUCTOR_CC
+#else
+// Mutex
+typedef SRWLOCK __libcpp_mutex_t;
+#define _LIBCPP_MUTEX_INITIALIZER SRWLOCK_INIT
+
+typedef CRITICAL_SECTION __libcpp_recursive_mutex_t;
+
+// Condition Variable
+typedef CONDITION_VARIABLE __libcpp_condvar_t;
+#define _LIBCPP_CONDVAR_INITIALIZER CONDITION_VARIABLE_INIT
+
+// Execute Once
+typedef INIT_ONCE __libcpp_exec_once_flag;
+#define _LIBCPP_EXEC_ONCE_INITIALIZER INIT_ONCE_STATIC_INIT
+
+// Thread ID
+typedef DWORD __libcpp_thread_id;
+
+// Thread
+typedef HANDLE __libcpp_thread_t;
+
+// Thread Local Storage
+typedef DWORD __libcpp_tls_key;
+
+#define _LIBCPP_TLS_DESTRUCTOR_CC WINAPI
 #endif
 
 // Mutex
@@ -321,6 +356,249 @@
 return pthread_setspecific(__key, __p);
 }
 
+#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
+
+// Mutex
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
+{
+  InitializeCriticalSection(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
+{
+  EnterCriticalSection(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
+{
+  TryEnterCriticalSection(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m)
+{
+  LeaveCriticalSection(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_recursive_mutex_destroy(__libcpp_recursive_mutex_t *__m)
+{
+  static_cast(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
+{
+  AcquireSRWLockExclusive(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
+{
+  TryAcquireSRWLockExclusive(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
+{
+  ReleaseSRWLockExclusive(__m);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_mutex_destroy(__libcpp_mutex_t *__m)
+{
+  static_cast(__m);
+  return 0;
+}
+
+// Condition Variable
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_condvar_signal(__libcpp_condvar_t *__cv)
+{
+  WakeConditionVariable(__cv);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_condvar_broadcast(__libcpp_condvar_t *__cv)
+{
+  WakeAllConditionVariable(__cv);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_condvar_wait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m)
+{
+  SleepConditionVariableSRW(__cv, __m, INFINITE, 0);
+  return 0;
+}
+
+_LIBCPP_ALWAYS_INLINE
+int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
+   timespec *__ts)
+{
+  using namespace _VSTD::chrono;
+
+  auto duration = seconds(__ts->tv_sec) + nanoseconds(__ts->tv_nsec);
+  auto abstime =
+  system_clock::time_point(duration_cast(duration));
+  auto timeout_ms = duration_cast(abstime - system_clock::now());
+
+  if (!SleepConditionVariableSRW(__cv, __m,
+ timeout_ms.count() > 0 ? timeout_ms.count()
+: 0,
+ 0))

[PATCH] D28220: provide Win32 native threading

2017-01-06 Thread Andrey Khalyavin via Phabricator via cfe-commits
halyavin added a comment.

LGTM.




Comment at: include/__threading_support:480
+  if (!SleepConditionVariableSRW(__cv, __m,
+ timeout_ms.count() > 0 ? timeout_ms.count()
+: 0,

There is still problem with large timeout but let us fix it later.


https://reviews.llvm.org/D28220



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


[PATCH] D28415: PCH: fix a regression that reports a module is defined in both pch and pcm

2017-01-06 Thread Manman Ren via Phabricator via cfe-commits
manmanren created this revision.
manmanren added reviewers: rsmith, benlangmuir, doug.gregor.
manmanren added a subscriber: cfe-commits.

In r276159, we started to say that a module X is defined in a pch if we specify 
-fmodule-name when building the pch.
This caused a regression that reports module X is defined in both pch and pcm 
if we generate the pch with -fmodule-name=X and then in a separate clang 
invocation, we include the pch and also import X.pcm.

This patch adds an option CompilingPCH similar to CompilingModule. When we use 
-fmodule-name=X while building a pch, modular headers in X will be textually 
included and the compiler knows that we are not building module X, so we don't 
put module X in SUBMODULE_DEFINITION of the pch.


https://reviews.llvm.org/D28415

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Frontend/FrontendActions.h
  lib/Frontend/FrontendActions.cpp
  lib/Lex/PPDirectives.cpp
  lib/Serialization/ASTWriter.cpp
  test/Modules/Inputs/pch-with-module-name/A.h
  test/Modules/Inputs/pch-with-module-name/C.h
  test/Modules/Inputs/pch-with-module-name/C.m
  test/Modules/Inputs/pch-with-module-name/D.h
  test/Modules/Inputs/pch-with-module-name/module.modulemap
  test/Modules/Inputs/pch-with-module-name/test.h
  test/Modules/pch-with-module-name.m

Index: test/Modules/pch-with-module-name.m
===
--- test/Modules/pch-with-module-name.m
+++ test/Modules/pch-with-module-name.m
@@ -0,0 +1,5 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/pch-with-module-name -emit-pch -o %t-A.pch %S/Inputs/pch-with-module-name/test.h -fmodule-name=Contacts -x objective-c-header
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/pch-with-module-name -include-pch %t-A.pch %s -fsyntax-only -fmodule-name=Contacts -verify
+// expected-no-diagnostics 
+#include "C.h"
Index: test/Modules/Inputs/pch-with-module-name/test.h
===
--- test/Modules/Inputs/pch-with-module-name/test.h
+++ test/Modules/Inputs/pch-with-module-name/test.h
@@ -0,0 +1 @@
+#include "A.h"
Index: test/Modules/Inputs/pch-with-module-name/module.modulemap
===
--- test/Modules/Inputs/pch-with-module-name/module.modulemap
+++ test/Modules/Inputs/pch-with-module-name/module.modulemap
@@ -0,0 +1,9 @@
+module CloudKit {
+  header "C.h"
+  export *
+}
+
+module Contacts {
+  header "D.h"
+  export *
+}
Index: test/Modules/Inputs/pch-with-module-name/D.h
===
--- test/Modules/Inputs/pch-with-module-name/D.h
+++ test/Modules/Inputs/pch-with-module-name/D.h
@@ -0,0 +1 @@
+//empty
Index: test/Modules/Inputs/pch-with-module-name/C.m
===
--- test/Modules/Inputs/pch-with-module-name/C.m
+++ test/Modules/Inputs/pch-with-module-name/C.m
@@ -0,0 +1 @@
+//empty
Index: test/Modules/Inputs/pch-with-module-name/C.h
===
--- test/Modules/Inputs/pch-with-module-name/C.h
+++ test/Modules/Inputs/pch-with-module-name/C.h
@@ -0,0 +1 @@
+#include "D.h"
Index: test/Modules/Inputs/pch-with-module-name/A.h
===
--- test/Modules/Inputs/pch-with-module-name/A.h
+++ test/Modules/Inputs/pch-with-module-name/A.h
@@ -0,0 +1 @@
+// in pch
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -4654,17 +4654,6 @@
   // If we're emitting a module, write out the submodule information.  
   if (WritingModule)
 WriteSubmodules(WritingModule);
-  else if (!getLangOpts().CurrentModule.empty()) {
-// If we're building a PCH in the implementation of a module, we may need
-// the description of the current module.
-//
-// FIXME: We may need other modules that we did not load from an AST file,
-// such as if a module declares a 'conflicts' on a different module.
-Module *M = PP.getHeaderSearchInfo().getModuleMap().findModule(
-getLangOpts().CurrentModule);
-if (M && !M->IsFromModuleFile)
-  WriteSubmodules(M);
-  }
 
   Stream.EmitRecord(SPECIAL_TYPES, SpecialTypes);
 
Index: lib/Lex/PPDirectives.cpp
===
--- lib/Lex/PPDirectives.cpp
+++ lib/Lex/PPDirectives.cpp
@@ -1996,18 +1996,28 @@
 
   // Ask HeaderInfo if we should enter this #include file.  If not, #including
   // this file will have no effect.
+  bool SkipHeader = false;
   if (ShouldEnter &&
   !HeaderInfo.ShouldEnterIncludeFile(*this, File, isImport,
  SuggestedModule.getModule())) {
 ShouldEnter = false

  1   2   >