r276517 - [Profile] Use a flag to enable PGO rather than the profraw filename

2016-07-22 Thread Xinliang David Li via cfe-commits
Author: davidxl
Date: Fri Jul 22 23:28:59 2016
New Revision: 276517

URL: http://llvm.org/viewvc/llvm-project?rev=276517=rev
Log:
[Profile] Use a flag to enable PGO rather than the profraw filename

Patch by Jake VanAdrighem

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



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=276517=276516=276517=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Jul 22 23:28:59 2016
@@ -453,6 +453,7 @@ void EmitAssemblyHelper::CreatePasses(le
 MPM.add(createInstrProfilingLegacyPass(Options));
   }
   if (CodeGenOpts.hasProfileIRInstr()) {
+PMBuilder.EnablePGOInstrGen = true;
 if (!CodeGenOpts.InstrProfileOutput.empty())
   PMBuilder.PGOInstrGen = CodeGenOpts.InstrProfileOutput;
 else


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


Re: [PATCH] D22608: [Profile] Use a flag to enable PGO rather than the profraw filename.

2016-07-22 Thread David Li via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL276517: [Profile] Use a flag to enable PGO rather than the 
profraw filename (authored by davidxl).

Changed prior to commit:
  https://reviews.llvm.org/D22608?vs=64812=65216#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D22608

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
@@ -453,6 +453,7 @@
 MPM.add(createInstrProfilingLegacyPass(Options));
   }
   if (CodeGenOpts.hasProfileIRInstr()) {
+PMBuilder.EnablePGOInstrGen = true;
 if (!CodeGenOpts.InstrProfileOutput.empty())
   PMBuilder.PGOInstrGen = CodeGenOpts.InstrProfileOutput;
 else


Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp
===
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp
@@ -453,6 +453,7 @@
 MPM.add(createInstrProfilingLegacyPass(Options));
   }
   if (CodeGenOpts.hasProfileIRInstr()) {
+PMBuilder.EnablePGOInstrGen = true;
 if (!CodeGenOpts.InstrProfileOutput.empty())
   PMBuilder.PGOInstrGen = CodeGenOpts.InstrProfileOutput;
 else
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22662: [cxx1z-constexpr-lambda] Make a lambda's closure type a literal type in C++1z.

2016-07-22 Thread Faisal Vali via cfe-commits
faisalv accepted this revision.
faisalv added a reviewer: faisalv.
faisalv added a comment.
This revision is now accepted and ready to land.

Thanks Richard.  Your request to separate out and centralize the diagnostic 
portion of the patch certainly seems like a good idea - and I shall do so 
separately.

The approved portion of this small patch is committed as: r276514.

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160718/165670.html

Thanks!


https://reviews.llvm.org/D22662



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


r276514 - [cxx1z-constexpr-lambda] Make a lambda's closure type eligible as a literal-type in C++1z

2016-07-22 Thread Faisal Vali via cfe-commits
Author: faisalv
Date: Fri Jul 22 23:05:19 2016
New Revision: 276514

URL: http://llvm.org/viewvc/llvm-project?rev=276514=rev
Log:
[cxx1z-constexpr-lambda] Make a lambda's closure type eligible as a 
literal-type in C++1z


Additionally, for pre-C++1z, instead of forbidding a lambda's closure type from 
being a literal type through circumlocutorily setting 
HasNonLiteralTypeFieldsOrBases falsely to true -- handle lambda's more directly 
in CXXRecordDecl::isLiteral().

One additional small step towards implementing constexpr-lambdas.

Thanks to Richard Smith for his review! 
https://reviews.llvm.org/D22662


Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/test/SemaCXX/cxx1z-constexpr-lambdas.cpp

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=276514=276513=276514=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Fri Jul 22 23:05:19 2016
@@ -535,11 +535,10 @@ class CXXRecordDecl : public RecordDecl
 MethodTyInfo(Info) {
   IsLambda = true;
 
-  // C++11 [expr.prim.lambda]p3:
-  //   This class type is neither an aggregate nor a literal type.
+  // C++1z [expr.prim.lambda]p4:
+  //   This class type is not an aggregate type.
   Aggregate = false;
   PlainOldData = false;
-  HasNonLiteralTypeFieldsOrBases = true;
 }
 
 /// \brief Whether this lambda is known to be dependent, even if its
@@ -1338,11 +1337,15 @@ public:
   ///
   /// We resolve DR1361 by ignoring the second bullet. We resolve DR1452 by
   /// treating types with trivial default constructors as literal types.
+  ///
+  /// Only in C++1z and beyond, are lambdas literal types.
   bool isLiteral() const {
 return hasTrivialDestructor() &&
-   (isAggregate() || hasConstexprNonCopyMoveConstructor() ||
-hasTrivialDefaultConstructor()) &&
-   !hasNonLiteralTypeFieldsOrBases();
+   (!isLambda() || getASTContext().getLangOpts().CPlusPlus1z) &&
+   !hasNonLiteralTypeFieldsOrBases() &&
+   (isAggregate() || isLambda() ||
+hasConstexprNonCopyMoveConstructor() ||
+hasTrivialDefaultConstructor());
   }
 
   /// \brief If this record is an instantiation of a member class,

Modified: cfe/trunk/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1z-constexpr-lambdas.cpp?rev=276514=276513=276514=diff
==
--- cfe/trunk/test/SemaCXX/cxx1z-constexpr-lambdas.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx1z-constexpr-lambdas.cpp Fri Jul 22 23:05:19 2016
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks %s
 // RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks 
-fdelayed-template-parsing %s 
-// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fms-extensions 
%s 
-// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks 
-fdelayed-template-parsing -fms-extensions %s 
+// RUN: %clang_cc1 -std=c++14 -verify -fsyntax-only -fblocks %s 
-DCPP14_AND_EARLIER
 
+#ifndef CPP14_AND_EARLIER
 namespace test_constexpr_checking {
 
 namespace ns1 {
@@ -33,4 +33,16 @@ namespace ns3 {
   L(3); //expected-note{{non-constexpr function}}
 } 
 
-} // end ns test_constexpr_call
\ No newline at end of file
+} // end ns test_constexpr_call
+
+#endif
+
+namespace test_lambda_is_literal {
+#ifdef CPP14_AND_EARLIER
+//expected-error@+4{{not a literal type}}
+//expected-note@+2{{not an aggregate and has no constexpr constructors}}
+#endif
+auto L = [] { };
+constexpr int foo(decltype(L) l) { return 0; }
+
+}
\ No newline at end of file


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


[libcxx] r276511 - Implement P0392r0. Integrate filesystem::path and string_view.

2016-07-22 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jul 22 22:10:56 2016
New Revision: 276511

URL: http://llvm.org/viewvc/llvm-project?rev=276511=rev
Log:
Implement P0392r0. Integrate filesystem::path and string_view.

Modified:
libcxx/trunk/include/experimental/filesystem
libcxx/trunk/src/experimental/filesystem/path.cpp

libcxx/trunk/test/libcxx/experimental/filesystem/class.path/path.req/is_pathable.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp

libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/experimental/filesystem
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/filesystem?rev=276511=276510=276511=diff
==
--- libcxx/trunk/include/experimental/filesystem (original)
+++ libcxx/trunk/include/experimental/filesystem Fri Jul 22 22:10:56 2016
@@ -228,7 +228,7 @@
 #include 
 #include 
 #include  // for quoted
-#include 
+#include 
 
 #include <__debug>
 
@@ -498,6 +498,21 @@ struct __is_pathable_string
+struct __is_pathable_string,
+_Void::__char_type>>
+: public __can_convert_char<_ECharT>
+{
+using _Str = basic_string_view<_ECharT, _Traits>;
+using _Base = __can_convert_char<_ECharT>;
+static _ECharT const* __range_begin(_Str const& __s) { return __s.data(); }
+static _ECharT const* __range_end(_Str const& __s) { return __s.data() + 
__s.length(); }
+static _ECharT __first_or_null(_Str const& __s) {
+return __s.empty() ? _ECharT{} : __s[0];
+}
+};
+
 template ::type,
   class _UnqualPtrType = typename remove_const<
@@ -642,6 +657,7 @@ class _LIBCPP_TYPE_VIS path
 public:
 typedef char value_type;
 typedef basic_string string_type;
+typedef _VSTD::string_view __string_view;
 static _LIBCPP_CONSTEXPR value_type preferred_separator = '/';
 
 // constructors and destructor
@@ -788,6 +804,12 @@ public:
 }
 
 _LIBCPP_INLINE_VISIBILITY
+path& operator+=(__string_view __x) {
+__pn_ += __x;
+return *this;
+}
+
+_LIBCPP_INLINE_VISIBILITY
 path& operator+=(const value_type* __x) {
 __pn_ += __x;
 return *this;
@@ -799,7 +821,6 @@ public:
 return *this;
 }
 
-
 template 
 typename enable_if<__can_convert_char<_ECharT>::value, path&>::type
 operator+=(_ECharT __x)
@@ -896,30 +917,31 @@ public:
 std::u32string generic_u32string() const { return string(); }
 
 private:
-_LIBCPP_FUNC_VIS int __compare(const value_type*) const;
-_LIBCPP_FUNC_VIS string_view __root_name() const;
-_LIBCPP_FUNC_VIS string_view __root_directory() const;
-_LIBCPP_FUNC_VIS string_view __relative_path() const;
-_LIBCPP_FUNC_VIS string_view __parent_path() const;
-_LIBCPP_FUNC_VIS string_view __filename() const;
-_LIBCPP_FUNC_VIS string_view __stem() const;
-_LIBCPP_FUNC_VIS string_view __extension() const;
+_LIBCPP_FUNC_VIS int __compare(__string_view) const;
+_LIBCPP_FUNC_VIS __string_view __root_name() const;
+_LIBCPP_FUNC_VIS __string_view __root_directory() const;
+_LIBCPP_FUNC_VIS __string_view __relative_path() const;
+_LIBCPP_FUNC_VIS __string_view __parent_path() const;
+_LIBCPP_FUNC_VIS __string_view __filename() const;
+_LIBCPP_FUNC_VIS __string_view __stem() const;
+_LIBCPP_FUNC_VIS __string_view __extension() const;
 
 public:
 // compare
-_LIBCPP_INLINE_VISIBILITY int compare(const path& __p) const _NOEXCEPT { 
return __compare(__p.c_str());}
-_LIBCPP_INLINE_VISIBILITY int compare(const string_type& __s) const { 
return __compare(__s.c_str()); }
+_LIBCPP_INLINE_VISIBILITY int compare(const path& __p) const _NOEXCEPT { 
return __compare(__p.__pn_);}
+_LIBCPP_INLINE_VISIBILITY int compare(const string_type& __s) const { 
return __compare(__s); }
+_LIBCPP_INLINE_VISIBILITY int compare(__string_view __s) const { return 
__compare(__s); }
 _LIBCPP_INLINE_VISIBILITY int compare(const value_type* __s) const  { 
return __compare(__s); }
 
 // decomposition
-_LIBCPP_INLINE_VISIBILITY path root_name()  const { return  
__root_name().to_string(); }
-_LIBCPP_INLINE_VISIBILITY path root_directory() const { return  
__root_directory().to_string(); }
-_LIBCPP_INLINE_VISIBILITY path root_path()  const { return 
root_name().append(__root_directory().to_string()); }
-_LIBCPP_INLINE_VISIBILITY path relative_path()  const { return 
__relative_path().to_string(); }
-

r276509 - Work around MSVC's lack of support for unrestricted unions by making this

2016-07-22 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Jul 22 21:39:52 2016
New Revision: 276509

URL: http://llvm.org/viewvc/llvm-project?rev=276509=rev
Log:
Work around MSVC's lack of support for unrestricted unions by making this
struct a bit bigger under MSVC (this shouldn't be a big deal; we typically
allocate no more than two of these at a time, on the stack).

Modified:
cfe/trunk/include/clang/Sema/DeclSpec.h

Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=276509=276508=276509=diff
==
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Fri Jul 22 21:39:52 2016
@@ -1752,13 +1752,17 @@ private:
   /// \brief The asm label, if specified.
   Expr *AsmLabel;
 
+#ifndef _MSC_VER
   union {
+#endif
 /// InlineParams - This is a local array used for the first function decl
 /// chunk to avoid going to the heap for the common case when we have one
 /// function chunk in the declarator.
 DeclaratorChunk::ParamInfo InlineParams[16];
 DecompositionDeclarator::Binding InlineBindings[16];
+#ifndef _MSC_VER
   };
+#endif
 
   /// \brief If this is the second or subsequent declarator in this 
declaration,
   /// the location of the comma before this declarator.


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


r276508 - Add -fmodules-ts flag to cc1 for the provisional C++ modules TS, and mark

2016-07-22 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Jul 22 21:32:21 2016
New Revision: 276508

URL: http://llvm.org/viewvc/llvm-project?rev=276508=rev
Log:
Add -fmodules-ts flag to cc1 for the provisional C++ modules TS, and mark
'module' and 'import' as keywords when the flag is specified.

Added:
cfe/trunk/test/Lexer/modules-ts.cpp
Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/lib/Basic/IdentifierTable.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=276508=276507=276508=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Fri Jul 22 21:32:21 2016
@@ -142,6 +142,7 @@ BENIGN_LANGOPT(EmitAllDecls  , 1, 0,
 LANGOPT(MathErrno , 1, 1, "errno in math functions")
 BENIGN_LANGOPT(HeinousExtensions , 1, 0, "extensions that we really don't like 
and may be ripped out at any time")
 LANGOPT(Modules   , 1, 0, "modules extension to C")
+LANGOPT(ModulesTS , 1, 0, "C++ Modules TS")
 BENIGN_LANGOPT(CompilingModule, 1, 0, "compiling a module interface")
 COMPATIBLE_LANGOPT(ModulesDeclUse, 1, 0, "require declaration of module 
uses")
 BENIGN_LANGOPT(ModulesSearchAll  , 1, 1, "searching even non-imported modules 
to find unresolved references")

Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=276508=276507=276508=diff
==
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Fri Jul 22 21:32:21 2016
@@ -30,6 +30,9 @@
 #ifndef CONCEPTS_KEYWORD
 #define CONCEPTS_KEYWORD(X) KEYWORD(X,KEYCONCEPTS)
 #endif
+#ifndef MODULES_KEYWORD
+#define MODULES_KEYWORD(X) KEYWORD(X,KEYMODULES)
+#endif
 #ifndef TYPE_TRAIT
 #define TYPE_TRAIT(N,I,K) KEYWORD(I,K)
 #endif
@@ -235,6 +238,8 @@ PUNCTUATOR(caretcaret,"^^")
 //   KEYCXX11 - This is a C++ keyword introduced to C++ in C++11
 //   KEYCONCEPTS - This is a keyword if the C++ extensions for concepts
 // are enabled.
+//   KEYMODULES - This is a keyword if the C++ extensions for modules
+//are enabled.
 //   KEYGNU   - This is a keyword if GNU extensions are enabled
 //   KEYMS- This is a keyword if Microsoft extensions are enabled
 //   KEYNOMS18 - This is a keyword that must never be enabled under
@@ -366,6 +371,10 @@ KEYWORD(co_await, KE
 KEYWORD(co_return   , KEYCOROUTINES)
 KEYWORD(co_yield, KEYCOROUTINES)
 
+// C++ modules TS keywords
+MODULES_KEYWORD(module)
+MODULES_KEYWORD(import)
+
 // GNU Extensions (in impl-reserved namespace)
 KEYWORD(_Decimal32  , KEYALL)
 KEYWORD(_Decimal64  , KEYALL)

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=276508=276507=276508=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Fri Jul 22 21:32:21 2016
@@ -388,6 +388,8 @@ def ast_dump_filter : Separate<["-"], "a
   HelpText<"Use with -ast-dump or -ast-print to dump/print only AST 
declaration"
" nodes having a certain substring in a qualified name. Use"
" -ast-list to list all filterable declaration node names.">;
+def fmodules_ts : Flag <["-"], "fmodules-ts">, Group,
+  HelpText<"Enable support for the C++ Modules TS">;
 def fno_modules_global_index : Flag<["-"], "fno-modules-global-index">,
   HelpText<"Do not automatically generate or update the global module index">;
 def fno_modules_error_recovery : Flag<["-"], "fno-modules-error-recovery">,

Modified: cfe/trunk/lib/Basic/IdentifierTable.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/IdentifierTable.cpp?rev=276508=276507=276508=diff
==
--- cfe/trunk/lib/Basic/IdentifierTable.cpp (original)
+++ cfe/trunk/lib/Basic/IdentifierTable.cpp Fri Jul 22 21:32:21 2016
@@ -113,7 +113,8 @@ namespace {
 KEYOBJC2= 0x2,
 KEYZVECTOR  = 0x4,
 KEYCOROUTINES = 0x8,
-KEYALL = (0xf & ~KEYNOMS18 &
+KEYMODULES = 0x10,
+KEYALL = (0x1f & ~KEYNOMS18 &
   ~KEYNOOPENCL) // KEYNOMS18 and KEYNOOPENCL are used to exclude.
   };
 
@@ -147,9 +148,10 @@ static KeywordStatus getKeywordStatus(co
   // We treat bridge casts as objective-C keywords so we can warn on them
   // in non-arc 

Re: [PATCH] D22666: Frontend: Fix mcount inlining bug

2016-07-22 Thread John McCall via cfe-commits
rjmccall added a comment.

Note that the presence of the mcount call itself will significantly impact 
inlining and, really, the entire optimization pipeline.  Having this be a late 
pass seems more in keeping with what I assume is a goal that this 
instrumentation doesn't drastically change the generated code.


https://reviews.llvm.org/D22666



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


Re: [PATCH] D22666: Frontend: Fix mcount inlining bug

2016-07-22 Thread Hal Finkel via cfe-commits
hfinkel added a comment.

In https://reviews.llvm.org/D22666#493706, @honggyu.kim wrote:

> In https://reviews.llvm.org/D22666#493109, @rjmccall wrote:
>
> > In https://reviews.llvm.org/D22666#493026, @hfinkel wrote:
> >
> > > What's the actual desired behavior here? Should the inliner strip out 
> > > calls to mcount() as it inlines?
> >
> >
> > I think they basically just want a late pass (as in immediately prior to 
> > codegen) to insert the mcount calls.
>
>
> You're right. I wanted to move mcount insertion phase myself but it seems not 
> that simple as I expected because mcount call is inserted in bitcode anyway, 
> then can be optimized using `opt` tool to do function inlining later on. In 
> this case, function inliner must strip mcount calls at the entry of each 
> function.
>
> Otherwise, we shouldn't generate mcount calls inside bitcode so that `opt` 
> can simply do function inlining as it does, then code generator, `llc`, has 
> to insert mcount just before code generation is done.  I think this is not 
> that simple as well.
>
> To sum up, we have two approaches.
>
> 1. inliner must strip mcount calls when it does function inlining.
> 2. `llc` has to insert mcount calls just before code generation.
>
>   We have to choose one of these approaches. But I think this patch fixes the 
> problem in a simpler way as of now.


But it will also severely hurt performance, and that's not good either.

Adding an early IR-level pass to llc to insert calls to mcount seems 
straightforward. We could, for example, add some function attribute in the 
frontend which causes the pass to actually insert the mcount calls. There is 
some frontend knowledge currently regarding exactly what the mcount function is 
named (lib/Basic/Targets.cpp sets the MCountName variable) that we'd either 
need to pass in the attribute or move to the backend.

Another option is to add a new function attribute, drop_when_inlining (modulo 
bikeshedding), add that to the mcount function in the frontend, and teach the 
inliner to drop functions with that attribute when inlining.


https://reviews.llvm.org/D22666



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


Re: [PATCH] D22666: Frontend: Fix mcount inlining bug

2016-07-22 Thread Honggyu Kim via cfe-commits
honggyu.kim added a comment.

In https://reviews.llvm.org/D22666#493109, @rjmccall wrote:

> In https://reviews.llvm.org/D22666#493026, @hfinkel wrote:
>
> > What's the actual desired behavior here? Should the inliner strip out calls 
> > to mcount() as it inlines?
>
>
> I think they basically just want a late pass (as in immediately prior to 
> codegen) to insert the mcount calls.


You're right. I wanted to move mcount insertion phase myself but it seems not 
that simple as I expected because mcount call is inserted in bitcode anyway, 
then can be optimized using `opt` tool to do function inlining later on. In 
this case, function inliner must strip mcount calls at the entry of each 
function.

Otherwise, we shouldn't generate mcount calls inside bitcode so that `opt` can 
simply do function inlining as it does, then code generator, `llc`, has to 
insert mcount just before code generation is done.  I think this is not that 
simple as well.

To sum up, we have two approaches.

1. inliner must strip mcount calls when it does function inlining.
2. `llc` has to insert mcount calls just before code generation.

We have to choose one of these approaches. But I think this patch fixes the 
problem in a simpler way as of now.


https://reviews.llvm.org/D22666



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


[libcxx] r276507 - Revert r276506 - Diagnose invalid memory order arguments in .

2016-07-22 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jul 22 20:43:53 2016
New Revision: 276507

URL: http://llvm.org/viewvc/llvm-project?rev=276507=rev
Log:
Revert r276506 - Diagnose invalid memory order arguments in .

There is a bug in Clang 3.6 and earlier that causes compile failures.
I suspect it's due to the usage of member function parameter names in the
attributes.


Removed:
libcxx/trunk/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp
Modified:
libcxx/trunk/include/atomic

Modified: libcxx/trunk/include/atomic
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/atomic?rev=276507=276506=276507=diff
==
--- libcxx/trunk/include/atomic (original)
+++ libcxx/trunk/include/atomic Fri Jul 22 20:43:53 2016
@@ -560,29 +560,6 @@ void atomic_signal_fence(memory_order m)
 # define __cpp_lib_atomic_is_always_lock_free 201603L
 #endif
 
-
-#if __has_attribute(__enable_if__) && __has_attribute(__unavailable__)
-# define _LIBCPP_CHECK_ATOMIC_MEMORY_ORDER
-# define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \
-__attribute__ ((__enable_if__(__m == memory_order_release \
-   || __m == memory_order_acq_rel, "")))  \
-__attribute__ ((__unavailable__("memory order argument to atomic operation 
is invalid")))
-
-# define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)\
-__attribute__ ((__enable_if__(__m == memory_order_consume \
-   || __m == memory_order_acquire \
-   || __m == memory_order_acq_rel, "")))  \
-__attribute__ ((__unavailable__("memory order argument to atomic operation 
is invalid")))
-
-// Note that this is not checking the 'stronger' requirement.
-// See wg21.link/p0418
-# define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)\
-__attribute__ ((__enable_if__(__f == memory_order_release \
-   || __f == memory_order_acq_rel, "")))  \
-__attribute__ ((__unavailable__("memory order argument to atomic operation 
is invalid")))
-#endif
-
-
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 typedef enum memory_order
@@ -956,21 +933,6 @@ struct __atomic_base  // false
 bool compare_exchange_strong(_Tp& __e, _Tp __d,
  memory_order __m = memory_order_seq_cst) 
_NOEXCEPT
 {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, 
__m);}
-#if defined(_LIBCPP_CHECK_ATOMIC_MEMORY_ORDER)
-void store(_Tp __d, memory_order __m) volatile 
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m);
-void store(_Tp __d, memory_order __m) 
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m);
-
-_Tp load(memory_order __m) const volatile 
_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m);
-_Tp load(memory_order __m) const _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m);
-bool compare_exchange_weak(_Tp&, _Tp, memory_order __s, memory_order __f) 
volatile
-_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f);
-bool compare_exchange_weak(_Tp&, _Tp, memory_order __s, memory_order __f)
-_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f);
-bool compare_exchange_strong(_Tp&, _Tp, memory_order __s, memory_order 
__f) volatile
-_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f);
-bool compare_exchange_strong(_Tp&, _Tp, memory_order __s, memory_order __f)
-_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f);
-#endif
 
 _LIBCPP_INLINE_VISIBILITY
 #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -1382,46 +1344,6 @@ atomic_compare_exchange_strong_explicit(
 return __o->compare_exchange_strong(*__e, __d, __s, __f);
 }
 
-
-#ifdef _LIBCPP_CHECK_ATOMIC_MEMORY_ORDER
-template 
-void atomic_store_explicit(volatile atomic<_Tp>*, _Tp, memory_order __m)
-_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m);
-
-template 
-void atomic_store_explicit(atomic<_Tp>*, _Tp, memory_order __m)
-_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m);
-
-template 
-_Tp atomic_load_explicit(const volatile atomic<_Tp>*, memory_order __m)
-_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m);
-
-template 
-_Tp atomic_load_explicit(const atomic<_Tp>*, memory_order __m)
-_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m);
-
-template 
-bool atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>*, _Tp*, _Tp,
-   memory_order __s, memory_order __f)
-_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f);
-
-template 
-bool atomic_compare_exchange_weak_explicit(atomic<_Tp>*, _Tp*, _Tp,
-   memory_order __s, memory_order __f)
-_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f);
-
-template 
-bool atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>*, _Tp*, _Tp,
- memory_order __s, memory_order 
__f)
-_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f);
-
-template 
-bool atomic_compare_exchange_strong_explicit(atomic<_Tp>*, 

[PATCH] D22717: Improve documentation of the type safety attributes

2016-07-22 Thread Yunzhong Gao via cfe-commits
ygao created this revision.
ygao added reviewers: gribozavr, aaron.ballman.
ygao added a subscriber: cfe-commits.

Hi,
I was preparing our internal release documentation with our tech writers, and
when reviewing the clang manual for the current release, we think the current
documentation of type safety attributes are inadequate in a few aspects:

1. The arguments to these attributes are not described.
2. Some of the MPI code examples seem incomplete as they miss declarations.
3. Some references could be made more clear. For example, for the
   "type_tag_for_datatype" attribute, it is mentioned that its optional
   third argument determines "how the expression is compared to the type
   tag", but it is left unspecified what the "expression" is referring to.

We would like to share the edits we have made, both in hope that the edits are
useful to a wider audience, and also to gather some feedback that the new
documentation is still accurate.

Could you review?

- Gao

https://reviews.llvm.org/D22717

Files:
  include/clang/Basic/AttrDocs.td

Index: include/clang/Basic/AttrDocs.td
===
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -1338,7 +1338,8 @@
 def DocCatTypeSafety : DocumentationCategory<"Type Safety Checking"> {
   let Content = [{
 Clang supports additional attributes to enable checking type safety properties
-that can't be enforced by the C type system.  Use cases include:
+that can't be enforced by the C type system. To see warnings produced by these
+checks, ensure that -Wtype-safety is enabled. Use cases include:
 
 * MPI library implementations, where these attributes enable checking that
   the buffer type matches the passed ``MPI_Datatype``;
@@ -1376,12 +1377,23 @@
 Use ``__attribute__((argument_with_type_tag(arg_kind, arg_idx,
 type_tag_idx)))`` on a function declaration to specify that the function
 accepts a type tag that determines the type of some other argument.
-``arg_kind`` is an identifier that should be used when annotating all
-applicable type tags.
 
 This attribute is primarily useful for checking arguments of variadic functions
 (``pointer_with_type_tag`` can be used in most non-variadic cases).
 
+In the attribute prototype above:
+* ``arg_kind`` is an identifier that should be used when annotating all
+  applicable type tags.
+* ``arg_idx`` provides the position of a function argument. The expected type of
+  this function argument will be determined by the function argument specified
+  by ``type_tag_idx``. In the code example below, "3" means that the type of the
+  function's third argument will be determined by ``type_tag_idx``.
+* ``type_tag_idx`` provides the position of a function argument. This function
+  argument will be a type tag. The type tag will determine the expected type of
+  the argument specified by ``arg_idx``. In the code example below, "2" means
+  that the type tag associated with the function's second argument should agree
+  with the type of the argument specified by ``arg_idx``.
+
 For example:
 
 .. code-block:: c++
@@ -1388,6 +1400,8 @@
 
   int fcntl(int fd, int cmd, ...)
   __attribute__(( argument_with_type_tag(fcntl,3,2) ));
+  // The function's second argument will be a type tag; this type tag will
+  // determine the expected type of the function's third argument.
   }];
 }
 
@@ -1399,12 +1413,30 @@
 on a function declaration to specify that the function accepts a type tag that
 determines the pointee type of some other pointer argument.
 
+In the attribute prototype above:
+* ``ptr_kind`` is an identifier that should be used when annotating all
+  applicable type tags.
+* ``ptr_idx`` provides the position of a function argument; this function
+  argument will have a pointer type. The expected pointee type of this pointer
+  type will be determined by the function argument specified by
+  ``type_tag_idx``. In the code example below, "1" means that the pointee type
+  of the function's first argument will be determined by ``type_tag_idx``.
+* ``type_tag_idx`` provides the position of a function argument; this function
+  argument will be a type tag. The type tag will determine the expected pointee
+  type of the pointer argument specified by ``ptr_idx``. In the code example
+  below, "3" means that the type tag associated with the function's third
+  argument should agree with the pointee type of the pointer argument specified
+  by ``ptr_idx``.
+
 For example:
 
 .. code-block:: c++
 
+  typedef int MPI_Datatype;
   int MPI_Send(void *buf, int count, MPI_Datatype datatype /*, other args omitted */)
   __attribute__(( pointer_with_type_tag(mpi,1,3) ));
+  // The function's 3rd argument will be a type tag; this type tag will
+  // determine the expected pointee type of the function's 1st argument.
   }];
 }
 
@@ -1411,70 +1443,107 @@
 def TypeTagForDatatypeDocs : Documentation {
   let Category = DocCatTypeSafety;
   let Content = [{
+When 

[PATCH] D22716: [libunwind] support building shared lib and static lib simultaneously

2016-07-22 Thread Lei Zhang via cfe-commits
zlei created this revision.
zlei added reviewers: rmaprath, EricWF, cfe-commits.

Currently libunwind can be configured to build either shared lib or static lib, 
but not both. Downstream package maintainers may want to build/install shared 
lib and static lib simultaneously, without configuring twice.

This patch enables building static lib along with shared lib.

https://reviews.llvm.org/D22716

Files:
  CMakeLists.txt
  src/CMakeLists.txt

Index: src/CMakeLists.txt
===
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -49,20 +49,12 @@
 ${LIBUNWIND_C_SOURCES}
 ${LIBUNWIND_ASM_SOURCES})
 
-if (LIBUNWIND_ENABLE_SHARED)
-  add_library(unwind SHARED ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS})
-else()
-  add_library(unwind STATIC ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS})
-endif ()
-
 # Generate library list.
 set(libraries ${LIBUNWINDCXX_ABI_LIBRARIES})
 append_if(libraries LIBUNWIND_HAS_C_LIB c)
 append_if(libraries LIBUNWIND_HAS_DL_LIB dl)
 append_if(libraries LIBUNWIND_HAS_PTHREAD_LIB pthread)
 
-target_link_libraries(unwind ${libraries})
-
 # Setup flags.
 append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_FPIC_FLAG -fPIC)
 append_if(LIBUNWIND_CXX_FLAGS LIBUNWIND_HAS_NO_RTTI_FLAG -fno-rtti)
@@ -97,19 +89,40 @@
 string(REPLACE ";" " " LIBUNWIND_C_FLAGS "${LIBUNWIND_C_FLAGS}")
 string(REPLACE ";" " " LIBUNWIND_LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}")
 
-set_target_properties(unwind
-  PROPERTIES
-COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}"
-LINK_FLAGS"${LIBUNWIND_LINK_FLAGS}"
-OUTPUT_NAME   "unwind"
-VERSION   "1.0"
-SOVERSION "1")
 set_property(SOURCE ${LIBUNWIND_CXX_SOURCES}
  APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_CXX_FLAGS} 
${LIBUNWIND_CXX_FLAGS}")
 set_property(SOURCE ${LIBUNWIND_C_SOURCES}
  APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_C_FLAGS} 
${LIBUNWIND_C_FLAGS}")
 
-install(TARGETS unwind
+set(LIBUNWIND_TARGETS)
+
+if (LIBUNWIND_ENABLE_SHARED)
+  add_library(unwind_shared SHARED ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS})
+  target_link_libraries(unwind_shared ${libraries})
+  set_target_properties(unwind_shared
+PROPERTIES
+  COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}"
+  LINK_FLAGS"${LIBUNWIND_LINK_FLAGS}"
+  OUTPUT_NAME   "unwind"
+  VERSION   "1.0"
+  SOVERSION "1")
+  list(APPEND LIBUNWIND_TARGETS "unwind_shared")
+endif ()
+
+if (LIBUNWIND_ENABLE_STATIC)
+  add_library(unwind_static STATIC ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS})
+  target_link_libraries(unwind_static ${libraries})
+  set_target_properties(unwind_static
+PROPERTIES
+  COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}"
+  LINK_FLAGS"${LIBUNWIND_LINK_FLAGS}"
+  OUTPUT_NAME   "unwind")
+  list(APPEND LIBUNWIND_TARGETS "unwind_static")
+endif ()
+
+add_custom_target(unwind DEPENDS ${LIBUNWIND_TARGETS})
+
+install(TARGETS ${LIBUNWIND_TARGETS}
 LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
 ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
 
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -104,6 +104,7 @@
 option(LIBUNWIND_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LIBUNWIND_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
 option(LIBUNWIND_ENABLE_SHARED "Build libunwind as a shared library." ON)
+option(LIBUNWIND_ENABLE_STATIC "Build libunwind as a static library." OFF)
 option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding 
support." OFF)
 option(LIBUNWIND_ENABLE_ARM_WMMX "Enable unwinding support for ARM WMMX 
registers." OFF)
 


Index: src/CMakeLists.txt
===
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -49,20 +49,12 @@
 ${LIBUNWIND_C_SOURCES}
 ${LIBUNWIND_ASM_SOURCES})
 
-if (LIBUNWIND_ENABLE_SHARED)
-  add_library(unwind SHARED ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS})
-else()
-  add_library(unwind STATIC ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS})
-endif ()
-
 # Generate library list.
 set(libraries ${LIBUNWINDCXX_ABI_LIBRARIES})
 append_if(libraries LIBUNWIND_HAS_C_LIB c)
 append_if(libraries LIBUNWIND_HAS_DL_LIB dl)
 append_if(libraries LIBUNWIND_HAS_PTHREAD_LIB pthread)
 
