[PATCH] D13622: Add call to find_package to load LLVM dependencies

2015-10-10 Thread don hinton via cfe-commits
hintonda created this revision.
hintonda added a reviewer: chapuni.
hintonda added a subscriber: cfe-commits.

ClangConfig requires LLVMConfig, so add find_package call in ClangConfig so 
find_package(clang REQUIRED CONFIG) will just work.  This makes it easier for 
cmake based projects to use clang, e.g., tools using ClangTooling.

http://reviews.llvm.org/D13622

Files:
  cmake/modules/ClangConfig.cmake

Index: cmake/modules/ClangConfig.cmake
===
--- cmake/modules/ClangConfig.cmake
+++ cmake/modules/ClangConfig.cmake
@@ -4,5 +4,7 @@
 # uses LLVM's. When it does, we should move this file to ClangConfig.cmake.in
 # and call configure_file() on it.
 
+find_package(LLVM REQUIRED CONFIG)
+
 # Provide all our library targets to users.
 include("${CMAKE_CURRENT_LIST_DIR}/ClangTargets.cmake")


Index: cmake/modules/ClangConfig.cmake
===
--- cmake/modules/ClangConfig.cmake
+++ cmake/modules/ClangConfig.cmake
@@ -4,5 +4,7 @@
 # uses LLVM's. When it does, we should move this file to ClangConfig.cmake.in
 # and call configure_file() on it.
 
+find_package(LLVM REQUIRED CONFIG)
+
 # Provide all our library targets to users.
 include("${CMAKE_CURRENT_LIST_DIR}/ClangTargets.cmake")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13440: [clang-tidy] Python script for easy check rename

2015-10-10 Thread Piotr Zegar via cfe-commits
ClockMan added a comment.

No, I don't have commits rights


Repository:
  rL LLVM

http://reviews.llvm.org/D13440



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


Re: [PATCH] D12501: [clang-format] Obj-C dictionary literals: Fixed typecast getting put on a separate line from the key

2015-10-10 Thread Kent Sutherland via cfe-commits
ksuther added a comment.

This patch is still awaiting a commit. Sorry to repeatedly post about this, 
just don't want it to get lost.

Thanks!


http://reviews.llvm.org/D12501



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


Re: [PATCH] D13344: Keep the IfStmt node even if the condition is invalid

2015-10-10 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Sema/SemaStmt.cpp:505-506
@@ -512,1 +504,4 @@
+  } else {
+ConditionExpr = new (Context) OpaqueValueExpr(SourceLocation(),
+  Context.VoidTy, VK_RValue);
   }

Please add a comment here saying that we're creating this node for error 
recovery. Also, the type of the expression should be `BoolTy`, not `VoidTy`. 
Other than that, this looks fine to me.


http://reviews.llvm.org/D13344



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


Re: [PATCH] D13344: Keep the IfStmt node even if the condition is invalid

2015-10-10 Thread Olivier Goffart via cfe-commits
ogoffart added a comment.

Are the analysis run if there is an error?  I think the consumer should expect 
null condition anyway.

But i'll try to add an ErrorExpr anyway.


http://reviews.llvm.org/D13344



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


[PATCH] D13620: Documentation for "Throw by value, catch by reference" check in clang-tidy

2015-10-10 Thread Tobias Langner via cfe-commits
randomcppprogrammer created this revision.
randomcppprogrammer added reviewers: aaron.ballman, cfe-commits.

adds documentation for the check mentioned in the title

http://reviews.llvm.org/D13620

Files:
  docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst

Index: docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
@@ -0,0 +1,11 @@
+misc-throw-by-value-catch-by-reference
+==
+
+Finds violations of the rule "Throw by value, catch by reference" presented 
for example in "C++ Coding Standards" by H. Sutter and A. Alexandrescu. This 
check also has the option to find violations of the rule "Throw anonymous 
temporaries" 
(https://www.securecoding.cert.org/confluence/display/cplusplus/ERR09-CPP.+Throw+anonymous+temporaries).
 The option is named "CheckThrowTemporaries" and it's on by default.
+
+Exceptions:
+- throwing string literals will not be flagged despite being a pointer. They 
are not susceptible to slicing and the usage of string literals is idomatic.
+- catching character pointers (char, wchar_t, unicode character types) will 
not be flagged to allow catching sting literals.
+- moved named values will not be flagged as not throwing an anonymous 
temporary. In this case we can be sure that the user knows that the object 
can't be accessed outside catch blocks handling the error.
+- throwing function parameters will not be flagged as not throwing an 
anonymous temporary. This allows helper functions for throwing.
+- re-throwing caught exception variables will not be flragged as not throwing 
an anonymous temporary. Although this can usually be done by just writing 
"throw;" it happens often enough in real code.


Index: docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
@@ -0,0 +1,11 @@
+misc-throw-by-value-catch-by-reference
+==
+
+Finds violations of the rule "Throw by value, catch by reference" presented for example in "C++ Coding Standards" by H. Sutter and A. Alexandrescu. This check also has the option to find violations of the rule "Throw anonymous temporaries" (https://www.securecoding.cert.org/confluence/display/cplusplus/ERR09-CPP.+Throw+anonymous+temporaries). The option is named "CheckThrowTemporaries" and it's on by default.
+
+Exceptions:
+- throwing string literals will not be flagged despite being a pointer. They are not susceptible to slicing and the usage of string literals is idomatic.
+- catching character pointers (char, wchar_t, unicode character types) will not be flagged to allow catching sting literals.
+- moved named values will not be flagged as not throwing an anonymous temporary. In this case we can be sure that the user knows that the object can't be accessed outside catch blocks handling the error.
+- throwing function parameters will not be flagged as not throwing an anonymous temporary. This allows helper functions for throwing.
+- re-throwing caught exception variables will not be flragged as not throwing an anonymous temporary. Although this can usually be done by just writing "throw;" it happens often enough in real code.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxx] r249936 - Get some of wchar_h.pass.cpp working on apple.

2015-10-10 Thread Richard Smith via cfe-commits
Thanks!
On Oct 9, 2015 7:56 PM, "Eric Fiselier via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Fri Oct  9 21:54:41 2015
> New Revision: 249936
>
> URL: http://llvm.org/viewvc/llvm-project?rev=249936=rev
> Log:
> Get some of wchar_h.pass.cpp working on apple.
>
> Modified:
> libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp
>
> Modified: libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp?rev=249936=249935=249936=diff
>
> ==
> --- libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp (original)
> +++ libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp Fri Oct  9
> 21:54:41 2015
> @@ -9,11 +9,6 @@
>
>  // 
>
> -// This test fails on systems whose C library doesn't provide a correct
> overload
> -// set for wcschr, wcspbrk, wcsrchr, wcsstr, and wmemchr. There's no way
> for
> -// libc++ to fix that on the C library's behalf.
> -//
> -// XFAIL: apple-darwin
>
>  #include 
>  #include 
> @@ -79,19 +74,19 @@ int main()
>  static_assert((std::is_same int>::value), "");
>  static_assert((std::is_same int>::value), "");
>  static_assert((std::is_same size_t>::value), "");
> -static_assert((std::is_same ')), const wchar_t*>::value), "");
> +// const wchar_t* wcschr((const wchar_t*)0, L' ') - See below
>  static_assert((std::is_same wchar_t*>::value), "");
>  static_assert((std::is_same size_t>::value), "");
>  static_assert((std::is_same::value),
> "");
> -static_assert((std::is_same L"")), const wchar_t*>::value), "");
> +// const wchar_t* wcspbrk((const wchar_t*)0, L"") - See below
>  static_assert((std::is_same wchar_t*>::value), "");
> -static_assert((std::is_same ')), const wchar_t*>::value), "");
> +// const wchar_t* wcsrchr((const wchar_t*)0, L' ') - See below
>  static_assert((std::is_same wchar_t*>::value), "");
>  static_assert((std::is_same size_t>::value), "");
> -static_assert((std::is_same const wchar_t*>::value), "");
> +// const wchar_t* wcsstr((const wchar_t*)0, L"") - See below
>  static_assert((std::is_same wchar_t*>::value), "");
>  static_assert((std::is_same wchar_t*>::value), "");
> -static_assert((std::is_same s)), const wchar_t*>::value), "");
> +// const wchar_t* wmemchr((const wchar_t*)0, L' ', s) - See below
>  static_assert((std::is_same wchar_t*>::value), "");
>  static_assert((std::is_same int>::value), "");
>  static_assert((std::is_same wchar_t*>::value), "");
> @@ -107,6 +102,17 @@ int main()
>  static_assert((std::is_same s, )), size_t>::value), "");
>  static_assert((std::is_same wchar_t**)0, s, )), size_t>::value), "");
>
> +// This test fails on systems whose C library doesn't provide a correct
> overload
> +// set for wcschr, wcspbrk, wcsrchr, wcsstr, and wmemchr. There's no way
> for
> +// libc++ to fix that on the C library's behalf.
> +#ifndef __APPLE__
> +static_assert((std::is_same ')), const wchar_t*>::value), "");
> +static_assert((std::is_same L"")), const wchar_t*>::value), "");
> +static_assert((std::is_same ')), const wchar_t*>::value), "");
> +static_assert((std::is_same const wchar_t*>::value), "");
> +static_assert((std::is_same s)), const wchar_t*>::value), "");
> +#endif
> +
>  #ifndef _LIBCPP_HAS_NO_STDIN
>  static_assert((std::is_same::value),
> "");
>  static_assert((std::is_same::value),
> "");
>
>
> ___
> 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