-target_link_libraries(unwind ${libraries})
-
 # Setup flags.
 append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_FPIC_FLAG -fPIC)
 append_if(LIBUNWIND_CXX_FLAGS LIBUNWIND_HAS_NO_RTTI_FLAG -fno-rtti)
@@ -97,19 +89,40 @@
 string(REPLACE ";" " " LIBUNWIND_C_FLAGS "${LIBUNWIND_C_FLAGS}")
 string(REPLACE ";" " " LIBUNWIND_LINK_FLAGS 

[libcxx] r276506 - [libcxx] Diagnose invalid memory order arguments in . Fixes PR21179.

2016-07-22 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jul 22 20:16:55 2016
New Revision: 276506

URL: http://llvm.org/viewvc/llvm-project?rev=276506=rev
Log:
[libcxx] Diagnose invalid memory order arguments in . Fixes PR21179.

Summary:
This patch uses the __attribute__((enable_if)) hack suggested by @rsmith to 
diagnose invalid arguments when possible.

In order to diagnose an invalid argument `m` to `f(m)` we provide an additional 
overload of `f` that is only enabled when `m` is invalid. When that function is 
enabled it uses __attribute__((unavailable)) to produce a diagnostic message.

Reviewers: mclow.lists, rsmith, jfb, EricWF

Subscribers: bcraig, jfb, rsmith, cfe-commits

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

Added:
libcxx/trunk/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp
Modified:
libcxx/trunk/include/atomic

Modified: libcxx/trunk/include/atomic
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/atomic?rev=276506=276505=276506=diff
==
--- libcxx/trunk/include/atomic (original)
+++ libcxx/trunk/include/atomic Fri Jul 22 20:16:55 2016
@@ -560,6 +560,29 @@ void atomic_signal_fence(memory_order m)
 # define __cpp_lib_atomic_is_always_lock_free 201603L
 #endif
 
+
+#if __has_attribute(__enable_if__) && __has_attribute(__unavailable__)
+# define _LIBCPP_CHECK_ATOMIC_MEMORY_ORDER
+# define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \
+__attribute__ ((__enable_if__(__m == memory_order_release \
+   || __m == memory_order_acq_rel, "")))  \
+__attribute__ ((__unavailable__("memory order argument to atomic operation 
is invalid")))
+
+# define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)\
+__attribute__ ((__enable_if__(__m == memory_order_consume \
+   || __m == memory_order_acquire \
+   || __m == memory_order_acq_rel, "")))  \
+__attribute__ ((__unavailable__("memory order argument to atomic operation 
is invalid")))
+
+// Note that this is not checking the 'stronger' requirement.
+// See wg21.link/p0418
+# define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)\
+__attribute__ ((__enable_if__(__f == memory_order_release \
+   || __f == memory_order_acq_rel, "")))  \
+__attribute__ ((__unavailable__("memory order argument to atomic operation 
is invalid")))
+#endif
+
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 typedef enum memory_order
@@ -933,6 +956,21 @@ struct __atomic_base  // false
 bool compare_exchange_strong(_Tp& __e, _Tp __d,
  memory_order __m = memory_order_seq_cst) 
_NOEXCEPT
 {return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, 
__m);}
+#if defined(_LIBCPP_CHECK_ATOMIC_MEMORY_ORDER)
+void store(_Tp __d, memory_order __m) volatile 
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m);
+void store(_Tp __d, memory_order __m) 
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m);
+
+_Tp load(memory_order __m) const volatile 
_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m);
+_Tp load(memory_order __m) const _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m);
+bool compare_exchange_weak(_Tp&, _Tp, memory_order __s, memory_order __f) 
volatile
+_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f);
+bool compare_exchange_weak(_Tp&, _Tp, memory_order __s, memory_order __f)
+_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f);
+bool compare_exchange_strong(_Tp&, _Tp, memory_order __s, memory_order 
__f) volatile
+_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f);
+bool compare_exchange_strong(_Tp&, _Tp, memory_order __s, memory_order __f)
+_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f);
+#endif
 
 _LIBCPP_INLINE_VISIBILITY
 #ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -1344,6 +1382,46 @@ atomic_compare_exchange_strong_explicit(
 return __o->compare_exchange_strong(*__e, __d, __s, __f);
 }
 
+
+#ifdef _LIBCPP_CHECK_ATOMIC_MEMORY_ORDER
+template 
+void atomic_store_explicit(volatile atomic<_Tp>*, _Tp, memory_order __m)
+_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m);
+
+template 
+void atomic_store_explicit(atomic<_Tp>*, _Tp, memory_order __m)
+_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m);
+
+template 
+_Tp atomic_load_explicit(const volatile atomic<_Tp>*, memory_order __m)
+_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m);
+
+template 
+_Tp atomic_load_explicit(const atomic<_Tp>*, memory_order __m)
+_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m);
+
+template 
+bool atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>*, _Tp*, _Tp,
+   memory_order __s, memory_order __f)
+_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f);
+
+template 
+bool atomic_compare_exchange_weak_explicit(atomic<_Tp>*, _Tp*, _Tp,
+   memory_order __s, 

[PATCH] D22712: Remove FileEntry copy-constructor

2016-07-22 Thread Alexander Shaposhnikov via cfe-commits
alexshap created this revision.
alexshap added reviewers: bkramer, jdennett.
alexshap added subscribers: compnerd, cfe-commits.
alexshap changed the visibility of this Differential Revision from "Public (No 
Login Required)" to "All Users".

Code cleanup: address FIXME in 
llvm/tools/clang/include/clang/Basic/FileManager.h.
Remove FileEntry copy-constructor. Build of llvm, clang succeeded, make 
check-all succeeded.

https://reviews.llvm.org/D22712

Files:
  include/clang/Basic/FileManager.h

Index: include/clang/Basic/FileManager.h
===
--- include/clang/Basic/FileManager.h
+++ include/clang/Basic/FileManager.h
@@ -66,6 +66,7 @@
   mutable std::unique_ptr File;
   friend class FileManager;
 
+  FileEntry(const FileEntry &) = delete;
   void operator=(const FileEntry &) = delete;
 
 public:
@@ -73,15 +74,6 @@
   : UniqueID(0, 0), IsNamedPipe(false), InPCH(false), IsValid(false)
   {}
 
-  // FIXME: this is here to allow putting FileEntry in std::map.  Once we have
-  // emplace, we shouldn't need a copy constructor anymore.
-  /// Intentionally does not copy fields that are not set in an uninitialized
-  /// \c FileEntry.
-  FileEntry(const FileEntry ) : UniqueID(FE.UniqueID),
-  IsNamedPipe(FE.IsNamedPipe), InPCH(FE.InPCH), IsValid(FE.IsValid) {
-assert(!isValid() && "Cannot copy an initialized FileEntry");
-  }
-
   const char *getName() const { return Name; }
   StringRef tryGetRealPathName() const { return RealPathName; }
   bool isValid() const { return IsValid; }


Index: include/clang/Basic/FileManager.h
===
--- include/clang/Basic/FileManager.h
+++ include/clang/Basic/FileManager.h
@@ -66,6 +66,7 @@
   mutable std::unique_ptr File;
   friend class FileManager;
 
+  FileEntry(const FileEntry &) = delete;
   void operator=(const FileEntry &) = delete;
 
 public:
@@ -73,15 +74,6 @@
   : UniqueID(0, 0), IsNamedPipe(false), InPCH(false), IsValid(false)
   {}
 
-  // FIXME: this is here to allow putting FileEntry in std::map.  Once we have
-  // emplace, we shouldn't need a copy constructor anymore.
-  /// Intentionally does not copy fields that are not set in an uninitialized
-  /// \c FileEntry.
-  FileEntry(const FileEntry ) : UniqueID(FE.UniqueID),
-  IsNamedPipe(FE.IsNamedPipe), InPCH(FE.InPCH), IsValid(FE.IsValid) {
-assert(!isValid() && "Cannot copy an initialized FileEntry");
-  }
-
   const char *getName() const { return Name; }
   StringRef tryGetRealPathName() const { return RealPathName; }
   bool isValid() const { return IsValid; }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D22711: Diagnose invalid failure memory orderings.

2016-07-22 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: majnemer, jfb, rsmith.
EricWF added a subscriber: cfe-commits.

Clang currently issues diagnostics if the success memory order argument is 
invalid, but it doesn't check the failure ordering argument for cmpxchg atomic 
operations.
This patch adds diagnostics if the failure ordering is either 
`memory_order_release` or `memory_order_acq_rel`.

https://reviews.llvm.org/D22711

Files:
  lib/Sema/SemaChecking.cpp
  test/Sema/atomic-ops.c

Index: test/Sema/atomic-ops.c
===
--- test/Sema/atomic-ops.c
+++ test/Sema/atomic-ops.c
@@ -355,13 +355,27 @@
   (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_acq_rel, memory_order_relaxed);
   (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_seq_cst, memory_order_relaxed);
 
+  (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_seq_cst, memory_order_relaxed);
+  (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_seq_cst, memory_order_acquire);
+  (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_seq_cst, memory_order_consume);
+  (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_seq_cst, memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+  (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_seq_cst, memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+  (void)__c11_atomic_compare_exchange_strong(Ap, p, val, memory_order_seq_cst, memory_order_seq_cst);
+
   (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_relaxed, memory_order_relaxed);
   (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_acquire, memory_order_relaxed);
   (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_consume, memory_order_relaxed);
   (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_release, memory_order_relaxed);
   (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_acq_rel, memory_order_relaxed);
   (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_seq_cst, memory_order_relaxed);
 
+  (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_seq_cst, memory_order_relaxed);
+  (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_seq_cst, memory_order_acquire);
+  (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_seq_cst, memory_order_consume);
+  (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_seq_cst, memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+  (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_seq_cst, memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+  (void)__c11_atomic_compare_exchange_weak(Ap, p, val, memory_order_seq_cst, memory_order_seq_cst);
+
   (void)__atomic_load_n(p, memory_order_relaxed);
   (void)__atomic_load_n(p, memory_order_acquire);
   (void)__atomic_load_n(p, memory_order_consume);
@@ -495,12 +509,26 @@
   (void)__atomic_compare_exchange(p, p, p, 0, memory_order_acq_rel, memory_order_relaxed);
   (void)__atomic_compare_exchange(p, p, p, 0, memory_order_seq_cst, memory_order_relaxed);
 
+  (void)__atomic_compare_exchange(p, p, p, 0, memory_order_seq_cst, memory_order_relaxed);
+  (void)__atomic_compare_exchange(p, p, p, 0, memory_order_seq_cst, memory_order_acquire);
+  (void)__atomic_compare_exchange(p, p, p, 0, memory_order_seq_cst, memory_order_consume);
+  (void)__atomic_compare_exchange(p, p, p, 0, memory_order_seq_cst, memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+  (void)__atomic_compare_exchange(p, p, p, 0, memory_order_seq_cst, memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+  (void)__atomic_compare_exchange(p, p, p, 0, memory_order_seq_cst, memory_order_seq_cst);
+
   (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_relaxed, memory_order_relaxed);
   (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_acquire, memory_order_relaxed);
   (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_consume, memory_order_relaxed);
   (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_release, memory_order_relaxed);
   (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_acq_rel, memory_order_relaxed);
   (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_seq_cst, memory_order_relaxed);
+
+  (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_seq_cst, memory_order_relaxed);
+  (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_seq_cst, memory_order_acquire);
+  (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_seq_cst, memory_order_consume);
+  (void)__atomic_compare_exchange_n(p, p, 

Re: [PATCH] D22557: [libcxx] Diagnose invalid memory order arguments in . Fixes PR21179.

2016-07-22 Thread JF Bastien via cfe-commits
On Jul 22, 2016 4:45 PM, "Eric Fiselier"  wrote:
>
> EricWF added inline comments.
>
> 
> Comment at: test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp:87
> @@ +86,3 @@
> +x.compare_exchange_weak(val1, val2, std::memory_order_release);
> +}
> +{
> 
> jfb wrote:
> > That's not quite true: the failure ordering is auto-deduced from the
success one, but it's not necessarily the same! The spec says all success
is valid, so the auto-mapping has to ensure that all failures are also
valid. That's what I'm trying to have you test: that the auto-mapping is
always valid as well.
> Right, but the auto-mapping is done once we have entered the
`compare_exchange_weak` function, These diagnostics are triggered within
the function signature. So even if we got the auto mapping wrong this test
would not be able to diagnose it.
>
> I agree we should be testing the auto-mapping, but I don't think this
test is the right place to do it.

Ah ok, that's good with me then.

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


r276499 - Add doxygen comments to emmintrin.h's intrinsics.

2016-07-22 Thread Ekaterina Romanova via cfe-commits
Author: kromanova
Date: Fri Jul 22 18:49:37 2016
New Revision: 276499

URL: http://llvm.org/viewvc/llvm-project?rev=276499=rev
Log:
Add doxygen comments to emmintrin.h's intrinsics.

Only around 50% of the intrinsics in this file are documented now. The patches 
for the rest of the intrisics in this file will be send out later.

The doxygen comments are automatically generated based on Sony's intrinsics docu
ment.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream. This patch was internally reviewed by Paul Robinson.


Modified:
cfe/trunk/lib/Headers/emmintrin.h

Modified: cfe/trunk/lib/Headers/emmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/emmintrin.h?rev=276499=276498=276499=diff
==
--- cfe/trunk/lib/Headers/emmintrin.h (original)
+++ cfe/trunk/lib/Headers/emmintrin.h Fri Jul 22 18:49:37 2016
@@ -2154,42 +2154,169 @@ _mm_set1_epi8(char __b)
   return (__m128i)(__v16qi){ __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, 
__b, __b, __b, __b, __b, __b };
 }
 
+/// \brief Constructs a 128-bit integer vector, initialized in reverse order
+/// with the specified 64-bit integral values.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VPUNPCKLQDQ / PUNPCKLQDQ instruction.
+///
+/// \param __q0
+///A 64-bit integral value used to initialize the lower 64 bits of the
+///result.
+/// \param __q1
+///A 64-bit integral value used to initialize the upper 64 bits of the
+///result.
+/// \returns An initialized 128-bit integer vector.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_setr_epi64(__m64 __q0, __m64 __q1)
 {
   return (__m128i){ (long long)__q0, (long long)__q1 };
 }
 
+/// \brief Constructs a 128-bit integer vector, initialized in reverse order
+/// with the specified 32-bit integral values.
+///
+/// \headerfile 
+///
+/// This intrinsic is a utility function and does not correspond to a specific
+///instruction.
+///
+/// \param __i0
+///A 32-bit integral value used to initialize bits [31:0] of the result.
+/// \param __i1
+///A 32-bit integral value used to initialize bits [63:32] of the result.
+/// \param __i2
+///A 32-bit integral value used to initialize bits [95:64] of the result.
+/// \param __i3
+///A 32-bit integral value used to initialize bits [127:96] of the result.
+/// \returns An initialized 128-bit integer vector.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_setr_epi32(int __i0, int __i1, int __i2, int __i3)
 {
   return (__m128i)(__v4si){ __i0, __i1, __i2, __i3};
 }
 
+/// \brief Constructs a 128-bit integer vector, initialized in reverse order
+/// with the specified 16-bit integral values.
+///
+/// \headerfile 
+///
+/// This intrinsic is a utility function and does not correspond to a specific
+///instruction.
+///
+/// \param __w0
+///A 16-bit integral value used to initialize bits [15:0] of the result.
+/// \param __w1
+///A 16-bit integral value used to initialize bits [31:16] of the result.
+/// \param __w2
+///A 16-bit integral value used to initialize bits [47:32] of the result.
+/// \param __w3
+///A 16-bit integral value used to initialize bits [63:48] of the result.
+/// \param __w4
+///A 16-bit integral value used to initialize bits [79:64] of the result.
+/// \param __w5
+///A 16-bit integral value used to initialize bits [95:80] of the result.
+/// \param __w6
+///A 16-bit integral value used to initialize bits [111:96] of the result.
+/// \param __w7
+///A 16-bit integral value used to initialize bits [127:112] of the result.
+/// \returns An initialized 128-bit integer vector.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
 _mm_setr_epi16(short __w0, short __w1, short __w2, short __w3, short __w4, 
short __w5, short __w6, short __w7)
 {
   return (__m128i)(__v8hi){ __w0, __w1, __w2, __w3, __w4, __w5, __w6, __w7 };
 }
 
+/// \brief Constructs a 128-bit integer vector, initialized in reverse order
+/// with the specified 8-bit integral values.
+///
+/// \headerfile 
+///
+/// This intrinsic is a utility function and does not correspond to a specific
+///instruction.
+///
+/// \param __b0
+///An 8-bit integral value used to initialize bits [7:0] of the result.
+/// \param __b1
+///An 8-bit integral value used to initialize bits [15:8] of the result.
+/// \param __b2
+///An 8-bit integral value used to initialize bits [23:16] of the result.
+/// \param __b3
+///An 8-bit integral value used to initialize bits [31:24] of the result.
+/// \param __b4
+///An 8-bit integral value used to initialize bits [39:32] of the result.
+/// \param __b5
+///An 8-bit integral value used to initialize bits [47:40] of the result.
+/// \param __b6
+///An 8-bit integral value used to initialize bits [55:48] of the result.
+/// \param __b7
+///An 8-bit integral value used to initialize bits 

[libclc] r276497 - Implement cbrt builtin

2016-07-22 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Fri Jul 22 18:45:15 2016
New Revision: 276497

URL: http://llvm.org/viewvc/llvm-project?rev=276497=rev
Log:
Implement cbrt builtin

This implementation was ported from the AMD builtin library
and has been tested with piglit, OpenCV, and the ocl conformance tests.

Added:
libclc/trunk/generic/include/clc/math/cbrt.h
  - copied, changed from r276496, libclc/trunk/generic/lib/math/tables.h
libclc/trunk/generic/include/clc/math/cbrt.inc
  - copied, changed from r276496, libclc/trunk/generic/lib/math/tables.h
libclc/trunk/generic/lib/math/cbrt.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES
libclc/trunk/generic/lib/math/tables.cl
libclc/trunk/generic/lib/math/tables.h

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=276497=276496=276497=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Jul 22 18:45:15 2016
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Copied: libclc/trunk/generic/include/clc/math/cbrt.h (from r276496, 
libclc/trunk/generic/lib/math/tables.h)
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/cbrt.h?p2=libclc/trunk/generic/include/clc/math/cbrt.h=libclc/trunk/generic/lib/math/tables.h=276496=276497=276497=diff
==
--- libclc/trunk/generic/lib/math/tables.h (original)
+++ libclc/trunk/generic/include/clc/math/cbrt.h Fri Jul 22 18:45:15 2016
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Advanced Micro Devices, Inc.
+ * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to 
deal
@@ -20,38 +20,5 @@
  * THE SOFTWARE.
  */
 
-#define TABLE_SPACE __constant
-
-#define TABLE_MANGLE(NAME) __clc_##NAME
-
-#define DECLARE_TABLE(TYPE,NAME,LENGTH) \
-TABLE_SPACE TYPE NAME [ LENGTH ]
-
-#define TABLE_FUNCTION(TYPE,TABLE,NAME) \
-TYPE TABLE_MANGLE(NAME)(size_t idx) { \
-return TABLE[idx]; \
-}
-
-#define TABLE_FUNCTION_DECL(TYPE, NAME) \
-TYPE TABLE_MANGLE(NAME)(size_t idx);
-
-#define USE_TABLE(NAME, IDX) \
-TABLE_MANGLE(NAME)(IDX)
-
-TABLE_FUNCTION_DECL(float2, loge_tbl);
-TABLE_FUNCTION_DECL(float, log_inv_tbl);
-TABLE_FUNCTION_DECL(float2, log2_tbl);
-TABLE_FUNCTION_DECL(uint4,  pibits_tbl);
-TABLE_FUNCTION_DECL(float2, sinhcosh_tbl);
-
-#ifdef cl_khr_fp64
-
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-
-TABLE_FUNCTION_DECL(double2, ln_tbl);
-TABLE_FUNCTION_DECL(double2, atan_jby256_tbl);
-TABLE_FUNCTION_DECL(double2, two_to_jby64_ep_tbl);
-TABLE_FUNCTION_DECL(double2, sinh_tbl);
-TABLE_FUNCTION_DECL(double2, cosh_tbl);
-
-#endif // cl_khr_fp64
+#define __CLC_BODY 
+#include 

Copied: libclc/trunk/generic/include/clc/math/cbrt.inc (from r276496, 
libclc/trunk/generic/lib/math/tables.h)
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/cbrt.inc?p2=libclc/trunk/generic/include/clc/math/cbrt.inc=libclc/trunk/generic/lib/math/tables.h=276496=276497=276497=diff
==
--- libclc/trunk/generic/lib/math/tables.h (original)
+++ libclc/trunk/generic/include/clc/math/cbrt.inc Fri Jul 22 18:45:15 2016
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Advanced Micro Devices, Inc.
+ * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to 
deal
@@ -20,38 +20,4 @@
  * THE SOFTWARE.
  */
 
-#define TABLE_SPACE __constant
-
-#define TABLE_MANGLE(NAME) __clc_##NAME
-
-#define DECLARE_TABLE(TYPE,NAME,LENGTH) \
-TABLE_SPACE TYPE NAME [ LENGTH ]
-
-#define TABLE_FUNCTION(TYPE,TABLE,NAME) \
-TYPE TABLE_MANGLE(NAME)(size_t idx) { \
-return TABLE[idx]; \
-}
-
-#define TABLE_FUNCTION_DECL(TYPE, NAME) \
-TYPE TABLE_MANGLE(NAME)(size_t idx);
-
-#define USE_TABLE(NAME, IDX) \
-TABLE_MANGLE(NAME)(IDX)
-
-TABLE_FUNCTION_DECL(float2, loge_tbl);
-TABLE_FUNCTION_DECL(float, log_inv_tbl);
-TABLE_FUNCTION_DECL(float2, log2_tbl);
-TABLE_FUNCTION_DECL(uint4,  pibits_tbl);
-TABLE_FUNCTION_DECL(float2, sinhcosh_tbl);
-
-#ifdef cl_khr_fp64
-
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-
-TABLE_FUNCTION_DECL(double2, ln_tbl);
-TABLE_FUNCTION_DECL(double2, atan_jby256_tbl);
-TABLE_FUNCTION_DECL(double2, two_to_jby64_ep_tbl);
-TABLE_FUNCTION_DECL(double2, sinh_tbl);
-TABLE_FUNCTION_DECL(double2, cosh_tbl);
-
-#endif // cl_khr_fp64
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE cbrt(__CLC_GENTYPE x);

Modified: 

[libclc] r276495 - geometric/floatn.inc: Add vec8 and vec16 types

2016-07-22 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Fri Jul 22 18:45:11 2016
New Revision: 276495

URL: http://llvm.org/viewvc/llvm-project?rev=276495=rev
Log:
geometric/floatn.inc: Add vec8 and vec16 types

Modified:
libclc/trunk/generic/include/clc/geometric/floatn.inc

Modified: libclc/trunk/generic/include/clc/geometric/floatn.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/geometric/floatn.inc?rev=276495=276494=276495=diff
==
--- libclc/trunk/generic/include/clc/geometric/floatn.inc (original)
+++ libclc/trunk/generic/include/clc/geometric/floatn.inc Fri Jul 22 18:45:11 
2016
@@ -19,6 +19,14 @@
 #include __CLC_BODY
 #undef __CLC_FLOATN
 
+#define __CLC_FLOATN float8
+#include __CLC_BODY
+#undef __CLC_FLOATN
+
+#define __CLC_FLOATN float16
+#include __CLC_BODY
+#undef __CLC_FLOATN
+
 #undef __CLC_FLOAT
 #undef __CLC_FPSIZE
 
@@ -46,6 +54,14 @@
 #include __CLC_BODY
 #undef __CLC_FLOATN
 
+#define __CLC_FLOATN double8
+#include __CLC_BODY
+#undef __CLC_FLOATN
+
+#define __CLC_FLOATN double16
+#include __CLC_BODY
+#undef __CLC_FLOATN
+
 #undef __CLC_FLOAT
 #undef __CLC_FPSIZE
 


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


[libclc] r276496 - Implement cosh builtin

2016-07-22 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Fri Jul 22 18:45:13 2016
New Revision: 276496

URL: http://llvm.org/viewvc/llvm-project?rev=276496=rev
Log:
Implement cosh builtin

This implementation was ported from the AMD builtin library
and has been tested with piglit, OpenCV, and the ocl conformance tests.

Added:
libclc/trunk/generic/include/clc/math/cosh.h
  - copied, changed from r276495, libclc/trunk/generic/lib/math/tables.h
libclc/trunk/generic/include/clc/math/cosh.inc
  - copied, changed from r276495, libclc/trunk/generic/lib/math/tables.h
libclc/trunk/generic/lib/math/cosh.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES
libclc/trunk/generic/lib/math/tables.cl
libclc/trunk/generic/lib/math/tables.h

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=276496=276495=276496=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Jul 22 18:45:13 2016
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Copied: libclc/trunk/generic/include/clc/math/cosh.h (from r276495, 
libclc/trunk/generic/lib/math/tables.h)
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/cosh.h?p2=libclc/trunk/generic/include/clc/math/cosh.h=libclc/trunk/generic/lib/math/tables.h=276495=276496=276496=diff
==
--- libclc/trunk/generic/lib/math/tables.h (original)
+++ libclc/trunk/generic/include/clc/math/cosh.h Fri Jul 22 18:45:13 2016
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Advanced Micro Devices, Inc.
+ * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to 
deal
@@ -20,34 +20,5 @@
  * THE SOFTWARE.
  */
 
-#define TABLE_SPACE __constant
-
-#define TABLE_MANGLE(NAME) __clc_##NAME
-
-#define DECLARE_TABLE(TYPE,NAME,LENGTH) \
-TABLE_SPACE TYPE NAME [ LENGTH ]
-
-#define TABLE_FUNCTION(TYPE,TABLE,NAME) \
-TYPE TABLE_MANGLE(NAME)(size_t idx) { \
-return TABLE[idx]; \
-}
-
-#define TABLE_FUNCTION_DECL(TYPE, NAME) \
-TYPE TABLE_MANGLE(NAME)(size_t idx);
-
-#define USE_TABLE(NAME, IDX) \
-TABLE_MANGLE(NAME)(IDX)
-
-TABLE_FUNCTION_DECL(float2, loge_tbl);
-TABLE_FUNCTION_DECL(float, log_inv_tbl);
-TABLE_FUNCTION_DECL(float2, log2_tbl);
-TABLE_FUNCTION_DECL(uint4,  pibits_tbl);
-
-#ifdef cl_khr_fp64
-
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-
-TABLE_FUNCTION_DECL(double2, ln_tbl);
-TABLE_FUNCTION_DECL(double2, atan_jby256_tbl);
-TABLE_FUNCTION_DECL(double2, two_to_jby64_ep_tbl);
-#endif // cl_khr_fp64
+#define __CLC_BODY 
+#include 

Copied: libclc/trunk/generic/include/clc/math/cosh.inc (from r276495, 
libclc/trunk/generic/lib/math/tables.h)
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/cosh.inc?p2=libclc/trunk/generic/include/clc/math/cosh.inc=libclc/trunk/generic/lib/math/tables.h=276495=276496=276496=diff
==
--- libclc/trunk/generic/lib/math/tables.h (original)
+++ libclc/trunk/generic/include/clc/math/cosh.inc Fri Jul 22 18:45:13 2016
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Advanced Micro Devices, Inc.
+ * Copyright (c) 2014, 2015 Advanced Micro Devices, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to 
deal
@@ -20,34 +20,4 @@
  * THE SOFTWARE.
  */
 
-#define TABLE_SPACE __constant
-
-#define TABLE_MANGLE(NAME) __clc_##NAME
-
-#define DECLARE_TABLE(TYPE,NAME,LENGTH) \
-TABLE_SPACE TYPE NAME [ LENGTH ]
-
-#define TABLE_FUNCTION(TYPE,TABLE,NAME) \
-TYPE TABLE_MANGLE(NAME)(size_t idx) { \
-return TABLE[idx]; \
-}
-
-#define TABLE_FUNCTION_DECL(TYPE, NAME) \
-TYPE TABLE_MANGLE(NAME)(size_t idx);
-
-#define USE_TABLE(NAME, IDX) \
-TABLE_MANGLE(NAME)(IDX)
-
-TABLE_FUNCTION_DECL(float2, loge_tbl);
-TABLE_FUNCTION_DECL(float, log_inv_tbl);
-TABLE_FUNCTION_DECL(float2, log2_tbl);
-TABLE_FUNCTION_DECL(uint4,  pibits_tbl);
-
-#ifdef cl_khr_fp64
-
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-
-TABLE_FUNCTION_DECL(double2, ln_tbl);
-TABLE_FUNCTION_DECL(double2, atan_jby256_tbl);
-TABLE_FUNCTION_DECL(double2, two_to_jby64_ep_tbl);
-#endif // cl_khr_fp64
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE cosh(__CLC_GENTYPE x);

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=276496=276495=276496=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ 

Re: [PATCH] D22557: [libcxx] Diagnose invalid memory order arguments in . Fixes PR21179.

2016-07-22 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.


Comment at: test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp:87
@@ +86,3 @@
+x.compare_exchange_weak(val1, val2, std::memory_order_release);
+}
+{

jfb wrote:
> That's not quite true: the failure ordering is auto-deduced from the success 
> one, but it's not necessarily the same! The spec says all success is valid, 
> so the auto-mapping has to ensure that all failures are also valid. That's 
> what I'm trying to have you test: that the auto-mapping is always valid as 
> well.
Right, but the auto-mapping is done once we have entered the 
`compare_exchange_weak` function, These diagnostics are triggered within the 
function signature. So even if we got the auto mapping wrong this test would 
not be able to diagnose it.

I agree we should be testing the auto-mapping, but I don't think this test is 
the right place to do it.


https://reviews.llvm.org/D22557



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


r276492 - P0217R3: Parsing support and framework for AST representation of C++1z

2016-07-22 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Jul 22 18:36:59 2016
New Revision: 276492

URL: http://llvm.org/viewvc/llvm-project?rev=276492=rev
Log:
P0217R3: Parsing support and framework for AST representation of C++1z
decomposition declarations.

There are a couple of things in the wording that seem strange here:
decomposition declarations are permitted at namespace scope (which we partially
support here) and they are permitted as the declaration in a template (which we
reject).

Added:
cfe/trunk/test/Parser/cxx1z-decomposition.cpp
cfe/trunk/test/SemaCXX/cxx1z-decomposition.cpp
Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/DeclNodes.td
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Serialization/ASTCommon.cpp
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=276492=276491=276492=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Fri Jul 22 18:36:59 2016
@@ -139,7 +139,6 @@ public:
   static bool classofKind(Kind K) { return K == AccessSpec; }
 };
 
-
 /// \brief Represents a base class of a C++ class.
 ///
 /// Each CXXBaseSpecifier represents a single, direct base class (or
@@ -3366,6 +3365,95 @@ public:
   friend class ASTDeclReader;
 };
 
+/// A binding in a decomposition declaration. For instance, given:
+///
+///   int n[3];
+///   auto &[a, b, c] = n;
+///
+/// a, b, and c are BindingDecls, whose bindings are the expressions
+/// x[0], x[1], and x[2] respectively, where x is the implicit
+/// DecompositionDecl of type 'int (&)[3]'.
+class BindingDecl : public ValueDecl {
+  void anchor() override;
+
+  /// The binding represented by this declaration. References to this
+  /// declaration are effectively equivalent to this expression (except
+  /// that it is only evaluated once at the point of declaration of the
+  /// binding).
+  Expr *Binding;
+
+  BindingDecl(DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id)
+  : ValueDecl(Decl::Binding, DC, IdLoc, Id, QualType()), Binding(nullptr) 
{}
+
+public:
+  static BindingDecl *Create(ASTContext , DeclContext *DC,
+ SourceLocation IdLoc, IdentifierInfo *Id);
+  static BindingDecl *CreateDeserialized(ASTContext , unsigned ID);
+
+  /// Get the expression to which this declaration is bound. This may be null
+  /// in two different cases: while parsing the initializer for the
+  /// decomposition declaration, and when the initializer is type-dependent.
+  Expr *getBinding() const { return Binding; }
+
+  /// Set the binding for this BindingDecl, along with its declared type (which
+  /// should be a possibly-cv-qualified form of the type of the binding, or a
+  /// reference to such a type).
+  void setBinding(QualType DeclaredType, Expr *Binding) {
+setType(DeclaredType);
+this->Binding = Binding;
+  }
+
+  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
+  static bool classofKind(Kind K) { return K == Decl::Binding; }
+};
+
+/// A decomposition declaration. For instance, given:
+///
+///   int n[3];
+///   auto &[a, b, c] = n;
+///
+/// the second line declares a DecompositionDecl of type 'int (&)[3]', and
+/// three BindingDecls (named a, b, and c). An instance of this class is always
+/// unnamed, but behaves in almost all other respects like a VarDecl.
+class DecompositionDecl final
+: public VarDecl,
+  private llvm::TrailingObjects {
+  void anchor() override;
+
+  /// The number of BindingDecl*s following this object.
+  unsigned NumBindings;
+
+  DecompositionDecl(ASTContext , DeclContext *DC, SourceLocation StartLoc,
+SourceLocation LSquareLoc, QualType T,
+TypeSourceInfo *TInfo, StorageClass SC,
+ArrayRef Bindings)
+  : VarDecl(Decomposition, C, DC, StartLoc, LSquareLoc, nullptr, T, TInfo,
+SC),
+NumBindings(Bindings.size()) {
+

Re: [PATCH] D22557: [libcxx] Diagnose invalid memory order arguments in . Fixes PR21179.

2016-07-22 Thread JF Bastien via cfe-commits
jfb added inline comments.


Comment at: test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp:87
@@ +86,3 @@
+x.compare_exchange_weak(val1, val2, std::memory_order_release);
+}
+{

That's not quite true: the failure ordering is auto-deduced from the success 
one, but it's not necessarily the same! The spec says all success is valid, so 
the auto-mapping has to ensure that all failures are also valid. That's what 
I'm trying to have you test: that the auto-mapping is always valid as well.


https://reviews.llvm.org/D22557



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


Re: r276232 - [Sema] Fix PR28623.

2016-07-22 Thread George Burgess IV via cfe-commits
r276489. Thanks!

On Fri, Jul 22, 2016 at 3:17 PM, Richard Smith 
wrote:

> On Fri, Jul 22, 2016 at 3:15 PM, George Burgess IV <
> george.burgess...@gmail.com> wrote:
>
>> (Assuming "yes" :) )
>>
>> Richard, are you okay with this being merged into 3.9?
>>
>
> Yes, LGTM for 3.9.
>
>
>> On Fri, Jul 22, 2016 at 9:54 AM, George Burgess IV <
>> george.burgess...@gmail.com> wrote:
>>
>>> Error message says r272936 had the error, so it looks like it would,
>>> yeah. :)
>>>
>>> Would you like me to merge it to the 3.9 branch?
>>>
>>> On Fri, Jul 22, 2016 at 6:51 AM, Hans Wennborg 
>>> wrote:
>>>
 Does this apply to 3.9?

 On Wed, Jul 20, 2016 at 11:28 PM, George Burgess IV via cfe-commits
  wrote:
 > Author: gbiv
 > Date: Wed Jul 20 22:28:13 2016
 > New Revision: 276232
 >
 > URL: http://llvm.org/viewvc/llvm-project?rev=276232=rev
 > Log:
 > [Sema] Fix PR28623.
 >
 > In atomic builtins, we assumed that the LValue conversion on the first
 > argument would succeed. So, we would crash given code like:
 >
 > ```
 > void ovl(char);
 > void ovl(int);
 > __atomic_store_n(ovl, 0, 0);
 > ```
 >
 > This patch makes us not assume that said conversion is successful. :)
 >
 > Added:
 > cfe/trunk/test/SemaCXX/atomic-ops.cpp
 > Modified:
 > cfe/trunk/lib/Sema/SemaChecking.cpp
 >
 > Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
 > URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=276232=276231=276232=diff
 >
 ==
 > --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
 > +++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Jul 20 22:28:13 2016
 > @@ -2398,7 +2398,11 @@ ExprResult Sema::SemaAtomicOpsOverloaded
 >
 >// Inspect the first argument of the atomic operation.
 >Expr *Ptr = TheCall->getArg(0);
 > -  Ptr = DefaultFunctionArrayLvalueConversion(Ptr).get();
 > +  ExprResult ConvertedPtr =
 DefaultFunctionArrayLvalueConversion(Ptr);
 > +  if (ConvertedPtr.isInvalid())
 > +return ExprError();
 > +
 > +  Ptr = ConvertedPtr.get();
 >const PointerType *pointerType =
 Ptr->getType()->getAs();
 >if (!pointerType) {
 >  Diag(DRE->getLocStart(),
 diag::err_atomic_builtin_must_be_pointer)
 >
 > Added: cfe/trunk/test/SemaCXX/atomic-ops.cpp
 > URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/atomic-ops.cpp?rev=276232=auto
 >
 ==
 > --- cfe/trunk/test/SemaCXX/atomic-ops.cpp (added)
 > +++ cfe/trunk/test/SemaCXX/atomic-ops.cpp Wed Jul 20 22:28:13 2016
 > @@ -0,0 +1,9 @@
 > +// RUN: %clang_cc1 %s -verify -fsyntax-only -triple=i686-linux-gnu
 -std=c++11
 > +
 > +// We crashed when we couldn't properly convert the first arg of
 __atomic_* to
 > +// an lvalue.
 > +void PR28623() {
 > +  void helper(int); // expected-note{{target}}
 > +  void helper(char); // expected-note{{target}}
 > +  __atomic_store_n(helper, 0, 0); // expected-error{{reference to
 overloaded function could not be resolved}}
 > +}
 >
 >
 > ___
 > cfe-commits mailing list
 > cfe-commits@lists.llvm.org
 > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


Re: [PATCH] D17820: Clang Code Completion Filtering

2016-07-22 Thread Argyrios Kyrtzidis via cfe-commits
akyrtzi added a comment.

Thanks for making the changes; I'd recommend to go ahead and commit and we can 
iterate post-commit if necessary.


Repository:
  rL LLVM

https://reviews.llvm.org/D17820



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


r276484 - [Profile] Enable profile merging with -fprofile-generat[=]

2016-07-22 Thread Xinliang David Li via cfe-commits
Author: davidxl
Date: Fri Jul 22 17:25:01 2016
New Revision: 276484

URL: http://llvm.org/viewvc/llvm-project?rev=276484=rev
Log:
[Profile] Enable profile merging with -fprofile-generat[=]

This patch enables raw profile merging for this option which is the
new intended behavior.



Modified:
cfe/trunk/docs/UsersManual.rst
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/clang_f_opts.c
cfe/trunk/test/Profile/gcc-flag-compatibility.c

Modified: cfe/trunk/docs/UsersManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=276484=276483=276484=diff
==
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Fri Jul 22 17:25:01 2016
@@ -1546,27 +1546,31 @@ profile creation and use.
   The ``-fprofile-generate`` and ``-fprofile-generate=`` flags will use
   an alterantive instrumentation method for profile generation. When
   given a directory name, it generates the profile file
-  ``default.profraw`` in the directory named ``dirname``. If ``dirname``
-  does not exist, it will be created at runtime. The environment variable
-  ``LLVM_PROFILE_FILE`` can be used to override the directory and
-  filename for the profile file at runtime. For example,
+  ``default_%m.profraw`` in the directory named ``dirname`` if specified.
+  If ``dirname`` does not exist, it will be created at runtime. ``%m`` 
specifier
+  will be substibuted with a unique id documented in step 2 above. In other 
words,
+  with ``-fprofile-generate[=]`` option, the "raw" profile data 
automatic
+  merging is turned on by default, so there will no longer any risk of profile
+  clobbering from different running processes.  For example,
 
   .. code-block:: console
 
 $ clang++ -O2 -fprofile-generate=yyy/zzz code.cc -o code
 
   When ``code`` is executed, the profile will be written to the file
-  ``yyy/zzz/default.profraw``. This can be altered at runtime via the
-  ``LLVM_PROFILE_FILE`` environment variable:
+  ``yyy/zzz/default_.profraw``.
 
-  .. code-block:: console
+  To generate the profile data file with the compiler readable format, the 
+  ``llvm-profdata`` tool can be used with the profile directory as the input:
+
+   .. code-block:: console
 
-$ LLVM_PROFILE_FILE=/tmp/myprofile/code.profraw ./code
+ $ llvm-profdata merge -output=code.profdata yyy/zzz/
 
-  The above invocation will produce the profile file
-  ``/tmp/myprofile/code.profraw`` instead of ``yyy/zzz/default.profraw``.
-  Notice that ``LLVM_PROFILE_FILE`` overrides the directory *and* the file
-  name for the profile file.
+ If the user wants to turn off the auto-merging feature, or simply override the
+ the profile dumping path specified at command line, the environment variable
+ ``LLVM_PROFILE_FILE`` can still be used to override
+ the directory and filename for the profile file at runtime.
 
 .. option:: -fprofile-use[=]
 

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=276484=276483=276484=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Jul 22 17:25:01 2016
@@ -456,7 +456,7 @@ void EmitAssemblyHelper::CreatePasses(le
 if (!CodeGenOpts.InstrProfileOutput.empty())
   PMBuilder.PGOInstrGen = CodeGenOpts.InstrProfileOutput;
 else
-  PMBuilder.PGOInstrGen = "default.profraw";
+  PMBuilder.PGOInstrGen = "default_%m.profraw";
   }
   if (CodeGenOpts.hasProfileIRUse())
 PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=276484=276483=276484=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Jul 22 17:25:01 2016
@@ -3609,7 +3609,7 @@ static void addPGOAndCoverageFlags(Compi
 if (PGOGenerateArg->getOption().matches(
 options::OPT_fprofile_generate_EQ)) {
   SmallString<128> Path(PGOGenerateArg->getValue());
-  llvm::sys::path::append(Path, "default.profraw");
+  llvm::sys::path::append(Path, "default_%m.profraw");
   CmdArgs.push_back(
   Args.MakeArgString(Twine("-fprofile-instrument-path=") + Path));
 }

Modified: cfe/trunk/test/Driver/clang_f_opts.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=276484=276483=276484=diff
==
--- cfe/trunk/test/Driver/clang_f_opts.c (original)
+++ cfe/trunk/test/Driver/clang_f_opts.c Fri Jul 22 17:25:01 2016
@@ -99,7 +99,7 @@
 // RUN: %clang -### -S -fprofile-instr-generate -fcoverage-mapping 

Re: r276232 - [Sema] Fix PR28623.

2016-07-22 Thread Richard Smith via cfe-commits
On Fri, Jul 22, 2016 at 3:15 PM, George Burgess IV <
george.burgess...@gmail.com> wrote:

> (Assuming "yes" :) )
>
> Richard, are you okay with this being merged into 3.9?
>

Yes, LGTM for 3.9.


> On Fri, Jul 22, 2016 at 9:54 AM, George Burgess IV <
> george.burgess...@gmail.com> wrote:
>
>> Error message says r272936 had the error, so it looks like it would,
>> yeah. :)
>>
>> Would you like me to merge it to the 3.9 branch?
>>
>> On Fri, Jul 22, 2016 at 6:51 AM, Hans Wennborg  wrote:
>>
>>> Does this apply to 3.9?
>>>
>>> On Wed, Jul 20, 2016 at 11:28 PM, George Burgess IV via cfe-commits
>>>  wrote:
>>> > Author: gbiv
>>> > Date: Wed Jul 20 22:28:13 2016
>>> > New Revision: 276232
>>> >
>>> > URL: http://llvm.org/viewvc/llvm-project?rev=276232=rev
>>> > Log:
>>> > [Sema] Fix PR28623.
>>> >
>>> > In atomic builtins, we assumed that the LValue conversion on the first
>>> > argument would succeed. So, we would crash given code like:
>>> >
>>> > ```
>>> > void ovl(char);
>>> > void ovl(int);
>>> > __atomic_store_n(ovl, 0, 0);
>>> > ```
>>> >
>>> > This patch makes us not assume that said conversion is successful. :)
>>> >
>>> > Added:
>>> > cfe/trunk/test/SemaCXX/atomic-ops.cpp
>>> > Modified:
>>> > cfe/trunk/lib/Sema/SemaChecking.cpp
>>> >
>>> > Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
>>> > URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=276232=276231=276232=diff
>>> >
>>> ==
>>> > --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
>>> > +++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Jul 20 22:28:13 2016
>>> > @@ -2398,7 +2398,11 @@ ExprResult Sema::SemaAtomicOpsOverloaded
>>> >
>>> >// Inspect the first argument of the atomic operation.
>>> >Expr *Ptr = TheCall->getArg(0);
>>> > -  Ptr = DefaultFunctionArrayLvalueConversion(Ptr).get();
>>> > +  ExprResult ConvertedPtr = DefaultFunctionArrayLvalueConversion(Ptr);
>>> > +  if (ConvertedPtr.isInvalid())
>>> > +return ExprError();
>>> > +
>>> > +  Ptr = ConvertedPtr.get();
>>> >const PointerType *pointerType =
>>> Ptr->getType()->getAs();
>>> >if (!pointerType) {
>>> >  Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer)
>>> >
>>> > Added: cfe/trunk/test/SemaCXX/atomic-ops.cpp
>>> > URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/atomic-ops.cpp?rev=276232=auto
>>> >
>>> ==
>>> > --- cfe/trunk/test/SemaCXX/atomic-ops.cpp (added)
>>> > +++ cfe/trunk/test/SemaCXX/atomic-ops.cpp Wed Jul 20 22:28:13 2016
>>> > @@ -0,0 +1,9 @@
>>> > +// RUN: %clang_cc1 %s -verify -fsyntax-only -triple=i686-linux-gnu
>>> -std=c++11
>>> > +
>>> > +// We crashed when we couldn't properly convert the first arg of
>>> __atomic_* to
>>> > +// an lvalue.
>>> > +void PR28623() {
>>> > +  void helper(int); // expected-note{{target}}
>>> > +  void helper(char); // expected-note{{target}}
>>> > +  __atomic_store_n(helper, 0, 0); // expected-error{{reference to
>>> overloaded function could not be resolved}}
>>> > +}
>>> >
>>> >
>>> > ___
>>> > cfe-commits mailing list
>>> > cfe-commits@lists.llvm.org
>>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r276232 - [Sema] Fix PR28623.

2016-07-22 Thread George Burgess IV via cfe-commits
(Assuming "yes" :) )

Richard, are you okay with this being merged into 3.9?

On Fri, Jul 22, 2016 at 9:54 AM, George Burgess IV <
george.burgess...@gmail.com> wrote:

> Error message says r272936 had the error, so it looks like it would,
> yeah. :)
>
> Would you like me to merge it to the 3.9 branch?
>
> On Fri, Jul 22, 2016 at 6:51 AM, Hans Wennborg  wrote:
>
>> Does this apply to 3.9?
>>
>> On Wed, Jul 20, 2016 at 11:28 PM, George Burgess IV via cfe-commits
>>  wrote:
>> > Author: gbiv
>> > Date: Wed Jul 20 22:28:13 2016
>> > New Revision: 276232
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=276232=rev
>> > Log:
>> > [Sema] Fix PR28623.
>> >
>> > In atomic builtins, we assumed that the LValue conversion on the first
>> > argument would succeed. So, we would crash given code like:
>> >
>> > ```
>> > void ovl(char);
>> > void ovl(int);
>> > __atomic_store_n(ovl, 0, 0);
>> > ```
>> >
>> > This patch makes us not assume that said conversion is successful. :)
>> >
>> > Added:
>> > cfe/trunk/test/SemaCXX/atomic-ops.cpp
>> > Modified:
>> > cfe/trunk/lib/Sema/SemaChecking.cpp
>> >
>> > Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=276232=276231=276232=diff
>> >
>> ==
>> > --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
>> > +++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Jul 20 22:28:13 2016
>> > @@ -2398,7 +2398,11 @@ ExprResult Sema::SemaAtomicOpsOverloaded
>> >
>> >// Inspect the first argument of the atomic operation.
>> >Expr *Ptr = TheCall->getArg(0);
>> > -  Ptr = DefaultFunctionArrayLvalueConversion(Ptr).get();
>> > +  ExprResult ConvertedPtr = DefaultFunctionArrayLvalueConversion(Ptr);
>> > +  if (ConvertedPtr.isInvalid())
>> > +return ExprError();
>> > +
>> > +  Ptr = ConvertedPtr.get();
>> >const PointerType *pointerType =
>> Ptr->getType()->getAs();
>> >if (!pointerType) {
>> >  Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer)
>> >
>> > Added: cfe/trunk/test/SemaCXX/atomic-ops.cpp
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/atomic-ops.cpp?rev=276232=auto
>> >
>> ==
>> > --- cfe/trunk/test/SemaCXX/atomic-ops.cpp (added)
>> > +++ cfe/trunk/test/SemaCXX/atomic-ops.cpp Wed Jul 20 22:28:13 2016
>> > @@ -0,0 +1,9 @@
>> > +// RUN: %clang_cc1 %s -verify -fsyntax-only -triple=i686-linux-gnu
>> -std=c++11
>> > +
>> > +// We crashed when we couldn't properly convert the first arg of
>> __atomic_* to
>> > +// an lvalue.
>> > +void PR28623() {
>> > +  void helper(int); // expected-note{{target}}
>> > +  void helper(char); // expected-note{{target}}
>> > +  __atomic_store_n(helper, 0, 0); // expected-error{{reference to
>> overloaded function could not be resolved}}
>> > +}
>> >
>> >
>> > ___
>> > cfe-commits mailing list
>> > cfe-commits@lists.llvm.org
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D22702: [libcxx]Missing default argument for flag_type parameter in one of std::basic_regex constructors

2016-07-22 Thread Jason Liu via cfe-commits
jasonliu created this revision.
jasonliu added reviewers: mclow.lists, rsmith, hubert.reinterpretcast.
jasonliu added a subscriber: cfe-commits.

Standard 28.8 p3 indicates the 3-argument constructor have a default argument 
for flag_type parameter:
basic_regex(const charT* p, size_t len, flag_type f = 
regex_constants::ECMAScript);
However, it is missing from the library's implementation. 

https://reviews.llvm.org/D22702

Files:
  include/regex
  test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp

Index: test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
===
--- test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
+++ test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
@@ -0,0 +1,34 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// template > class 
basic_regex;
+
+// basic_regex(const charT* p, size_t len);
+
+#include 
+#include 
+
+template 
+void
+test(const CharT* p, std::size_t len, unsigned mc)
+{
+std::basic_regex r(p, len);
+assert(r.flags() == std::regex_constants::ECMAScript);
+assert(r.mark_count() == mc);
+}
+
+int main()
+{
+test("\\(a\\)", 5, 0);
+test("\\(a[bc]\\)", 9, 0);
+test("\\(a\\([bc]\\)\\)", 13, 0);
+test("(a([bc]))", 9, 2);
+}
Index: include/regex
===
--- include/regex
+++ include/regex
@@ -145,7 +145,7 @@
 // construct/copy/destroy:
 basic_regex();
 explicit basic_regex(const charT* p, flag_type f = 
regex_constants::ECMAScript);
-basic_regex(const charT* p, size_t len, flag_type f);
+basic_regex(const charT* p, size_t len, flag_type f = 
regex_constants::ECMAScript);
 basic_regex(const basic_regex&);
 basic_regex(basic_regex&&) noexcept;
 template 
@@ -2515,7 +2515,7 @@
   __end_(0)
 {__parse(__p, __p + __traits_.length(__p));}
 _LIBCPP_INLINE_VISIBILITY
-basic_regex(const value_type* __p, size_t __len, flag_type __f)
+basic_regex(const value_type* __p, size_t __len, flag_type __f = 
regex_constants::ECMAScript)
 : __flags_(__f), __marked_count_(0), __loop_count_(0), 
__open_count_(0),
   __end_(0)
 {__parse(__p, __p + __len);}


Index: test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
===
--- test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
+++ test/std/re/re.regex/re.regex.construct/ptr_size.pass.cpp
@@ -0,0 +1,34 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// template > class basic_regex;
+
+// basic_regex(const charT* p, size_t len);
+
+#include 
+#include 
+
+template 
+void
+test(const CharT* p, std::size_t len, unsigned mc)
+{
+std::basic_regex r(p, len);
+assert(r.flags() == std::regex_constants::ECMAScript);
+assert(r.mark_count() == mc);
+}
+
+int main()
+{
+test("\\(a\\)", 5, 0);
+test("\\(a[bc]\\)", 9, 0);
+test("\\(a\\([bc]\\)\\)", 13, 0);
+test("(a([bc]))", 9, 2);
+}
Index: include/regex
===
--- include/regex
+++ include/regex
@@ -145,7 +145,7 @@
 // construct/copy/destroy:
 basic_regex();
 explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
-basic_regex(const charT* p, size_t len, flag_type f);
+basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript);
 basic_regex(const basic_regex&);
 basic_regex(basic_regex&&) noexcept;
 template 
@@ -2515,7 +2515,7 @@
   __end_(0)
 {__parse(__p, __p + __traits_.length(__p));}
 _LIBCPP_INLINE_VISIBILITY
-basic_regex(const value_type* __p, size_t __len, flag_type __f)
+basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
 : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
   __end_(0)
 {__parse(__p, __p + __len);}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17820: Clang Code Completion Filtering

2016-07-22 Thread Vassil Vassilev via cfe-commits
v.g.vassilev added a subscriber: v.g.vassilev.


Comment at: include/clang/Lex/Preprocessor.h:270
@@ +269,3 @@
+  /// on the stem that is to be code completed.
+  IdentifierInfo *CodeCompletionII;
+

Can you initialize this variable in the PP's ctor?


Repository:
  rL LLVM

https://reviews.llvm.org/D17820



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


r276473 - [modules] Teach the ASTWriter to ignore mutations coming from the ASTReader.

2016-07-22 Thread Vassil Vassilev via cfe-commits
Author: vvassilev
Date: Fri Jul 22 16:08:24 2016
New Revision: 276473

URL: http://llvm.org/viewvc/llvm-project?rev=276473=rev
Log:
[modules] Teach the ASTWriter to ignore mutations coming from the ASTReader.

Processing update records (and loading a module, in general) might trigger
unexpected calls to the ASTWriter (being a mutation listener). Now we have a
mechanism to suppress those calls to the ASTWriter but notify other possible
mutation listeners.

Fixes https://llvm.org/bugs/show_bug.cgi?id=28332

Patch by Cristina Cristescu and me.

Reviewed by Richard Smith (D21800).

Added:
cfe/trunk/test/Modules/Inputs/PR28332/
cfe/trunk/test/Modules/Inputs/PR28332/TextualInclude.h
cfe/trunk/test/Modules/Inputs/PR28332/a.h
cfe/trunk/test/Modules/Inputs/PR28332/b.h
cfe/trunk/test/Modules/Inputs/PR28332/c.h
cfe/trunk/test/Modules/Inputs/PR28332/module.modulemap
cfe/trunk/test/Modules/pr28332.cpp
Modified:
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=276473=276472=276473=diff
==
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Fri Jul 22 16:08:24 2016
@@ -842,6 +842,9 @@ private:
   /// \brief Whether we have tried loading the global module index yet.
   bool TriedLoadingGlobalIndex;
 
+  ///\brief Whether we are currently processing update records.
+  bool ProcessingUpdateRecords;
+
   typedef llvm::DenseMap SwitchCaseMapTy;
   /// \brief Mapping from switch-case IDs in the chain to switch-case 
statements
   ///
@@ -1041,6 +1044,23 @@ private:
 ~ReadingKindTracker() { Reader.ReadingKind = PrevKind; }
   };
 
+  /// \brief RAII object to mark the start of processing updates.
+  class ProcessingUpdatesRAIIObj {
+ASTReader 
+bool PrevState;
+
+ProcessingUpdatesRAIIObj(const ProcessingUpdatesRAIIObj &) = delete;
+void operator=(const ProcessingUpdatesRAIIObj &) = delete;
+
+  public:
+ProcessingUpdatesRAIIObj(ASTReader )
+  : Reader(reader), PrevState(Reader.ProcessingUpdateRecords) {
+  Reader.ProcessingUpdateRecords = true;
+}
+
+~ProcessingUpdatesRAIIObj() { Reader.ProcessingUpdateRecords = PrevState; }
+  };
+
   /// \brief Suggested contents of the predefines buffer, after this
   /// PCH file has been processed.
   ///
@@ -2129,6 +2149,8 @@ public:
 
   /// \brief Loads comments ranges.
   void ReadComments() override;
+
+  bool isProcessingUpdateRecords() { return ProcessingUpdateRecords; }
 };
 
 /// \brief Helper class that saves the current stream position and

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=276473=276472=276473=diff
==
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Jul 22 16:08:24 2016
@@ -8644,6 +8644,7 @@ void ASTReader::FinishedDeserializing()
   auto Updates = std::move(PendingExceptionSpecUpdates);
   PendingExceptionSpecUpdates.clear();
   for (auto Update : Updates) {
+ProcessingUpdatesRAIIObj ProcessingUpdates(*this);
 auto *FPT = Update.second->getType()->castAs();
 auto ESI = FPT->getExtProtoInfo().ExceptionSpec;
 if (auto *Listener = Context.getASTMutationListener())
@@ -8714,6 +8715,7 @@ ASTReader::ASTReader(
   AllowConfigurationMismatch(AllowConfigurationMismatch),
   ValidateSystemInputs(ValidateSystemInputs),
   UseGlobalIndex(UseGlobalIndex), TriedLoadingGlobalIndex(false),
+  ProcessingUpdateRecords(false),
   CurrSwitchCaseStmts(), NumSLocEntriesRead(0),
   TotalNumSLocEntries(0), NumStatementsRead(0), TotalNumStatements(0),
   NumMacrosRead(0), TotalNumMacros(0), NumIdentifierLookups(0),

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=276473=276472=276473=diff
==
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Fri Jul 22 16:08:24 2016
@@ -3489,6 +3489,7 @@ void ASTReader::loadDeclUpdateRecords(se
   // The declaration may have been modified by files later in the chain.
   // If this is the case, read the record containing the updates from each file
   // and pass it to ASTDeclReader to make the modifications.
+  ProcessingUpdatesRAIIObj ProcessingUpdates(*this);
   DeclUpdateOffsetsMap::iterator UpdI = 

Re: [PATCH] D19544: Pass for translating math intrinsics to math library calls.

2016-07-22 Thread Matt via cfe-commits
mmasten added a comment.

Thanks Michael. The tests have been updated.

Matt


https://reviews.llvm.org/D19544



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


Re: [PATCH] D19544: Pass for translating math intrinsics to math library calls.

2016-07-22 Thread Matt via cfe-commits
mmasten updated this revision to Diff 65152.

https://reviews.llvm.org/D19544

Files:
  include/llvm/Analysis/TargetLibraryInfo.h
  lib/Analysis/TargetLibraryInfo.cpp
  test/Transforms/LoopVectorize/X86/svml-calls.ll

Index: lib/Analysis/TargetLibraryInfo.cpp
===
--- lib/Analysis/TargetLibraryInfo.cpp
+++ lib/Analysis/TargetLibraryInfo.cpp
@@ -23,6 +23,8 @@
   "No vector functions library"),
clEnumValN(TargetLibraryInfoImpl::Accelerate, "Accelerate",
   "Accelerate framework"),
+   clEnumValN(TargetLibraryInfoImpl::SVML, "SVML",
+  "Intel SVML library"),
clEnumValEnd));
 
 const char *const TargetLibraryInfoImpl::StandardNames[LibFunc::NumLibFuncs] = {
@@ -1074,6 +1076,75 @@
 addVectorizableFunctions(VecFuncs);
 break;
   }
+  case SVML: {
+const VecDesc VecFuncs[] = {
+{"sin", "__svml_sin2", 2},
+{"sin", "__svml_sin4", 4},
+{"sin", "__svml_sin8", 8},
+
+{"sinf", "__svml_sinf4", 4},
+{"sinf", "__svml_sinf8", 8},
+{"sinf", "__svml_sinf16", 16},
+
+{"cos", "__svml_cos2", 2},
+{"cos", "__svml_cos4", 4},
+{"cos", "__svml_cos8", 8},
+
+{"cosf", "__svml_cosf4", 4},
+{"cosf", "__svml_cosf8", 8},
+{"cosf", "__svml_cosf16", 16},
+
+{"pow", "__svml_pow2", 2},
+{"pow", "__svml_pow4", 4},
+{"pow", "__svml_pow8", 8},
+
+{"powf", "__svml_powf4", 4},
+{"powf", "__svml_powf8", 8},
+{"powf", "__svml_powf16", 16},
+
+{"llvm.pow.f64", "__svml_pow2", 2},
+{"llvm.pow.f64", "__svml_pow4", 4},
+{"llvm.pow.f64", "__svml_pow8", 8},
+
+{"llvm.pow.f32", "__svml_powf4", 4},
+{"llvm.pow.f32", "__svml_powf8", 8},
+{"llvm.pow.f32", "__svml_powf16", 16},
+
+{"exp", "__svml_exp2", 2},
+{"exp", "__svml_exp4", 4},
+{"exp", "__svml_exp8", 8},
+
+{"expf", "__svml_expf4", 4},
+{"expf", "__svml_expf8", 8},
+{"expf", "__svml_expf16", 16},
+
+{"llvm.exp.f64", "__svml_exp2", 2},
+{"llvm.exp.f64", "__svml_exp4", 4},
+{"llvm.exp.f64", "__svml_exp8", 8},
+
+{"llvm.exp.f32", "__svml_expf4", 4},
+{"llvm.exp.f32", "__svml_expf8", 8},
+{"llvm.exp.f32", "__svml_expf16", 16},
+
+{"log", "__svml_log2", 2},
+{"log", "__svml_log4", 4},
+{"log", "__svml_log8", 8},
+
+{"logf", "__svml_logf4", 4},
+{"logf", "__svml_logf8", 8},
+{"logf", "__svml_logf16", 16},
+
+{"llvm.log.f64", "__svml_log2", 2},
+{"llvm.log.f64", "__svml_log4", 4},
+{"llvm.log.f64", "__svml_log8", 8},
+
+{"llvm.log.f32", "__svml_logf4", 4},
+{"llvm.log.f32", "__svml_logf8", 8},
+{"llvm.log.f32", "__svml_logf16", 16},
+};
+addVectorizableFunctions(VecFuncs);
+break;
+  }
   case NoLibrary:
 break;
   }
Index: include/llvm/Analysis/TargetLibraryInfo.h
===
--- include/llvm/Analysis/TargetLibraryInfo.h
+++ include/llvm/Analysis/TargetLibraryInfo.h
@@ -85,8 +85,9 @@
   /// addVectorizableFunctionsFromVecLib for filling up the tables of
   /// vectorizable functions.
   enum VectorLibrary {
-NoLibrary, // Don't use any vector library.
-Accelerate // Use Accelerate framework.
+NoLibrary,  // Don't use any vector library.
+Accelerate, // Use Accelerate framework.
+SVML// Intel short vector math library.
   };
 
   TargetLibraryInfoImpl();
Index: test/Transforms/LoopVectorize/X86/svml-calls.ll
===
--- test/Transforms/LoopVectorize/X86/svml-calls.ll
+++ test/Transforms/LoopVectorize/X86/svml-calls.ll
@@ -0,0 +1,185 @@
+; RUN: opt -vector-library=SVML -loop-vectorize -S < %s | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; CHECK-LABEL: @sin_f32
+; CHECK: <4 x float> @__svml_sinf4
+; CHECK: ret
+
+declare float @sinf(float) #0
+
+define void @sin_f32(float* nocapture %varray) {
+entry:
+  br label %for.body
+
+for.body: ; preds = %for.body, %entry
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+  %tmp = trunc i64 %indvars.iv to i32
+  %conv = sitofp i32 %tmp to float
+  %call = tail call fast float @sinf(float %conv)
+  %arrayidx = getelementptr inbounds float, float* %varray, i64 %indvars.iv
+  store float %call, float* %arrayidx, align 4
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  %exitcond = icmp eq i64 %indvars.iv.next, 1000
+  br i1 %exitcond, label %for.end, label %for.body
+
+for.end:  ; preds = %for.body
+  ret void
+}
+
+; CHECK-LABEL: @cos_f32
+; CHECK: <4 x float> 

[PATCH] D22698: [libcxx] Missing member types 'traits_type' and 'string_type' in class basic_regex

2016-07-22 Thread Jason Liu via cfe-commits
jasonliu created this revision.
jasonliu added reviewers: mclow.lists, rsmith, hubert.reinterpretcast.
jasonliu added a subscriber: cfe-commits.

In standard 28.8 p3, class basic_regex is supposed to have 'traits_type' and 
'string_type' as its member types. However, they are missing from the library's 
implementation. Unexpected error occurs when user have lines like 
"std::basic_regex::traits_type" or "std::basic_regex::string_type".

https://reviews.llvm.org/D22698

Files:
  include/regex
  test/std/re/re.regex/types.pass.cpp

Index: test/std/re/re.regex/types.pass.cpp
===
--- test/std/re/re.regex/types.pass.cpp
+++ test/std/re/re.regex/types.pass.cpp
@@ -15,6 +15,8 @@
 // public:
 // // types:
 // typedef charT   value_type;
+// typedef traits  traits_type;
+// typedef typename traits::string_typestring_type;
 // typedef regex_constants::syntax_option_type flag_type;
 // typedef typename traits::locale_typelocale_type;
 
@@ -25,11 +27,15 @@
 int main()
 {
 static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 
 static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
Index: include/regex
===
--- include/regex
+++ include/regex
@@ -127,6 +127,8 @@
 public:
 // types:
 typedef charT   value_type;
+typedef traits  traits_type;
+typedef typename traits::string_typestring_type;
 typedef regex_constants::syntax_option_type flag_type;
 typedef typename traits::locale_typelocale_type;
 
@@ -2475,6 +2477,8 @@
 public:
 // types:
 typedef _CharT  value_type;
+typedef _Traits traits_type;
+typedef typename _Traits::string_type   string_type;
 typedef regex_constants::syntax_option_type flag_type;
 typedef typename _Traits::locale_type   locale_type;
 


Index: test/std/re/re.regex/types.pass.cpp
===
--- test/std/re/re.regex/types.pass.cpp
+++ test/std/re/re.regex/types.pass.cpp
@@ -15,6 +15,8 @@
 // public:
 // // types:
 // typedef charT   value_type;
+// typedef traits  traits_type;
+// typedef typename traits::string_typestring_type;
 // typedef regex_constants::syntax_option_type flag_type;
 // typedef typename traits::locale_typelocale_type;
 
@@ -25,11 +27,15 @@
 int main()
 {
 static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 
 static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
+static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
Index: include/regex
===
--- include/regex
+++ include/regex
@@ -127,6 +127,8 @@
 public:
 // types:
 typedef charT   value_type;
+typedef traits  traits_type;
+typedef typename 

r276469 - Add regression test for PR27699.

2016-07-22 Thread Vassil Vassilev via cfe-commits
Author: vvassilev
Date: Fri Jul 22 15:49:31 2016
New Revision: 276469

URL: http://llvm.org/viewvc/llvm-project?rev=276469=rev
Log:
Add regression test for PR27699.

Added:
cfe/trunk/test/Modules/Inputs/PR27699/
cfe/trunk/test/Modules/Inputs/PR27699/Subdir/
cfe/trunk/test/Modules/Inputs/PR27699/Subdir/a.h
cfe/trunk/test/Modules/Inputs/PR27699/Subdir/b.h
cfe/trunk/test/Modules/Inputs/PR27699/module.modulemap
cfe/trunk/test/Modules/Inputs/PR27699/streambuf
cfe/trunk/test/Modules/pr27699.cpp

Added: cfe/trunk/test/Modules/Inputs/PR27699/Subdir/a.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/PR27699/Subdir/a.h?rev=276469=auto
==
--- cfe/trunk/test/Modules/Inputs/PR27699/Subdir/a.h (added)
+++ cfe/trunk/test/Modules/Inputs/PR27699/Subdir/a.h Fri Jul 22 15:49:31 2016
@@ -0,0 +1 @@
+#include "streambuf"

Added: cfe/trunk/test/Modules/Inputs/PR27699/Subdir/b.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/PR27699/Subdir/b.h?rev=276469=auto
==
--- cfe/trunk/test/Modules/Inputs/PR27699/Subdir/b.h (added)
+++ cfe/trunk/test/Modules/Inputs/PR27699/Subdir/b.h Fri Jul 22 15:49:31 2016
@@ -0,0 +1 @@
+#include "streambuf"

Added: cfe/trunk/test/Modules/Inputs/PR27699/module.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/PR27699/module.modulemap?rev=276469=auto
==
--- cfe/trunk/test/Modules/Inputs/PR27699/module.modulemap (added)
+++ cfe/trunk/test/Modules/Inputs/PR27699/module.modulemap Fri Jul 22 15:49:31 
2016
@@ -0,0 +1 @@
+module a {   umbrella "Subdir" module * {export *} }

Added: cfe/trunk/test/Modules/Inputs/PR27699/streambuf
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/PR27699/streambuf?rev=276469=auto
==
--- cfe/trunk/test/Modules/Inputs/PR27699/streambuf (added)
+++ cfe/trunk/test/Modules/Inputs/PR27699/streambuf Fri Jul 22 15:49:31 2016
@@ -0,0 +1,7 @@
+ #ifndef STREAMBUF
+ #define STREAMBUF
+ template  struct basic_streambuf {
+  basic_streambuf(const basic_streambuf &);
+  };
+template  basic_streambuf::basic_streambuf(const 
basic_streambuf &) = default;
+#endif

Added: cfe/trunk/test/Modules/pr27699.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/pr27699.cpp?rev=276469=auto
==
--- cfe/trunk/test/Modules/pr27699.cpp (added)
+++ cfe/trunk/test/Modules/pr27699.cpp Fri Jul 22 15:49:31 2016
@@ -0,0 +1,9 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -std=c++11 -I%S/Inputs/PR27699 -verify %s
+// RUN: %clang_cc1 -std=c++11 -fmodules 
-fmodule-map-file=%S/Inputs/PR27699/module.modulemap -fmodules-cache-path=%t 
-fmodules-local-submodule-visibility -I%S/Inputs/PR27699 -verify %s
+
+#include "Subdir/a.h"
+#include "Subdir/b.h"
+
+// expected-no-diagnostics
+


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


[PATCH] D22697: [ObjC Availability] Consider lexical context of use of declaration when emitting availability diagnostics

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

-Wpartial-availability currently fires on the following:
```
void f1() __attribute__((availability(macos, introduced=10.10)));

void f2() __attribute__((availability(macos, introduced=10.10))) {
  f1(); // warning: f1 is partially available: introduced in 10.10.
}
```
This is bad: f2 is also only available on macOS 10.10, so we know that the call 
to f1 is safe. This patch fixes this by considering the availability attributes 
of the lexical context of a use of a declaration when checking it for 
availability violations.

Thanks!

https://reviews.llvm.org/D22697

Files:
  include/clang/AST/DeclBase.h
  include/clang/Sema/Sema.h
  lib/AST/DeclBase.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaExpr.cpp
  test/SemaObjC/attr-availability.m

Index: test/SemaObjC/attr-availability.m
===
--- test/SemaObjC/attr-availability.m
+++ test/SemaObjC/attr-availability.m
@@ -294,3 +294,34 @@
   [obj method]; // expected-error{{'method' is unavailable}}
 }
 @end
+
+#if defined(WARN_PARTIAL)
+
+int fn_10_7() __attribute__((availability(macosx, introduced=10.7))); // expected-note{{marked partial here}}
+int fn_10_8() __attribute__((availability(macosx, introduced=10.8))) { // expected-note{{marked partial here}}
+  return fn_10_7();
+}
+
+__attribute__((objc_root_class))
+@interface LookupAvailabilityBase
+-(void) method1;
+@end
+
+@implementation LookupAvailabilityBase
+-(void)method1 { fn_10_7(); } // expected-warning{{partial}} expected-note{{explicitly redeclare}}
+@end
+
+__attribute__((availability(macosx, introduced=10.7)))
+@interface LookupAvailability : LookupAvailabilityBase
+- (void)method2;
+- (void)method3;
+- (void)method4 __attribute__((availability(macosx, introduced=10.8)));
+@end
+
+@implementation LookupAvailability
+-(void)method2 { fn_10_7(); }
+-(void)method3 { fn_10_8(); } // expected-warning{{partial}} expected-note{{explicitly redeclare}}
+-(void)method4 { fn_10_8(); }
+@end
+
+#endif
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -107,17 +107,20 @@
 DiagnoseAvailabilityOfDecl(Sema , NamedDecl *D, SourceLocation Loc,
const ObjCInterfaceDecl *UnknownObjCClass,
bool ObjCPropertyAccess) {
-  // See if this declaration is unavailable or deprecated.
+  VersionTuple ContextVersion = S.getCurContextVersion();
+
+  // See if this declaration is unavailable, deprecated, or partial in the
+  // current context.
   std::string Message;
-  AvailabilityResult Result = D->getAvailability();
+  AvailabilityResult Result = D->getAvailability(, ContextVersion);
 
   // For typedefs, if the typedef declaration appears available look
   // to the underlying type to see if it is more restrictive.
   while (const TypedefNameDecl *TD = dyn_cast(D)) {
 if (Result == AR_Available) {
   if (const TagType *TT = TD->getUnderlyingType()->getAs()) {
 D = TT->getDecl();
-Result = D->getAvailability();
+Result = D->getAvailability(, ContextVersion);
 continue;
   }
 }
@@ -128,23 +131,24 @@
   if (ObjCInterfaceDecl *IDecl = dyn_cast(D)) {
 if (IDecl->getDefinition()) {
   D = IDecl->getDefinition();
-  Result = D->getAvailability();
+  Result = D->getAvailability(, ContextVersion);
 }
   }
 
   if (const EnumConstantDecl *ECD = dyn_cast(D))
 if (Result == AR_Available) {
   const DeclContext *DC = ECD->getDeclContext();
   if (const EnumDecl *TheEnumDecl = dyn_cast(DC))
-Result = TheEnumDecl->getAvailability();
+Result = TheEnumDecl->getAvailability(, ContextVersion);
 }
 
   const ObjCPropertyDecl *ObjCPDecl = nullptr;
   if (Result == AR_Deprecated || Result == AR_Unavailable ||
   Result == AR_NotYetIntroduced) {
 if (const ObjCMethodDecl *MD = dyn_cast(D)) {
   if (const ObjCPropertyDecl *PD = MD->findPropertyDecl()) {
-AvailabilityResult PDeclResult = PD->getAvailability(nullptr);
+AvailabilityResult PDeclResult =
+PD->getAvailability(nullptr, ContextVersion);
 if (PDeclResult == Result)
   ObjCPDecl = PD;
   }
@@ -198,7 +202,7 @@
   break;
 
 }
-return Result;
+  return Result;
 }
 
 /// \brief Emit a note explaining that this function is deleted.
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -6484,3 +6484,28 @@
   DoEmitAvailabilityWarning(*this, AD, Ctx, D, Message, Loc, UnknownObjCClass,
 ObjCProperty, ObjCPropertyAccess);
 }
+
+VersionTuple Sema::getCurContextVersion() const {
+  const Decl *D = cast_or_null(getCurObjCLexicalContext());
+  if (!D)
+

Re: [PATCH] D22584: constexpr array support C++1z (P0031)

2016-07-22 Thread Jason Turner via cfe-commits
lefticus retitled this revision from "C++1z constexpr support for array and 
iterator" to "constexpr array support C++1z (P0031)".
lefticus updated the summary for this revision.
lefticus updated this revision to Diff 65143.
lefticus added a comment.

- Updated title and summary to be more accurate.
- Implemented tests for constexpr std::array access.
- Added required constexpr iterator support.
- Implemented tests for constexpr iterator functions


https://reviews.llvm.org/D22584

Files:
  include/array
  include/iterator
  test/std/containers/sequences/array/at.pass.cpp
  test/std/containers/sequences/array/begin.pass.cpp
  test/std/containers/sequences/array/front_back.pass.cpp
  test/std/containers/sequences/array/indexing.pass.cpp
  test/std/containers/sequences/array/iterators.pass.cpp
  test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp
  test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp
  test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
  test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp

Index: test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp
===
--- test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp
+++ test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp
@@ -33,12 +33,21 @@
 
 int main()
 {
-const char* s = "1234567890";
-test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s));
-test(random_access_iterator(s+10), 10, random_access_iterator(s));
-test(s+10, 10, s);
-
-test(bidirectional_iterator(s+1), bidirectional_iterator(s));
-test(random_access_iterator(s+1), random_access_iterator(s));
-test(s+1, s);
+{
+const char* s = "1234567890";
+test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s));
+test(random_access_iterator(s+10), 10, random_access_iterator(s));
+test(s+10, 10, s);
+
+test(bidirectional_iterator(s+1), bidirectional_iterator(s));
+test(random_access_iterator(s+1), random_access_iterator(s));
+test(s+1, s);
+}
+
+{
+constexpr const char* s = "1234567890";
+static_assert(std::prev(s+10, 10) == s);
+static_assert(std::prev(s+1) == s);
+}
+
 }
Index: test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
===
--- test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
+++ test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
@@ -35,16 +35,27 @@
 
 int main()
 {
-const char* s = "1234567890";
-test(input_iterator(s), 10, input_iterator(s+10));
-test(forward_iterator(s), 10, forward_iterator(s+10));
-test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10));
-test(random_access_iterator(s), 10, random_access_iterator(s+10));
-test(s, 10, s+10);
-
-test(input_iterator(s), input_iterator(s+1));
-test(forward_iterator(s), forward_iterator(s+1));
-test(bidirectional_iterator(s), bidirectional_iterator(s+1));
-test(random_access_iterator(s), random_access_iterator(s+1));
-test(s, s+1);
+{
+const char* s = "1234567890";
+test(input_iterator(s), 10, input_iterator(s+10));
+test(forward_iterator(s), 10, forward_iterator(s+10));
+test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10));
+test(random_access_iterator(s), 10, random_access_iterator(s+10));
+test(s, 10, s+10);
+
+test(input_iterator(s), input_iterator(s+1));
+test(forward_iterator(s), forward_iterator(s+1));
+test(bidirectional_iterator(s), bidirectional_iterator(s+1));
+test(random_access_iterator(s), random_access_iterator(s+1));
+test(s, s+1);
+}
+
+#if TEST_STD_VER > 14
+{
+constexpr const char* s = "1234567890";
+static_assert(std::next(s, 10) == s+10);
+static_assert(std::next(s) == s+1);
+}
+#endif
+
 }
Index: test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp
===
--- test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp
+++ test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp
@@ -31,10 +31,21 @@
 
 int main()
 {
-const char* s = "1234567890";
-test(input_iterator(s), input_iterator(s+10), 10);
-test(forward_iterator(s), forward_iterator(s+10), 10);
-test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10);
-test(random_access_iterator(s), random_access_iterator(s+10), 10);
-test(s, s+10, 10);
+{
+const char* s = "1234567890";
+test(input_iterator(s), input_iterator(s+10), 10);
+test(forward_iterator(s), forward_iterator(s+10), 10);
+

Re: [PATCH] D22557: [libcxx] Diagnose invalid memory order arguments in . Fixes PR21179.

2016-07-22 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 65140.
EricWF added a comment.

Add comment about checking "stronger" orderings.


https://reviews.llvm.org/D22557

Files:
  include/atomic
  test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp

Index: test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp
===
--- /dev/null
+++ test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp
@@ -0,0 +1,125 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// The attributes used to diagnose incorrect memory order inputs is clang
+// specific.
+// UNSUPPORTED: gcc
+
+// 
+
+// Test that invalid memory order arguments are diagnosed where possible.
+
+#include 
+
+int main() {
+std::atomic x(42);
+volatile std::atomic& vx = x;
+int val1 = 1;
+int val2 = 2;
+// load operations
+{
+x.load(std::memory_order_release); // expected-error {{operation is invalid}}
+x.load(std::memory_order_acq_rel); // expected-error {{operation is invalid}}
+vx.load(std::memory_order_release); // expected-error {{operation is invalid}}
+vx.load(std::memory_order_acq_rel); // expected-error {{operation is invalid}}
+// valid memory orders
+x.load(std::memory_order_relaxed);
+x.load(std::memory_order_consume);
+x.load(std::memory_order_acquire);
+x.load(std::memory_order_seq_cst);
+}
+{
+std::atomic_load_explicit(, std::memory_order_release); // expected-error {{operation is invalid}}
+std::atomic_load_explicit(, std::memory_order_acq_rel); // expected-error {{operation is invalid}}
+std::atomic_load_explicit(, std::memory_order_release); // expected-error {{operation is invalid}}
+std::atomic_load_explicit(, std::memory_order_acq_rel); // expected-error {{operation is invalid}}
+// valid memory orders
+std::atomic_load_explicit(, std::memory_order_relaxed);
+std::atomic_load_explicit(, std::memory_order_consume);
+std::atomic_load_explicit(, std::memory_order_acquire);
+std::atomic_load_explicit(, std::memory_order_seq_cst);
+}
+// store operations
+{
+x.store(42, std::memory_order_consume); // expected-error {{operation is invalid}}
+x.store(42, std::memory_order_acquire); // expected-error {{operation is invalid}}
+x.store(42, std::memory_order_acq_rel); // expected-error {{operation is invalid}}
+vx.store(42, std::memory_order_consume); // expected-error {{operation is invalid}}
+vx.store(42, std::memory_order_acquire); // expected-error {{operation is invalid}}
+vx.store(42, std::memory_order_acq_rel); // expected-error {{operation is invalid}}
+// valid memory orders
+x.store(42, std::memory_order_relaxed);
+x.store(42, std::memory_order_release);
+x.store(42, std::memory_order_seq_cst);
+}
+{
+std::atomic_store_explicit(, 42, std::memory_order_consume); // expected-error {{operation is invalid}}
+std::atomic_store_explicit(, 42, std::memory_order_acquire); // expected-error {{operation is invalid}}
+std::atomic_store_explicit(, 42, std::memory_order_acq_rel); // expected-error {{operation is invalid}}
+std::atomic_store_explicit(, 42, std::memory_order_consume); // expected-error {{operation is invalid}}
+std::atomic_store_explicit(, 42, std::memory_order_acquire); // expected-error {{operation is invalid}}
+std::atomic_store_explicit(, 42, std::memory_order_acq_rel); // expected-error {{operation is invalid}}
+// valid memory orders
+std::atomic_store_explicit(, 42, std::memory_order_relaxed);
+std::atomic_store_explicit(, 42, std::memory_order_release);
+std::atomic_store_explicit(, 42, std::memory_order_seq_cst);
+}
+// compare exchange weak
+{
+x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-error {{operation is invalid}}
+x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-error {{operation is invalid}}
+vx.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-error {{operation is invalid}}
+vx.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-error {{operation is invalid}}
+// valid memory orders
+x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_relaxed);
+x.compare_exchange_weak(val1, val2, 

Re: [PATCH] D22513: [clang-tidy] add check cppcoreguidelines-rule-of-five-and-zero

2016-07-22 Thread Piotr Padlewski via cfe-commits
Prazek added a comment.

In https://reviews.llvm.org/D22513#493303, @Eugene.Zelenko wrote:

> Since rule name is different in C++98/03 and C++11 or newer it will make 
> sense to create two checks which will work only for their respective versions 
> (of course, implementation should be shared). Or create alias name.
>
> Check is still not mentioned in  docs/ReleaseNotes.rst.


This seems like too much work, maybe just cppcoreguidelines-rule-of-3-or-5?


https://reviews.llvm.org/D22513



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


Re: [PATCH] D22513: [clang-tidy] add check cppcoreguidelines-rule-of-five-and-zero

2016-07-22 Thread Piotr Padlewski via cfe-commits
Prazek added a comment.

I will look again soon, but it looks much better right now!



Comment at: clang-tidy/cppcoreguidelines/RuleOfFiveAndZeroCheck.cpp:43-57
@@ +42,17 @@
+
+llvm::StringRef RuleOfFiveAndZeroCheck::toString(
+RuleOfFiveAndZeroCheck::SpecialMemberFunctionKind K) {
+  switch (K) {
+  case SpecialMemberFunctionKind::Destructor:
+return "a destructor";
+  case SpecialMemberFunctionKind::CopyConstructor:
+return "a copy constructor";
+  case SpecialMemberFunctionKind::CopyAssignment:
+return "a copy assignment operator";
+  case SpecialMemberFunctionKind::MoveConstructor:
+return "a move constructor";
+  case SpecialMemberFunctionKind::MoveAssignment:
+return "a move assignment operator";
+  }
+}
+

maybe make it a DenseMap? (or maybe there is SmallMap or SmallDense map or 
something similar)


Comment at: clang-tidy/cppcoreguidelines/RuleOfFiveAndZeroCheck.cpp:85-105
@@ +84,23 @@
+
+  if (Result.Nodes.getNodeAs("dtor")) {
+ClassWithSpecialMembers[ID].push_back(
+SpecialMemberFunctionKind::Destructor);
+  }
+  if (Result.Nodes.getNodeAs("copy-ctor")) {
+ClassWithSpecialMembers[ID].push_back(
+SpecialMemberFunctionKind::CopyConstructor);
+  }
+  if (Result.Nodes.getNodeAs("copy-assign")) {
+ClassWithSpecialMembers[ID].push_back(
+SpecialMemberFunctionKind::CopyAssignment);
+  }
+  if (Result.Nodes.getNodeAs("move-ctor")) {
+ClassWithSpecialMembers[ID].push_back(
+SpecialMemberFunctionKind::MoveConstructor);
+  }
+  if (Result.Nodes.getNodeAs("move-assign")) {
+ClassWithSpecialMembers[ID].push_back(
+SpecialMemberFunctionKind::MoveAssignment);
+  }
+}
+

This looks like it could be changed into for 
for (auto [str, kind] : kinds) {
  if( ... Result.Nodes.getNodeAs(str))

I havent tried putting Base type to getNodeAs, but I think it should work.


https://reviews.llvm.org/D22513



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


Re: [PATCH] D22557: [libcxx] Diagnose invalid memory order arguments in . Fixes PR21179.

2016-07-22 Thread Eric Fiselier via cfe-commits
EricWF added a reviewer: jfb.
EricWF marked an inline comment as done.
EricWF added a comment.

Address inline comments from @jfb and add him as a reviewer.



Comment at: test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp:86
@@ +85,3 @@
+// does not generate any diagnostics.
+x.compare_exchange_weak(val1, val2, std::memory_order_release);
+}

jfb wrote:
> Could you do the other 5 (same below).
I could, but we only check the two argument version of the overload, so I 
*know* the other orderings will have the same result. I think the one test is 
sufficient because it will fail the second we start testing the one argument 
version.

Do you still want the additional tests?


https://reviews.llvm.org/D22557



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


Re: [PATCH] D22513: [clang-tidy] add check cppcoreguidelines-rule-of-five-and-zero

2016-07-22 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

Since rule name is different in C++98/03 and C++11 or newer it will make sense 
to create two checks which will work only for their respective versions (of 
course, implementation should be shared). Or create alias name.

Check is still not mentioned in  docs/ReleaseNotes.rst.


https://reviews.llvm.org/D22513



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


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

2016-07-22 Thread Piotr Padlewski via cfe-commits
Prazek marked 3 inline comments as done.


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

alexfh wrote:
> alexfh wrote:
> > "wierd" is weird ;)
> I should have been more clear in the first place: please fix the typo.
> 
> http://www.google.com/#q=wierd
sorry, I pushed the patch immidiatelly when I saw that I missed your comment.


Repository:
  rL LLVM

https://reviews.llvm.org/D21642



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


Re: [PATCH] D22637: [OpenCL] Add extension cl_khr_mipmap_image to clang

2016-07-22 Thread Yaxun Liu via cfe-commits
yaxunl accepted this revision.
yaxunl added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D22637



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


[libunwind] r276462 - Merging r276215:

2016-07-22 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Jul 22 15:04:56 2016
New Revision: 276462

URL: http://llvm.org/viewvc/llvm-project?rev=276462=rev
Log:
Merging r276215:

r276215 | ericwf | 2016-07-20 17:56:42 -0600 (Wed, 20 Jul 2016) | 9 lines

[libunwind] Properly align _Unwind_Exception.

Summary: _Unwind_Exception is required to be double word aligned. Currently the 
struct is under aligned.

Reviewers: mclow.lists, compnerd, kledzik, emaste

Subscribers: emaste, cfe-commits

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


Added:
libunwind/branches/release_39/test/alignment.pass.cpp
Modified:
libunwind/branches/release_39/include/unwind.h

Modified: libunwind/branches/release_39/include/unwind.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/branches/release_39/include/unwind.h?rev=276462=276461=276462=diff
==
--- libunwind/branches/release_39/include/unwind.h (original)
+++ libunwind/branches/release_39/include/unwind.h Fri Jul 22 15:04:56 2016
@@ -122,13 +122,16 @@ struct _Unwind_Exception {
   uintptr_t private_1; // non-zero means forced unwind
   uintptr_t private_2; // holds sp that phase1 found for phase2 to use
 #ifndef __LP64__
-  // The gcc implementation of _Unwind_Exception used attribute mode on the
-  // above fields which had the side effect of causing this whole struct to
+  // The implementation of _Unwind_Exception uses an attribute mode on the
+  // above fields which has the side effect of causing this whole struct to
   // round up to 32 bytes in size. To be more explicit, we add pad fields
   // added for binary compatibility.
   uint32_t reserved[3];
 #endif
-};
+  // The Itanium ABI requires that _Unwind_Exception objects are "double-word
+  // aligned".  GCC has interpreted this to mean "use the maximum useful
+  // alignment for the target"; so do we.
+} __attribute__((__aligned__));
 
 typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
 (int version,

Added: libunwind/branches/release_39/test/alignment.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/branches/release_39/test/alignment.pass.cpp?rev=276462=auto
==
--- libunwind/branches/release_39/test/alignment.pass.cpp (added)
+++ libunwind/branches/release_39/test/alignment.pass.cpp Fri Jul 22 15:04:56 
2016
@@ -0,0 +1,21 @@
+// -*- C++ -*-
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// The Itanium ABI requires that _Unwind_Exception objects are "double-word
+// aligned".
+
+#include 
+
+struct MaxAligned {} __attribute__((aligned));
+static_assert(alignof(_Unwind_Exception) == alignof(MaxAligned), "");
+
+int main()
+{
+}


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


Re: [PATCH] D22514: CloneDetection now respects statement specific data when searching for clones.

2016-07-22 Thread Vassil Vassilev via cfe-commits
v.g.vassilev added a comment.

Could we stress test the implementation by running on files from llvm's/clang's 
test suite. For example, for a test TST we could do something like: cat TST >> 
tmp_TST;  cat TST >> tmp_TST and run our our copy-paste checker on tmp_TST. 
This way we know how many clones to expect and we can cross-check how many we 
are able to detect.



Comment at: lib/Analysis/CloneDetection.cpp:98
@@ +97,3 @@
+  ///FoldingSetNodeID.
+  StmtDataCollector(Stmt const *S, ASTContext ,
+llvm::FoldingSetNodeID ) : Context(Context), D(D) {

I'd prefer to see `const Stmt *S`. Could you please edit all occurrences?


Comment at: lib/Analysis/CloneDetection.cpp:109
@@ +108,3 @@
+
+  void addData(llvm::StringRef const ) {
+D.AddString(String);

Use just `llvm::StringRef`, we don't need `const &`.


Comment at: lib/Analysis/CloneDetection.cpp:113
@@ +112,3 @@
+
+  void addData(std::string const ) {
+D.AddString(String);

Same here, `const std::string `. Is this caught by clang-format?


Comment at: test/Analysis/copypaste/test-catch.cpp:29
@@ +28,2 @@
+  return true;
+}

Could you add an example like:

```
void non_compound_stmt1(int x)
  try { x / 0; } catch(...) { x++; }

void non_compound_stmt2(int x, float z)
  try { z / 0; } catch(...) { x++; }
```



https://reviews.llvm.org/D22514



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


Re: [PATCH] D22637: [OpenCL] Add extension cl_khr_mipmap_image to clang

2016-07-22 Thread Aaron En Ye Shi via cfe-commits
ashi1 updated this revision to Diff 65126.
ashi1 marked an inline comment as done.
ashi1 added a comment.

Revised based on Sam's comments.


Repository:
  rL LLVM

https://reviews.llvm.org/D22637

Files:
  include/clang/Basic/OpenCLExtensions.def
  lib/Basic/Targets.cpp
  test/Misc/amdgcn.languageOptsOpenCL.cl
  test/SemaOpenCL/extension-version.cl

Index: test/SemaOpenCL/extension-version.cl
===
--- test/SemaOpenCL/extension-version.cl
+++ test/SemaOpenCL/extension-version.cl
@@ -221,6 +221,18 @@
 #endif
 #pragma OPENCL EXTENSION cl_khr_egl_image: enable
 
+#if (__OPENCL_C_VERSION__ < 200)
+#ifdef cl_khr_mipmap_image
+#error "Incorrect cl_khr_mipmap_image define"
+#endif
+// expected-warning@+6{{unsupported OpenCL extension 'cl_khr_mipmap_image' - 
ignoring}}
+#else
+#ifndef cl_khr_mipmap_image
+#error "Missing cl_khr_mipmap_image define"
+#endif
+#endif
+#pragma OPENCL EXTENSION cl_khr_mipmap_image: enable
+
 #if (__OPENCL_C_VERSION__ >= 200)
 #ifndef cl_khr_srgb_image_writes
 #error "Missing cl_khr_srgb_image_writes define"
Index: test/Misc/amdgcn.languageOptsOpenCL.cl
===
--- test/Misc/amdgcn.languageOptsOpenCL.cl
+++ test/Misc/amdgcn.languageOptsOpenCL.cl
@@ -181,6 +181,18 @@
 #pragma OPENCL EXTENSION cl_khr_egl_image: enable
 // expected-warning@-1{{unsupported OpenCL extension 'cl_khr_egl_image' - 
ignoring}}
 
+#if (__OPENCL_C_VERSION__ < 200)
+#ifdef cl_khr_mipmap_image
+#error "Incorrect cl_khr_mipmap_image define"
+#endif
+// expected-warning@+6{{unsupported OpenCL extension 'cl_khr_mipmap_image' - 
ignoring}}
+#else
+#ifndef cl_khr_mipmap_image
+#error "Missing cl_khr_mipmap_image define"
+#endif
+#endif
+#pragma OPENCL EXTENSION cl_khr_mipmap_image: enable
+
 #ifdef cl_khr_srgb_image_writes
 #error "Incorrect cl_khr_srgb_image_writes define"
 #endif
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -2115,6 +2115,7 @@
   Opts.cl_khr_fp16 = 1;
   Opts.cl_khr_int64_base_atomics = 1;
   Opts.cl_khr_int64_extended_atomics = 1;
+  Opts.cl_khr_mipmap_image = 1;
   Opts.cl_khr_3d_image_writes = 1;
 }
   }
Index: include/clang/Basic/OpenCLExtensions.def
===
--- include/clang/Basic/OpenCLExtensions.def
+++ include/clang/Basic/OpenCLExtensions.def
@@ -67,6 +67,7 @@
 // OpenCL 2.0.
 OPENCLEXT_INTERNAL(cl_khr_egl_event, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_egl_image, 200, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_mipmap_image, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_terminate_context, 200, ~0U)


Index: test/SemaOpenCL/extension-version.cl
===
--- test/SemaOpenCL/extension-version.cl
+++ test/SemaOpenCL/extension-version.cl
@@ -221,6 +221,18 @@
 #endif
 #pragma OPENCL EXTENSION cl_khr_egl_image: enable
 
+#if (__OPENCL_C_VERSION__ < 200)
+#ifdef cl_khr_mipmap_image
+#error "Incorrect cl_khr_mipmap_image define"
+#endif
+// expected-warning@+6{{unsupported OpenCL extension 'cl_khr_mipmap_image' - ignoring}}
+#else
+#ifndef cl_khr_mipmap_image
+#error "Missing cl_khr_mipmap_image define"
+#endif
+#endif
+#pragma OPENCL EXTENSION cl_khr_mipmap_image: enable
+
 #if (__OPENCL_C_VERSION__ >= 200)
 #ifndef cl_khr_srgb_image_writes
 #error "Missing cl_khr_srgb_image_writes define"
Index: test/Misc/amdgcn.languageOptsOpenCL.cl
===
--- test/Misc/amdgcn.languageOptsOpenCL.cl
+++ test/Misc/amdgcn.languageOptsOpenCL.cl
@@ -181,6 +181,18 @@
 #pragma OPENCL EXTENSION cl_khr_egl_image: enable
 // expected-warning@-1{{unsupported OpenCL extension 'cl_khr_egl_image' - ignoring}}
 
+#if (__OPENCL_C_VERSION__ < 200)
+#ifdef cl_khr_mipmap_image
+#error "Incorrect cl_khr_mipmap_image define"
+#endif
+// expected-warning@+6{{unsupported OpenCL extension 'cl_khr_mipmap_image' - ignoring}}
+#else
+#ifndef cl_khr_mipmap_image
+#error "Missing cl_khr_mipmap_image define"
+#endif
+#endif
+#pragma OPENCL EXTENSION cl_khr_mipmap_image: enable
+
 #ifdef cl_khr_srgb_image_writes
 #error "Incorrect cl_khr_srgb_image_writes define"
 #endif
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -2115,6 +2115,7 @@
   Opts.cl_khr_fp16 = 1;
   Opts.cl_khr_int64_base_atomics = 1;
   Opts.cl_khr_int64_extended_atomics = 1;
+  Opts.cl_khr_mipmap_image = 1;
   Opts.cl_khr_3d_image_writes = 1;
 }
   }
Index: include/clang/Basic/OpenCLExtensions.def
===
--- include/clang/Basic/OpenCLExtensions.def
+++ 

Re: [PATCH] D22691: [OpenMP] Codegen for use_device_ptr clause.

2016-07-22 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 65123.
sfantao added a comment.

- Use the correct enumerator for return pointer, as specified in the design 
document.


https://reviews.llvm.org/D22691

Files:
  include/clang/AST/OpenMPClause.h
  lib/AST/OpenMPClause.cpp
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Sema/SemaOpenMP.cpp
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/OpenMP/target_data_use_device_ptr_codegen.cpp

Index: test/OpenMP/target_data_use_device_ptr_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/target_data_use_device_ptr_codegen.cpp
@@ -0,0 +1,464 @@
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+///==///
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+#ifdef CK1
+
+double *g;
+
+// CK1: @g = global double*
+// CK1: [[MTYPE00:@.+]] = {{.*}}constant [1 x i32] [i32 99]
+// CK1: [[MTYPE01:@.+]] = {{.*}}constant [1 x i32] [i32 99]
+// CK1: [[MTYPE03:@.+]] = {{.*}}constant [1 x i32] [i32 99]
+// CK1: [[MTYPE04:@.+]] = {{.*}}constant [1 x i32] [i32 99]
+// CK1: [[MTYPE05:@.+]] = {{.*}}constant [1 x i32] [i32 99]
+// CK1: [[MTYPE06:@.+]] = {{.*}}constant [1 x i32] [i32 99]
+// CK1: [[MTYPE07:@.+]] = {{.*}}constant [1 x i32] [i32 99]
+// CK1: [[MTYPE08:@.+]] = {{.*}}constant [2 x i32] [{{i32 35, i32 99|i32 99, i32 35}}]
+// CK1: [[MTYPE09:@.+]] = {{.*}}constant [2 x i32] [i32 99, i32 99]
+// CK1: [[MTYPE10:@.+]] = {{.*}}constant [2 x i32] [i32 99, i32 99]
+// CK1: [[MTYPE11:@.+]] = {{.*}}constant [2 x i32] [i32 96, i32 35]
+// CK1: [[MTYPE12:@.+]] = {{.*}}constant [2 x i32] [i32 96, i32 35]
+
+// CK1-LABEL: @_Z3foo
+template
+void foo(float *, T *) {
+  float *l;
+  T *t;
+
+  // CK1-DAG: [[RVAL:%.+]] = bitcast double* [[T:%.+]] to i8*
+  // CK1-DAG: [[T]] = load double*, double** [[DECL:@g]],
+  // CK1: [[BP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* %{{.+}}, i32 0, i32 0
+  // CK1: store i8* [[RVAL]], i8** [[BP]],
+  // CK1: call void @__tgt_target_data_begin{{.+}}[[MTYPE00]]
+  // CK1: [[CBP:%.+]] = bitcast i8** [[BP]] to double**
+  // CK1: [[VAL:%.+]] = load double*, double** [[CBP]],
+  // CK1-NOT: store double* [[VAL]], double** [[DECL]],
+  // CK1: store double* [[VAL]], double** [[PVT:%.+]],
+  // CK1: [[TT:%.+]] = load double*, double** [[PVT]],
+  // CK1: getelementptr inbounds double, double* [[TT]], i32 1
+  #pragma omp target data map(g[:10]) use_device_ptr(g)
+  {
+++g;
+  }
+  // CK1: call void @__tgt_target_data_end{{.+}}[[MTYPE00]]
+  // CK1: [[TTT:%.+]] = load double*, double** [[DECL]],
+  // CK1: getelementptr inbounds double, double* [[TTT]], i32 1
+  ++g;
+
+  // CK1-DAG: [[RVAL:%.+]] = bitcast float* [[T1:%.+]] to i8*
+  // CK1-DAG: [[T1]] = load float*, float** [[DECL:%.+]],
+  // CK1: [[BP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* %{{.+}}, i32 0, i32 0
+  // CK1: store i8* [[RVAL]], i8** [[BP]],
+  // CK1: call void @__tgt_target_data_begin{{.+}}[[MTYPE01]]
+  // CK1: [[CBP:%.+]] = bitcast i8** [[BP]] to float**
+  // CK1: [[VAL:%.+]] = load float*, float** [[CBP]],
+  // CK1-NOT: store float* [[VAL]], float** [[DECL]],
+  // CK1: store float* [[VAL]], float** [[PVT:%.+]],
+  // CK1: [[TT1:%.+]] = load float*, float** [[PVT]],
+  // CK1: getelementptr inbounds float, float* [[TT1]], i32 1
+  #pragma omp target data map(l[:10]) use_device_ptr(l)
+  {
+++l;
+  }
+  // CK1: call void @__tgt_target_data_end{{.+}}[[MTYPE01]]
+  // CK1: [[TTT:%.+]] = load float*, float** [[DECL]],
+  // CK1: getelementptr inbounds float, float* [[TTT]], i32 1
+  ++l;
+
+  // CK1-NOT: call void @__tgt_target
+  // CK1: [[TTT:%.+]] = load float*, float** 

Re: r276250 - [Sema, X86] Add explicit check to ensure that builtins that require x86-64 target throw an error if used on 32-bit target.

2016-07-22 Thread Craig Topper via cfe-commits
Most of these have been broken like this for a long time so I'm not sure.
This patch as is depends on r276249 too since we were missing qualifiers in
the intrinsics file.

~Craig

On Fri, Jul 22, 2016 at 6:55 AM, Hans Wennborg  wrote:

> Should we merge this to 3.9?
>
> On Thu, Jul 21, 2016 at 3:38 AM, Craig Topper via cfe-commits
>  wrote:
> > Author: ctopper
> > Date: Thu Jul 21 02:38:43 2016
> > New Revision: 276250
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=276250=rev
> > Log:
> > [Sema,X86] Add explicit check to ensure that builtins that require
> x86-64 target throw an error if used on 32-bit target.
> >
> > If these builtins are allowed to go through on a 32-bit target they will
> fire assertions in the backend.
> >
> > Fixes PR28635.
> >
> > Added:
> > cfe/trunk/test/CodeGen/builtins-x86-disabled.c
> > Modified:
> > cfe/trunk/lib/Sema/SemaChecking.cpp
> >
> > Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=276250=276249=276250=diff
> >
> ==
> > --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
> > +++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Jul 21 02:38:43 2016
> > @@ -1597,6 +1597,56 @@ bool Sema::CheckX86BuiltinFunctionCall(u
> >  return SemaBuiltinCpuSupports(*this, TheCall);
> >case X86::BI__builtin_ms_va_start:
> >  return SemaBuiltinMSVAStart(TheCall);
> > +  case X86::BI__builtin_ia32_addcarryx_u64:
> > +  case X86::BI__builtin_ia32_addcarry_u64:
> > +  case X86::BI__builtin_ia32_subborrow_u64:
> > +  case X86::BI__builtin_ia32_readeflags_u64:
> > +  case X86::BI__builtin_ia32_writeeflags_u64:
> > +  case X86::BI__builtin_ia32_bextr_u64:
> > +  case X86::BI__builtin_ia32_bextri_u64:
> > +  case X86::BI__builtin_ia32_bzhi_di:
> > +  case X86::BI__builtin_ia32_pdep_di:
> > +  case X86::BI__builtin_ia32_pext_di:
> > +  case X86::BI__builtin_ia32_crc32di:
> > +  case X86::BI__builtin_ia32_fxsave64:
> > +  case X86::BI__builtin_ia32_fxrstor64:
> > +  case X86::BI__builtin_ia32_xsave64:
> > +  case X86::BI__builtin_ia32_xrstor64:
> > +  case X86::BI__builtin_ia32_xsaveopt64:
> > +  case X86::BI__builtin_ia32_xrstors64:
> > +  case X86::BI__builtin_ia32_xsavec64:
> > +  case X86::BI__builtin_ia32_xsaves64:
> > +  case X86::BI__builtin_ia32_rdfsbase64:
> > +  case X86::BI__builtin_ia32_rdgsbase64:
> > +  case X86::BI__builtin_ia32_wrfsbase64:
> > +  case X86::BI__builtin_ia32_wrgsbase64:
> > +  case X86::BI__builtin_ia32_pbroadcastb512_gpr_mask:
> > +  case X86::BI__builtin_ia32_pbroadcastb256_gpr_mask:
> > +  case X86::BI__builtin_ia32_pbroadcastb128_gpr_mask:
> > +  case X86::BI__builtin_ia32_vcvtsd2si64:
> > +  case X86::BI__builtin_ia32_vcvtsd2usi64:
> > +  case X86::BI__builtin_ia32_vcvtss2si64:
> > +  case X86::BI__builtin_ia32_vcvtss2usi64:
> > +  case X86::BI__builtin_ia32_vcvttsd2si64:
> > +  case X86::BI__builtin_ia32_vcvttsd2usi64:
> > +  case X86::BI__builtin_ia32_vcvttss2si64:
> > +  case X86::BI__builtin_ia32_vcvttss2usi64:
> > +  case X86::BI__builtin_ia32_cvtss2si64:
> > +  case X86::BI__builtin_ia32_cvttss2si64:
> > +  case X86::BI__builtin_ia32_cvtsd2si64:
> > +  case X86::BI__builtin_ia32_cvttsd2si64:
> > +  case X86::BI__builtin_ia32_cvtsi2sd64:
> > +  case X86::BI__builtin_ia32_cvtsi2ss64:
> > +  case X86::BI__builtin_ia32_cvtusi2sd64:
> > +  case X86::BI__builtin_ia32_cvtusi2ss64:
> > +  case X86::BI__builtin_ia32_rdseed64_step: {
> > +// These builtins only work on x86-64 targets.
> > +const llvm::Triple  = Context.getTargetInfo().getTriple();
> > +if (TT.getArch() != llvm::Triple::x86_64)
> > +  return Diag(TheCall->getCallee()->getLocStart(),
> > +  diag::err_x86_builtin_32_bit_tgt);
> > +return false;
> > +  }
> >case X86::BI__builtin_ia32_extractf64x4_mask:
> >case X86::BI__builtin_ia32_extracti64x4_mask:
> >case X86::BI__builtin_ia32_extractf32x8_mask:
> >
> > Added: cfe/trunk/test/CodeGen/builtins-x86-disabled.c
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-x86-disabled.c?rev=276250=auto
> >
> ==
> > --- cfe/trunk/test/CodeGen/builtins-x86-disabled.c (added)
> > +++ cfe/trunk/test/CodeGen/builtins-x86-disabled.c Thu Jul 21 02:38:43
> 2016
> > @@ -0,0 +1,22 @@
> > +// REQUIRES: x86-registered-target
> > +// RUN: not %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o -
> 2>&1 | FileCheck %s
> > +
> > +void call_x86_64_builtins(void)
> > +{
> > +  unsigned long long a = __builtin_ia32_crc32di(0, 0);
> > +  unsigned long long b;
> > +  unsigned int c = __builtin_ia32_rdseed64_step ();
> > +  unsigned long long d = __builtin_ia32_bextr_u64 (0, 0);
> > +  unsigned long long e = __builtin_ia32_pdep_di(0, 0);
> > +  unsigned long long f = __builtin_ia32_pext_di(0, 0);
> > +  unsigned 

Re: [PATCH] D20795: Added basic capabilities to detect source code clones.

2016-07-22 Thread Vassil Vassilev via cfe-commits
v.g.vassilev accepted this revision.
v.g.vassilev added a comment.
This revision is now accepted and ready to land.

LGTM, given the comments are addressed.



Comment at: include/clang/Analysis/CloneDetection.h:37
@@ +36,3 @@
+  /// Stmt, then S is a pointer to this Stmt.
+  Stmt const *S;
+

It is more common in the codebase to use Did you mean `const Stmt *S`. Could 
you update all similar occurrences to it?


Comment at: lib/Analysis/CloneDetection.cpp:119
@@ +118,3 @@
+  /// \brief Retrieves the CloneSignature that describes the given Sequence.
+  CloneDetector::CloneSignature get(StmtSequence const ) const {
+// This cache promises good lookup time for recently added CloneSignatures

Same here `const StmtSequence ` is the common style in the codebase.


https://reviews.llvm.org/D20795



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


Re: [PATCH] D15031: CFG: Add CFGElement for automatic variables that leave the scope

2016-07-22 Thread Matthias Gehre via cfe-commits
mgehre added a comment.

Friendly ping


https://reviews.llvm.org/D15031



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


Re: [PATCH] D22637: [OpenCL] Add extension cl_khr_mipmap_image to clang

2016-07-22 Thread Yaxun Liu via cfe-commits
yaxunl added inline comments.


Comment at: test/Misc/amdgcn.languageOptsOpenCL.cl:190
@@ +189,3 @@
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_mipmap_image' - 
ignoring}}
+#endif
+

we also need to check the else case for `__OPENCL_C_VERSION__ < 200` that 
cl_khr_mipmap_image is defined and no warning msg for #pragma OPENCL EXTENSION 
cl_khr_mipmap_image: enable


Repository:
  rL LLVM

https://reviews.llvm.org/D22637



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


Re: [PATCH] D20602: Add .rgba syntax extension to ext_vector_type types

2016-07-22 Thread Pirama Arumuga Nainar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL276455: Add .rgba syntax extension to ext_vector_type types 
(authored by pirama).

Changed prior to commit:
  https://reviews.llvm.org/D20602?vs=62305=65119#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D20602

Files:
  cfe/trunk/include/clang/AST/Type.h
  cfe/trunk/include/clang/Basic/DiagnosticGroups.td
  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
  cfe/trunk/lib/AST/Expr.cpp
  cfe/trunk/lib/Sema/SemaExprMember.cpp
  cfe/trunk/test/CodeGen/ext-vector.c
  cfe/trunk/test/Sema/ext_vector_components.c
  cfe/trunk/test/SemaOpenCL/ext_vectors.cl

Index: cfe/trunk/include/clang/AST/Type.h
===
--- cfe/trunk/include/clang/AST/Type.h
+++ cfe/trunk/include/clang/AST/Type.h
@@ -2812,19 +2812,20 @@
 /// __attribute__((ext_vector_type(n)), where "n" is the number of elements.
 /// Unlike vector_size, ext_vector_type is only allowed on typedef's. This
 /// class enables syntactic extensions, like Vector Components for accessing
-/// points, colors, and textures (modeled after OpenGL Shading Language).
+/// points (as .xyzw), colors (as .rgba), and textures (modeled after OpenGL
+/// Shading Language).
 class ExtVectorType : public VectorType {
   ExtVectorType(QualType vecType, unsigned nElements, QualType canonType) :
 VectorType(ExtVector, vecType, nElements, canonType, GenericVector) {}
   friend class ASTContext;  // ASTContext creates these.
 public:
   static int getPointAccessorIdx(char c) {
 switch (c) {
 default: return -1;
-case 'x': return 0;
-case 'y': return 1;
-case 'z': return 2;
-case 'w': return 3;
+case 'x': case 'r': return 0;
+case 'y': case 'g': return 1;
+case 'z': case 'b': return 2;
+case 'w': case 'a': return 3;
 }
   }
   static int getNumericAccessorIdx(char c) {
@@ -2855,13 +2856,15 @@
 }
   }
 
-  static int getAccessorIdx(char c) {
-if (int idx = getPointAccessorIdx(c)+1) return idx-1;
-return getNumericAccessorIdx(c);
+  static int getAccessorIdx(char c, bool isNumericAccessor) {
+if (isNumericAccessor)
+  return getNumericAccessorIdx(c);
+else
+  return getPointAccessorIdx(c);
   }
 
-  bool isAccessorWithinNumElements(char c) const {
-if (int idx = getAccessorIdx(c)+1)
+  bool isAccessorWithinNumElements(char c, bool isNumericAccessor) const {
+if (int idx = getAccessorIdx(c, isNumericAccessor)+1)
   return unsigned(idx-1) < getNumElements();
 return false;
   }
Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
@@ -7980,6 +7980,11 @@
   "blocks used in device side enqueue are expected to have parameters of type 'local void*'">;
 def err_opencl_enqueue_kernel_blocks_no_args : Error<
   "blocks in this form of device side enqueue call are expected to have have no parameters">;
+
+// OpenCL v2.2 s2.1.2.3 - Vector Component Access
+def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
+  "vector component name '%0' is an OpenCL version 2.2 feature">,
+  InGroup;
 } // end of sema category
 
 let CategoryName = "OpenMP Issue" in {
Index: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td
@@ -316,6 +316,7 @@
 def ObjCPointerIntrospectPerformSelector : DiagGroup<"deprecated-objc-pointer-introspection-performSelector">;
 def ObjCPointerIntrospect : DiagGroup<"deprecated-objc-pointer-introspection", [ObjCPointerIntrospectPerformSelector]>;
 def ObjCMultipleMethodNames : DiagGroup<"objc-multiple-method-names">;
+def OpenCLUnsupportedRGBA: DiagGroup<"opencl-unsupported-rgba">;
 def DeprecatedObjCIsaUsage : DiagGroup<"deprecated-objc-isa-usage">;
 def ExplicitInitializeCall : DiagGroup<"explicit-initialize-call">;
 def Packed : DiagGroup<"packed">;
Index: cfe/trunk/test/CodeGen/ext-vector.c
===
--- cfe/trunk/test/CodeGen/ext-vector.c
+++ cfe/trunk/test/CodeGen/ext-vector.c
@@ -301,3 +301,40 @@
   char valC;
   char16 destVal = valC ? valA : valB;
 }
+
+typedef __attribute__(( ext_vector_type(16) )) float float16;
+
+float16 vec16, vec16_2;
+
+// CHECK: @test_rgba
+void test_rgba() {
+  // CHECK: fadd <4 x float>
+  vec4_2 = vec4.abgr + vec4;
+
+  // CHECK: shufflevector {{.*}} 
+  vec2 = vec4.rg;
+  // CHECK: shufflevector {{.*}} 
+  vec2_2 = vec4.ba;
+  // CHECK: extractelement {{.*}} 2
+  f = vec4.b;
+  // CHECK: shufflevector {{.*}} 
+  vec4_2 = vec4_2.;
+
+  // CHECK: insertelement {{.*}} 0
+  vec2.r = f;
+  // CHECK: shufflevector {{.*}} 
+  vec2.gr = vec2;
+
+  // CHECK: extractelement {{.*}} 0
+  f = 

r276455 - Add .rgba syntax extension to ext_vector_type types

2016-07-22 Thread Pirama Arumuga Nainar via cfe-commits
Author: pirama
Date: Fri Jul 22 13:49:43 2016
New Revision: 276455

URL: http://llvm.org/viewvc/llvm-project?rev=276455=rev
Log:
Add .rgba syntax extension to ext_vector_type types

Summary:
This patch enables .rgba accessors to ext_vector_type types and adds
tests for syntax validation and code generation.

'a' and 'b' can appear either in the point access mode or the numeric
access mode (for indices 10 and 11).  To disambiguate between the two
usages, the accessor type is explicitly passed to relevant methods.

Reviewers: rsmith

Subscribers: Anastasia, bader, srhines, cfe-commits

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

Added:
cfe/trunk/test/SemaOpenCL/ext_vectors.cl
Modified:
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/Sema/SemaExprMember.cpp
cfe/trunk/test/CodeGen/ext-vector.c
cfe/trunk/test/Sema/ext_vector_components.c

Modified: cfe/trunk/include/clang/AST/Type.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=276455=276454=276455=diff
==
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Fri Jul 22 13:49:43 2016
@@ -2812,7 +2812,8 @@ public:
 /// __attribute__((ext_vector_type(n)), where "n" is the number of elements.
 /// Unlike vector_size, ext_vector_type is only allowed on typedef's. This
 /// class enables syntactic extensions, like Vector Components for accessing
-/// points, colors, and textures (modeled after OpenGL Shading Language).
+/// points (as .xyzw), colors (as .rgba), and textures (modeled after OpenGL
+/// Shading Language).
 class ExtVectorType : public VectorType {
   ExtVectorType(QualType vecType, unsigned nElements, QualType canonType) :
 VectorType(ExtVector, vecType, nElements, canonType, GenericVector) {}
@@ -2821,10 +2822,10 @@ public:
   static int getPointAccessorIdx(char c) {
 switch (c) {
 default: return -1;
-case 'x': return 0;
-case 'y': return 1;
-case 'z': return 2;
-case 'w': return 3;
+case 'x': case 'r': return 0;
+case 'y': case 'g': return 1;
+case 'z': case 'b': return 2;
+case 'w': case 'a': return 3;
 }
   }
   static int getNumericAccessorIdx(char c) {
@@ -2855,13 +2856,15 @@ public:
 }
   }
 
-  static int getAccessorIdx(char c) {
-if (int idx = getPointAccessorIdx(c)+1) return idx-1;
-return getNumericAccessorIdx(c);
+  static int getAccessorIdx(char c, bool isNumericAccessor) {
+if (isNumericAccessor)
+  return getNumericAccessorIdx(c);
+else
+  return getPointAccessorIdx(c);
   }
 
-  bool isAccessorWithinNumElements(char c) const {
-if (int idx = getAccessorIdx(c)+1)
+  bool isAccessorWithinNumElements(char c, bool isNumericAccessor) const {
+if (int idx = getAccessorIdx(c, isNumericAccessor)+1)
   return unsigned(idx-1) < getNumElements();
 return false;
   }

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=276455=276454=276455=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Fri Jul 22 13:49:43 2016
@@ -316,6 +316,7 @@ def ObjCRootClass : DiagGroup<"objc-root
 def ObjCPointerIntrospectPerformSelector : 
DiagGroup<"deprecated-objc-pointer-introspection-performSelector">;
 def ObjCPointerIntrospect : DiagGroup<"deprecated-objc-pointer-introspection", 
[ObjCPointerIntrospectPerformSelector]>;
 def ObjCMultipleMethodNames : DiagGroup<"objc-multiple-method-names">;
+def OpenCLUnsupportedRGBA: DiagGroup<"opencl-unsupported-rgba">;
 def DeprecatedObjCIsaUsage : DiagGroup<"deprecated-objc-isa-usage">;
 def ExplicitInitializeCall : DiagGroup<"explicit-initialize-call">;
 def Packed : DiagGroup<"packed">;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=276455=276454=276455=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jul 22 13:49:43 
2016
@@ -7980,6 +7980,11 @@ def err_opencl_enqueue_kernel_blocks_non
   "blocks used in device side enqueue are expected to have parameters of type 
'local void*'">;
 def err_opencl_enqueue_kernel_blocks_no_args : Error<
   "blocks in this form of device side enqueue call are expected to have have 
no parameters">;
+
+// OpenCL v2.2 s2.1.2.3 - Vector Component Access
+def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
+  "vector component name '%0' is an OpenCL version 2.2 

Re: [PATCH] D22637: [OpenCL] Add extension cl_khr_mipmap_image to clang

2016-07-22 Thread Aaron En Ye Shi via cfe-commits
ashi1 updated this revision to Diff 65118.
ashi1 marked an inline comment as done.
ashi1 added a comment.

Revised based on Sam's comments. Added to tests 
Misc\amdgcn.languageOptsOpenCL.cl and SemaOpenCL\extension-version.cl


Repository:
  rL LLVM

https://reviews.llvm.org/D22637

Files:
  include/clang/Basic/OpenCLExtensions.def
  lib/Basic/Targets.cpp
  test/Misc/amdgcn.languageOptsOpenCL.cl
  test/SemaOpenCL/extension-version.cl

Index: test/SemaOpenCL/extension-version.cl
===
--- test/SemaOpenCL/extension-version.cl
+++ test/SemaOpenCL/extension-version.cl
@@ -222,6 +222,15 @@
 #pragma OPENCL EXTENSION cl_khr_egl_image: enable
 
 #if (__OPENCL_C_VERSION__ >= 200)
+#ifndef cl_khr_mipmap_image
+#error "Missing cl_khr_mipmap_image define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_mipmap_image' - 
ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_mipmap_image: enable
+
+#if (__OPENCL_C_VERSION__ >= 200)
 #ifndef cl_khr_srgb_image_writes
 #error "Missing cl_khr_srgb_image_writes define"
 #endif
Index: test/Misc/amdgcn.languageOptsOpenCL.cl
===
--- test/Misc/amdgcn.languageOptsOpenCL.cl
+++ test/Misc/amdgcn.languageOptsOpenCL.cl
@@ -181,6 +181,14 @@
 #pragma OPENCL EXTENSION cl_khr_egl_image: enable
 // expected-warning@-1{{unsupported OpenCL extension 'cl_khr_egl_image' - 
ignoring}}
 
+#if (__OPENCL_C_VERSION__ < 200)
+#ifdef cl_khr_mipmap_image
+#error "Incorrect cl_khr_mipmap_image define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_mipmap_image: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_mipmap_image' - 
ignoring}}
+#endif
+
 #ifdef cl_khr_srgb_image_writes
 #error "Incorrect cl_khr_srgb_image_writes define"
 #endif
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -2115,6 +2115,7 @@
   Opts.cl_khr_fp16 = 1;
   Opts.cl_khr_int64_base_atomics = 1;
   Opts.cl_khr_int64_extended_atomics = 1;
+  Opts.cl_khr_mipmap_image = 1;
   Opts.cl_khr_3d_image_writes = 1;
 }
   }
Index: include/clang/Basic/OpenCLExtensions.def
===
--- include/clang/Basic/OpenCLExtensions.def
+++ include/clang/Basic/OpenCLExtensions.def
@@ -67,6 +67,7 @@
 // OpenCL 2.0.
 OPENCLEXT_INTERNAL(cl_khr_egl_event, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_egl_image, 200, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_mipmap_image, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_terminate_context, 200, ~0U)


Index: test/SemaOpenCL/extension-version.cl
===
--- test/SemaOpenCL/extension-version.cl
+++ test/SemaOpenCL/extension-version.cl
@@ -222,6 +222,15 @@
 #pragma OPENCL EXTENSION cl_khr_egl_image: enable
 
 #if (__OPENCL_C_VERSION__ >= 200)
+#ifndef cl_khr_mipmap_image
+#error "Missing cl_khr_mipmap_image define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_mipmap_image' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_mipmap_image: enable
+
+#if (__OPENCL_C_VERSION__ >= 200)
 #ifndef cl_khr_srgb_image_writes
 #error "Missing cl_khr_srgb_image_writes define"
 #endif
Index: test/Misc/amdgcn.languageOptsOpenCL.cl
===
--- test/Misc/amdgcn.languageOptsOpenCL.cl
+++ test/Misc/amdgcn.languageOptsOpenCL.cl
@@ -181,6 +181,14 @@
 #pragma OPENCL EXTENSION cl_khr_egl_image: enable
 // expected-warning@-1{{unsupported OpenCL extension 'cl_khr_egl_image' - ignoring}}
 
+#if (__OPENCL_C_VERSION__ < 200)
+#ifdef cl_khr_mipmap_image
+#error "Incorrect cl_khr_mipmap_image define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_mipmap_image: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_mipmap_image' - ignoring}}
+#endif
+
 #ifdef cl_khr_srgb_image_writes
 #error "Incorrect cl_khr_srgb_image_writes define"
 #endif
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -2115,6 +2115,7 @@
   Opts.cl_khr_fp16 = 1;
   Opts.cl_khr_int64_base_atomics = 1;
   Opts.cl_khr_int64_extended_atomics = 1;
+  Opts.cl_khr_mipmap_image = 1;
   Opts.cl_khr_3d_image_writes = 1;
 }
   }
Index: include/clang/Basic/OpenCLExtensions.def
===
--- include/clang/Basic/OpenCLExtensions.def
+++ include/clang/Basic/OpenCLExtensions.def
@@ -67,6 +67,7 @@
 // OpenCL 2.0.
 OPENCLEXT_INTERNAL(cl_khr_egl_event, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_egl_image, 200, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_mipmap_image, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U)
 

Re: [PATCH] D22636: Module: retry building modules that were just compiled by the same instance and are are out of date

2016-07-22 Thread Manman Ren via cfe-commits
manmanren added a comment.

In https://reviews.llvm.org/D22636#493072, @benlangmuir wrote:

> > Can you point me to the source codes where we use rename to replace the 
> > file? I am curious on how this all works out.
>
>
> This is the same as clang's handling of other output files.  See 
> {{CompilerInstance::createOutputFile}} and {{clearOutputFiles}}.  When we are 
> performing the GenerateModuleAction, the .pcm file will be the output file.


Thanks for the info!

> 

> 

> > What I described is a scenario I thought possible that can cause 
> > "out-of-date" error:

> 

> >  module "B" is out of date and needs to be rebuilt

> 

> >  note: imported by module "A"

> 

> >  The only invocation of ReadAST that reads a module file and can't handle 
> > out-of-date modules, is the path where we just built module "A" and tries 
> > to load module "A" (here ModuleLoadCapabilities will be ARR_Missing).

> 

> 

> Right, here and in PCH loading (I assume your case doesn't involve a PCH).  
> I'm concerned about adding this loop, because it removes the guarantee of 
> progress.  We should never need to build a module more than once in the same 
> compilation.  If we have a bug that's causing us to not be able to load a 
> module that we just compiled, I think we need to fix the underlying problem, 
> not just retry the build.


Yes, I agree. We should try to figure out the root cause. I gave the project 
owner a root with debugging messages, but with this root, the error disappeared 
:(

If you have suggestions on debugging this, let me know.

Thanks,
Manman


https://reviews.llvm.org/D22636



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


Re: [PATCH] D22666: Frontend: Fix mcount inlining bug

2016-07-22 Thread John McCall via cfe-commits
rjmccall added a comment.

In https://reviews.llvm.org/D22666#493026, @hfinkel wrote:

> What's the actual desired behavior here? Should the inliner strip out calls 
> to mcount() as it inlines?


I think they basically just want a late pass (as in immediately prior to 
codegen) to insert the mcount calls.


https://reviews.llvm.org/D22666



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


[PATCH] D22691: [OpenMP] Codegen for use_device_ptr clause.

2016-07-22 Thread Samuel Antao via cfe-commits
sfantao created this revision.
sfantao added reviewers: ABataev, hfinkel, carlo.bertolli, arpith-jacob, kkwli0.
sfantao added subscribers: cfe-commits, caomhin.

This patch adds support for the use_device_ptr clause. It includes changes in 
SEMA that could not be tested without codegen, namely, the use of the first 
private logic and mappable expressions support.

https://reviews.llvm.org/D22691

Files:
  include/clang/AST/OpenMPClause.h
  lib/AST/OpenMPClause.cpp
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Sema/SemaOpenMP.cpp
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/OpenMP/target_data_use_device_ptr_codegen.cpp

Index: test/OpenMP/target_data_use_device_ptr_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/target_data_use_device_ptr_codegen.cpp
@@ -0,0 +1,464 @@
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+///==///
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+#ifdef CK1
+
+double *g;
+
+// CK1: @g = global double*
+// CK1: [[MTYPE00:@.+]] = {{.*}}constant [1 x i32] [i32 547]
+// CK1: [[MTYPE01:@.+]] = {{.*}}constant [1 x i32] [i32 547]
+// CK1: [[MTYPE03:@.+]] = {{.*}}constant [1 x i32] [i32 547]
+// CK1: [[MTYPE04:@.+]] = {{.*}}constant [1 x i32] [i32 547]
+// CK1: [[MTYPE05:@.+]] = {{.*}}constant [1 x i32] [i32 547]
+// CK1: [[MTYPE06:@.+]] = {{.*}}constant [1 x i32] [i32 547]
+// CK1: [[MTYPE07:@.+]] = {{.*}}constant [1 x i32] [i32 547]
+// CK1: [[MTYPE08:@.+]] = {{.*}}constant [2 x i32] [{{i32 35, i32 547|i32 547, i32 35}}]
+// CK1: [[MTYPE09:@.+]] = {{.*}}constant [2 x i32] [i32 547, i32 547]
+// CK1: [[MTYPE10:@.+]] = {{.*}}constant [2 x i32] [i32 547, i32 547]
+// CK1: [[MTYPE11:@.+]] = {{.*}}constant [2 x i32] [i32 544, i32 35]
+// CK1: [[MTYPE12:@.+]] = {{.*}}constant [2 x i32] [i32 544, i32 35]
+
+// CK1-LABEL: @_Z3foo
+template
+void foo(float *, T *) {
+  float *l;
+  T *t;
+
+  // CK1-DAG: [[RVAL:%.+]] = bitcast double* [[T:%.+]] to i8*
+  // CK1-DAG: [[T]] = load double*, double** [[DECL:@g]],
+  // CK1: [[BP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* %{{.+}}, i32 0, i32 0
+  // CK1: store i8* [[RVAL]], i8** [[BP]],
+  // CK1: call void @__tgt_target_data_begin{{.+}}[[MTYPE00]]
+  // CK1: [[CBP:%.+]] = bitcast i8** [[BP]] to double**
+  // CK1: [[VAL:%.+]] = load double*, double** [[CBP]],
+  // CK1-NOT: store double* [[VAL]], double** [[DECL]],
+  // CK1: store double* [[VAL]], double** [[PVT:%.+]],
+  // CK1: [[TT:%.+]] = load double*, double** [[PVT]],
+  // CK1: getelementptr inbounds double, double* [[TT]], i32 1
+  #pragma omp target data map(g[:10]) use_device_ptr(g)
+  {
+++g;
+  }
+  // CK1: call void @__tgt_target_data_end{{.+}}[[MTYPE00]]
+  // CK1: [[TTT:%.+]] = load double*, double** [[DECL]],
+  // CK1: getelementptr inbounds double, double* [[TTT]], i32 1
+  ++g;
+
+  // CK1-DAG: [[RVAL:%.+]] = bitcast float* [[T1:%.+]] to i8*
+  // CK1-DAG: [[T1]] = load float*, float** [[DECL:%.+]],
+  // CK1: [[BP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* %{{.+}}, i32 0, i32 0
+  // CK1: store i8* [[RVAL]], i8** [[BP]],
+  // CK1: call void @__tgt_target_data_begin{{.+}}[[MTYPE01]]
+  // CK1: [[CBP:%.+]] = bitcast i8** [[BP]] to float**
+  // CK1: [[VAL:%.+]] = load float*, float** [[CBP]],
+  // CK1-NOT: store float* [[VAL]], float** [[DECL]],
+  // CK1: store float* [[VAL]], float** [[PVT:%.+]],
+  // CK1: [[TT1:%.+]] = load float*, float** [[PVT]],
+  // CK1: getelementptr inbounds float, float* [[TT1]], i32 1
+  #pragma omp target data map(l[:10]) use_device_ptr(l)
+  {
+++l;
+  }
+  // CK1: call void @__tgt_target_data_end{{.+}}[[MTYPE01]]
+  // 

[PATCH] D22690: [OpenMP] Add support for mapping array sections through pointer references.

2016-07-22 Thread Samuel Antao via cfe-commits
sfantao created this revision.
sfantao added reviewers: ABataev, hfinkel, carlo.bertolli, kkwli0.
sfantao added subscribers: cfe-commits, caomhin.

This patch fixes a bug in the map of array sections whose base is a reference 
to a pointer. The existing mapping support was not prepared to deal with it, 
causing the compiler to crash.

Mapping a reference to a pointer enjoys the same characteristics of a regular 
pointer, i.e., it is passed by value. Therefore, the reference has to be 
materialized in the target region.

https://reviews.llvm.org/D22690

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  test/OpenMP/target_map_codegen.cpp

Index: test/OpenMP/target_map_codegen.cpp
===
--- test/OpenMP/target_map_codegen.cpp
+++ test/OpenMP/target_map_codegen.cpp
@@ -60,12 +60,15 @@
 // RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK2 --check-prefix CK2-32
 #ifdef CK2
 
-// CK2-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
+// CK2: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
 // Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
-// CK2-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
+// CK2: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
+// CK2: [[SIZES2:@.+]] = {{.+}}constant [1 x i[[sz]]] zeroinitializer
+// Map types: OMP_MAP_IS_PTR = 32
+// CK2: [[TYPES2:@.+]] = {{.+}}constant [1 x i32] [i32 32]
 
-// CK2-LABEL: implicit_maps_integer_reference
-void implicit_maps_integer_reference (int a){
+// CK2-LABEL: implicit_maps_reference
+void implicit_maps_reference (int a, int *b){
   int  = a;
   // CK2-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
   // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
@@ -85,6 +88,25 @@
   {
++i;
   }
+
+  int * = b;
+  // CK2-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES2]]{{.+}}, {{.+}}[[TYPES2]]{{.+}})
+  // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
+  // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
+  // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
+  // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
+  // CK2-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
+  // CK2-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
+  // CK2-DAG: [[VALBP]] = bitcast i32* [[VAL:%.+]] to i8*
+  // CK2-DAG: [[VALP]] = bitcast i32* [[VAL]] to i8*
+  // CK2-DAG: [[VAL]] = load i32*, i32** [[ADDR:%.+]],
+  // CK2-DAG: [[ADDR]] = load i32**, i32*** [[ADDR2:%.+]],
+
+  // CK2: call void [[KERNEL2:@.+]](i32* [[VAL]])
+  #pragma omp target
+  {
+   ++p;
+  }
 }
 
 // CK2: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
@@ -99,6 +121,14 @@
 // CK2-32: [[RVAL:%.+]] = load i32*, i32** [[REF]],
 // CK2-32: {{.+}} = load i32, i32* [[RVAL]],
 
+// CK2: define internal void [[KERNEL2]](i32* [[ARG:%.+]])
+// CK2: [[ADDR:%.+]] = alloca i32*,
+// CK2: [[REF:%.+]] = alloca i32**,
+// CK2: store i32* [[ARG]], i32** [[ADDR]],
+// CK2: store i32** [[ADDR]], i32*** [[REF]],
+// CK2: [[T:%.+]] = load i32**, i32*** [[REF]],
+// CK2: [[TT:%.+]] = load i32*, i32** [[T]],
+// CK2: getelementptr inbounds i32, i32* [[TT]], i32 1
 #endif
 ///==///
 // RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-64
@@ -4471,4 +4501,67 @@
 // CK27: define {{.+}}[[CALL06]]
 // CK27: define {{.+}}[[CALL07]]
 #endif
+///==///
+// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK28 --check-prefix CK28-64
+// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK28 --check-prefix CK28-64
+// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s  --check-prefix CK28 --check-prefix CK28-32
+// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 

r276448 - Clang changes for overloading invariant.start and end intrinsics

2016-07-22 Thread Anna Thomas via cfe-commits
Author: annat
Date: Fri Jul 22 12:50:08 2016
New Revision: 276448

URL: http://llvm.org/viewvc/llvm-project?rev=276448=rev
Log:
Clang changes for overloading invariant.start and end intrinsics

This change depends on the corresponding LLVM change at:
https://reviews.llvm.org/D22519

The llvm.invariant.start and llvm.invariant.end intrinsics currently
support specifying invariant memory objects only in the default address
space.

With this LLVM change, these intrinsics are overloaded for any adddress space
for memory objects and we can use these llvm invariant intrinsics in
non-default address spaces.

Example: llvm.invariant.start.p1i8(i64 4, i8 addrspace(1)* %ptr)

This overloaded intrinsic is needed for representing final or invariant
memory in managed languages.

Modified:
cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
cfe/trunk/test/CodeGenCXX/init-invariant.cpp

Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=276448=276447=276448=diff
==
--- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Fri Jul 22 12:50:08 2016
@@ -127,7 +127,9 @@ static void EmitDeclInvariant(CodeGenFun
 
   // Grab the llvm.invariant.start intrinsic.
   llvm::Intrinsic::ID InvStartID = llvm::Intrinsic::invariant_start;
-  llvm::Constant *InvariantStart = CGF.CGM.getIntrinsic(InvStartID);
+  // Overloaded address space type.
+  llvm::Type *ObjectPtr[1] = {CGF.Int8PtrTy};
+  llvm::Constant *InvariantStart = CGF.CGM.getIntrinsic(InvStartID, ObjectPtr);
 
   // Emit a call with the size in bytes of the object.
   CharUnits WidthChars = CGF.getContext().getTypeSizeInChars(D.getType());

Modified: cfe/trunk/test/CodeGenCXX/init-invariant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/init-invariant.cpp?rev=276448=276447=276448=diff
==
--- cfe/trunk/test/CodeGenCXX/init-invariant.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/init-invariant.cpp Fri Jul 22 12:50:08 2016
@@ -1,12 +1,12 @@
 // RUN: %clang_cc1 -triple i686-linux-gnu -emit-llvm %s -o - | FileCheck %s 
--check-prefix=CHECK-O0
 // RUN: %clang_cc1 -triple i686-linux-gnu -emit-llvm %s -O1 -o - | FileCheck %s
 
-// Check that we add an llvm.invariant.start to mark when a global becomes
+// Check that we add an llvm.invariant.start.p0i8 to mark when a global becomes
 // read-only. If globalopt can fold the initializer, it will then mark the
 // variable as constant.
 
 // Do not produce markers at -O0.
-// CHECK-O0-NOT: llvm.invariant.start
+// CHECK-O0-NOT: llvm.invariant.start.p0i8
 
 struct A {
   A();
@@ -42,19 +42,19 @@ void e() {
 }
 
 // CHECK: call void @_ZN1AC1Ev({{.*}}* nonnull @a)
-// CHECK: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @a to 
i8*))
+// CHECK: call {{.*}}@llvm.invariant.start.p0i8(i64 4, i8* bitcast ({{.*}} @a 
to i8*))
 
 // CHECK: call void @_ZN1BC1Ev({{.*}}* nonnull @b)
-// CHECK-NOT: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @b 
to i8*))
+// CHECK-NOT: call {{.*}}@llvm.invariant.start.p0i8(i64 4, i8* bitcast ({{.*}} 
@b to i8*))
 
 // CHECK: call void @_ZN1CC1Ev({{.*}}* nonnull @c)
-// CHECK-NOT: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @c 
to i8*))
+// CHECK-NOT: call {{.*}}@llvm.invariant.start.p0i8(i64 4, i8* bitcast ({{.*}} 
@c to i8*))
 
 // CHECK: call i32 @_Z1fv(
 // CHECK: store {{.*}}, i32* @d
-// CHECK: call {{.*}}@llvm.invariant.start(i64 4, i8* bitcast ({{.*}} @d to 
i8*))
+// CHECK: call {{.*}}@llvm.invariant.start.p0i8(i64 4, i8* bitcast ({{.*}} @d 
to i8*))
 
 // CHECK-LABEL: define void @_Z1ev(
 // CHECK: call void @_ZN1AC1Ev(%struct.A* nonnull @_ZZ1evE1a)
-// CHECK: call {{.*}}@llvm.invariant.start(i64 4, i8* {{.*}}bitcast ({{.*}} 
@_ZZ1evE1a to i8*))
+// CHECK: call {{.*}}@llvm.invariant.start.p0i8(i64 4, i8* {{.*}}bitcast 
({{.*}} @_ZZ1evE1a to i8*))
 // CHECK-NOT: llvm.invariant.end


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


Re: [PATCH] D22636: Module: retry building modules that were just compiled by the same instance and are are out of date

2016-07-22 Thread Ben Langmuir via cfe-commits
benlangmuir added a comment.

> Can you point me to the source codes where we use rename to replace the file? 
> I am curious on how this all works out.


This is the same as clang's handling of other output files.  See 
{{CompilerInstance::createOutputFile}} and {{clearOutputFiles}}.  When we are 
performing the GenerateModuleAction, the .pcm file will be the output file.

> What I described is a scenario I thought possible that can cause 
> "out-of-date" error:

>  module "B" is out of date and needs to be rebuilt

>  note: imported by module "A"

>  The only invocation of ReadAST that reads a module file and can't handle 
> out-of-date modules, is the path where we just built module "A" and tries to 
> load module "A" (here ModuleLoadCapabilities will be ARR_Missing).


Right, here and in PCH loading (I assume your case doesn't involve a PCH).  I'm 
concerned about adding this loop, because it removes the guarantee of progress. 
 We should never need to build a module more than once in the same compilation. 
 If we have a bug that's causing us to not be able to load a module that we 
just compiled, I think we need to fix the underlying problem, not just retry 
the build.


https://reviews.llvm.org/D22636



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


[clang-tools-extra] r276445 - ClangRenameTests: Update libdeps.

2016-07-22 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Fri Jul 22 12:33:04 2016
New Revision: 276445

URL: http://llvm.org/viewvc/llvm-project?rev=276445=rev
Log:
ClangRenameTests: Update libdeps.

Modified:
clang-tools-extra/trunk/unittests/clang-rename/CMakeLists.txt

Modified: clang-tools-extra/trunk/unittests/clang-rename/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-rename/CMakeLists.txt?rev=276445=276444=276445=diff
==
--- clang-tools-extra/trunk/unittests/clang-rename/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/unittests/clang-rename/CMakeLists.txt Fri Jul 22 
12:33:04 2016
@@ -20,5 +20,6 @@ target_link_libraries(ClangRenameTests
   clangBasic
   clangFrontend
   clangIndex
+  clangLex
   clangTooling
   )


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


Re: [PATCH] D22494: [analyzer] Explain why analyzer report is not generated (fix for PR12421).

2016-07-22 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: test/Analysis/PR12421.c:11
@@ +10,2 @@
+
+// CHECK: warning: Path diagnostic report is not generated. HTMLDiagnostics 
does not support diagnostics that cross file boundaries.

We should use the name of the diagnostic consumer here - that will only be 
legible for the developers working on the attic analyzer core. 


Comment at: test/Analysis/PR12421.h:1
@@ +1,2 @@
+static void f() {
+  int *p = 0;

Please. do not use the PR as a file name. Use the purpose of the test instead,


https://reviews.llvm.org/D22494



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


RE: [PATCH] D16135: Macro Debug Info support in Clang

2016-07-22 Thread Aboud, Amjad via cfe-commits
Thanks Ranjeet,
Indeed I was planning to update the patches to top of trunk and reload them, so 
if you can save me this trouble I would appreciate that.
Once we upload the updated patches I would like to ping the community and ask 
for feedback.

Thanks,
Amjad 
> -Original Message-
> From: Ranjeet Singh [mailto:ranjeet.si...@arm.com]
> Sent: Friday, July 22, 2016 20:16
> To: Aboud, Amjad ; rich...@metafoo.co.uk;
> paul.robin...@sony.com; apra...@apple.com
> Cc: ranjeet.si...@arm.com; cfe-commits@lists.llvm.org
> Subject: Re: [PATCH] D16135: Macro Debug Info support in Clang
> 
> rs added a subscriber: rs.
> rs added a comment.
> 
> Hi Amjad,
> 
> are you still planning on getting this patch and
> https://reviews.llvm.org/D16077 committed ? It looks like these two patches
> are final pieces in the puzzle to get macro information in the DWARF debug
> output.
> 
> I've downloaded the diffs and applied them myself on my local checkout and
> they seem to work fine. If you would like me to upload the rebased patches
> onto phabricator to save you the trouble of having to the fix conflicts
> downstream then let me know.
> 
> Thanks,
> Ranjeet
> 
> 
> https://reviews.llvm.org/D16135
> 
> 

-
Intel Israel (74) Limited

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


[libclc] r276443 - AMDGPU: Implement get_global_offset builtin

2016-07-22 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Jul 22 12:24:24 2016
New Revision: 276443

URL: http://llvm.org/viewvc/llvm-project?rev=276443=rev
Log:
AMDGPU: Implement get_global_offset builtin

Also fix get_global_id to consider offset
No idea how to add this for ptx, so they are stuck with the old get_global_id
implementation.

v2: split to a separate patch

v3: Switch R600 to use implictarg.ptr

Signed-off-by: Jan Vesely 

Added:
libclc/trunk/amdgcn/lib/workitem/get_global_offset.cl
libclc/trunk/generic/include/clc/workitem/get_global_offset.h
libclc/trunk/ptx-nvidiacl/lib/workitem/get_global_id.cl
libclc/trunk/r600/lib/workitem/get_global_offset.cl
Modified:
libclc/trunk/amdgcn/lib/SOURCES
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/workitem/get_global_id.cl
libclc/trunk/ptx-nvidiacl/lib/SOURCES
libclc/trunk/r600/lib/SOURCES

Modified: libclc/trunk/amdgcn/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES?rev=276443=276442=276443=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES (original)
+++ libclc/trunk/amdgcn/lib/SOURCES Fri Jul 22 12:24:24 2016
@@ -1,5 +1,6 @@
 math/ldexp.cl
 synchronization/barrier_impl.ll
+workitem/get_global_offset.cl
 workitem/get_group_id.cl
 workitem/get_local_id.cl
 workitem/get_work_dim.cl

Added: libclc/trunk/amdgcn/lib/workitem/get_global_offset.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/workitem/get_global_offset.cl?rev=276443=auto
==
--- libclc/trunk/amdgcn/lib/workitem/get_global_offset.cl (added)
+++ libclc/trunk/amdgcn/lib/workitem/get_global_offset.cl Fri Jul 22 12:24:24 
2016
@@ -0,0 +1,11 @@
+#include 
+
+_CLC_DEF uint get_global_offset(uint dim)
+{
+   __attribute__((address_space(2))) uint * ptr =
+   (__attribute__((address_space(2))) uint *)
+   __builtin_amdgcn_implicitarg_ptr();
+   if (dim < 3)
+   return ptr[dim + 1];
+   return 0;
+}

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=276443=276442=276443=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Jul 22 12:24:24 2016
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* 6.11.2 Math Functions */
 #include 

Added: libclc/trunk/generic/include/clc/workitem/get_global_offset.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/workitem/get_global_offset.h?rev=276443=auto
==
--- libclc/trunk/generic/include/clc/workitem/get_global_offset.h (added)
+++ libclc/trunk/generic/include/clc/workitem/get_global_offset.h Fri Jul 22 
12:24:24 2016
@@ -0,0 +1 @@
+_CLC_DECL size_t get_global_offset(uint dim);

Modified: libclc/trunk/generic/lib/workitem/get_global_id.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/workitem/get_global_id.cl?rev=276443=276442=276443=diff
==
--- libclc/trunk/generic/lib/workitem/get_global_id.cl (original)
+++ libclc/trunk/generic/lib/workitem/get_global_id.cl Fri Jul 22 12:24:24 2016
@@ -1,5 +1,5 @@
 #include 
 
 _CLC_DEF size_t get_global_id(uint dim) {
-  return get_group_id(dim)*get_local_size(dim) + get_local_id(dim);
+  return get_group_id(dim) * get_local_size(dim) + get_local_id(dim) + 
get_global_offset(dim);
 }

Modified: libclc/trunk/ptx-nvidiacl/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/ptx-nvidiacl/lib/SOURCES?rev=276443=276442=276443=diff
==
--- libclc/trunk/ptx-nvidiacl/lib/SOURCES (original)
+++ libclc/trunk/ptx-nvidiacl/lib/SOURCES Fri Jul 22 12:24:24 2016
@@ -1,4 +1,5 @@
 synchronization/barrier.cl
+workitem/get_global_id.cl
 workitem/get_group_id.cl
 workitem/get_local_id.cl
 workitem/get_local_size.cl

Added: libclc/trunk/ptx-nvidiacl/lib/workitem/get_global_id.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/ptx-nvidiacl/lib/workitem/get_global_id.cl?rev=276443=auto
==
--- libclc/trunk/ptx-nvidiacl/lib/workitem/get_global_id.cl (added)
+++ libclc/trunk/ptx-nvidiacl/lib/workitem/get_global_id.cl Fri Jul 22 12:24:24 
2016
@@ -0,0 +1,5 @@
+#include 
+
+_CLC_DEF size_t get_global_id(uint dim) {
+  return get_group_id(dim) * get_local_size(dim) + get_local_id(dim);
+}

Modified: libclc/trunk/r600/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES?rev=276443=276442=276443=diff

[libclc] r276442 - AMDGPU: Use clang intrinsics for workitem builtins

2016-07-22 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Jul 22 12:24:20 2016
New Revision: 276442

URL: http://llvm.org/viewvc/llvm-project?rev=276442=rev
Log:
AMDGPU: Use clang intrinsics for workitem builtins

v2: split into 2 patches
use clang builtins for other intrinsics as well

v3: Fix warnings
Switch r600 to use implictarg.ptr

Signed-off-by: Jan Vesely 

Added:
libclc/trunk/amdgcn/lib/workitem/get_group_id.cl
libclc/trunk/amdgcn/lib/workitem/get_local_id.cl
libclc/trunk/amdgcn/lib/workitem/get_work_dim.cl
libclc/trunk/r600/lib/workitem/get_group_id.cl
libclc/trunk/r600/lib/workitem/get_local_id.cl
libclc/trunk/r600/lib/workitem/get_work_dim.cl
Removed:
libclc/trunk/amdgcn/lib/workitem/get_group_id.ll
libclc/trunk/amdgcn/lib/workitem/get_local_id.ll
libclc/trunk/amdgpu/lib/workitem/get_work_dim.ll
libclc/trunk/r600/lib/workitem/get_group_id.ll
libclc/trunk/r600/lib/workitem/get_local_id.ll
Modified:
libclc/trunk/amdgcn/lib/SOURCES
libclc/trunk/amdgpu/lib/SOURCES
libclc/trunk/r600/lib/SOURCES

Modified: libclc/trunk/amdgcn/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES?rev=276442=276441=276442=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES (original)
+++ libclc/trunk/amdgcn/lib/SOURCES Fri Jul 22 12:24:20 2016
@@ -1,4 +1,5 @@
 math/ldexp.cl
 synchronization/barrier_impl.ll
-workitem/get_group_id.ll
-workitem/get_local_id.ll
+workitem/get_group_id.cl
+workitem/get_local_id.cl
+workitem/get_work_dim.cl

Added: libclc/trunk/amdgcn/lib/workitem/get_group_id.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/workitem/get_group_id.cl?rev=276442=auto
==
--- libclc/trunk/amdgcn/lib/workitem/get_group_id.cl (added)
+++ libclc/trunk/amdgcn/lib/workitem/get_group_id.cl Fri Jul 22 12:24:20 2016
@@ -0,0 +1,11 @@
+#include 
+
+_CLC_DEF uint get_group_id(uint dim)
+{
+   switch(dim) {
+   case 0: return __builtin_amdgcn_workgroup_id_x();
+   case 1: return __builtin_amdgcn_workgroup_id_y();
+   case 2: return __builtin_amdgcn_workgroup_id_z();
+   default: return 1;
+   }
+}

Removed: libclc/trunk/amdgcn/lib/workitem/get_group_id.ll
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/workitem/get_group_id.ll?rev=276441=auto
==
--- libclc/trunk/amdgcn/lib/workitem/get_group_id.ll (original)
+++ libclc/trunk/amdgcn/lib/workitem/get_group_id.ll (removed)
@@ -1,29 +0,0 @@
-declare i32 @llvm.amdgcn.workgroup.id.x() #0
-declare i32 @llvm.amdgcn.workgroup.id.y() #0
-declare i32 @llvm.amdgcn.workgroup.id.z() #0
-
-define i32 @get_group_id(i32 %dim) #1 {
-  switch i32 %dim, label %default [
-i32 0, label %x_dim
-i32 1, label %y_dim
-i32 2, label %z_dim
-  ]
-
-x_dim:
-  %x = tail call i32 @llvm.amdgcn.workgroup.id.x()
-  ret i32 %x
-
-y_dim:
-  %y = tail call i32 @llvm.amdgcn.workgroup.id.y()
-  ret i32 %y
-
-z_dim:
-  %z = tail call i32 @llvm.amdgcn.workgroup.id.z()
-  ret i32 %z
-
-default:
-  ret i32 0
-}
-
-attributes #0 = { nounwind readnone }
-attributes #1 = { alwaysinline norecurse nounwind readnone }

Added: libclc/trunk/amdgcn/lib/workitem/get_local_id.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/workitem/get_local_id.cl?rev=276442=auto
==
--- libclc/trunk/amdgcn/lib/workitem/get_local_id.cl (added)
+++ libclc/trunk/amdgcn/lib/workitem/get_local_id.cl Fri Jul 22 12:24:20 2016
@@ -0,0 +1,11 @@
+#include 
+
+_CLC_DEF uint get_local_id(uint dim)
+{
+   switch(dim) {
+   case 0: return __builtin_amdgcn_workitem_id_x();
+   case 1: return __builtin_amdgcn_workitem_id_y();
+   case 2: return __builtin_amdgcn_workitem_id_z();
+   default: return 1;
+   }
+}

Removed: libclc/trunk/amdgcn/lib/workitem/get_local_id.ll
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/workitem/get_local_id.ll?rev=276441=auto
==
--- libclc/trunk/amdgcn/lib/workitem/get_local_id.ll (original)
+++ libclc/trunk/amdgcn/lib/workitem/get_local_id.ll (removed)
@@ -1,31 +0,0 @@
-declare i32 @llvm.amdgcn.workitem.id.x() #0
-declare i32 @llvm.amdgcn.workitem.id.y() #0
-declare i32 @llvm.amdgcn.workitem.id.z() #0
-
-define i32 @get_local_id(i32 %dim) #1 {
-  switch i32 %dim, label %default [
-i32 0, label %x_dim
-i32 1, label %y_dim
-i32 2, label %z_dim
-  ]
-
-x_dim:
-  %x = tail call i32 @llvm.amdgcn.workitem.id.x(), !range !0
-  ret i32 %x
-
-y_dim:
-  %y = tail call i32 @llvm.amdgcn.workitem.id.y(), !range !0
-  ret i32 %y
-
-z_dim:
-  %z = tail call i32 @llvm.amdgcn.workitem.id.z(), !range !0
-  ret i32 %z
-
-default:
-  ret i32 0
-}
-

Re: [PATCH] D22656: [Clang-apply-replacements] Remove custom version printing; fix some Include What You Use warnings

2016-07-22 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko updated this revision to Diff 65099.
Eugene.Zelenko added a comment.

Don't include DiagnosticIDs.h.


Repository:
  rL LLVM

https://reviews.llvm.org/D22656

Files:
  clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp

Index: clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
===
--- clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
+++ clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
@@ -16,13 +16,27 @@
 #include "clang-apply-replacements/Tooling/ApplyReplacements.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/DiagnosticOptions.h"
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/FileSystemOptions.h"
+#include "clang/Basic/LangOptions.h"
+#include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
-#include "clang/Basic/Version.h"
 #include "clang/Format/Format.h"
+#include "clang/Rewrite/Core/RewriteBuffer.h"
 #include "clang/Rewrite/Core/Rewriter.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/StringSet.h"
+#include "llvm/ADT/ArrayRef.h"   // for make...
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/raw_ostream.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 using namespace llvm;
 using namespace clang;
@@ -43,7 +57,6 @@
  "merging/replacing."),
 cl::init(false), cl::cat(ReplacementCategory));
 
-
 static cl::opt DoFormat(
 "format",
 cl::desc("Enable formatting of code changed by applying replacements.\n"
@@ -85,10 +98,6 @@
 };
 } // namespace
 
-static void printVersion() {
-  outs() << "clang-apply-replacements version " CLANG_VERSION_STRING << "\n";
-}
-
 /// \brief Convenience function to get rewritten content for \c Filename from
 /// \c Rewrites.
 ///
@@ -200,8 +209,6 @@
 
 int main(int argc, char **argv) {
   cl::HideUnrelatedOptions(makeArrayRef(VisibleCategories));
-
-  cl::SetVersionPrinter();
   cl::ParseCommandLineOptions(argc, argv);
 
   IntrusiveRefCntPtr DiagOpts(new DiagnosticOptions());


Index: clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
===
--- clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
+++ clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
@@ -16,13 +16,27 @@
 #include "clang-apply-replacements/Tooling/ApplyReplacements.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/DiagnosticOptions.h"
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/FileSystemOptions.h"
+#include "clang/Basic/LangOptions.h"
+#include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
-#include "clang/Basic/Version.h"
 #include "clang/Format/Format.h"
+#include "clang/Rewrite/Core/RewriteBuffer.h"
 #include "clang/Rewrite/Core/Rewriter.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/StringSet.h"
+#include "llvm/ADT/ArrayRef.h"   // for make...
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/raw_ostream.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 using namespace llvm;
 using namespace clang;
@@ -43,7 +57,6 @@
  "merging/replacing."),
 cl::init(false), cl::cat(ReplacementCategory));
 
-
 static cl::opt DoFormat(
 "format",
 cl::desc("Enable formatting of code changed by applying replacements.\n"
@@ -85,10 +98,6 @@
 };
 } // namespace
 
-static void printVersion() {
-  outs() << "clang-apply-replacements version " CLANG_VERSION_STRING << "\n";
-}
-
 /// \brief Convenience function to get rewritten content for \c Filename from
 /// \c Rewrites.
 ///
@@ -200,8 +209,6 @@
 
 int main(int argc, char **argv) {
   cl::HideUnrelatedOptions(makeArrayRef(VisibleCategories));
-
-  cl::SetVersionPrinter();
   cl::ParseCommandLineOptions(argc, argv);
 
   IntrusiveRefCntPtr DiagOpts(new DiagnosticOptions());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16135: Macro Debug Info support in Clang

2016-07-22 Thread Ranjeet Singh via cfe-commits
rs added a subscriber: rs.
rs added a comment.

Hi Amjad,

are you still planning on getting this patch and 
https://reviews.llvm.org/D16077 committed ? It looks like these two patches are 
final pieces in the puzzle to get macro information in the DWARF debug output.

I've downloaded the diffs and applied them myself on my local checkout and they 
seem to work fine. If you would like me to upload the rebased patches onto 
phabricator to save you the trouble of having to the fix conflicts downstream 
then let me know.

Thanks,
Ranjeet


https://reviews.llvm.org/D16135



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


Re: [PATCH] D22666: Frontend: Fix mcount inlining bug

2016-07-22 Thread Hal Finkel via cfe-commits
hfinkel added a subscriber: hfinkel.
hfinkel added a comment.

What's the actual desired behavior here? Should the inliner strip out calls to 
mcount() as it inlines?


https://reviews.llvm.org/D22666



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


Re: [PATCH] D22513: [clang-tidy] add check cppcoreguidelines-rule-of-five-and-zero

2016-07-22 Thread Jonathan B Coe via cfe-commits
jbcoe updated this revision to Diff 65096.
jbcoe marked 6 inline comments as done.
jbcoe added a comment.

Address comments from review, thanks for those.


https://reviews.llvm.org/D22513

Files:
  clang-tidy/cppcoreguidelines/CMakeLists.txt
  clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
  clang-tidy/cppcoreguidelines/RuleOfFiveAndZeroCheck.cpp
  clang-tidy/cppcoreguidelines/RuleOfFiveAndZeroCheck.h
  docs/clang-tidy/checks/cppcoreguidelines-rule-of-five-and-zero.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/cppcoreguidelines-rule-of-five-and-zero-cxx-03.cpp
  test/clang-tidy/cppcoreguidelines-rule-of-five-and-zero.cpp

Index: test/clang-tidy/cppcoreguidelines-rule-of-five-and-zero.cpp
===
--- /dev/null
+++ test/clang-tidy/cppcoreguidelines-rule-of-five-and-zero.cpp
@@ -0,0 +1,52 @@
+// RUN: %check_clang_tidy %s cppcoreguidelines-rule-of-five-and-zero %t
+
+class DefinesDestructor {
+  ~DefinesDestructor();
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesDestructor' defines a destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-rule-of-five-and-zero] 
+
+class DefinesCopyConstructor {
+  DefinesCopyConstructor(const DefinesCopyConstructor &);
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesCopyConstructor' defines a copy constructor but does not define a destructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-rule-of-five-and-zero]
+
+class DefinesCopyAssignment {
+  DefinesCopyAssignment =(const DefinesCopyAssignment &);
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesCopyAssignment' defines a copy assignment operator but does not define a destructor, a copy constructor, a move constructor or a move assignment operator [cppcoreguidelines-rule-of-five-and-zero]
+
+class DefinesMoveConstructor {
+  DefinesMoveConstructor(DefinesMoveConstructor &&);
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesMoveConstructor' defines a move constructor but does not define a destructor, a copy constructor, a copy assignment operator or a move assignment operator [cppcoreguidelines-rule-of-five-and-zero]
+
+class DefinesMoveAssignment {
+  DefinesMoveAssignment =(DefinesMoveAssignment &&);
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesMoveAssignment' defines a move assignment operator but does not define a destructor, a copy constructor, a copy assignment operator or a move constructor [cppcoreguidelines-rule-of-five-and-zero]
+class DefinesNothing {
+};
+
+class DefinesEverything {
+  DefinesEverything(const DefinesEverything &);
+  DefinesEverything =(const DefinesEverything &);
+  DefinesEverything(DefinesEverything &&);
+  DefinesEverything =(DefinesEverything &&);
+  ~DefinesEverything();
+};
+
+class DeletesEverything {
+  DeletesEverything(const DeletesEverything &) = delete;
+  DeletesEverything =(const DeletesEverything &) = delete;
+  DeletesEverything(DeletesEverything &&) = delete;
+  DeletesEverything =(DeletesEverything &&) = delete;
+  ~DeletesEverything() = delete;
+};
+
+class DeletesCopyDefaultsMove {
+  DeletesCopyDefaultsMove(const DeletesCopyDefaultsMove &) = delete;
+  DeletesCopyDefaultsMove =(const DeletesCopyDefaultsMove &) = delete;
+  DeletesCopyDefaultsMove(DeletesCopyDefaultsMove &&) = default;
+  DeletesCopyDefaultsMove =(DeletesCopyDefaultsMove &&) = default;
+  ~DeletesCopyDefaultsMove() = default;
+};
Index: test/clang-tidy/cppcoreguidelines-rule-of-five-and-zero-cxx-03.cpp
===
--- /dev/null
+++ test/clang-tidy/cppcoreguidelines-rule-of-five-and-zero-cxx-03.cpp
@@ -0,0 +1,26 @@
+// RUN: %check_clang_tidy %s cppcoreguidelines-rule-of-five-and-zero %t -- -- -std=c++03
+
+class DefinesDestructor {
+  ~DefinesDestructor();
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesDestructor' defines a destructor but does not define a copy constructor or a copy assignment operator [cppcoreguidelines-rule-of-five-and-zero] 
+
+class DefinesCopyConstructor {
+  DefinesCopyConstructor(const DefinesCopyConstructor &);
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesCopyConstructor' defines a copy constructor but does not define a destructor or a copy assignment operator [cppcoreguidelines-rule-of-five-and-zero]
+
+class DefinesCopyAssignment {
+  DefinesCopyAssignment =(const DefinesCopyAssignment &);
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesCopyAssignment' defines a copy assignment operator but does not define a destructor or a copy constructor [cppcoreguidelines-rule-of-five-and-zero]
+
+class DefinesNothing {
+};
+
+class DefinesEverything {
+  DefinesEverything(const DefinesEverything &);
+  DefinesEverything =(const DefinesEverything &);
+  ~DefinesEverything();
+};
+
Index: 

Re: [PATCH] D22654: [Clang-rename] Remove custom version, fix extra space in error message

2016-07-22 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

It's used for DiagnosticIDs.. However, in https://reviews.llvm.org/D22656 
Alexander told that DiagnosticIDs.h should be treated as part of Diagnostic.h.


Repository:
  rL LLVM

https://reviews.llvm.org/D22654



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


Re: [PATCH] D21385: Adjust Registry interface to not require plugins to export a registry

2016-07-22 Thread John Brawn via cfe-commits
john.brawn added a comment.

Ping.


Repository:
  rL LLVM

https://reviews.llvm.org/D21385



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


Re: [PATCH] D22221: Decide whether to enable plugin tests based on cmake variables

2016-07-22 Thread John Brawn via cfe-commits
john.brawn added a comment.

Ping.


Repository:
  rL LLVM

https://reviews.llvm.org/D1



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


Re: r276232 - [Sema] Fix PR28623.

2016-07-22 Thread George Burgess IV via cfe-commits
Error message says r272936 had the error, so it looks like it would, yeah.
:)

Would you like me to merge it to the 3.9 branch?

On Fri, Jul 22, 2016 at 6:51 AM, Hans Wennborg  wrote:

> Does this apply to 3.9?
>
> On Wed, Jul 20, 2016 at 11:28 PM, George Burgess IV via cfe-commits
>  wrote:
> > Author: gbiv
> > Date: Wed Jul 20 22:28:13 2016
> > New Revision: 276232
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=276232=rev
> > Log:
> > [Sema] Fix PR28623.
> >
> > In atomic builtins, we assumed that the LValue conversion on the first
> > argument would succeed. So, we would crash given code like:
> >
> > ```
> > void ovl(char);
> > void ovl(int);
> > __atomic_store_n(ovl, 0, 0);
> > ```
> >
> > This patch makes us not assume that said conversion is successful. :)
> >
> > Added:
> > cfe/trunk/test/SemaCXX/atomic-ops.cpp
> > Modified:
> > cfe/trunk/lib/Sema/SemaChecking.cpp
> >
> > Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=276232=276231=276232=diff
> >
> ==
> > --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
> > +++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Jul 20 22:28:13 2016
> > @@ -2398,7 +2398,11 @@ ExprResult Sema::SemaAtomicOpsOverloaded
> >
> >// Inspect the first argument of the atomic operation.
> >Expr *Ptr = TheCall->getArg(0);
> > -  Ptr = DefaultFunctionArrayLvalueConversion(Ptr).get();
> > +  ExprResult ConvertedPtr = DefaultFunctionArrayLvalueConversion(Ptr);
> > +  if (ConvertedPtr.isInvalid())
> > +return ExprError();
> > +
> > +  Ptr = ConvertedPtr.get();
> >const PointerType *pointerType = Ptr->getType()->getAs();
> >if (!pointerType) {
> >  Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer)
> >
> > Added: cfe/trunk/test/SemaCXX/atomic-ops.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/atomic-ops.cpp?rev=276232=auto
> >
> ==
> > --- cfe/trunk/test/SemaCXX/atomic-ops.cpp (added)
> > +++ cfe/trunk/test/SemaCXX/atomic-ops.cpp Wed Jul 20 22:28:13 2016
> > @@ -0,0 +1,9 @@
> > +// RUN: %clang_cc1 %s -verify -fsyntax-only -triple=i686-linux-gnu
> -std=c++11
> > +
> > +// We crashed when we couldn't properly convert the first arg of
> __atomic_* to
> > +// an lvalue.
> > +void PR28623() {
> > +  void helper(int); // expected-note{{target}}
> > +  void helper(char); // expected-note{{target}}
> > +  __atomic_store_n(helper, 0, 0); // expected-error{{reference to
> overloaded function could not be resolved}}
> > +}
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22513: [clang-tidy] add check cppcoreguidelines-rule-of-five-and-zero

2016-07-22 Thread Jonathan B Coe via cfe-commits
jbcoe removed rL LLVM as the repository for this revision.
jbcoe updated this revision to Diff 65092.
jbcoe marked 2 inline comments as done.
jbcoe added a comment.

Addressed review comments, thanks for those, check is nicer now.


https://reviews.llvm.org/D22513

Files:
  clang-tidy/cppcoreguidelines/CMakeLists.txt
  clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
  clang-tidy/cppcoreguidelines/RuleOfFiveAndZeroCheck.cpp
  clang-tidy/cppcoreguidelines/RuleOfFiveAndZeroCheck.h
  docs/clang-tidy/checks/cppcoreguidelines-rule-of-five-and-zero.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/cppcoreguidelines-rule-of-five-and-zero-cxx-03.cpp
  test/clang-tidy/cppcoreguidelines-rule-of-five-and-zero.cpp

Index: test/clang-tidy/cppcoreguidelines-rule-of-five-and-zero.cpp
===
--- /dev/null
+++ test/clang-tidy/cppcoreguidelines-rule-of-five-and-zero.cpp
@@ -0,0 +1,52 @@
+// RUN: %check_clang_tidy %s cppcoreguidelines-rule-of-five-and-zero %t
+
+class DefinesDestructor {
+  ~DefinesDestructor();
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesDestructor' defines a destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-rule-of-five-and-zero] 
+
+class DefinesCopyConstructor {
+  DefinesCopyConstructor(const DefinesCopyConstructor &);
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesCopyConstructor' defines a copy constructor but does not define a destructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-rule-of-five-and-zero]
+
+class DefinesCopyAssignment {
+  DefinesCopyAssignment =(const DefinesCopyAssignment &);
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesCopyAssignment' defines a copy assignment operator but does not define a destructor, a copy constructor, a move constructor or a move assignment operator [cppcoreguidelines-rule-of-five-and-zero]
+
+class DefinesMoveConstructor {
+  DefinesMoveConstructor(DefinesMoveConstructor &&);
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesMoveConstructor' defines a move constructor but does not define a destructor, a copy constructor, a copy assignment operator or a move assignment operator [cppcoreguidelines-rule-of-five-and-zero]
+
+class DefinesMoveAssignment {
+  DefinesMoveAssignment =(DefinesMoveAssignment &&);
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesMoveAssignment' defines a move assignment operator but does not define a destructor, a copy constructor, a copy assignment operator or a move constructor [cppcoreguidelines-rule-of-five-and-zero]
+class DefinesNothing {
+};
+
+class DefinesEverything {
+  DefinesEverything(const DefinesEverything &);
+  DefinesEverything =(const DefinesEverything &);
+  DefinesEverything(DefinesEverything &&);
+  DefinesEverything =(DefinesEverything &&);
+  ~DefinesEverything();
+};
+
+class DeletesEverything {
+  DeletesEverything(const DeletesEverything &);
+  DeletesEverything =(const DeletesEverything &);
+  DeletesEverything(DeletesEverything &&);
+  DeletesEverything =(DeletesEverything &&);
+  ~DeletesEverything();
+};
+
+class DeletesCopyDefaultsMove {
+  DeletesCopyDefaultsMove(const DeletesCopyDefaultsMove &) = delete;
+  DeletesCopyDefaultsMove =(const DeletesCopyDefaultsMove &) = delete;
+  DeletesCopyDefaultsMove(DeletesCopyDefaultsMove &&) = default;
+  DeletesCopyDefaultsMove =(DeletesCopyDefaultsMove &&) = default;
+  ~DeletesCopyDefaultsMove() = default;
+};
Index: test/clang-tidy/cppcoreguidelines-rule-of-five-and-zero-cxx-03.cpp
===
--- /dev/null
+++ test/clang-tidy/cppcoreguidelines-rule-of-five-and-zero-cxx-03.cpp
@@ -0,0 +1,32 @@
+// RUN: %check_clang_tidy %s cppcoreguidelines-rule-of-five-and-zero %t -- -- -std=c++03
+
+class DefinesDestructor {
+  ~DefinesDestructor();
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesDestructor' defines a destructor but does not define a copy constructor or a copy assignment operator [cppcoreguidelines-rule-of-five-and-zero] 
+
+class DefinesCopyConstructor {
+  DefinesCopyConstructor(const DefinesCopyConstructor &);
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesCopyConstructor' defines a copy constructor but does not define a destructor or a copy assignment operator [cppcoreguidelines-rule-of-five-and-zero]
+
+class DefinesCopyAssignment {
+  DefinesCopyAssignment =(const DefinesCopyAssignment &);
+};
+// CHECK-MESSAGES: [[@LINE-3]]:7: warning: class 'DefinesCopyAssignment' defines a copy assignment operator but does not define a destructor or a copy constructor [cppcoreguidelines-rule-of-five-and-zero]
+
+class DefinesNothing {
+};
+
+class DefinesEverything {
+  DefinesEverything(const DefinesEverything &);
+  DefinesEverything =(const DefinesEverything &);
+  

r276425 - test commit. update comment grammatically. NFC

2016-07-22 Thread Anna Thomas via cfe-commits
Author: annat
Date: Fri Jul 22 10:37:56 2016
New Revision: 276425

URL: http://llvm.org/viewvc/llvm-project?rev=276425=rev
Log:
test commit. update comment grammatically. NFC

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

Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=276425=276424=276425=diff
==
--- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Fri Jul 22 10:37:56 2016
@@ -121,7 +121,7 @@ static void EmitDeclDestroy(CodeGenFunct
 /// constant from this point onwards.
 static void EmitDeclInvariant(CodeGenFunction , const VarDecl ,
   llvm::Constant *Addr) {
-  // Don't emit the intrinsic if we're not optimizing.
+  // Do not emit the intrinsic if we're not optimizing.
   if (!CGF.CGM.getCodeGenOpts().OptimizationLevel)
 return;
 


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


Re: [PATCH] D22622: [analyzer] Add more info to exploded graph dumps

2016-07-22 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Great!

How does this work when a path spans multiple files, specifically, when the 
definitions from a header file are inlined? We could add file names but only in 
cases the file name does not match the main file.

> and hard to navigate (especially when using a specialized .dot-file viewer 
> like xdot - i found it 

>  much more comfortable to convert the file to .svg and view in a web browser


This is not something that the patch addresses. Feel free to add a patch to the 
checker developer manual with instructions for this.


https://reviews.llvm.org/D22622



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


Re: [PATCH] D22514: CloneDetection now respects statement specific data when searching for clones.

2016-07-22 Thread Raphael Isemann via cfe-commits
teemperor updated this revision to Diff 65086.
teemperor added a comment.

- StmtDataCollector is now using ConstStmtVisitor
- Added tests for StmtDataCollector


https://reviews.llvm.org/D22514

Files:
  lib/Analysis/CloneDetection.cpp
  test/Analysis/copypaste/test-asm.cpp
  test/Analysis/copypaste/test-attributes.cpp
  test/Analysis/copypaste/test-call.cpp
  test/Analysis/copypaste/test-catch.cpp
  test/Analysis/copypaste/test-delete.cpp
  test/Analysis/copypaste/test-dependent-exist.cpp
  test/Analysis/copypaste/test-expr-types.cpp
  test/Analysis/copypaste/test-fold.cpp
  test/Analysis/copypaste/test-generic.c
  test/Analysis/copypaste/test-labels.cpp
  test/Analysis/copypaste/test-lambda.cpp
  test/Analysis/copypaste/test-min-max.cpp
  test/Analysis/copypaste/test-operators.cpp
  test/Analysis/copypaste/test-predefined.cpp
  test/Analysis/copypaste/test-trait.cpp

Index: test/Analysis/copypaste/test-trait.cpp
===
--- /dev/null
+++ test/Analysis/copypaste/test-trait.cpp
@@ -0,0 +1,63 @@
+// RUN: %clang_cc1 -analyze -std=c++1z -analyzer-checker=alpha.clone.CloneChecker -verify %s
+
+// expected-no-diagnostics
+
+bool foo1(int x) {
+  if (x > 0)
+return false;
+  else if (x < 0)
+return __is_trivially_constructible(long, int*, int*);
+  return true;
+}
+
+// Identical to foo1 except that long was replaced by int in the TypeTraitExpr.
+bool foo2(int x) {
+  if (x > 0)
+return false;
+  else if (x < 0)
+return __is_trivially_constructible(int, int*, int*);
+  return true;
+}
+
+// Identical to foo1 except the different number of types in the TypeTraitExpr.
+bool foo3(int x) {
+  if (x > 0)
+return false;
+  else if (x < 0)
+return __is_trivially_constructible(long, int*);
+  return true;
+}
+
+bool foo4(int x) {
+  if (x > 0)
+return false;
+  else if (x < 0)
+return __is_enum(long);
+  return true;
+}
+
+// Identical to foo4 except the different TypeTraitExpr kind.
+bool foo5(int x) {
+  if (x > 0)
+return false;
+  else if (x < 0)
+return __is_pod(long);
+  return true;
+}
+
+bool foo6(int x) {
+  if (x > 0)
+return false;
+  else if (x < 0)
+return __is_lvalue_expr(x);
+  return true;
+}
+
+// Identical to foo6 except the different ExpressionTraitExpr kind.
+bool foo7(int x) {
+  if (x > 0)
+return false;
+  else if (x < 0)
+return __is_rvalue_expr(x);
+  return true;
+}
Index: test/Analysis/copypaste/test-predefined.cpp
===
--- /dev/null
+++ test/Analysis/copypaste/test-predefined.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -analyze -std=c++1z -analyzer-checker=alpha.clone.CloneChecker -verify %s
+
+// expected-no-diagnostics
+
+bool foo1(int x) {
+  if (x > 0)
+return false;
+  else if (x < 0)
+return sizeof(__PRETTY_FUNCTION__);
+  return true;
+}
+
+// Identical to foo1 except the different predefined __func__ instead of __PRETTY_FUNCTION__
+bool foo2(int x) {
+  if (x > 0)
+return false;
+  else if (x < 0)
+return sizeof(__func__);
+  return true;
+}
Index: test/Analysis/copypaste/test-operators.cpp
===
--- /dev/null
+++ test/Analysis/copypaste/test-operators.cpp
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -analyze -std=c++1z -analyzer-checker=alpha.clone.CloneChecker -verify %s
+
+// expected-no-diagnostics
+
+bool foo1(int x) {
+  if (x > 0)
+return false;
+  else if (x < 0)
+return +x;
+  return true;
+}
+
+// Identical to foo1 except the different unary operator kind.
+bool foo2(int x) {
+  if (x > 0)
+return false;
+  else if (x < 0)
+return -x;
+  return true;
+}
+
+bool foo3(int x) {
+  if (x > 0)
+return false;
+  else if (x < 0)
+return x - x;
+  return true;
+}
+
+// Identical to foo3 except the different binary operator kind.
+bool foo4(int x) {
+  if (x > 0)
+return false;
+  else if (x < 0)
+return x + x;
+  return true;
+}
Index: test/Analysis/copypaste/test-min-max.cpp
===
--- test/Analysis/copypaste/test-min-max.cpp
+++ test/Analysis/copypaste/test-min-max.cpp
@@ -18,14 +18,6 @@
 
 // False positives below. These clones should not be reported.
 
-// FIXME: Detect different binary operator kinds.
-int min1(int a, int b) { // expected-note{{Related code clone is here.}}
-  log();
-  if (a < b)
-return a;
-  return b;
-}
-
 // FIXME: Detect different variable patterns.
 int min2(int a, int b) { // expected-note{{Related code clone is here.}}
   log();
@@ -36,6 +28,13 @@
 
 // Functions below are not clones and should not be reported.
 
+int min1(int a, int b) { // no-warning
+  log();
+  if (a < b)
+return a;
+  return b;
+}
+
 int foo(int a, int b) { // no-warning
   return a + b;
 }
Index: test/Analysis/copypaste/test-lambda.cpp
===
--- /dev/null
+++ 

Re: [PATCH] D22671: MPI-Checker: move MPIFunctionClassifier.h

2016-07-22 Thread Anna Zaks via cfe-commits
zaks.anna accepted this revision.
zaks.anna added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D22671



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


[libunwind] r276424 - Merge r276128: libunwind: limit stack usage in unwind cursor

2016-07-22 Thread Ed Maste via cfe-commits
Author: emaste
Date: Fri Jul 22 10:00:42 2016
New Revision: 276424

URL: http://llvm.org/viewvc/llvm-project?rev=276424=rev
Log:
Merge r276128: libunwind: limit stack usage in unwind cursor

Modified:
libunwind/branches/release_39/   (props changed)
libunwind/branches/release_39/include/__libunwind_config.h
libunwind/branches/release_39/src/DwarfParser.hpp

Propchange: libunwind/branches/release_39/
--
svn:mergeinfo = /libunwind/trunk:276128

Modified: libunwind/branches/release_39/include/__libunwind_config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/branches/release_39/include/__libunwind_config.h?rev=276424=276423=276424=diff
==
--- libunwind/branches/release_39/include/__libunwind_config.h (original)
+++ libunwind/branches/release_39/include/__libunwind_config.h Fri Jul 22 
10:00:42 2016
@@ -22,18 +22,22 @@
 #  define _LIBUNWIND_TARGET_I386 1
 #  define _LIBUNWIND_CONTEXT_SIZE 8
 #  define _LIBUNWIND_CURSOR_SIZE 19
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 9
 # elif defined(__x86_64__)
 #  define _LIBUNWIND_TARGET_X86_64 1
 #  define _LIBUNWIND_CONTEXT_SIZE 21
 #  define _LIBUNWIND_CURSOR_SIZE 33
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 17
 # elif defined(__ppc__)
 #  define _LIBUNWIND_TARGET_PPC 1
 #  define _LIBUNWIND_CONTEXT_SIZE 117
 #  define _LIBUNWIND_CURSOR_SIZE 128
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 113
 # elif defined(__aarch64__)
 #  define _LIBUNWIND_TARGET_AARCH64 1
 #  define _LIBUNWIND_CONTEXT_SIZE 66
 #  define _LIBUNWIND_CURSOR_SIZE 78
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 96
 # elif defined(__arm__)
 #  define _LIBUNWIND_TARGET_ARM 1
 #  if defined(__ARM_WMMX)
@@ -43,10 +47,12 @@
 #define _LIBUNWIND_CONTEXT_SIZE 42
 #define _LIBUNWIND_CURSOR_SIZE 49
 #  endif
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 96
 # elif defined(__or1k__)
 #  define _LIBUNWIND_TARGET_OR1K 1
 #  define _LIBUNWIND_CONTEXT_SIZE 16
 #  define _LIBUNWIND_CURSOR_SIZE 28
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 32
 # else
 #  error "Unsupported architecture."
 # endif
@@ -59,6 +65,7 @@
 # define _LIBUNWIND_TARGET_OR1K 1
 # define _LIBUNWIND_CONTEXT_SIZE 128
 # define _LIBUNWIND_CURSOR_SIZE 140
+# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 120
 #endif // _LIBUNWIND_IS_NATIVE_ONLY
 
 #endif // LIBUNWIND_CONFIG_H__

Modified: libunwind/branches/release_39/src/DwarfParser.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/branches/release_39/src/DwarfParser.hpp?rev=276424=276423=276424=diff
==
--- libunwind/branches/release_39/src/DwarfParser.hpp (original)
+++ libunwind/branches/release_39/src/DwarfParser.hpp Fri Jul 22 10:00:42 2016
@@ -62,7 +62,7 @@ public:
   };
 
   enum {
-kMaxRegisterNumber = 120
+kMaxRegisterNumber = _LIBUNWIND_HIGHEST_DWARF_REGISTER
   };
   enum RegisterSavedWhere {
 kRegisterUnused,


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


[libclc] r276423 - ptx: Fix builtin names after clang r274770

2016-07-22 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Fri Jul 22 10:00:08 2016
New Revision: 276423

URL: http://llvm.org/viewvc/llvm-project?rev=276423=rev
Log:
ptx: Fix builtin names after clang r274770

Signed-off-by: Jan Vesely 
Acked-By: Aaron Watry 

Modified:
libclc/trunk/ptx-nvidiacl/lib/synchronization/barrier.cl
libclc/trunk/ptx-nvidiacl/lib/workitem/get_group_id.cl
libclc/trunk/ptx-nvidiacl/lib/workitem/get_local_id.cl
libclc/trunk/ptx-nvidiacl/lib/workitem/get_local_size.cl
libclc/trunk/ptx-nvidiacl/lib/workitem/get_num_groups.cl

Modified: libclc/trunk/ptx-nvidiacl/lib/synchronization/barrier.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/ptx-nvidiacl/lib/synchronization/barrier.cl?rev=276423=276422=276423=diff
==
--- libclc/trunk/ptx-nvidiacl/lib/synchronization/barrier.cl (original)
+++ libclc/trunk/ptx-nvidiacl/lib/synchronization/barrier.cl Fri Jul 22 
10:00:08 2016
@@ -2,7 +2,7 @@
 
 _CLC_DEF void barrier(cl_mem_fence_flags flags) {
   if (flags & CLK_LOCAL_MEM_FENCE) {
-__builtin_ptx_bar_sync(0);
+__syncthreads();
   }
 }
 

Modified: libclc/trunk/ptx-nvidiacl/lib/workitem/get_group_id.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/ptx-nvidiacl/lib/workitem/get_group_id.cl?rev=276423=276422=276423=diff
==
--- libclc/trunk/ptx-nvidiacl/lib/workitem/get_group_id.cl (original)
+++ libclc/trunk/ptx-nvidiacl/lib/workitem/get_group_id.cl Fri Jul 22 10:00:08 
2016
@@ -2,9 +2,9 @@
 
 _CLC_DEF size_t get_group_id(uint dim) {
   switch (dim) {
-  case 0:  return __builtin_ptx_read_ctaid_x();
-  case 1:  return __builtin_ptx_read_ctaid_y();
-  case 2:  return __builtin_ptx_read_ctaid_z();
+  case 0:  return __nvvm_read_ptx_sreg_ctaid_x();
+  case 1:  return __nvvm_read_ptx_sreg_ctaid_y();
+  case 2:  return __nvvm_read_ptx_sreg_ctaid_z();
   default: return 0;
   }
 }

Modified: libclc/trunk/ptx-nvidiacl/lib/workitem/get_local_id.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/ptx-nvidiacl/lib/workitem/get_local_id.cl?rev=276423=276422=276423=diff
==
--- libclc/trunk/ptx-nvidiacl/lib/workitem/get_local_id.cl (original)
+++ libclc/trunk/ptx-nvidiacl/lib/workitem/get_local_id.cl Fri Jul 22 10:00:08 
2016
@@ -2,9 +2,9 @@
 
 _CLC_DEF size_t get_local_id(uint dim) {
   switch (dim) {
-  case 0:  return __builtin_ptx_read_tid_x();
-  case 1:  return __builtin_ptx_read_tid_y();
-  case 2:  return __builtin_ptx_read_tid_z();
+  case 0:  return __nvvm_read_ptx_sreg_tid_x();
+  case 1:  return __nvvm_read_ptx_sreg_tid_y();
+  case 2:  return __nvvm_read_ptx_sreg_tid_z();
   default: return 0;
   }
 }

Modified: libclc/trunk/ptx-nvidiacl/lib/workitem/get_local_size.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/ptx-nvidiacl/lib/workitem/get_local_size.cl?rev=276423=276422=276423=diff
==
--- libclc/trunk/ptx-nvidiacl/lib/workitem/get_local_size.cl (original)
+++ libclc/trunk/ptx-nvidiacl/lib/workitem/get_local_size.cl Fri Jul 22 
10:00:08 2016
@@ -2,9 +2,9 @@
 
 _CLC_DEF size_t get_local_size(uint dim) {
   switch (dim) {
-  case 0:  return __builtin_ptx_read_ntid_x();
-  case 1:  return __builtin_ptx_read_ntid_y();
-  case 2:  return __builtin_ptx_read_ntid_z();
+  case 0:  return __nvvm_read_ptx_sreg_ntid_x();
+  case 1:  return __nvvm_read_ptx_sreg_ntid_y();
+  case 2:  return __nvvm_read_ptx_sreg_ntid_z();
   default: return 0;
   }
 }

Modified: libclc/trunk/ptx-nvidiacl/lib/workitem/get_num_groups.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/ptx-nvidiacl/lib/workitem/get_num_groups.cl?rev=276423=276422=276423=diff
==
--- libclc/trunk/ptx-nvidiacl/lib/workitem/get_num_groups.cl (original)
+++ libclc/trunk/ptx-nvidiacl/lib/workitem/get_num_groups.cl Fri Jul 22 
10:00:08 2016
@@ -2,9 +2,9 @@
 
 _CLC_DEF size_t get_num_groups(uint dim) {
   switch (dim) {
-  case 0:  return __builtin_ptx_read_nctaid_x();
-  case 1:  return __builtin_ptx_read_nctaid_y();
-  case 2:  return __builtin_ptx_read_nctaid_z();
+  case 0:  return __nvvm_read_ptx_sreg_nctaid_x();
+  case 1:  return __nvvm_read_ptx_sreg_nctaid_y();
+  case 2:  return __nvvm_read_ptx_sreg_nctaid_z();
   default: return 0;
   }
 }


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


Re: [PATCH] D22656: [Clang-apply-replacements] Remove custom version printing; fix some Include What You Use warnings

2016-07-22 Thread Alexander Kornienko via cfe-commits
alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.

In many cases a transitively included header can be considered a part of a 
public interface of an already included header, e.g. it's reasonable to assume 
that DiagnosticIDs.h is a part of the public API exposed by Diagnostics.h. 
Thus, I consider IWYU fixes useless or even mildly harmful until (most of) 
LLVM/Clang headers are properly annotated with `// IWYU pragma: export` etc.

The other change seems fine, if you have properly verified the new behavior.


Repository:
  rL LLVM

https://reviews.llvm.org/D22656



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


Re: [PATCH] D22679: [mips][ias] Enable IAS by default for N64 on Debian mips64el.

2016-07-22 Thread Simon Dardis via cfe-commits
sdardis added a comment.

Actually, seeing your reply on the related patch, keep the comment as it 
reflects trunk.


https://reviews.llvm.org/D22679



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


Re: [PATCH] D22679: [mips][ias] Enable IAS by default for N64 on Debian mips64el.

2016-07-22 Thread Simon Dardis via cfe-commits
sdardis added a comment.

Yes, I think you should also reflect mpf's comment here too.


https://reviews.llvm.org/D22679



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


Re: [PATCH] D22679: [mips][ias] Enable IAS by default for N64 on Debian mips64el.

2016-07-22 Thread Simon Dardis via cfe-commits
sdardis accepted this revision.
sdardis added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D22679



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


Re: [PATCH] D21962: MPITypeMismatchCheck for Clang-Tidy

2016-07-22 Thread Alexander Droste via cfe-commits
Alexander_Droste updated this revision to Diff 65074.
Alexander_Droste added a comment.

- fix typo


https://reviews.llvm.org/D21962

Files:
  clang-tidy/CMakeLists.txt
  clang-tidy/mpi/CMakeLists.txt
  clang-tidy/mpi/MPITidyModule.cpp
  clang-tidy/mpi/TypeMismatchCheck.cpp
  clang-tidy/mpi/TypeMismatchCheck.h
  clang-tidy/plugin/CMakeLists.txt
  clang-tidy/tool/CMakeLists.txt
  clang-tidy/tool/ClangTidyMain.cpp
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/mpi-type-mismatch.rst
  test/clang-tidy/Inputs/mpi-type-mismatch/mpimock.h
  test/clang-tidy/mpi-type-mismatch.cpp

Index: test/clang-tidy/mpi-type-mismatch.cpp
===
--- /dev/null
+++ test/clang-tidy/mpi-type-mismatch.cpp
@@ -0,0 +1,254 @@
+// RUN: %check_clang_tidy %s mpi-type-mismatch %t -- -- -I %S/Inputs/mpi-type-mismatch
+
+#include "mpimock.h"
+
+void charNegativeTest() {
+  unsigned char buf;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'unsigned char' does not match the MPI datatype 'MPI_CHAR' [mpi-type-mismatch]
+  
+  int buf2;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'int' does not match the MPI datatype 'MPI_CHAR'
+  
+  short buf3;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'short' does not match the MPI datatype 'MPI_CHAR'
+
+  long buf4;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'long' does not match the MPI datatype 'MPI_CHAR'
+  
+  int8_t buf5;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'int8_t' does not match the MPI datatype 'MPI_CHAR'
+
+  uint16_t buf6;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'uint16_t' does not match the MPI datatype 'MPI_CHAR'
+
+  long double _Complex buf7;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'long double _Complex' does not match the MPI datatype 'MPI_CHAR'
+
+  std::complex buf8;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'complex' does not match the MPI datatype 'MPI_CHAR'
+}
+
+void intNegativeTest() {
+  unsigned char buf;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'unsigned char' does not match the MPI datatype 'MPI_INT'
+  
+  unsigned buf2;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'unsigned int' does not match the MPI datatype 'MPI_INT'
+  
+  short buf3;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'short' does not match the MPI datatype 'MPI_INT'
+
+  long buf4;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'long' does not match the MPI datatype 'MPI_INT'
+  
+  int8_t buf5;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'int8_t' does not match the MPI datatype 'MPI_INT'
+
+  uint16_t buf6;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'uint16_t' does not match the MPI datatype 'MPI_INT'
+
+  long double _Complex buf7;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'long double _Complex' does not match the MPI datatype 'MPI_INT'
+
+  std::complex buf8;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'complex' does not match the MPI datatype 'MPI_INT'
+}
+
+void longNegativeTest() {
+  char buf;
+  MPI_Send(, 1, MPI_LONG, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'char' does not match the MPI datatype 'MPI_LONG'
+  
+  unsigned buf2;
+  MPI_Send(, 1, MPI_LONG, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'unsigned int' does not match the MPI datatype 'MPI_LONG'
+  
+  unsigned short buf3;
+  MPI_Send(, 1, MPI_LONG, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'unsigned short' does not match the MPI datatype 'MPI_LONG'
+
+  unsigned long buf4;
+  MPI_Send(, 1, MPI_LONG, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'unsigned long' does not match the MPI datatype 'MPI_LONG'
+  
+  int8_t buf5;
+  MPI_Send(, 1, MPI_LONG, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'int8_t' does not match the MPI datatype 'MPI_LONG'
+
+  uint16_t buf6;
+  MPI_Send(, 1, MPI_LONG, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: 

[PATCH] D22679: [mips][ias] Enable IAS by default for N64 on Debian mips64el.

2016-07-22 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added a reviewer: sdardis.
dsanders added a subscriber: cfe-commits.

Unfortunately we can't enable it for all N64 because it is not yet possible to  
  
distinguish N32 from N64 from the triple on other environments. 


  
N64 has been confirmed to produce identical (within reason) objects to GAS  
  
during stage 2 of compiler recursion on N64-abi Fedora. Unfortunately,  
 
Fedora's triples do not distinguish N32 from N64 so I can't enable it by
  
default there. I'm currently repeating this testing for Debian mips64el but 
  
it's very unlikely to produce a different result.

https://reviews.llvm.org/D22679

Files:
  lib/Driver/ToolChains.cpp

Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2758,6 +2758,13 @@
   case llvm::Triple::mips:
   case llvm::Triple::mipsel:
 return true;
+  case llvm::Triple::mips64:
+  case llvm::Triple::mips64el:
+// Enabled for Debian mips64/mips64el only. Other targets are unable to
+// distinguish N32 from N64.
+if (getTriple().getEnvironment() == llvm::Triple::GNUABI64)
+  return true;
+return false;
   default:
 return false;
   }


Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2758,6 +2758,13 @@
   case llvm::Triple::mips:
   case llvm::Triple::mipsel:
 return true;
+  case llvm::Triple::mips64:
+  case llvm::Triple::mips64el:
+// Enabled for Debian mips64/mips64el only. Other targets are unable to
+// distinguish N32 from N64.
+if (getTriple().getEnvironment() == llvm::Triple::GNUABI64)
+  return true;
+return false;
   default:
 return false;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r276417 - [X86][AVX] Added support for lowering to VBROADCASTF128/VBROADCASTI128 with generic IR

2016-07-22 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Fri Jul 22 08:58:56 2016
New Revision: 276417

URL: http://llvm.org/viewvc/llvm-project?rev=276417=rev
Log:
[X86][AVX] Added support for lowering to VBROADCASTF128/VBROADCASTI128 with 
generic IR

As discussed on D22460, I've updated the vbroadcastf128 pd256/ps256 builtins to 
map directly to generic IR - load+splat a 128-bit vector to both lanes of a 
256-bit vector.

Fix for PR28657.

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/avx-builtins.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=276417=276416=276417=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Fri Jul 22 08:58:56 2016
@@ -6619,6 +6619,26 @@ static Value *EmitX86MaskedLoad(CodeGenF
   return CGF.Builder.CreateMaskedLoad(Ops[0], Align, MaskVec, Ops[1]);
 }
 
+static Value *EmitX86SubVectorBroadcast(CodeGenFunction ,
+SmallVectorImpl ,
+llvm::Type *DstTy,
+unsigned SrcSizeInBits,
+unsigned Align) {
+  // Load the subvector.
+  Ops[0] = CGF.Builder.CreateAlignedLoad(Ops[0], Align);
+
+  // Create broadcast mask.
+  unsigned NumDstElts = DstTy->getVectorNumElements();
+  unsigned NumSrcElts = SrcSizeInBits / DstTy->getScalarSizeInBits();
+
+  SmallVector Mask;
+  for (unsigned i = 0; i != NumDstElts; i += NumSrcElts)
+for (unsigned j = 0; j != NumSrcElts; ++j)
+  Mask.push_back(j);
+
+  return CGF.Builder.CreateShuffleVector(Ops[0], Ops[0], Mask, "subvecbcst");
+}
+
 static Value *EmitX86Select(CodeGenFunction ,
 Value *Mask, Value *Op0, Value *Op1) {
 
@@ -6995,6 +7015,13 @@ Value *CodeGenFunction::EmitX86BuiltinEx
   getContext().getTypeAlignInChars(E->getArg(1)->getType()).getQuantity();
 return EmitX86MaskedLoad(*this, Ops, Align);
   }
+
+  case X86::BI__builtin_ia32_vbroadcastf128_pd256:
+  case X86::BI__builtin_ia32_vbroadcastf128_ps256: {
+llvm::Type *DstTy = ConvertType(E->getType());
+return EmitX86SubVectorBroadcast(*this, Ops, DstTy, 128, 16);
+  }
+
   case X86::BI__builtin_ia32_storehps:
   case X86::BI__builtin_ia32_storelps: {
 llvm::Type *PtrTy = llvm::PointerType::getUnqual(Int64Ty);

Modified: cfe/trunk/test/CodeGen/avx-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx-builtins.c?rev=276417=276416=276417=diff
==
--- cfe/trunk/test/CodeGen/avx-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx-builtins.c Fri Jul 22 08:58:56 2016
@@ -84,13 +84,15 @@ __m256 test_mm256_blendv_ps(__m256 V1, _
 
 __m256d test_mm256_broadcast_pd(__m128d* A) {
   // CHECK-LABEL: test_mm256_broadcast_pd
-  // CHECK: call <4 x double> @llvm.x86.avx.vbroadcastf128.pd.256(i8* %{{.*}})
+  // CHECK: load <2 x double>, <2 x double>* %{{.*}}, align 16
+  // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <4 x 
i32> 
   return _mm256_broadcast_pd(A);
 }
 
 __m256 test_mm256_broadcast_ps(__m128* A) {
   // CHECK-LABEL: test_mm256_broadcast_ps
-  // CHECK: call <8 x float> @llvm.x86.avx.vbroadcastf128.ps.256(i8* %{{.*}})
+  // CHECK: load <4 x float>, <4 x float>* %{{.*}}, align 16
+  // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <8 x i32> 

   return _mm256_broadcast_ps(A);
 }
 


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


Re: [PATCH] D21962: MPITypeMismatchCheck for Clang-Tidy

2016-07-22 Thread Alexander Droste via cfe-commits
Alexander_Droste updated this revision to Diff 65072.
Alexander_Droste added a comment.

This update addresses all requested changes. All integration tests are still 
passing.


https://reviews.llvm.org/D21962

Files:
  clang-tidy/CMakeLists.txt
  clang-tidy/mpi/CMakeLists.txt
  clang-tidy/mpi/MPITidyModule.cpp
  clang-tidy/mpi/TypeMismatchCheck.cpp
  clang-tidy/mpi/TypeMismatchCheck.h
  clang-tidy/plugin/CMakeLists.txt
  clang-tidy/tool/CMakeLists.txt
  clang-tidy/tool/ClangTidyMain.cpp
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/mpi-type-mismatch.rst
  test/clang-tidy/Inputs/mpi-type-mismatch/mpimock.h
  test/clang-tidy/mpi-type-mismatch.cpp

Index: test/clang-tidy/mpi-type-mismatch.cpp
===
--- /dev/null
+++ test/clang-tidy/mpi-type-mismatch.cpp
@@ -0,0 +1,254 @@
+// RUN: %check_clang_tidy %s mpi-type-mismatch %t -- -- -I %S/Inputs/mpi-type-mismatch
+
+#include "mpimock.h"
+
+void charNegativeTest() {
+  unsigned char buf;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'unsigned char' does not match the MPI datatype 'MPI_CHAR' [mpi-type-mismatch]
+  
+  int buf2;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'int' does not match the MPI datatype 'MPI_CHAR'
+  
+  short buf3;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'short' does not match the MPI datatype 'MPI_CHAR'
+
+  long buf4;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'long' does not match the MPI datatype 'MPI_CHAR'
+  
+  int8_t buf5;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'int8_t' does not match the MPI datatype 'MPI_CHAR'
+
+  uint16_t buf6;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'uint16_t' does not match the MPI datatype 'MPI_CHAR'
+
+  long double _Complex buf7;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'long double _Complex' does not match the MPI datatype 'MPI_CHAR'
+
+  std::complex buf8;
+  MPI_Send(, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'complex' does not match the MPI datatype 'MPI_CHAR'
+}
+
+void intNegativeTest() {
+  unsigned char buf;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'unsigned char' does not match the MPI datatype 'MPI_INT'
+  
+  unsigned buf2;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'unsigned int' does not match the MPI datatype 'MPI_INT'
+  
+  short buf3;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'short' does not match the MPI datatype 'MPI_INT'
+
+  long buf4;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'long' does not match the MPI datatype 'MPI_INT'
+  
+  int8_t buf5;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'int8_t' does not match the MPI datatype 'MPI_INT'
+
+  uint16_t buf6;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'uint16_t' does not match the MPI datatype 'MPI_INT'
+
+  long double _Complex buf7;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'long double _Complex' does not match the MPI datatype 'MPI_INT'
+
+  std::complex buf8;
+  MPI_Send(, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'complex' does not match the MPI datatype 'MPI_INT'
+}
+
+void longNegativeTest() {
+  char buf;
+  MPI_Send(, 1, MPI_LONG, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'char' does not match the MPI datatype 'MPI_LONG'
+  
+  unsigned buf2;
+  MPI_Send(, 1, MPI_LONG, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'unsigned int' does not match the MPI datatype 'MPI_LONG'
+  
+  unsigned short buf3;
+  MPI_Send(, 1, MPI_LONG, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'unsigned short' does not match the MPI datatype 'MPI_LONG'
+
+  unsigned long buf4;
+  MPI_Send(, 1, MPI_LONG, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'unsigned long' does not match the MPI datatype 'MPI_LONG'
+  
+  int8_t buf5;
+  MPI_Send(, 1, MPI_LONG, 0, 0, MPI_COMM_WORLD);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: buffer type 'int8_t' does not match the MPI datatype 'MPI_LONG'
+
+  uint16_t 

Re: [PATCH] D21962: MPITypeMismatchCheck for Clang-Tidy

2016-07-22 Thread Alexander Droste via cfe-commits
Alexander_Droste marked 5 inline comments as done.
Alexander_Droste added a comment.

> You need to add this to ClangTidyMain.cpp:


Thanks for pointing this out and reviewing the code once more!


https://reviews.llvm.org/D21962



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


Re: r276250 - [Sema, X86] Add explicit check to ensure that builtins that require x86-64 target throw an error if used on 32-bit target.

2016-07-22 Thread Hans Wennborg via cfe-commits
Should we merge this to 3.9?

On Thu, Jul 21, 2016 at 3:38 AM, Craig Topper via cfe-commits
 wrote:
> Author: ctopper
> Date: Thu Jul 21 02:38:43 2016
> New Revision: 276250
>
> URL: http://llvm.org/viewvc/llvm-project?rev=276250=rev
> Log:
> [Sema,X86] Add explicit check to ensure that builtins that require x86-64 
> target throw an error if used on 32-bit target.
>
> If these builtins are allowed to go through on a 32-bit target they will fire 
> assertions in the backend.
>
> Fixes PR28635.
>
> Added:
> cfe/trunk/test/CodeGen/builtins-x86-disabled.c
> Modified:
> cfe/trunk/lib/Sema/SemaChecking.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=276250=276249=276250=diff
> ==
> --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Jul 21 02:38:43 2016
> @@ -1597,6 +1597,56 @@ bool Sema::CheckX86BuiltinFunctionCall(u
>  return SemaBuiltinCpuSupports(*this, TheCall);
>case X86::BI__builtin_ms_va_start:
>  return SemaBuiltinMSVAStart(TheCall);
> +  case X86::BI__builtin_ia32_addcarryx_u64:
> +  case X86::BI__builtin_ia32_addcarry_u64:
> +  case X86::BI__builtin_ia32_subborrow_u64:
> +  case X86::BI__builtin_ia32_readeflags_u64:
> +  case X86::BI__builtin_ia32_writeeflags_u64:
> +  case X86::BI__builtin_ia32_bextr_u64:
> +  case X86::BI__builtin_ia32_bextri_u64:
> +  case X86::BI__builtin_ia32_bzhi_di:
> +  case X86::BI__builtin_ia32_pdep_di:
> +  case X86::BI__builtin_ia32_pext_di:
> +  case X86::BI__builtin_ia32_crc32di:
> +  case X86::BI__builtin_ia32_fxsave64:
> +  case X86::BI__builtin_ia32_fxrstor64:
> +  case X86::BI__builtin_ia32_xsave64:
> +  case X86::BI__builtin_ia32_xrstor64:
> +  case X86::BI__builtin_ia32_xsaveopt64:
> +  case X86::BI__builtin_ia32_xrstors64:
> +  case X86::BI__builtin_ia32_xsavec64:
> +  case X86::BI__builtin_ia32_xsaves64:
> +  case X86::BI__builtin_ia32_rdfsbase64:
> +  case X86::BI__builtin_ia32_rdgsbase64:
> +  case X86::BI__builtin_ia32_wrfsbase64:
> +  case X86::BI__builtin_ia32_wrgsbase64:
> +  case X86::BI__builtin_ia32_pbroadcastb512_gpr_mask:
> +  case X86::BI__builtin_ia32_pbroadcastb256_gpr_mask:
> +  case X86::BI__builtin_ia32_pbroadcastb128_gpr_mask:
> +  case X86::BI__builtin_ia32_vcvtsd2si64:
> +  case X86::BI__builtin_ia32_vcvtsd2usi64:
> +  case X86::BI__builtin_ia32_vcvtss2si64:
> +  case X86::BI__builtin_ia32_vcvtss2usi64:
> +  case X86::BI__builtin_ia32_vcvttsd2si64:
> +  case X86::BI__builtin_ia32_vcvttsd2usi64:
> +  case X86::BI__builtin_ia32_vcvttss2si64:
> +  case X86::BI__builtin_ia32_vcvttss2usi64:
> +  case X86::BI__builtin_ia32_cvtss2si64:
> +  case X86::BI__builtin_ia32_cvttss2si64:
> +  case X86::BI__builtin_ia32_cvtsd2si64:
> +  case X86::BI__builtin_ia32_cvttsd2si64:
> +  case X86::BI__builtin_ia32_cvtsi2sd64:
> +  case X86::BI__builtin_ia32_cvtsi2ss64:
> +  case X86::BI__builtin_ia32_cvtusi2sd64:
> +  case X86::BI__builtin_ia32_cvtusi2ss64:
> +  case X86::BI__builtin_ia32_rdseed64_step: {
> +// These builtins only work on x86-64 targets.
> +const llvm::Triple  = Context.getTargetInfo().getTriple();
> +if (TT.getArch() != llvm::Triple::x86_64)
> +  return Diag(TheCall->getCallee()->getLocStart(),
> +  diag::err_x86_builtin_32_bit_tgt);
> +return false;
> +  }
>case X86::BI__builtin_ia32_extractf64x4_mask:
>case X86::BI__builtin_ia32_extracti64x4_mask:
>case X86::BI__builtin_ia32_extractf32x8_mask:
>
> Added: cfe/trunk/test/CodeGen/builtins-x86-disabled.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-x86-disabled.c?rev=276250=auto
> ==
> --- cfe/trunk/test/CodeGen/builtins-x86-disabled.c (added)
> +++ cfe/trunk/test/CodeGen/builtins-x86-disabled.c Thu Jul 21 02:38:43 2016
> @@ -0,0 +1,22 @@
> +// REQUIRES: x86-registered-target
> +// RUN: not %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - 2>&1 
> | FileCheck %s
> +
> +void call_x86_64_builtins(void)
> +{
> +  unsigned long long a = __builtin_ia32_crc32di(0, 0);
> +  unsigned long long b;
> +  unsigned int c = __builtin_ia32_rdseed64_step ();
> +  unsigned long long d = __builtin_ia32_bextr_u64 (0, 0);
> +  unsigned long long e = __builtin_ia32_pdep_di(0, 0);
> +  unsigned long long f = __builtin_ia32_pext_di(0, 0);
> +  unsigned long long g = __builtin_ia32_bzhi_di(0, 0);
> +  unsigned long long h;
> +  unsigned long long i = __builtin_ia32_addcarryx_u64(0, 0, 0, );
> +  unsigned long long j;
> +  unsigned long long k = __builtin_ia32_addcarry_u64(0, 0, 0, );
> +  unsigned long long l;
> +  unsigned long long m = __builtin_ia32_subborrow_u64(0, 0, 0, );
> +}
> +
> +// CHECK: error: this builtin is only available on x86-64 targets
> +// CHECK: __builtin_ia32_crc32di
>
>
> 

Re: r276352 - [Sema] Handle errors during rewriteBuiltinFunctionDecl

2016-07-22 Thread Hans Wennborg via cfe-commits
Richard: should we merge this to 3.9?

On Thu, Jul 21, 2016 at 7:03 PM, David Majnemer via cfe-commits
 wrote:
> Author: majnemer
> Date: Thu Jul 21 18:03:43 2016
> New Revision: 276352
>
> URL: http://llvm.org/viewvc/llvm-project?rev=276352=rev
> Log:
> [Sema] Handle errors during rewriteBuiltinFunctionDecl
>
> rewriteBuiltinFunctionDecl can encounter errors when performing
> DefaultFunctionArrayLvalueConversion.  These errors were not handled
> which led to a null pointer dereference.
>
> This fixes PR28651.
>
> Modified:
> cfe/trunk/lib/Sema/SemaExpr.cpp
> cfe/trunk/test/Sema/builtins.cl
>
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=276352=276351=276352=diff
> ==
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jul 21 18:03:43 2016
> @@ -5051,7 +5051,11 @@ static FunctionDecl *rewriteBuiltinFunct
>for (QualType ParamType : FT->param_types()) {
>
>  // Convert array arguments to pointer to simplify type lookup.
> -Expr *Arg = 
> Sema->DefaultFunctionArrayLvalueConversion(ArgExprs[i++]).get();
> +ExprResult ArgRes =
> +Sema->DefaultFunctionArrayLvalueConversion(ArgExprs[i++]);
> +if (ArgRes.isInvalid())
> +  return nullptr;
> +Expr *Arg = ArgRes.get();
>  QualType ArgType = Arg->getType();
>  if (!ParamType->isPointerType() ||
>  ParamType.getQualifiers().hasAddressSpace() ||
>
> Modified: cfe/trunk/test/Sema/builtins.cl
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/builtins.cl?rev=276352=276351=276352=diff
> ==
> --- cfe/trunk/test/Sema/builtins.cl (original)
> +++ cfe/trunk/test/Sema/builtins.cl Thu Jul 21 18:03:43 2016
> @@ -1,8 +1,11 @@
>  // RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
> -// expected-no-diagnostics
>
>  kernel void test(global float *out, global float *in, global int* in2) {
>out[0] = __builtin_nanf("");
>__builtin_memcpy(out, in, 32);
>out[0] = __builtin_frexpf(in[0], in2);
>  }
> +
> +void pr28651() {
> +  __builtin_alloca(value); // expected-error{{use of undeclared identifier}}
> +}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r276350 - [CodeGen] Fix a crash when constant folding switch statement

2016-07-22 Thread Hans Wennborg via cfe-commits
Richard: should we merge this to 3.9?

On Thu, Jul 21, 2016 at 6:31 PM, Erik Pilkington via cfe-commits
 wrote:
> Author: epilk
> Date: Thu Jul 21 17:31:40 2016
> New Revision: 276350
>
> URL: http://llvm.org/viewvc/llvm-project?rev=276350=rev
> Log:
> [CodeGen] Fix a crash when constant folding switch statement
>
> Differential revision: https://reviews.llvm.org/D22542
>
> Modified:
> cfe/trunk/lib/CodeGen/CGStmt.cpp
> cfe/trunk/test/CodeGenCXX/switch-case-folding-2.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=276350=276349=276350=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGStmt.cpp Thu Jul 21 17:31:40 2016
> @@ -1264,6 +1264,14 @@ void CodeGenFunction::EmitCaseStmt(const
>  }
>
>  void CodeGenFunction::EmitDefaultStmt(const DefaultStmt ) {
> +  // If there is no enclosing switch instance that we're aware of, then this
> +  // default statement can be elided. This situation only happens when we've
> +  // constant-folded the switch.
> +  if (!SwitchInsn) {
> +EmitStmt(S.getSubStmt());
> +return;
> +  }
> +
>llvm::BasicBlock *DefaultBlock = SwitchInsn->getDefaultDest();
>assert(DefaultBlock->empty() &&
>   "EmitDefaultStmt: Default block already defined?");
>
> Modified: cfe/trunk/test/CodeGenCXX/switch-case-folding-2.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/switch-case-folding-2.cpp?rev=276350=276349=276350=diff
> ==
> --- cfe/trunk/test/CodeGenCXX/switch-case-folding-2.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/switch-case-folding-2.cpp Thu Jul 21 17:31:40 
> 2016
> @@ -18,4 +18,13 @@ int main(void) {
>   return test(5);
>  }
>
> +void other_test() {
> +  switch(0) {
> +  case 0:
> +do {
> +default:;
> +} while(0);
> +  }
> +}
> +
>  // CHECK: call i32 (i8*, ...) @_Z6printfPKcz
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D5409: Fix for PR18393 - emit error when abstract type is returned or taken by value

2016-07-22 Thread Elias Pipping via cfe-commits
pipping added a subscriber: pipping.
pipping added a comment.

Any updates on this?


https://reviews.llvm.org/D5409



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


[clang-tools-extra] r276415 - Revert "Revert "[clang-tidy] new cppcoreguidelines-slicing""

2016-07-22 Thread Clement Courbet via cfe-commits
Author: courbet
Date: Fri Jul 22 08:45:00 2016
New Revision: 276415

URL: http://llvm.org/viewvc/llvm-project?rev=276415=rev
Log:
Revert "Revert "[clang-tidy] new cppcoreguidelines-slicing""

Second try for r276408

Added:
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SlicingCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SlicingCheck.h
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-slicing.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
clang-tools-extra/trunk/docs/ReleaseNotes.rst

Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt?rev=276415=276414=276415=diff
==
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt 
(original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt Fri Jul 
22 08:45:00 2016
@@ -13,6 +13,7 @@ add_clang_library(clangTidyCppCoreGuidel
   ProTypeStaticCastDowncastCheck.cpp
   ProTypeUnionAccessCheck.cpp
   ProTypeVarargCheck.cpp
+  SlicingCheck.cpp
 
   LINK_LIBS
   clangAST

Modified: 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp?rev=276415=276414=276415=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
 (original)
+++ 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
 Fri Jul 22 08:45:00 2016
@@ -22,6 +22,7 @@
 #include "ProTypeStaticCastDowncastCheck.h"
 #include "ProTypeUnionAccessCheck.h"
 #include "ProTypeVarargCheck.h"
+#include "SlicingCheck.h"
 
 namespace clang {
 namespace tidy {
@@ -53,6 +54,8 @@ public:
 "cppcoreguidelines-pro-type-union-access");
 CheckFactories.registerCheck(
 "cppcoreguidelines-pro-type-vararg");
+CheckFactories.registerCheck(
+"cppcoreguidelines-slicing");
 CheckFactories.registerCheck(
 "cppcoreguidelines-c-copy-assignment-signature");
   }

Added: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SlicingCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SlicingCheck.cpp?rev=276415=auto
==
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SlicingCheck.cpp 
(added)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SlicingCheck.cpp Fri 
Jul 22 08:45:00 2016
@@ -0,0 +1,135 @@
+//===--- SlicingCheck.cpp - 
clang-tidy-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "SlicingCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/RecordLayout.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace cppcoreguidelines {
+
+void SlicingCheck::registerMatchers(MatchFinder *Finder) {
+  // When we see:
+  //   class B : public A { ... };
+  //   A a;
+  //   B b;
+  //   a = b;
+  // The assignment is OK if:
+  //   - the assignment operator is defined as taking a B as second parameter,
+  //   or
+  //   - B does not define any additional members (either variables or
+  //   overrides) wrt A.
+  //
+  // The same holds for copy ctor calls. This also captures stuff like:
+  //   void f(A a);
+  //   f(b);
+
+  //  Helpers.
+  const auto OfBaseClass = ofClass(cxxRecordDecl().bind("BaseDecl"));
+  const auto IsDerivedFromBaseDecl =
+  cxxRecordDecl(isDerivedFrom(equalsBoundNode("BaseDecl")))
+  .bind("DerivedDecl");
+  const auto HasTypeDerivedFromBaseDecl =
+  anyOf(hasType(IsDerivedFromBaseDecl),
+hasType(references(IsDerivedFromBaseDecl)));
+  const auto IsWithinDerivedCtor =
+  hasParent(cxxConstructorDecl(ofClass(equalsBoundNode("DerivedDecl";
+
+  // Assignement slicing: "a = b;" and "a = std::move(b);" variants.
+  const auto SlicesObjectInAssignment =
+  callExpr(callee(cxxMethodDecl(anyOf(isCopyAssignmentOperator(),
+  isMoveAssignmentOperator()),
+OfBaseClass)),
+   hasArgument(1, HasTypeDerivedFromBaseDecl));
+

Re: r276232 - [Sema] Fix PR28623.

2016-07-22 Thread Hans Wennborg via cfe-commits
Does this apply to 3.9?

On Wed, Jul 20, 2016 at 11:28 PM, George Burgess IV via cfe-commits
 wrote:
> Author: gbiv
> Date: Wed Jul 20 22:28:13 2016
> New Revision: 276232
>
> URL: http://llvm.org/viewvc/llvm-project?rev=276232=rev
> Log:
> [Sema] Fix PR28623.
>
> In atomic builtins, we assumed that the LValue conversion on the first
> argument would succeed. So, we would crash given code like:
>
> ```
> void ovl(char);
> void ovl(int);
> __atomic_store_n(ovl, 0, 0);
> ```
>
> This patch makes us not assume that said conversion is successful. :)
>
> Added:
> cfe/trunk/test/SemaCXX/atomic-ops.cpp
> Modified:
> cfe/trunk/lib/Sema/SemaChecking.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=276232=276231=276232=diff
> ==
> --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Jul 20 22:28:13 2016
> @@ -2398,7 +2398,11 @@ ExprResult Sema::SemaAtomicOpsOverloaded
>
>// Inspect the first argument of the atomic operation.
>Expr *Ptr = TheCall->getArg(0);
> -  Ptr = DefaultFunctionArrayLvalueConversion(Ptr).get();
> +  ExprResult ConvertedPtr = DefaultFunctionArrayLvalueConversion(Ptr);
> +  if (ConvertedPtr.isInvalid())
> +return ExprError();
> +
> +  Ptr = ConvertedPtr.get();
>const PointerType *pointerType = Ptr->getType()->getAs();
>if (!pointerType) {
>  Diag(DRE->getLocStart(), diag::err_atomic_builtin_must_be_pointer)
>
> Added: cfe/trunk/test/SemaCXX/atomic-ops.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/atomic-ops.cpp?rev=276232=auto
> ==
> --- cfe/trunk/test/SemaCXX/atomic-ops.cpp (added)
> +++ cfe/trunk/test/SemaCXX/atomic-ops.cpp Wed Jul 20 22:28:13 2016
> @@ -0,0 +1,9 @@
> +// RUN: %clang_cc1 %s -verify -fsyntax-only -triple=i686-linux-gnu -std=c++11
> +
> +// We crashed when we couldn't properly convert the first arg of __atomic_* 
> to
> +// an lvalue.
> +void PR28623() {
> +  void helper(int); // expected-note{{target}}
> +  void helper(char); // expected-note{{target}}
> +  __atomic_store_n(helper, 0, 0); // expected-error{{reference to overloaded 
> function could not be resolved}}
> +}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D22465: [clang-rename] introduce better symbol finding and add few more tests

2016-07-22 Thread Kirill Bobyrev via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL276414: [clang-rename] introduce better symbol finding 
(authored by omtcyfz).

Changed prior to commit:
  https://reviews.llvm.org/D22465?vs=65066=65067#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D22465

Files:
  clang-tools-extra/trunk/clang-rename/RenamingAction.cpp
  clang-tools-extra/trunk/clang-rename/USRFinder.cpp
  clang-tools-extra/trunk/clang-rename/USRFinder.h
  clang-tools-extra/trunk/clang-rename/USRFindingAction.cpp
  clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
  
clang-tools-extra/trunk/test/clang-rename/ClassAsTemplateArgumentFindByClass.cpp
  
clang-tools-extra/trunk/test/clang-rename/ClassAsTemplateArgumentFindByTemplateArgument.cpp
  clang-tools-extra/trunk/test/clang-rename/ClassNameInFunctionDefenition.cpp
  clang-tools-extra/trunk/test/clang-rename/ComplicatedClassType.cpp
  
clang-tools-extra/trunk/test/clang-rename/TemplateClassInstantiationFindByDeclaration.cpp
  
clang-tools-extra/trunk/test/clang-rename/TemplateClassInstantiationFindByTypeUse.cpp
  
clang-tools-extra/trunk/test/clang-rename/TemplateFunctionFindByDeclaration.cpp
  clang-tools-extra/trunk/test/clang-rename/TemplateFunctionFindByUse.cpp
  
clang-tools-extra/trunk/test/clang-rename/TemplateTypenameFindByTemplateParam.cpp
  clang-tools-extra/trunk/test/clang-rename/TemplateTypenameFindByTypeInside.cpp
  
clang-tools-extra/trunk/test/clang-rename/UserDefinedConversionFindByTypeDeclaration.cpp

Index: clang-tools-extra/trunk/test/clang-rename/TemplateTypenameFindByTypeInside.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/TemplateTypenameFindByTypeInside.cpp
+++ clang-tools-extra/trunk/test/clang-rename/TemplateTypenameFindByTypeInside.cpp
@@ -0,0 +1,22 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=350 -new-name=U %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+
+// Currently unsupported test.
+// FIXME: clang-rename should be able to rename template parameters correctly.
+// XFAIL: *
+
+template  // CHECK: template 
+class Foo {
+T foo(T arg, T& ref, T* ptr) {// CHECK: U foo(U arg, U& ref, U* ptr) {
+  T value;// CHECK: U value;
+  int number = 42;
+  value = (T)number;  // CHECK: value = (U)number;
+  value = static_cast(number); // CHECK: value = static_cast(number);
+  return value;
+}
+
+static void foo(T value) {}   // CHECK: static void foo(U value) {}
+
+T member; // CHECK: U member;
+};
Index: clang-tools-extra/trunk/test/clang-rename/TemplateClassInstantiationFindByDeclaration.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/TemplateClassInstantiationFindByDeclaration.cpp
+++ clang-tools-extra/trunk/test/clang-rename/TemplateClassInstantiationFindByDeclaration.cpp
@@ -0,0 +1,44 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=287 -new-name=Bar %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+
+// Currently unsupported test.
+// FIXME: clang-rename should be able to rename classes with templates
+// correctly.
+// XFAIL: *
+
+template 
+class Foo {   // CHECK: class Bar;
+public:
+  T foo(T arg, T& ref, T* ptr) {
+T value;
+int number = 42;
+value = (T)number;
+value = static_cast(number);
+return value;
+  }
+  static void foo(T value) {}
+  T member;
+};
+
+template 
+void func() {
+  Foo obj; // CHECK: Bar obj;
+  obj.member = T();
+  Foo::foo();  // CHECK: Bar::foo();
+}
+
+int main() {
+  Foo i; // CHECK: Bar i;
+  i.member = 0;
+  Foo::foo(0);   // CHECK: Bar::foo(0);
+
+  Foo b;// CHECK: Bar b;
+  b.member = false;
+  Foo::foo(false);  // CHECK: Bar::foo(false);
+
+  return 0;
+}
+
+// Use grep -FUbo 'C'  to get the correct offset of foo when changing
+// this file.
Index: clang-tools-extra/trunk/test/clang-rename/ClassNameInFunctionDefenition.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/ClassNameInFunctionDefenition.cpp
+++ clang-tools-extra/trunk/test/clang-rename/ClassNameInFunctionDefenition.cpp
@@ -1,17 +1,10 @@
-// Currently unsupported test.
 // RUN: cat %s > %t.cpp
-// FIXME: clang-rename doesn't recognize symbol in class function definition.
+// RUN: clang-rename -offset=136 -new-name=Bar %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
 
-class Foo {
+class Foo { // CHECK: class Bar {
 public:
   void foo(int x);
 };
 
-void Foo::foo(int x) {}
-//   ^ this one
-
-int main() {
-  Foo obj;
-  obj.foo(0);
-  return 0;
-}
+void Foo::foo(int x) {} // CHECK: void Bar::foo(int x) {}
Index: clang-tools-extra/trunk/test/clang-rename/UserDefinedConversionFindByTypeDeclaration.cpp
===
--- 

[clang-tools-extra] r276414 - [clang-rename] introduce better symbol finding

2016-07-22 Thread Kirill Bobyrev via cfe-commits
Author: omtcyfz
Date: Fri Jul 22 08:41:09 2016
New Revision: 276414

URL: http://llvm.org/viewvc/llvm-project?rev=276414=rev
Log:
[clang-rename] introduce better symbol finding

This patch introduces:

* TypeLoc visiting, which helps a lot in renaming types
* NestedNameSpecifierLoc visiting (through getting them via ASTMatcher at the 
moment, though, because RecursiveASTVisitor::VisitNestedNameSpecifierLoc 
isn't implemented), which helps to treat nested names correctly
* better code formatting and refactoring
* bunch of tests

Reviewers: alexfh

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


Added:

clang-tools-extra/trunk/test/clang-rename/ClassAsTemplateArgumentFindByClass.cpp

clang-tools-extra/trunk/test/clang-rename/ClassAsTemplateArgumentFindByTemplateArgument.cpp

clang-tools-extra/trunk/test/clang-rename/TemplateClassInstantiationFindByDeclaration.cpp

clang-tools-extra/trunk/test/clang-rename/TemplateClassInstantiationFindByTypeUse.cpp

clang-tools-extra/trunk/test/clang-rename/TemplateFunctionFindByDeclaration.cpp
clang-tools-extra/trunk/test/clang-rename/TemplateFunctionFindByUse.cpp

clang-tools-extra/trunk/test/clang-rename/TemplateTypenameFindByTemplateParam.cpp

clang-tools-extra/trunk/test/clang-rename/TemplateTypenameFindByTypeInside.cpp
Modified:
clang-tools-extra/trunk/clang-rename/RenamingAction.cpp
clang-tools-extra/trunk/clang-rename/USRFinder.cpp
clang-tools-extra/trunk/clang-rename/USRFinder.h
clang-tools-extra/trunk/clang-rename/USRFindingAction.cpp
clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
clang-tools-extra/trunk/test/clang-rename/ClassNameInFunctionDefenition.cpp
clang-tools-extra/trunk/test/clang-rename/ComplicatedClassType.cpp

clang-tools-extra/trunk/test/clang-rename/UserDefinedConversionFindByTypeDeclaration.cpp

Modified: clang-tools-extra/trunk/clang-rename/RenamingAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/RenamingAction.cpp?rev=276414=276413=276414=diff
==
--- clang-tools-extra/trunk/clang-rename/RenamingAction.cpp (original)
+++ clang-tools-extra/trunk/clang-rename/RenamingAction.cpp Fri Jul 22 08:41:09 
2016
@@ -57,19 +57,16 @@ public:
 }
 
 auto PrevNameLen = PrevName.length();
-if (PrintLocations)
-  for (const auto  : RenamingCandidates) {
+for (const auto  : RenamingCandidates) {
+  if (PrintLocations) {
 FullSourceLoc FullLoc(Loc, SourceMgr);
 errs() << "clang-rename: renamed at: " << SourceMgr.getFilename(Loc)
<< ":" << FullLoc.getSpellingLineNumber() << ":"
<< FullLoc.getSpellingColumnNumber() << "\n";
-Replaces.insert(tooling::Replacement(SourceMgr, Loc, PrevNameLen,
- NewName));
   }
-else
-  for (const auto  : RenamingCandidates)
-Replaces.insert(tooling::Replacement(SourceMgr, Loc, PrevNameLen,
- NewName));
+  Replaces.insert(tooling::Replacement(SourceMgr, Loc, PrevNameLen,
+   NewName));
+}
   }
 
 private:

Modified: clang-tools-extra/trunk/clang-rename/USRFinder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/USRFinder.cpp?rev=276414=276413=276414=diff
==
--- clang-tools-extra/trunk/clang-rename/USRFinder.cpp (original)
+++ clang-tools-extra/trunk/clang-rename/USRFinder.cpp Fri Jul 22 08:41:09 2016
@@ -35,18 +35,15 @@ public:
   // \brief Finds the NamedDecl at a point in the source.
   // \param Point the location in the source to search for the NamedDecl.
   explicit NamedDeclFindingASTVisitor(const SourceManager ,
-  const SourceLocation Point)
-  : Result(nullptr), SourceMgr(SourceMgr),
-Point(Point) {
-  }
+  const SourceLocation Point,
+  const ASTContext *Context)
+  : Result(nullptr), SourceMgr(SourceMgr), Point(Point), Context(Context) 
{}
 
   // \brief Finds the NamedDecl for a name in the source.
   // \param Name the fully qualified name.
   explicit NamedDeclFindingASTVisitor(const SourceManager ,
   const std::string )
-  : Result(nullptr), SourceMgr(SourceMgr),
-Name(Name) {
-  }
+  : Result(nullptr), SourceMgr(SourceMgr), Name(Name) {}
 
   // Declaration visitors:
 
@@ -62,10 +59,6 @@ public:
   // Expression visitors:
 
   bool VisitDeclRefExpr(const DeclRefExpr *Expr) {
-// Check the namespace specifier first.
-if (!checkNestedNameSpecifierLoc(Expr->getQualifierLoc()))
-  return false;
-
 const auto *Decl = Expr->getFoundDecl();
 return setResult(Decl, Expr->getLocation(),
  

[clang-tools-extra] r276413 - Revert "[clang-tidy] new cppcoreguidelines-slicing"

2016-07-22 Thread Clement Courbet via cfe-commits
Author: courbet
Date: Fri Jul 22 08:33:51 2016
New Revision: 276413

URL: http://llvm.org/viewvc/llvm-project?rev=276413=rev
Log:
Revert "[clang-tidy] new cppcoreguidelines-slicing"

Tests fail on clang-x64-ninja-win7 due to too narrow expectation.

Removed:
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SlicingCheck.cpp
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SlicingCheck.h
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-slicing.rst
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-slicing.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
clang-tools-extra/trunk/docs/ReleaseNotes.rst

Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt?rev=276413=276412=276413=diff
==
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt 
(original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CMakeLists.txt Fri Jul 
22 08:33:51 2016
@@ -13,7 +13,6 @@ add_clang_library(clangTidyCppCoreGuidel
   ProTypeStaticCastDowncastCheck.cpp
   ProTypeUnionAccessCheck.cpp
   ProTypeVarargCheck.cpp
-  SlicingCheck.cpp
 
   LINK_LIBS
   clangAST

Modified: 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp?rev=276413=276412=276413=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
 (original)
+++ 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
 Fri Jul 22 08:33:51 2016
@@ -22,7 +22,6 @@
 #include "ProTypeStaticCastDowncastCheck.h"
 #include "ProTypeUnionAccessCheck.h"
 #include "ProTypeVarargCheck.h"
-#include "SlicingCheck.h"
 
 namespace clang {
 namespace tidy {
@@ -54,8 +53,6 @@ public:
 "cppcoreguidelines-pro-type-union-access");
 CheckFactories.registerCheck(
 "cppcoreguidelines-pro-type-vararg");
-CheckFactories.registerCheck(
-"cppcoreguidelines-slicing");
 CheckFactories.registerCheck(
 "cppcoreguidelines-c-copy-assignment-signature");
   }

Removed: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SlicingCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SlicingCheck.cpp?rev=276412=auto
==
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SlicingCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SlicingCheck.cpp 
(removed)
@@ -1,135 +0,0 @@
-//===--- SlicingCheck.cpp - 
clang-tidy-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#include "SlicingCheck.h"
-#include "clang/AST/ASTContext.h"
-#include "clang/AST/RecordLayout.h"
-#include "clang/ASTMatchers/ASTMatchFinder.h"
-#include "clang/ASTMatchers/ASTMatchers.h"
-
-using namespace clang::ast_matchers;
-
-namespace clang {
-namespace tidy {
-namespace cppcoreguidelines {
-
-void SlicingCheck::registerMatchers(MatchFinder *Finder) {
-  // When we see:
-  //   class B : public A { ... };
-  //   A a;
-  //   B b;
-  //   a = b;
-  // The assignment is OK if:
-  //   - the assignment operator is defined as taking a B as second parameter,
-  //   or
-  //   - B does not define any additional members (either variables or
-  //   overrides) wrt A.
-  //
-  // The same holds for copy ctor calls. This also captures stuff like:
-  //   void f(A a);
-  //   f(b);
-
-  //  Helpers.
-  const auto OfBaseClass = ofClass(cxxRecordDecl().bind("BaseDecl"));
-  const auto IsDerivedFromBaseDecl =
-  cxxRecordDecl(isDerivedFrom(equalsBoundNode("BaseDecl")))
-  .bind("DerivedDecl");
-  const auto HasTypeDerivedFromBaseDecl =
-  anyOf(hasType(IsDerivedFromBaseDecl),
-hasType(references(IsDerivedFromBaseDecl)));
-  const auto IsWithinDerivedCtor =
-  hasParent(cxxConstructorDecl(ofClass(equalsBoundNode("DerivedDecl";
-
-  // Assignement slicing: "a = b;" and "a = std::move(b);" variants.
-  const auto SlicesObjectInAssignment =
-  callExpr(callee(cxxMethodDecl(anyOf(isCopyAssignmentOperator(),
-  isMoveAssignmentOperator()),
-OfBaseClass)),
-   hasArgument(1, 

  1   2   >