Re: [PATCH] D23832: cmake: Add ordering dep between HTML Sphinx docs and manpages

2016-08-24 Thread Andrew Wilkins via cfe-commits
axw accepted this revision.
axw added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D23832



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


[libunwind] r279716 - Creating release candidate rc3 from release_390 branch

2016-08-24 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug 24 22:32:43 2016
New Revision: 279716

URL: http://llvm.org/viewvc/llvm-project?rev=279716=rev
Log:
Creating release candidate rc3 from release_390 branch

Added:
libunwind/tags/RELEASE_390/rc3/   (props changed)
  - copied from r279715, libunwind/branches/release_39/

Propchange: libunwind/tags/RELEASE_390/rc3/
--
svn:mergeinfo = /libunwind/trunk:276128,277868,278029


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


[libcxx] r279709 - Creating release candidate rc3 from release_390 branch

2016-08-24 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug 24 22:32:22 2016
New Revision: 279709

URL: http://llvm.org/viewvc/llvm-project?rev=279709=rev
Log:
Creating release candidate rc3 from release_390 branch

Added:
libcxx/tags/RELEASE_390/rc3/   (props changed)
  - copied from r279708, libcxx/branches/release_39/

Propchange: libcxx/tags/RELEASE_390/rc3/
--
--- svn:mergeinfo (added)
+++ svn:mergeinfo Wed Aug 24 22:32:22 2016
@@ -0,0 +1,2 @@
+/libcxx/branches/apple:136569-137939
+/libcxx/trunk:278282,278357,278387,278904,279008


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


[libcxxabi] r279710 - Creating release candidate rc3 from release_390 branch

2016-08-24 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug 24 22:32:25 2016
New Revision: 279710

URL: http://llvm.org/viewvc/llvm-project?rev=279710=rev
Log:
Creating release candidate rc3 from release_390 branch

Added:
libcxxabi/tags/RELEASE_390/rc3/   (props changed)
  - copied from r279709, libcxxabi/branches/release_39/

Propchange: libcxxabi/tags/RELEASE_390/rc3/
--
svn:mergeinfo = /libcxxabi/trunk:278030,278579


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


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

2016-08-24 Thread Jason Turner via cfe-commits
lefticus updated this revision to Diff 69195.
lefticus added a comment.

Address formatting concerns and out-of-date-ness of patch relative to 
trunk/master


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);
+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);
+}
+
+
+#if TEST_STD_VER > 14
+{
+constexpr const char* s = "1234567890";
+static_assert(std::distance(s, s+10) == 10);
+   

Re: [PATCH] D23855: Make exception-throwing from a noexcept build `abort()`.

2016-08-24 Thread Sebastian Pop via cfe-commits
sebpop added a comment.

I like the patch.
Thanks for removing #ifdefs from the code: it improves readability in general.
Would it be possible to move the __throw_* functions in a same .h file to avoid 
having them all over?



Comment at: include/array:212
@@ -214,3 +211,3 @@
 #else
-assert(!"array::at out_of_range");
+_VSTD::abort();
 #endif

Maybe you can use __throw_out_of_range?
Fewer #ifdefs in the code is better.


Comment at: include/array:226
@@ -228,3 +225,3 @@
 #else
-assert(!"array::at out_of_range");
+_VSTD::abort();
 #endif

__throw_out_of_range


Comment at: include/bitset:218
@@ +217,3 @@
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+throw overflow_error(__msg);

To improve readability, could you please avoid the double negation by turning 
around the clauses:

  #ifdef _LIBCPP_NO_EXCEPTIONS
_VSTD::abort();
  #else
throw overflow_error(__msg);
  #endif

And the same below in all the __throw_* functions.  Thanks!


Comment at: include/deque:909
@@ -908,1 +908,3 @@
+#else
+   _VSTD::abort();
 #endif

Maybe you can add another function for this one:
__throw_length_error


Comment at: include/deque:920
@@ -917,1 +919,3 @@
+#else
+   _VSTD::abort();
 #endif

__throw_out_of_range


Comment at: include/experimental/any:106
@@ -106,3 +105,3 @@
 #else
-assert(!"bad_any_cast");
+_VSTD::abort();
 #endif

Maybe add a new function __throw_bad_any_cast?


Comment at: include/experimental/dynarray:145
@@ -148,3 +144,3 @@
 #else
-assert(!"dynarray::allocation");
+_VSTD::abort();
 #endif

New function: __throw_bad_array_length?


Comment at: include/experimental/dynarray:286
@@ -289,3 +285,3 @@
 #else
-assert(!"dynarray::at out_of_range");
+_VSTD::abort();
 #endif

__throw_out_of_range


Comment at: include/experimental/dynarray:302
@@ -305,3 +301,3 @@
 #else
-assert(!"dynarray::at out_of_range");
+_VSTD::abort();
 #endif

__throw_out_of_range


https://reviews.llvm.org/D23855



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


Re: [PATCH] D23853: Assert in performTrivialCopy - Bug report and a possible solution

2016-08-24 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

I'm not sure that weakening the assert is the right thing to do here. It seems 
like if V is undef that the analyzer ideally ought to have issued a diagnostic 
(and a sink) somewhere before. Do you have a test case that reproduces? (It 
would be good to add that to the tests in any event!).

Also: I think r270511 is unlikely to be the change that caused this -- that is 
a change in LLVM's treatment of DebugInfo, which shouldn't affect the analyzer.


https://reviews.llvm.org/D23853



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


r279702 - Remove a pointless LLVM_CONSTEXPR. NFC.

2016-08-24 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Wed Aug 24 20:54:37 2016
New Revision: 279702

URL: http://llvm.org/viewvc/llvm-project?rev=279702=rev
Log:
Remove a pointless LLVM_CONSTEXPR. NFC.

Modified:
cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=279702=279701=279702=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Aug 24 20:54:37 2016
@@ -653,7 +653,7 @@ ASTContext::getCanonicalTemplateTemplate
 
   assert(!TTP->getRequiresClause() &&
  "Unexpected requires-clause on template template-parameter");
-  LLVM_CONSTEXPR Expr *const CanonRequiresClause = nullptr;
+  Expr *const CanonRequiresClause = nullptr;
 
   TemplateTemplateParmDecl *CanonTTP
 = TemplateTemplateParmDecl::Create(*this, getTranslationUnitDecl(), 


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


Buildbot numbers for the last week of 8/14/2016 - 8/20/2016

2016-08-24 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 8/14/2016 - 8/20/2016.

Please see the same data in attached csv files:

The longest time each builder was red during the last week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time);

Thanks

Galina


The longest time each builder was red during the last week:

 buildername|  was_red
+---
 clang-x86-win2008-selfhost | 60:16:25
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 49:57:48
 perf-x86_64-penryn-O3-polly-before-vectorizer  | 46:42:32
 sanitizer-x86_64-linux | 41:03:36
 clang-cmake-armv7-a15-selfhost-neon| 31:52:07
 perf-x86_64-penryn-O3-polly-unprofitable   | 31:06:18
 sanitizer-windows  | 26:30:33
 clang-cmake-armv7-a15-selfhost | 25:15:08
 lldb-x86_64-ubuntu-14.04-cmake | 23:41:28
 clang-cmake-thumbv7-a15-full-sh| 23:16:56
 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only  | 23:03:55
 llvm-hexagon-elf   | 17:20:35
 clang-hexagon-elf  | 17:19:27
 clang-native-arm-lnt   | 16:18:07
 clang-ppc64be-linux-multistage | 15:44:48
 clang-cmake-aarch64-42vma  | 15:29:03
 clang-ppc64le-linux| 15:23:19
 clang-cmake-aarch64-quick  | 15:15:35
 clang-ppc64le-linux-lnt| 15:08:01
 clang-cmake-aarch64-full   | 15:07:53
 clang-ppc64be-linux-lnt| 15:05:53
 clang-ppc64be-linux| 15:02:45
 clang-cuda-build   | 14:51:00
 clang-ppc64le-linux-multistage | 14:47:32
 sanitizer-ppc64be-linux| 13:53:01
 clang-cmake-mips   | 13:04:30
 sanitizer-ppc64le-linux| 12:39:04
 sanitizer-x86_64-linux-fuzzer  | 12:25:25
 sanitizer-x86_64-linux-bootstrap   | 11:25:10
 clang-x64-ninja-win7   | 10:56:13
 sanitizer-x86_64-linux-autoconf| 10:51:30
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 10:08:55
 llvm-clang-lld-x86_64-debian-fast  | 09:19:05
 sanitizer-x86_64-linux-fast| 09:13:31
 clang-x86_64-debian-fast   | 09:12:12
 llvm-sphinx-docs   | 09:08:06
 lldb-windows7-android  | 07:54:42
 clang-atom-d525-fedora-rel | 07:44:38
 clang-cmake-armv7-a15-full | 07:09:44
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 07:05:07
 clang-bpf-build| 07:03:03
 clang-3stage-ubuntu| 06:51:23
 clang-cmake-armv7-a15  | 06:33:01
 clang-cmake-thumbv7-a15| 06:32:59
 perf-x86_64-penryn-O3  | 06:04:03
 clang-with-lto-ubuntu  | 05:41:39
 clang-x86_64-linux-abi-test| 05:16:47
 lldb-amd64-ninja-netbsd7   | 03:37:40
 llvm-mips-linux| 02:35:03
 clang-sphinx-docs  | 02:02:46
 lldb-x86_64-ubuntu-14.04-android   | 01:39:43
 lldb-x86_64-ubuntu-14.04-buildserver   | 01:24:33
 lldb-x86_64-darwin-13.4| 01:08:13
 perf-x86_64-penryn-O3-polly-parallel-fast  | 00:47:32
 lld-x86_64-freebsd | 00:45:28
 lld-x86_64-darwin13| 00:25:45
 lldb-amd64-ninja-freebsd11 | 00:11:19
 lld-x86_64-win7| 00:10:16
 polly-amd64-linux  | 00:09:43
(59 rows)


"Status 

r279694 - Lazily load the ContextDecl for a lambda's DefinitionData, to fix a

2016-08-24 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Aug 24 19:34:00 2016
New Revision: 279694

URL: http://llvm.org/viewvc/llvm-project?rev=279694=rev
Log:
Lazily load the ContextDecl for a lambda's DefinitionData, to fix a
deserialization cycle caused by the ContextDecl recursively importing members
of the lambda's closure type.

Added:
cfe/trunk/test/Modules/lambda-context.cpp
Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/test/PCH/cxx11-lambdas.mm

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=279694=279693=279694=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Wed Aug 24 19:34:00 2016
@@ -571,7 +571,7 @@ class CXXRecordDecl : public RecordDecl
 /// actual DeclContext does not suffice. This is used for lambdas that
 /// occur within default arguments of function parameters within the class
 /// or within a data member initializer.
-Decl *ContextDecl;
+LazyDeclPtr ContextDecl;
 
 /// \brief The list of captures, both explicit and implicit, for this 
 /// lambda.
@@ -1673,10 +1673,7 @@ public:
   /// the declaration in which the lambda occurs, e.g., the function parameter 
   /// or the non-static data member. Otherwise, it returns NULL to imply that
   /// the declaration context suffices.
-  Decl *getLambdaContextDecl() const {
-assert(isLambda() && "Not a lambda closure type!");
-return getLambdaData().ContextDecl;
-  }
+  Decl *getLambdaContextDecl() const;
   
   /// \brief Set the mangling number and context declaration for a lambda
   /// class.

Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=279694=279693=279694=diff
==
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Wed Aug 24 19:34:00 2016
@@ -1107,6 +1107,12 @@ CXXRecordDecl::getGenericLambdaTemplateP
   return nullptr;
 }
 
+Decl *CXXRecordDecl::getLambdaContextDecl() const {
+  assert(isLambda() && "Not a lambda closure type!");
+  ExternalASTSource *Source = getParentASTContext().getExternalSource();
+  return getLambdaData().ContextDecl.get(Source);
+}
+
 static CanQualType GetConversionType(ASTContext , NamedDecl *Conv) {
   QualType T =
   cast(Conv->getUnderlyingDecl()->getAsFunction())

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=279694=279693=279694=diff
==
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Wed Aug 24 19:34:00 2016
@@ -1539,7 +1539,7 @@ void ASTDeclReader::ReadCXXDefinitionDat
 Lambda.NumCaptures = Record[Idx++];
 Lambda.NumExplicitCaptures = Record[Idx++];
 Lambda.ManglingNumber = Record[Idx++];
-Lambda.ContextDecl = ReadDecl(Record, Idx);
+Lambda.ContextDecl = ReadDeclID(Record, Idx);
 Lambda.Captures 
   = (Capture*)Reader.Context.Allocate(sizeof(Capture)*Lambda.NumCaptures);
 Capture *ToCapture = Lambda.Captures;

Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=279694=279693=279694=diff
==
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Wed Aug 24 19:34:00 2016
@@ -5565,7 +5565,7 @@ void ASTRecordWriter::AddCXXDefinitionDa
 Record->push_back(Lambda.NumCaptures);
 Record->push_back(Lambda.NumExplicitCaptures);
 Record->push_back(Lambda.ManglingNumber);
-AddDeclRef(Lambda.ContextDecl);
+AddDeclRef(D->getLambdaContextDecl());
 AddTypeSourceInfo(Lambda.MethodTyInfo);
 for (unsigned I = 0, N = Lambda.NumCaptures; I != N; ++I) {
   const LambdaCapture  = Lambda.Captures[I];

Added: cfe/trunk/test/Modules/lambda-context.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/lambda-context.cpp?rev=279694=auto
==
--- cfe/trunk/test/Modules/lambda-context.cpp (added)
+++ cfe/trunk/test/Modules/lambda-context.cpp Wed Aug 24 19:34:00 2016
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fmodules -std=c++11 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fmodules -std=c++11 -include-pch %t %s -verify
+//
+// This test checks for a bug in the deserialization code that was only
+// reachable with modules enabled, but actually building and using modules is
+// not necessary in order to 

[libclc] r279692 - Strip opencl.ocl.version metadata

2016-08-24 Thread Matt Arsenault via cfe-commits
Author: arsenm
Date: Wed Aug 24 19:25:10 2016
New Revision: 279692

URL: http://llvm.org/viewvc/llvm-project?rev=279692=rev
Log:
Strip opencl.ocl.version metadata

This should be uniqued when linking, but right now it creates
a lot of metadata spam listing the same version. This should also
probably be reporting the compiled version of the user program,
which may differ from the library. Currently the library IR files report
1.0 while 1.1/1.2 are the default for user programs.

Modified:
libclc/trunk/utils/prepare-builtins.cpp

Modified: libclc/trunk/utils/prepare-builtins.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/utils/prepare-builtins.cpp?rev=279692=279691=279692=diff
==
--- libclc/trunk/utils/prepare-builtins.cpp (original)
+++ libclc/trunk/utils/prepare-builtins.cpp Wed Aug 24 19:25:10 2016
@@ -57,6 +57,13 @@ int main(int argc, char **argv) {
 return 1;
   }
 
+  // Strip the OpenCL version metadata. There are a lot of linked
+  // modules in the library build, each spamming the same
+  // version. This may also report a different version than the user
+  // program is using. This should probably be uniqued when linking.
+  if (NamedMDNode *OCLVersion = M->getNamedMetadata("opencl.ocl.version"))
+  M->eraseNamedMetadata(OCLVersion);
+
   // Set linkage of every external definition to linkonce_odr.
   for (Module::iterator i = M->begin(), e = M->end(); i != e; ++i) {
 if (!i->isDeclaration() && i->getLinkage() == GlobalValue::ExternalLinkage)


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


[PATCH] D23860: [Sema][Comments] Add support for TypeAliasTemplate

2016-08-24 Thread Bruno Cardoso Lopes via cfe-commits
bruno created this revision.
bruno added a reviewer: gribozavr.
bruno added a subscriber: cfe-commits.

Emit proper diagnostics when -Wdocumentation is used with constructs such as:

  template
  using fn = int(T aaa, int ccc);

Previously clang wouldn't recognize the function and complain with
'comment that is not attached to a function declaration'.

https://reviews.llvm.org/D23860

Files:
  lib/AST/Comment.cpp
  test/Sema/warn-documentation.cpp

Index: test/Sema/warn-documentation.cpp
===
--- test/Sema/warn-documentation.cpp
+++ test/Sema/warn-documentation.cpp
@@ -416,6 +416,22 @@
 /// \returns aaa.
 using test_function_like_using8 = foo::function_wrapper &&;
 
+// expected-warning@+4 {{template parameter 'U' not found in the template 
declaration}} expected-note@+4 {{did you mean 'T'?}}
+// expected-warning@+2 {{parameter 'bbb' not found in the function 
declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \tparam U Uuu.
+template
+using test_function_like_using9 = int(T aaa, int ccc);
+
+// expected-warning@+4 {{template parameter 'U' not found in the template 
declaration}} expected-note@+4 {{did you mean 'T'?}}
+// expected-warning@+2 {{parameter 'bbb' not found in the function 
declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \tparam U Uuu.
+template
+using test_function_like_usingA = foo::function_wrapper;
+
 using test_not_function_like_using1 = int (*)(int aaa);
 
 // expected-warning@+1 {{'\param' command used in a comment that is not 
attached to a function declaration}}
Index: lib/AST/Comment.cpp
===
--- lib/AST/Comment.cpp
+++ lib/AST/Comment.cpp
@@ -310,6 +310,20 @@
 Kind = TypedefKind;
 TemplateKind = Template;
 TemplateParameters = TAT->getTemplateParameters();
+TypeAliasDecl *TAD = TAT->getTemplatedDecl();
+if (!TAD)
+  break;
+
+const TypeSourceInfo *TSI = TAD->getTypeSourceInfo();
+if (!TSI)
+  break;
+TypeLoc TL = TSI->getTypeLoc().getUnqualifiedLoc();
+FunctionTypeLoc FTL;
+if (getFunctionTypeLoc(TL, FTL)) {
+  Kind = FunctionKind;
+  ParamVars = FTL.getParams();
+  ReturnType = FTL.getReturnLoc().getType();
+}
 break;
   }
   case Decl::Enum:


Index: test/Sema/warn-documentation.cpp
===
--- test/Sema/warn-documentation.cpp
+++ test/Sema/warn-documentation.cpp
@@ -416,6 +416,22 @@
 /// \returns aaa.
 using test_function_like_using8 = foo::function_wrapper &&;
 
+// expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \tparam U Uuu.
+template
+using test_function_like_using9 = int(T aaa, int ccc);
+
+// expected-warning@+4 {{template parameter 'U' not found in the template declaration}} expected-note@+4 {{did you mean 'T'?}}
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \tparam U Uuu.
+template
+using test_function_like_usingA = foo::function_wrapper;
+
 using test_not_function_like_using1 = int (*)(int aaa);
 
 // expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
Index: lib/AST/Comment.cpp
===
--- lib/AST/Comment.cpp
+++ lib/AST/Comment.cpp
@@ -310,6 +310,20 @@
 Kind = TypedefKind;
 TemplateKind = Template;
 TemplateParameters = TAT->getTemplateParameters();
+TypeAliasDecl *TAD = TAT->getTemplatedDecl();
+if (!TAD)
+  break;
+
+const TypeSourceInfo *TSI = TAD->getTypeSourceInfo();
+if (!TSI)
+  break;
+TypeLoc TL = TSI->getTypeLoc().getUnqualifiedLoc();
+FunctionTypeLoc FTL;
+if (getFunctionTypeLoc(TL, FTL)) {
+  Kind = FunctionKind;
+  ParamVars = FTL.getParams();
+  ReturnType = FTL.getReturnLoc().getType();
+}
 break;
   }
   case Decl::Enum:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r279691 - [Sema][Comments] Factor out function type loc logic. NFCI

2016-08-24 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Wed Aug 24 19:22:08 2016
New Revision: 279691

URL: http://llvm.org/viewvc/llvm-project?rev=279691=rev
Log:
[Sema][Comments] Factor out function type loc logic. NFCI

This is in prepatation for @param TypeAliasTemplate support.

Modified:
cfe/trunk/lib/AST/Comment.cpp

Modified: cfe/trunk/lib/AST/Comment.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Comment.cpp?rev=279691=279690=279691=diff
==
--- cfe/trunk/lib/AST/Comment.cpp (original)
+++ cfe/trunk/lib/AST/Comment.cpp Wed Aug 24 19:22:08 2016
@@ -113,6 +113,65 @@ bool ParagraphComment::isWhitespaceNoCac
   return true;
 }
 
+static TypeLoc lookThroughTypedefOrTypeAliasLocs(TypeLoc ) {
+  TypeLoc TL = SrcTL.IgnoreParens();
+
+  // Look through qualified types.
+  if (QualifiedTypeLoc QualifiedTL = TL.getAs())
+return QualifiedTL.getUnqualifiedLoc();
+  // Look through pointer types.
+  if (PointerTypeLoc PointerTL = TL.getAs())
+return PointerTL.getPointeeLoc().getUnqualifiedLoc();
+  // Look through reference types.
+  if (ReferenceTypeLoc ReferenceTL = TL.getAs())
+return ReferenceTL.getPointeeLoc().getUnqualifiedLoc();
+  // Look through adjusted types.
+  if (AdjustedTypeLoc ATL = TL.getAs())
+return ATL.getOriginalLoc();
+  if (BlockPointerTypeLoc BlockPointerTL = TL.getAs())
+return BlockPointerTL.getPointeeLoc().getUnqualifiedLoc();
+  if (MemberPointerTypeLoc MemberPointerTL = TL.getAs())
+return MemberPointerTL.getPointeeLoc().getUnqualifiedLoc();
+  if (ElaboratedTypeLoc ETL = TL.getAs())
+return ETL.getNamedTypeLoc();
+
+  return TL;
+}
+
+static bool getFunctionTypeLoc(TypeLoc TL, FunctionTypeLoc ) {
+  TypeLoc PrevTL;
+  while (PrevTL != TL) {
+PrevTL = TL;
+TL = lookThroughTypedefOrTypeAliasLocs(TL);
+  }
+
+  if (FunctionTypeLoc FTL = TL.getAs()) {
+ResFTL = FTL;
+return true;
+  }
+
+  if (TemplateSpecializationTypeLoc STL =
+  TL.getAs()) {
+// If we have a typedef to a template specialization with exactly one
+// template argument of a function type, this looks like std::function,
+// boost::function, or other function wrapper.  Treat these typedefs as
+// functions.
+if (STL.getNumArgs() != 1)
+  return false;
+TemplateArgumentLoc MaybeFunction = STL.getArgLoc(0);
+if (MaybeFunction.getArgument().getKind() != TemplateArgument::Type)
+  return false;
+TypeSourceInfo *MaybeFunctionTSI = MaybeFunction.getTypeSourceInfo();
+TypeLoc TL = MaybeFunctionTSI->getTypeLoc().getUnqualifiedLoc();
+if (FunctionTypeLoc FTL = TL.getAs()) {
+  ResFTL = FTL;
+  return true;
+}
+  }
+
+  return false;
+}
+
 const char *ParamCommandComment::getDirectionAsString(PassDirection D) {
   switch (D) {
   case ParamCommandComment::In:
@@ -238,70 +297,11 @@ void DeclInfo::fill() {
 if (!TSI)
   break;
 TypeLoc TL = TSI->getTypeLoc().getUnqualifiedLoc();
-while (true) {
-  TL = TL.IgnoreParens();
-  // Look through qualified types.
-  if (QualifiedTypeLoc QualifiedTL = TL.getAs()) {
-TL = QualifiedTL.getUnqualifiedLoc();
-continue;
-  }
-  // Look through pointer types.
-  if (PointerTypeLoc PointerTL = TL.getAs()) {
-TL = PointerTL.getPointeeLoc().getUnqualifiedLoc();
-continue;
-  }
-  // Look through reference types.
-  if (ReferenceTypeLoc ReferenceTL = TL.getAs()) {
-TL = ReferenceTL.getPointeeLoc().getUnqualifiedLoc();
-continue;
-  }
-  // Look through adjusted types.
-  if (AdjustedTypeLoc ATL = TL.getAs()) {
-TL = ATL.getOriginalLoc();
-continue;
-  }
-  if (BlockPointerTypeLoc BlockPointerTL =
-  TL.getAs()) {
-TL = BlockPointerTL.getPointeeLoc().getUnqualifiedLoc();
-continue;
-  }
-  if (MemberPointerTypeLoc MemberPointerTL =
-  TL.getAs()) {
-TL = MemberPointerTL.getPointeeLoc().getUnqualifiedLoc();
-continue;
-  }
-  if (ElaboratedTypeLoc ETL = TL.getAs()) {
-TL = ETL.getNamedTypeLoc();
-continue;
-  }
-  // Is this a typedef for a function type?
-  if (FunctionTypeLoc FTL = TL.getAs()) {
-Kind = FunctionKind;
-ParamVars = FTL.getParams();
-ReturnType = FTL.getReturnLoc().getType();
-break;
-  }
-  if (TemplateSpecializationTypeLoc STL =
-  TL.getAs()) {
-// If we have a typedef to a template specialization with exactly one
-// template argument of a function type, this looks like std::function,
-// boost::function, or other function wrapper.  Treat these typedefs as
-// functions.
-if (STL.getNumArgs() != 1)
-  break;
-TemplateArgumentLoc MaybeFunction = STL.getArgLoc(0);
-if (MaybeFunction.getArgument().getKind() != TemplateArgument::Type)
-  break;
-

Re: [PATCH] D23279: clang-reorder-fields

2016-08-24 Thread Alexander Shaposhnikov via cfe-commits
alexshap added a comment.

so looks like i have marked all the inline comments as done - please, let me 
know if i need to change smth else.
Many thanks for the code review/comments/suggestions.


Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D23279: clang-reorder-fields

2016-08-24 Thread Alexander Shaposhnikov via cfe-commits
alexshap marked an inline comment as done.
alexshap added a comment.

Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D23279: clang-reorder-fields

2016-08-24 Thread Alexander Shaposhnikov via cfe-commits
alexshap updated this revision to Diff 69186.
alexshap added a comment.

Use a more elaborate approach for command line options.

alexshap-mbp:srcs alexshap$ clang-reorder-fields -record-name Foo -fields-order 
s1,x,z,s2 main.cpp >/dev/null && echo ok
ok
alexshap-mbp:srcs alexshap$ clang-reorder-fields -fields-order s1,x,z,s2 
main.cpp >/dev/null && echo ok
clang-reorder-fields: for the -record-name option: must be specified at least 
once!
alexshap-mbp:srcs alexshap$ clang-reorder-fields -record-name Foo main.cpp 
>/dev/null && echo ok
clang-reorder-fields: for the -fields-order option: must be specified at least 
once!
alexshap-mbp:srcs alexshap$ clang-reorder-fields --help
OVERVIEW: A tool to reorder fields in C/C++ structs/classes.

USAGE: clang-reorder-fields [subcommand] [options]  [... ]

OPTIONS:

Generic Options:

  -help  - Display available options (-help-hidden for more)
  -help-list - Display list of available options 
(-help-list-hidden for more)
  -version   - Display the version of this program

clang-reorder-fields options:

  -extra-arg=- Additional argument to append to the compiler 
command line
  -extra-arg-before= - Additional argument to prepend to the compiler 
command line
  -fields-order= - The desired fields order.
  -i - Overwrite edited files.
  -p=- Build path
  -record-name=  - The name of the struct/class.


Repository:
  rL LLVM

https://reviews.llvm.org/D23279

Files:
  CMakeLists.txt
  clang-reorder-fields/CMakeLists.txt
  clang-reorder-fields/ReorderFieldsAction.cpp
  clang-reorder-fields/ReorderFieldsAction.h
  clang-reorder-fields/tool/CMakeLists.txt
  clang-reorder-fields/tool/ClangReorderFields.cpp
  test/CMakeLists.txt
  test/clang-reorder-fields/CStructAmbiguousName.cpp
  test/clang-reorder-fields/CStructFieldsOrder.cpp
  test/clang-reorder-fields/ClassMixedInitialization.cpp
  test/clang-reorder-fields/ClassSimpleCtor.cpp

Index: test/clang-reorder-fields/ClassSimpleCtor.cpp
===
--- test/clang-reorder-fields/ClassSimpleCtor.cpp
+++ test/clang-reorder-fields/ClassSimpleCtor.cpp
@@ -0,0 +1,24 @@
+// RUN: clang-reorder-fields -record-name Foo -fields-order s1,x,z,s2 %s -- | FileCheck %s
+
+class Foo {
+public:
+  Foo();
+
+private:
+  int x;  // CHECK:  {{^  const char \*s1;}}
+  const char *s1; // CHECK-NEXT: {{^  int x;}}
+  const char *s2; // CHECK-NEXT: {{^  double z;}}
+  double z;   // CHECK-NEXT: {{^  const char \*s2;}}
+};
+
+Foo::Foo():
+  x(12),  // CHECK:  {{^  s1\("abc"\),}}
+  s1("abc"),  // CHECK-NEXT: {{^  x\(12\),}}
+  s2("def"),  // CHECK-NEXT: {{^  z\(3.14\),}}
+  z(3.14) // CHECK-NEXT: {{^  s2\("def"\)}}
+{}
+
+int main() {
+  Foo foo;
+  return 0;
+}
Index: test/clang-reorder-fields/ClassMixedInitialization.cpp
===
--- test/clang-reorder-fields/ClassMixedInitialization.cpp
+++ test/clang-reorder-fields/ClassMixedInitialization.cpp
@@ -0,0 +1,24 @@
+// RUN: clang-reorder-fields -record-name Foo -fields-order e,x,pi,s2,s1 %s -- -std=c++11 | FileCheck %s
+
+class Foo {
+public:
+  Foo();
+
+private:
+  int x;  // CHECK:  {{^  double e = 2.71;}}
+  const char *s1; // CHECK-NEXT: {{^  int x;}}
+  const char *s2; // CHECK-NEXT: {{^  double pi = 3.14;}}
+  double pi = 3.14;   // CHECK-NEXT: {{^  const char \*s2;}}
+  double e = 2.71;// CHECK-NEXT: {{^  const char \*s1;}}
+};
+
+Foo::Foo():
+  x(12),  // CHECK:  {{^  x\(12\)}},
+  s1("abc"),  // CHECK-NEXT: {{^  s2\("def"\)}},
+  s2("def")   // CHECK-NEXT: {{^  s1\("abc"\)}}
+{}
+
+int main() {
+  Foo foo;
+  return 0;
+}
Index: test/clang-reorder-fields/CStructFieldsOrder.cpp
===
--- test/clang-reorder-fields/CStructFieldsOrder.cpp
+++ test/clang-reorder-fields/CStructFieldsOrder.cpp
@@ -0,0 +1,16 @@
+// RUN: clang-reorder-fields -record-name ::bar::Foo -fields-order z,w,y,x %s -- | FileCheck %s
+
+namespace bar {
+struct Foo {
+  const int* x; // CHECK:  {{^  double z;}}
+  int y;// CHECK-NEXT: {{^  int w;}}
+  double z; // CHECK-NEXT: {{^  int y;}}
+  int w;// CHECK-NEXT: {{^  const int\* x}}
+};
+} // end namespace bar
+
+int main() {
+  const int x = 13;
+  bar::Foo foo = { , 0, 1.29, 17 }; // CHECK: {{^  bar::Foo foo = { 1.29, 17, 0,  };}} 
+  return 0;
+}
Index: test/clang-reorder-fields/CStructAmbiguousName.cpp
===
--- test/clang-reorder-fields/CStructAmbiguousName.cpp
+++ test/clang-reorder-fields/CStructAmbiguousName.cpp
@@ -0,0 +1,18 @@
+// RUN: clang-reorder-fields -record-name ::Foo -fields-order y,x %s -- | FileCheck %s
+
+struct Foo {
+  int x;// CHECK:  {{^  double y;}}
+  double y; // CHECK-NEXT: {{^  int x;}}
+};
+

[PATCH] D23859: [Preprocessor] Add a macro for -fno-gnu-inline-asm

2016-08-24 Thread Bruno Cardoso Lopes via cfe-commits
bruno created this revision.
bruno added reviewers: rsmith, echristo.
bruno added subscribers: cfe-commits, friss.
Herald added a subscriber: mehdi_amini.

When building with -fno-gnu-inline-asm and -fmodules on Darwin, the compilation 
might fail if some of the implicit modules try to use gnu asm inline. For 
example, the issue happens when building _Builtin_intrinsics because of inline 
asm in cpuid.h

Add __CLANG_NO_GNU_INLINE_ASM macro when -fno-gnu-inline-asm is used and allow 
the user to ifdef asm inline's if desired.

https://reviews.llvm.org/D23859

Files:
  lib/Frontend/InitPreprocessor.cpp
  lib/Headers/cpuid.h
  test/Driver/inline-asm.c

Index: test/Driver/inline-asm.c
===
--- test/Driver/inline-asm.c
+++ test/Driver/inline-asm.c
@@ -22,3 +22,9 @@
 // RUN: FileCheck --check-prefix=CHECK-NO-GNU-INLINE-ASM %s
 
 // CHECK-NO-GNU-INLINE-ASM: "-fno-gnu-inline-asm"
+
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN:   -fno-gnu-inline-asm -dM -E %s 2>&1 | \
+// RUN: FileCheck --check-prefix=CHECK-NO-GNU-INLINE-ASM-DEFINE %s
+
+// CHECK-NO-GNU-INLINE-ASM-DEFINE: #define __CLANG_NO_GNU_INLINE_ASM 1
Index: lib/Headers/cpuid.h
===
--- lib/Headers/cpuid.h
+++ lib/Headers/cpuid.h
@@ -152,6 +152,8 @@
 #define bit_SMEP0x0080
 #define bit_ENH_MOVSB   0x0200
 
+#ifndef __CLANG_NO_GNU_INLINE_ASM
+
 #if __i386__
 #define __cpuid(__level, __eax, __ebx, __ecx, __edx) \
 __asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \
@@ -213,3 +215,5 @@
 *__sig = __ebx;
 return __eax;
 }
+
+#endif /* __CLANG_NO_GNU_INLINE_ASM */
Index: lib/Frontend/InitPreprocessor.cpp
===
--- lib/Frontend/InitPreprocessor.cpp
+++ lib/Frontend/InitPreprocessor.cpp
@@ -952,6 +952,9 @@
 Builder.defineMacro("__CLANG_CUDA_APPROX_TRANSCENDENTALS__");
   }
 
+  if (!LangOpts.GNUAsm)
+Builder.defineMacro("__CLANG_NO_GNU_INLINE_ASM");
+
   // OpenCL definitions.
   if (LangOpts.OpenCL) {
 #define OPENCLEXT(Ext) \


Index: test/Driver/inline-asm.c
===
--- test/Driver/inline-asm.c
+++ test/Driver/inline-asm.c
@@ -22,3 +22,9 @@
 // RUN: FileCheck --check-prefix=CHECK-NO-GNU-INLINE-ASM %s
 
 // CHECK-NO-GNU-INLINE-ASM: "-fno-gnu-inline-asm"
+
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN:   -fno-gnu-inline-asm -dM -E %s 2>&1 | \
+// RUN: FileCheck --check-prefix=CHECK-NO-GNU-INLINE-ASM-DEFINE %s
+
+// CHECK-NO-GNU-INLINE-ASM-DEFINE: #define __CLANG_NO_GNU_INLINE_ASM 1
Index: lib/Headers/cpuid.h
===
--- lib/Headers/cpuid.h
+++ lib/Headers/cpuid.h
@@ -152,6 +152,8 @@
 #define bit_SMEP0x0080
 #define bit_ENH_MOVSB   0x0200
 
+#ifndef __CLANG_NO_GNU_INLINE_ASM
+
 #if __i386__
 #define __cpuid(__level, __eax, __ebx, __ecx, __edx) \
 __asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \
@@ -213,3 +215,5 @@
 *__sig = __ebx;
 return __eax;
 }
+
+#endif /* __CLANG_NO_GNU_INLINE_ASM */
Index: lib/Frontend/InitPreprocessor.cpp
===
--- lib/Frontend/InitPreprocessor.cpp
+++ lib/Frontend/InitPreprocessor.cpp
@@ -952,6 +952,9 @@
 Builder.defineMacro("__CLANG_CUDA_APPROX_TRANSCENDENTALS__");
   }
 
+  if (!LangOpts.GNUAsm)
+Builder.defineMacro("__CLANG_NO_GNU_INLINE_ASM");
+
   // OpenCL definitions.
   if (LangOpts.OpenCL) {
 #define OPENCLEXT(Ext) \
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D23858: Don't diagnose non-modular includes when we are not compiling a module

2016-08-24 Thread Manman Ren via cfe-commits
manmanren created this revision.
manmanren added reviewers: rsmith, benlangmuir.
manmanren added a subscriber: cfe-commits.

We used to have -fmodule-implementation-of and it was merged with 
-fmodule-name. But this causes some regression on our internal projects. We are 
now seeing non-modular include warnings.

This is triggered when we have relative includes to a VFS-mapped module, -I 
that points us to the real header and -F that points us to the vfs. The real 
header that is part of the umbrella directory will be classified as non-modular.

It seems like we can use CompilingModule to tell if we are compiling the 
interface of a module or the implementation file of a module. When compiling 
the implementation file, we don't diagnose non-modular includes. The 
non-modular includes will be diagnosed when building the interface and writing 
the pcm file.

Related changes:
http://llvm.org/viewvc/llvm-project?rev=213767=rev
http://llvm.org/viewvc/llvm-project?rev=261372=rev
http://llvm.org/viewvc/llvm-project?rev=263449=rev

https://reviews.llvm.org/D23858

Files:
  lib/Lex/PPDirectives.cpp
  test/VFS/Inputs/Nonmodular/A.h
  test/VFS/Inputs/Nonmodular/Nonmodular.modulemap
  test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
  test/VFS/Inputs/Nonmodular/test.c
  test/VFS/Inputs/Nonmodular/umbrella.h
  test/VFS/test_nonmodular.c

Index: test/VFS/test_nonmodular.c
===
--- test/VFS/test_nonmodular.c
+++ test/VFS/test_nonmodular.c
@@ -0,0 +1,11 @@
+// REQUIRES: shell
+
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/vdir %t/cache %t/outdir
+// We can't have module.map inside Inputs/Nonmodular.
+// RUN: cp %S/Inputs/Nonmodular/Nonmodular.modulemap %t/outdir/module.modulemap
+//
+// RUN: sed -e "s:VDIR:%t/vdir:g" -e "s:IN_DIR:%S:g" -e "s:OUT_DIR:%t/outdir:g" %S/Inputs/Nonmodular/nonmodular-headers.yaml > %t/vdir/nonmodular-headers.yaml
+// RUN: %clang_cc1 -fmodule-name=Nonmodular -fmodules -Wnon-modular-include-in-framework-module -verify -fimplicit-module-maps -fmodules-cache-path=%t/cache -ivfsoverlay %t/vdir/nonmodular-headers.yaml -I %S/Inputs -F %t/vdir -fsyntax-only %S/Inputs/Nonmodular/test.c
+
+// expected-no-diagnostics
Index: test/VFS/Inputs/Nonmodular/umbrella.h
===
--- test/VFS/Inputs/Nonmodular/umbrella.h
+++ test/VFS/Inputs/Nonmodular/umbrella.h
@@ -0,0 +1,5 @@
+#ifndef __umbrella_h__
+#define __umbrella_h__
+
+#include 
+#endif
Index: test/VFS/Inputs/Nonmodular/test.c
===
--- test/VFS/Inputs/Nonmodular/test.c
+++ test/VFS/Inputs/Nonmodular/test.c
@@ -0,0 +1,3 @@
+// expected-no-diagnostics
+
+#include "umbrella.h"
Index: test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
===
--- test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
+++ test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml
@@ -0,0 +1,34 @@
+{
+  'version': 0,
+  'case-sensitive': 'false',
+  'ignore-non-existent-contents': 'true',
+  'roots': [
+{
+  'type': 'directory',
+  'name': "VDIR/Nonmodular.framework/Headers",
+  'contents': [
+{
+  'type': 'file',
+  'name': "umbrella.h",
+  'external-contents': "IN_DIR/Inputs/Nonmodular/umbrella.h"
+},
+{
+  'type': 'file',
+  'name': "A.h",
+  'external-contents': "IN_DIR/Inputs/Nonmodular/A.h"
+}
+  ]
+},
+{
+  'type': 'directory',
+  'name': "VDIR/Nonmodular.framework/Modules",
+  'contents': [
+{
+  'type': 'file',
+  'name': "module.modulemap",
+  'external-contents': "OUT_DIR/module.modulemap"
+}
+  ]
+}
+  ]
+}
Index: test/VFS/Inputs/Nonmodular/Nonmodular.modulemap
===
--- test/VFS/Inputs/Nonmodular/Nonmodular.modulemap
+++ test/VFS/Inputs/Nonmodular/Nonmodular.modulemap
@@ -0,0 +1,5 @@
+framework module Nonmodular [extern_c] {
+  umbrella header "umbrella.h"
+  export *
+  module * { export * }
+}
Index: test/VFS/Inputs/Nonmodular/A.h
===
--- test/VFS/Inputs/Nonmodular/A.h
+++ test/VFS/Inputs/Nonmodular/A.h
@@ -0,0 +1 @@
+// A.h
Index: lib/Lex/PPDirectives.cpp
===
--- lib/Lex/PPDirectives.cpp
+++ lib/Lex/PPDirectives.cpp
@@ -746,7 +746,8 @@
 ModuleMap::KnownHeader *SuggestedModule,
 bool SkipCache) {
   Module *RequestingModule = getModuleForLocation(FilenameLoc);
-  bool RequestingModuleIsModuleInterface = !SourceMgr.isInMainFile(FilenameLoc);
+  bool RequestingModuleIsModuleInterface =
+  !SourceMgr.isInMainFile(FilenameLoc) && getLangOpts().CompilingModule;
 
   // If the header lookup mechanism may be relative to the current inclusion
   // stack, record the parent #includes.

r279687 - DebugInfo: Let -gsplit-dwarf and -gmlt compose if -fno-split-dwarf-inlining is used

2016-08-24 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Wed Aug 24 18:22:36 2016
New Revision: 279687

URL: http://llvm.org/viewvc/llvm-project?rev=279687=rev
Log:
DebugInfo: Let -gsplit-dwarf and -gmlt compose if -fno-split-dwarf-inlining is 
used

If the inline info is not duplicated into the skeleton CU, then there's
value in using -gsplit-dwarf and -gmlt together (to keep all those extra
subprograms out of the skeleton CU, while also producing smaller .dwo
files)

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/split-debug.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=279687=279686=279687=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug 24 18:22:36 2016
@@ -4597,6 +4597,12 @@ void Clang::ConstructJob(Compilation ,
  : "-");
   }
 
+  bool splitDwarfInlining =
+  Args.hasFlag(options::OPT_fsplit_dwarf_inlining,
+   options::OPT_fno_split_dwarf_inlining, true);
+  if (!splitDwarfInlining)
+CmdArgs.push_back("-fno-split-dwarf-inlining");
+
   Args.ClaimAllArgs(options::OPT_g_Group);
   Arg *SplitDwarfArg = Args.getLastArg(options::OPT_gsplit_dwarf);
   if (Arg *A = Args.getLastArg(options::OPT_g_Group)) {
@@ -4606,8 +4612,15 @@ void Clang::ConstructJob(Compilation ,
   // If you say "-gsplit-dwarf -gline-tables-only", -gsplit-dwarf loses.
   // But -gsplit-dwarf is not a g_group option, hence we have to check the
   // order explicitly. (If -gsplit-dwarf wins, we fix DebugInfoKind later.)
-  if (SplitDwarfArg && DebugInfoKind < codegenoptions::LimitedDebugInfo &&
-  A->getIndex() > SplitDwarfArg->getIndex())
+  // This gets a bit more complicated if you've disabled inline info in the
+  // skeleton CUs (splitDwarfInlining) - then there's value in composing
+  // split-dwarf and line-tables-only, so let those compose naturally in
+  // that case.
+  // And if you just turned off debug info, (-gsplit-dwarf -g0) - do that.
+  if (SplitDwarfArg && A->getIndex() > SplitDwarfArg->getIndex() &&
+  ((DebugInfoKind == codegenoptions::DebugLineTablesOnly &&
+splitDwarfInlining) ||
+   DebugInfoKind == codegenoptions::NoDebugInfo))
 SplitDwarfArg = nullptr;
 } else
   // For any other 'g' option, use Limited.
@@ -4659,7 +4672,8 @@ void Clang::ConstructJob(Compilation ,
   // splitting and extraction.
   // FIXME: Currently only works on Linux.
   if (getToolChain().getTriple().isOSLinux() && SplitDwarfArg) {
-DebugInfoKind = codegenoptions::LimitedDebugInfo;
+if (splitDwarfInlining)
+  DebugInfoKind = codegenoptions::LimitedDebugInfo;
 CmdArgs.push_back("-backend-option");
 CmdArgs.push_back("-split-dwarf=Enable");
   }
@@ -4697,10 +4711,6 @@ void Clang::ConstructJob(Compilation ,
 CmdArgs.push_back("-generate-type-units");
   }
 
-  if (!Args.hasFlag(options::OPT_fsplit_dwarf_inlining,
-options::OPT_fno_split_dwarf_inlining, true))
-CmdArgs.push_back("-fno-split-dwarf-inlining");
-
   // CloudABI and WebAssembly use -ffunction-sections and -fdata-sections by
   // default.
   bool UseSeparateSections = Triple.getOS() == llvm::Triple::CloudABI ||

Modified: cfe/trunk/test/Driver/split-debug.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/split-debug.c?rev=279687=279686=279687=diff
==
--- cfe/trunk/test/Driver/split-debug.c (original)
+++ cfe/trunk/test/Driver/split-debug.c Wed Aug 24 18:22:36 2016
@@ -33,11 +33,25 @@
 //
 // CHECK-IAS: objcopy
 
+// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt 
-fno-split-dwarf-inlining -S -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-GMLT-WITH-SPLIT < %t %s
+//
+// CHECK-GMLT-WITH-SPLIT: "-split-dwarf=Enable"
+// CHECK-GMLT-WITH-SPLIT: "-debug-info-kind=line-tables-only"
+// CHECK-GMLT-WITH-SPLIT: "-split-dwarf-file"
+
+// RUN: %clang -target x86_64-unknown-linux-gnu -gmlt -gsplit-dwarf 
-fno-split-dwarf-inlining -S -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-SPLIT-WITH-GMLT < %t %s
+//
+// CHECK-SPLIT-WITH-GMLT: "-split-dwarf=Enable"
+// CHECK-SPLIT-WITH-GMLT: "-debug-info-kind=line-tables-only"
+// CHECK-SPLIT-WITH-GMLT: "-split-dwarf-file"
+
 // RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt -S -### %s 
2> %t
 // RUN: FileCheck -check-prefix=CHECK-GMLT-OVER-SPLIT < %t %s
 //
-// CHECK-GMLT-OVER-SPLIT: "-debug-info-kind=line-tables-only"
 // CHECK-GMLT-OVER-SPLIT-NOT: "-split-dwarf=Enable"
+// CHECK-GMLT-OVER-SPLIT: "-debug-info-kind=line-tables-only"
 // CHECK-GMLT-OVER-SPLIT-NOT: "-split-dwarf-file"
 
 // RUN: %clang -target x86_64-unknown-linux-gnu -gmlt -gsplit-dwarf -S -### %s 
2> %t
@@ -46,11 +60,18 @@
 // CHECK-SPLIT-OVER-GMLT: 

Re: [PATCH] D23783: [Sema][Comments] Support @param with c++ 'using' keyword

2016-08-24 Thread Bruno Cardoso Lopes via cfe-commits
bruno closed this revision.
bruno added a comment.

r279662


https://reviews.llvm.org/D23783



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


[PATCH] D23856: [libc++] Perform configuration checks with -nodefaultlibs

2016-08-24 Thread Shoaib Meenai via cfe-commits
smeenai created this revision.
smeenai added reviewers: EricWF, compnerd.
smeenai added subscribers: cfe-commits, kastiglione.

We're compiling libc++ with -nodefaultlibs, so we should also pass this
option during the configuration checks to ensure those checks are
consistent with the actual build.

The primary motivation here is to ease cross-compilation against a
non-standard set of C++ libraries. Previously, the configuration checks
would attempt to link against the standard C++ libraries, which would
cause link failures when cross-compiling, even though the actual library
link would go through correctly (because of the use of -nodefaultlibs
and explicitly specifying any needed libraries). This is more correct
even ignoring the motivation, however.

This redoes D23791 but fixes the configuration errors in sanitizer
builds by disabling the sanitizers for the configuration checks.

Test Plan:
- check-libcxx passes on OS X 10.11
- check-libcxx passes on Ubuntu 16.04
- libcxx configures correctly on Ubuntu 16.04 with LLVM_USE_SANITIZER
  Address, Memory, Thread, and Undefined

https://reviews.llvm.org/D23856

Files:
  cmake/Modules/CheckLibcxxAtomic.cmake
  cmake/config-ix.cmake

Index: cmake/config-ix.cmake
===
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -1,5 +1,34 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+
+check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
+if (NOT LIBCXX_USE_COMPILER_RT)
+  check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+endif()
+
+# libc++ is built with -nodefaultlibs, so we want all our checks to also
+# use this option, otherwise we may end up with an inconsistency between
+# the flags we think we require during configuration (if the checks are
+# performed without -nodefaultlibs) and the flags that are actually
+# required during compilation (which has the -nodefaultlibs). libc is
+# required for the link to go through. We remove sanitizers from the
+# configuration checks to avoid spurious link errors.
+check_cxx_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+  list(APPEND CMAKE_REQUIRED_LIBRARIES -nodefaultlibs)
+  if (LIBCXX_HAS_C_LIB)
+list(APPEND CMAKE_REQUIRED_LIBRARIES c)
+  endif ()
+  if (LIBCXX_USE_COMPILER_RT)
+list(APPEND CMAKE_REQUIRED_LIBRARIES -rtlib=compiler-rt)
+  elseif (LIBCXX_HAS_GCC_S_LIB)
+list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
+  endif ()
+  if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
+list(APPEND CMAKE_REQUIRED_FLAGS -fno-sanitize=all)
+  endif ()
+endif ()
+
 include(CheckLibcxxAtomic)
 
 # Check compiler flags
@@ -14,9 +43,5 @@
 
 # Check libraries
 check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
-check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
-if (NOT LIBCXX_USE_COMPILER_RT)
-  check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
-endif()
Index: cmake/Modules/CheckLibcxxAtomic.cmake
===
--- cmake/Modules/CheckLibcxxAtomic.cmake
+++ cmake/Modules/CheckLibcxxAtomic.cmake
@@ -13,6 +13,9 @@
   if (${LIBCXX_GCC_TOOLCHAIN})
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} 
--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
   endif()
+  if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
+set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
+  endif()
   check_cxx_source_compiles("
 #include 
 #include 


Index: cmake/config-ix.cmake
===
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -1,5 +1,34 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+
+check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
+if (NOT LIBCXX_USE_COMPILER_RT)
+  check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+endif()
+
+# libc++ is built with -nodefaultlibs, so we want all our checks to also
+# use this option, otherwise we may end up with an inconsistency between
+# the flags we think we require during configuration (if the checks are
+# performed without -nodefaultlibs) and the flags that are actually
+# required during compilation (which has the -nodefaultlibs). libc is
+# required for the link to go through. We remove sanitizers from the
+# configuration checks to avoid spurious link errors.
+check_cxx_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+  list(APPEND CMAKE_REQUIRED_LIBRARIES -nodefaultlibs)
+  if (LIBCXX_HAS_C_LIB)
+list(APPEND CMAKE_REQUIRED_LIBRARIES c)
+  endif ()
+  if (LIBCXX_USE_COMPILER_RT)
+list(APPEND CMAKE_REQUIRED_LIBRARIES -rtlib=compiler-rt)
+  elseif (LIBCXX_HAS_GCC_S_LIB)
+list(APPEND 

Re: [PATCH] D22431: clang-format: [JS] nested and tagged template strings.

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

Looks good. Sorry for the delay!



Comment at: lib/Format/FormatTokenLexer.h:68
@@ +67,3 @@
+  // embedding expressions nested in ${expr-here}. Template strings can be
+  // nested recursively, i.e. expressions can contain template strings in 
turns.
+  //

.. in turn.


https://reviews.llvm.org/D22431



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


[PATCH] D23855: Make exception-throwing from a noexcept build `abort()`.

2016-08-24 Thread Marshall Clow via cfe-commits
mclow.lists created this revision.
mclow.lists added reviewers: EricWF, hiraditya, kparzysz.
mclow.lists added a subscriber: cfe-commits.

This is a follow on to D21232, which marked a bunch of exception-throwing 
helper routines as `noreturn`.

Now, make them really never return.  Either they throw, or they call `abort`.


https://reviews.llvm.org/D23855

Files:
  include/__locale
  include/any
  include/array
  include/bitset
  include/complex
  include/deque
  include/experimental/any
  include/experimental/dynarray
  include/experimental/optional
  include/future
  include/locale
  include/memory
  include/regex
  include/string
  include/vector
  src/locale.cpp
  src/new.cpp
  src/string.cpp
  src/system_error.cpp
  src/thread.cpp
  src/typeinfo.cpp

Index: src/typeinfo.cpp
===
--- src/typeinfo.cpp
+++ src/typeinfo.cpp
@@ -54,12 +54,16 @@
   {
 #ifndef _LIBCPP_NO_EXCEPTIONS
  throw std::bad_typeid();
+#else
+ _VSTD::abort();
 #endif
   }
   void __cxxabiv1::__cxa_bad_cast()
   {
 #ifndef _LIBCPP_NO_EXCEPTIONS
   throw std::bad_cast();
+#else
+  _VSTD::abort();
 #endif
   }
 #endif
Index: src/thread.cpp
===
--- src/thread.cpp
+++ src/thread.cpp
@@ -56,6 +56,9 @@
 #ifndef _LIBCPP_NO_EXCEPTIONS
 if (ec)
 throw system_error(error_code(ec, system_category()), "thread::join failed");
+#else
+if (ec)
+_VSTD::abort();
 #endif  // _LIBCPP_NO_EXCEPTIONS
 }
 
@@ -72,6 +75,9 @@
 #ifndef _LIBCPP_NO_EXCEPTIONS
 if (ec)
 throw system_error(error_code(ec, system_category()), "thread::detach failed");
+#else
+if (ec)
+_VSTD::abort();
 #endif  // _LIBCPP_NO_EXCEPTIONS
 }
 
Index: src/system_error.cpp
===
--- src/system_error.cpp
+++ src/system_error.cpp
@@ -258,6 +258,7 @@
 #else
 (void)ev;
 (void)what_arg;
+_VSTD::abort();
 #endif
 }
 
Index: src/string.cpp
===
--- src/string.cpp
+++ src/string.cpp
@@ -40,7 +40,7 @@
 throw T( msg );
 #else
 fprintf(stderr, "%s\n", msg.c_str());
-abort();
+_VSTD::abort();
 #endif
 }
 
Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -241,6 +241,8 @@
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
 throw bad_alloc();
+#else
+_VSTD::abort();
 #endif
 }
 
Index: src/locale.cpp
===
--- src/locale.cpp
+++ src/locale.cpp
@@ -107,8 +107,18 @@
 return static_cast(end - begin);
 }
 
+_LIBCPP_NORETURN static void __throw_runtime_error(const string )
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+throw runtime_error(msg);
+#else
+(void)msg;
+_VSTD::abort();
+#endif
 }
 
+}
+
 #if defined(_AIX)
 // Set priority to INT_MIN + 256 + 150
 # pragma priority ( -2147483242 )
@@ -646,22 +656,18 @@
 : collate(refs),
   __l(newlocale(LC_ALL_MASK, n, 0))
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__l == 0)
-throw runtime_error("collate_byname::collate_byname"
+__throw_runtime_error("collate_byname::collate_byname"
 " failed to construct for " + string(n));
-#endif  // _LIBCPP_NO_EXCEPTIONS
 }
 
 collate_byname::collate_byname(const string& name, size_t refs)
 : collate(refs),
   __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__l == 0)
-throw runtime_error("collate_byname::collate_byname"
+__throw_runtime_error("collate_byname::collate_byname"
 " failed to construct for " + name);
-#endif  // _LIBCPP_NO_EXCEPTIONS
 }
 
 collate_byname::~collate_byname()
@@ -698,22 +704,18 @@
 : collate(refs),
   __l(newlocale(LC_ALL_MASK, n, 0))
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__l == 0)
-throw runtime_error("collate_byname::collate_byname(size_t refs)"
+__throw_runtime_error("collate_byname::collate_byname(size_t refs)"
 " failed to construct for " + string(n));
-#endif  // _LIBCPP_NO_EXCEPTIONS
 }
 
 collate_byname::collate_byname(const string& name, size_t refs)
 : collate(refs),
   __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__l == 0)
-throw runtime_error("collate_byname::collate_byname(size_t refs)"
+__throw_runtime_error("collate_byname::collate_byname(size_t refs)"
 " failed to construct for " + name);
-#endif  // _LIBCPP_NO_EXCEPTIONS
 }
 
 collate_byname::~collate_byname()
@@ -1172,22 +1174,18 @@
 : ctype(0, false, refs),
   __l(newlocale(LC_ALL_MASK, name, 0))
 {
-#ifndef _LIBCPP_NO_EXCEPTIONS
 if (__l == 0)
-throw runtime_error("ctype_byname::ctype_byname"
+__throw_runtime_error("ctype_byname::ctype_byname"
 

Re: [PATCH] D23699: [CMake] Be more consistent about naming targets and components

2016-08-24 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279675: [CMake] Be more consistent about naming targets and 
components (authored by cbieneman).

Changed prior to commit:
  https://reviews.llvm.org/D23699?vs=68637=69177#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23699

Files:
  libcxx/trunk/include/CMakeLists.txt
  libcxx/trunk/lib/CMakeLists.txt
  libcxx/trunk/test/CMakeLists.txt

Index: libcxx/trunk/lib/CMakeLists.txt
===
--- libcxx/trunk/lib/CMakeLists.txt
+++ libcxx/trunk/lib/CMakeLists.txt
@@ -225,8 +225,8 @@
 set(experimental_lib cxx_experimental)
   endif()
   install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib}
-LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
-ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
+LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
 )
   # NOTE: This install command must go after the cxx install command otherwise
   # it will not be executed after the library symlinks are installed.
@@ -248,13 +248,14 @@
   set(experimental_lib_install_target cxx_experimental)
 endif()
 if(LIBCXX_INSTALL_HEADERS)
-  set(header_install_target install-libcxx-headers)
+  set(header_install_target install-cxx-headers)
 endif()
-add_custom_target(install-libcxx
+add_custom_target(install-cxx
   DEPENDS ${lib_install_target}
   ${experimental_lib_install_target}
   ${header_install_target}
   COMMAND "${CMAKE_COMMAND}"
-  -DCMAKE_INSTALL_COMPONENT=libcxx
+  -DCMAKE_INSTALL_COMPONENT=cxx
   -P "${LIBCXX_BINARY_DIR}/cmake_install.cmake")
+add_custom_target(install-libcxx DEPENDS install-cxx)
 endif()
Index: libcxx/trunk/include/CMakeLists.txt
===
--- libcxx/trunk/include/CMakeLists.txt
+++ libcxx/trunk/include/CMakeLists.txt
@@ -19,7 +19,7 @@
 if (LIBCXX_INSTALL_HEADERS)
   install(DIRECTORY .
 DESTINATION include/c++/v1
-COMPONENT libcxx-headers
+COMPONENT cxx-headers
 FILES_MATCHING
 ${LIBCXX_HEADER_PATTERN}
 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
@@ -47,17 +47,20 @@
   DESTINATION include/c++/v1
   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
   RENAME __config
-  COMPONENT libcxx-headers)
+  COMPONENT cxx-headers)
   endif()
 
   if (NOT CMAKE_CONFIGURATION_TYPES)
 # this target is just needed as a placeholder for the distribution target
-add_custom_target(libcxx-headers)
-add_custom_target(install-libcxx-headers
-  DEPENDS libcxx-headers ${generated_config_deps}
+add_custom_target(cxx-headers)
+add_custom_target(install-cxx-headers
+  DEPENDS cxx-headers ${generated_config_deps}
   COMMAND "${CMAKE_COMMAND}"
-  -DCMAKE_INSTALL_COMPONENT=libcxx-headers
+  -DCMAKE_INSTALL_COMPONENT=cxx-headers
   -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+
+add_custom_target(libcxx-headers)
+add_custom_target(install-libcxx-headers DEPENDS install-cxx-headers)
   endif()
 
 endif()
Index: libcxx/trunk/test/CMakeLists.txt
===
--- libcxx/trunk/test/CMakeLists.txt
+++ libcxx/trunk/test/CMakeLists.txt
@@ -52,11 +52,13 @@
   set(experimental_dep cxx_experimental)
 endif()
 
-add_lit_testsuite(check-libcxx
+add_lit_testsuite(check-cxx
   "Running libcxx tests"
   ${CMAKE_CURRENT_BINARY_DIR}
   DEPENDS cxx ${experimental_dep})
 
+add_custom_target(check-libcxx DEPENDS check-cxx)
+
 if (LIBCXX_GENERATE_COVERAGE)
   include(CodeCoverage)
   set(output_dir "${CMAKE_CURRENT_BINARY_DIR}/coverage")


Index: libcxx/trunk/lib/CMakeLists.txt
===
--- libcxx/trunk/lib/CMakeLists.txt
+++ libcxx/trunk/lib/CMakeLists.txt
@@ -225,8 +225,8 @@
 set(experimental_lib cxx_experimental)
   endif()
   install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib}
-LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
-ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
+LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
 )
   # NOTE: This install command must go after the cxx install command otherwise
   # it will not be executed after the library symlinks are installed.
@@ -248,13 +248,14 @@
   set(experimental_lib_install_target cxx_experimental)
 endif()
 if(LIBCXX_INSTALL_HEADERS)
-  set(header_install_target install-libcxx-headers)
+  

[libcxx] r279675 - [CMake] Be more consistent about naming targets and components

2016-08-24 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Wed Aug 24 17:17:06 2016
New Revision: 279675

URL: http://llvm.org/viewvc/llvm-project?rev=279675=rev
Log:
[CMake] Be more consistent about naming targets and components

Summary:
The point of this patch is to have a consistent convention for naming build, 
check and install targets so that the targets can be constructed from the 
project name.

This change renames a bunch of CMake components and targets from libcxx to cxx. 
For each renamed target I've added a convenience target that matches the old 
target name and depends on the new target. This will preserve function of the 
old targets so that the change doesn't break the world. We can evaluate if it 
is worth removing the extra targets later.

Reviewers: EricWF

Subscribers: cfe-commits

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

Modified:
libcxx/trunk/include/CMakeLists.txt
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/test/CMakeLists.txt

Modified: libcxx/trunk/include/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/CMakeLists.txt?rev=279675=279674=279675=diff
==
--- libcxx/trunk/include/CMakeLists.txt (original)
+++ libcxx/trunk/include/CMakeLists.txt Wed Aug 24 17:17:06 2016
@@ -19,7 +19,7 @@ file(COPY .
 if (LIBCXX_INSTALL_HEADERS)
   install(DIRECTORY .
 DESTINATION include/c++/v1
-COMPONENT libcxx-headers
+COMPONENT cxx-headers
 FILES_MATCHING
 ${LIBCXX_HEADER_PATTERN}
 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
@@ -47,17 +47,20 @@ if (LIBCXX_INSTALL_HEADERS)
   DESTINATION include/c++/v1
   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
   RENAME __config
-  COMPONENT libcxx-headers)
+  COMPONENT cxx-headers)
   endif()
 
   if (NOT CMAKE_CONFIGURATION_TYPES)
 # this target is just needed as a placeholder for the distribution target
-add_custom_target(libcxx-headers)
-add_custom_target(install-libcxx-headers
-  DEPENDS libcxx-headers ${generated_config_deps}
+add_custom_target(cxx-headers)
+add_custom_target(install-cxx-headers
+  DEPENDS cxx-headers ${generated_config_deps}
   COMMAND "${CMAKE_COMMAND}"
-  -DCMAKE_INSTALL_COMPONENT=libcxx-headers
+  -DCMAKE_INSTALL_COMPONENT=cxx-headers
   -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
+
+add_custom_target(libcxx-headers)
+add_custom_target(install-libcxx-headers DEPENDS install-cxx-headers)
   endif()
 
 endif()

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=279675=279674=279675=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Wed Aug 24 17:17:06 2016
@@ -225,8 +225,8 @@ if (LIBCXX_INSTALL_LIBRARY)
 set(experimental_lib cxx_experimental)
   endif()
   install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib}
-LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
-ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx
+LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
+ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
 )
   # NOTE: This install command must go after the cxx install command otherwise
   # it will not be executed after the library symlinks are installed.
@@ -248,13 +248,14 @@ if (NOT CMAKE_CONFIGURATION_TYPES AND (L
   set(experimental_lib_install_target cxx_experimental)
 endif()
 if(LIBCXX_INSTALL_HEADERS)
-  set(header_install_target install-libcxx-headers)
+  set(header_install_target install-cxx-headers)
 endif()
-add_custom_target(install-libcxx
+add_custom_target(install-cxx
   DEPENDS ${lib_install_target}
   ${experimental_lib_install_target}
   ${header_install_target}
   COMMAND "${CMAKE_COMMAND}"
-  -DCMAKE_INSTALL_COMPONENT=libcxx
+  -DCMAKE_INSTALL_COMPONENT=cxx
   -P "${LIBCXX_BINARY_DIR}/cmake_install.cmake")
+add_custom_target(install-libcxx DEPENDS install-cxx)
 endif()

Modified: libcxx/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=279675=279674=279675=diff
==
--- libcxx/trunk/test/CMakeLists.txt (original)
+++ libcxx/trunk/test/CMakeLists.txt Wed Aug 24 17:17:06 2016
@@ -52,11 +52,13 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
   set(experimental_dep cxx_experimental)
 endif()
 
-add_lit_testsuite(check-libcxx
+add_lit_testsuite(check-cxx
   "Running libcxx tests"
   ${CMAKE_CURRENT_BINARY_DIR}
   

Re: [PATCH] D23699: [CMake] Be more consistent about naming targets and components

2016-08-24 Thread Chris Bieneman via cfe-commits
beanz added a comment.

Ping.


https://reviews.llvm.org/D23699



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


Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-24 Thread Adrian McCarthy via cfe-commits
amccarth added a comment.

I don't know enough C# to review for language usage.  I was mostly reading for 
understandability.  Overall, I think this looks really nice.



Comment at: clang-tidy-vs/ClangTidy/CheckTree.cs:67
@@ +66,3 @@
+if (ParentPath == null)
+return Name_;
+return ParentPath + "-" + Name_;

This seems overly complicated so I assume I'm missing some nuance.  Why not:

if (Parent_ == null)
return Name_;
string ParentPath = Parent_.Path;

Is there a case where Parent_.Path could return null besides the one that you 
created?




Comment at: clang-tidy-vs/ClangTidy/InheritablePropertyComponent.cs:14
@@ +13,3 @@
+/// have properties which might inherit from their parent, or be 
overridden.
+/// It turns out this is somewhat non-trivial.  The .NET PropertyGrid is 
good makes
+/// displaying simple properties with a static notion of what constitutes a

s/good makes/makes/



Comment at: clang-tidy-vs/README.txt:8
@@ +7,3 @@
+- Visual Studio 2010 Professional (?)
+- Visual Studio 2010 SDK (?)
+

2010?  2015?  Will Community editions work?


https://reviews.llvm.org/D23848



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


r279673 - [Order Files] On Darwin use DTrace's oneshot probe

2016-08-24 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Wed Aug 24 17:09:46 2016
New Revision: 279673

URL: http://llvm.org/viewvc/llvm-project?rev=279673=rev
Log:
[Order Files] On Darwin use DTrace's oneshot probe

The oneshot probe only gets executed the first time the probe is hit in the 
process. For order file generation this is really all we care about.

Modified:
cfe/trunk/utils/perf-training/order-files.lit.cfg

Modified: cfe/trunk/utils/perf-training/order-files.lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/perf-training/order-files.lit.cfg?rev=279673=279672=279673=diff
==
--- cfe/trunk/utils/perf-training/order-files.lit.cfg (original)
+++ cfe/trunk/utils/perf-training/order-files.lit.cfg Wed Aug 24 17:09:46 2016
@@ -30,6 +30,11 @@ config.suffixes = ['.c', '.cpp', '.m', '
 dtrace_wrapper = '%s %s/perf-helper.py dtrace' % (config.python_exe, 
config.test_source_root)
 dtrace_wrapper_cc1 = '%s %s/perf-helper.py dtrace --cc1' % (config.python_exe, 
config.test_source_root)
 
+if 'darwin' in config.target_triple:
+lit_config.note('using DTrace oneshot probe')
+dtrace_wrapper = '%s --use-oneshot' % dtrace_wrapper
+dtrace_wrapper_cc1 = '%s --use-oneshot' % dtrace_wrapper_cc1
+
 use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
 config.test_format = lit.formats.ShTest(use_lit_shell == "0")
 config.substitutions.append( ('%clang_cpp_skip_driver', ' %s %s 
--driver-mode=cpp %s ' % (dtrace_wrapper_cc1, config.clang, sysroot_flags)))


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


Re: [PATCH] D23279: clang-reorder-fields

2016-08-24 Thread Alexander Shaposhnikov via cfe-commits
alexshap marked 17 inline comments as done.
alexshap added a comment.

Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy-vs/ClangTidy/ClangTidyProperties.cs:82
@@ +81,3 @@
+public bool CERTDCL50
+{
+get { return GetInheritableProperty("CERTDCL50").Value;  }

zturner wrote:
> alexfh wrote:
> > zturner wrote:
> > > Are the .rst files in the repo somewhere already?  I don't see them.
> > > 
> > > As for the display name, I agree this one is bad (I forgot to change it). 
> > >  But you can look at some of the ones below for better examples.  For 
> > > example, I find `I.22 - Complex Global Initializers` to be a better short 
> > > descriptor than `cppcoreguidelines-interfaces-global-init`.
> > > 
> > > What about a hand-maintained Yaml file that adheres to a format similar 
> > > to the following?
> > > 
> > > ```
> > > ---
> > > Checks:
> > >   - Name:cert-dcl54-cpp
> > > Label:   Overloaded allocation function pairs
> > > Description: Checks for violations of CERT DCL54-CPP - Overload 
> > > allocation and deallocation functions as a pair in the same scope
> > > Category:CERT Secure Coding Standards
> > >   - Name:cppcoreguidelines-interfaces-global-init
> > > Label:   I.22 - Complex Global Initializers
> > > Description: Checks for violations of Core Guideline I.22 - Avoid 
> > > complex initializers of global objects
> > > Category:C++ Core Guidelines
> > > ...
> > > 
> > > ```
> > > 
> > > Some file somewhere is going to have to be maintained by hand, and since 
> > > a file such as this doesn't appear to exist in clang-tidy already, we 
> > > might as well use a format that we already have good tools to parse at 
> > > runtime, such as Yaml.
> > The .rst files are there: 
> > https://reviews.llvm.org/diffusion/L/browse/clang-tools-extra/trunk/docs/clang-tidy/checks/
> > 
> > Docs + source code are already enough hassle to maintain, so adding yet 
> > another file with a similar information seems too much. We can start with a 
> > hand-written YAML file and later add a script to generate it from the docs. 
> > I'm not sure though, what `Label` could be mapped on. Do you need it for 
> > the property editor or can you get away with just the name?
> Well you can look at the screenshot to see how I'm using it.  Basically the 
> left hand side of the grid are all the "label" values.  It's what people are 
> going to see when deciding whether they want to enable a check or not.  So it 
> should be mostly self-explanatory without having to click on it to get more 
> detail.  The name kinda is, but the point of the extension is to be 
> friendlier than editing files by hand, so I think we should try to provide a 
> friendlier name too.  When you're using the command line tool you have no 
> choice but to specify the check name, but if you're using a UI I think we can 
> give the user a little bit more info about each check.
> 
> Generating YAML from docs seems like a decent idea.  Perhaps to map label we 
> could extend the rst format a little to add the label to it.  Sort of like 
> "summary" vs "description".
> 
> I'll do a hand-written Yaml file for now, and think about the best way to 
> generate the Yaml from RST in a later patch.
SG.

Re: label vs check name. I think, even if we show a friendlier label (which 
we'll need to require for all new checks and back-fill for the existing ones), 
the extension should also show the check name somewhere for transparency. It's 
supposed to be human-readable to some degree (not a proper explanation though, 
rather a hint to what the check is about). It's also shown in the diagnostic 
messages, so there's no point in hiding it elsewhere.


https://reviews.llvm.org/D23848



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


Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-24 Thread Zachary Turner via cfe-commits
zturner added inline comments.


Comment at: clang-tidy-vs/ClangTidy/ClangTidyProperties.cs:82
@@ +81,3 @@
+public bool CERTDCL50
+{
+get { return GetInheritableProperty("CERTDCL50").Value;  }

alexfh wrote:
> zturner wrote:
> > Are the .rst files in the repo somewhere already?  I don't see them.
> > 
> > As for the display name, I agree this one is bad (I forgot to change it).  
> > But you can look at some of the ones below for better examples.  For 
> > example, I find `I.22 - Complex Global Initializers` to be a better short 
> > descriptor than `cppcoreguidelines-interfaces-global-init`.
> > 
> > What about a hand-maintained Yaml file that adheres to a format similar to 
> > the following?
> > 
> > ```
> > ---
> > Checks:
> >   - Name:cert-dcl54-cpp
> > Label:   Overloaded allocation function pairs
> > Description: Checks for violations of CERT DCL54-CPP - Overload 
> > allocation and deallocation functions as a pair in the same scope
> > Category:CERT Secure Coding Standards
> >   - Name:cppcoreguidelines-interfaces-global-init
> > Label:   I.22 - Complex Global Initializers
> > Description: Checks for violations of Core Guideline I.22 - Avoid 
> > complex initializers of global objects
> > Category:C++ Core Guidelines
> > ...
> > 
> > ```
> > 
> > Some file somewhere is going to have to be maintained by hand, and since a 
> > file such as this doesn't appear to exist in clang-tidy already, we might 
> > as well use a format that we already have good tools to parse at runtime, 
> > such as Yaml.
> The .rst files are there: 
> https://reviews.llvm.org/diffusion/L/browse/clang-tools-extra/trunk/docs/clang-tidy/checks/
> 
> Docs + source code are already enough hassle to maintain, so adding yet 
> another file with a similar information seems too much. We can start with a 
> hand-written YAML file and later add a script to generate it from the docs. 
> I'm not sure though, what `Label` could be mapped on. Do you need it for the 
> property editor or can you get away with just the name?
Well you can look at the screenshot to see how I'm using it.  Basically the 
left hand side of the grid are all the "label" values.  It's what people are 
going to see when deciding whether they want to enable a check or not.  So it 
should be mostly self-explanatory without having to click on it to get more 
detail.  The name kinda is, but the point of the extension is to be friendlier 
than editing files by hand, so I think we should try to provide a friendlier 
name too.  When you're using the command line tool you have no choice but to 
specify the check name, but if you're using a UI I think we can give the user a 
little bit more info about each check.

Generating YAML from docs seems like a decent idea.  Perhaps to map label we 
could extend the rst format a little to add the label to it.  Sort of like 
"summary" vs "description".

I'll do a hand-written Yaml file for now, and think about the best way to 
generate the Yaml from RST in a later patch.


https://reviews.llvm.org/D23848



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


Re: r278984 - Add test missed from r278983.

2016-08-24 Thread Richard Smith via cfe-commits
As of r279668, we shouldn't run this test for ASan builds any more. Perhaps
we should increase Clang's minimum stack allocation when built with ASan to
compensate for it making stack frames larger.

On Wed, Aug 24, 2016 at 12:33 AM, Yaron Keren  wrote:

> I see the same stack overflow asan error in a local buildbot.
>
>
> 2016-08-22 20:30 GMT+03:00 Akira Hatanaka via cfe-commits <
> cfe-commits@lists.llvm.org>:
>
>> Hi Richard,
>>
>> This test has been failing since it was committed.
>>
>> http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_check/2277/
>>
>> > On Aug 17, 2016, at 2:42 PM, Richard Smith via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>> >
>> > Author: rsmith
>> > Date: Wed Aug 17 16:42:10 2016
>> > New Revision: 278984
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=278984=rev
>> > Log:
>> > Add test missed from r278983.
>> >
>> > Added:
>> >cfe/trunk/test/SemaTemplate/instantiation-depth-default.cpp
>> >
>> > Added: cfe/trunk/test/SemaTemplate/instantiation-depth-default.cpp
>> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTempl
>> ate/instantiation-depth-default.cpp?rev=278984=auto
>> > 
>> ==
>> > --- cfe/trunk/test/SemaTemplate/instantiation-depth-default.cpp (added)
>> > +++ cfe/trunk/test/SemaTemplate/instantiation-depth-default.cpp Wed
>> Aug 17 16:42:10 2016
>> > @@ -0,0 +1,9 @@
>> > +// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit 2
>> %s
>> > +
>> > +template struct X : X {};
>> > +// expected-error-re@3 {{recursive template instantiation exceeded
>> maximum depth of 1024{{$
>> > +// expected-note@3 {{instantiation of template class}}
>> > +// expected-note@3 {{skipping 1023 contexts in backtrace}}
>> > +// expected-note@3 {{use -ftemplate-depth=N to increase recursive
>> template instantiation depth}}
>> > +
>> > +X<0, int> x; // expected-note {{in instantiation of}}
>> >
>> >
>> > ___
>> > 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
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy-vs/ClangTidy/ClangTidyProperties.cs:82
@@ +81,3 @@
+public bool CERTDCL50
+{
+get { return GetInheritableProperty("CERTDCL50").Value;  }

zturner wrote:
> Are the .rst files in the repo somewhere already?  I don't see them.
> 
> As for the display name, I agree this one is bad (I forgot to change it).  
> But you can look at some of the ones below for better examples.  For example, 
> I find `I.22 - Complex Global Initializers` to be a better short descriptor 
> than `cppcoreguidelines-interfaces-global-init`.
> 
> What about a hand-maintained Yaml file that adheres to a format similar to 
> the following?
> 
> ```
> ---
> Checks:
>   - Name:cert-dcl54-cpp
> Label:   Overloaded allocation function pairs
> Description: Checks for violations of CERT DCL54-CPP - Overload 
> allocation and deallocation functions as a pair in the same scope
> Category:CERT Secure Coding Standards
>   - Name:cppcoreguidelines-interfaces-global-init
> Label:   I.22 - Complex Global Initializers
> Description: Checks for violations of Core Guideline I.22 - Avoid complex 
> initializers of global objects
> Category:C++ Core Guidelines
> ...
> 
> ```
> 
> Some file somewhere is going to have to be maintained by hand, and since a 
> file such as this doesn't appear to exist in clang-tidy already, we might as 
> well use a format that we already have good tools to parse at runtime, such 
> as Yaml.
The .rst files are there: 
https://reviews.llvm.org/diffusion/L/browse/clang-tools-extra/trunk/docs/clang-tidy/checks/

Docs + source code are already enough hassle to maintain, so adding yet another 
file with a similar information seems too much. We can start with a 
hand-written YAML file and later add a script to generate it from the docs. I'm 
not sure though, what `Label` could be mapped on. Do you need it for the 
property editor or can you get away with just the name?


https://reviews.llvm.org/D23848



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


r279668 - Disable test under asan: it uses a lot of stack, and asan increases the

2016-08-24 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Aug 24 16:30:00 2016
New Revision: 279668

URL: http://llvm.org/viewvc/llvm-project?rev=279668=rev
Log:
Disable test under asan: it uses a lot of stack, and asan increases the
per-frame stack usage enough to cause it to hit our stack limit. This is not
ideal; we should find a better way of dealing with this, such as increasing
our stack allocation when built with ASan.

Modified:
cfe/trunk/test/SemaTemplate/instantiation-depth-default.cpp

Modified: cfe/trunk/test/SemaTemplate/instantiation-depth-default.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiation-depth-default.cpp?rev=279668=279667=279668=diff
==
--- cfe/trunk/test/SemaTemplate/instantiation-depth-default.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiation-depth-default.cpp Wed Aug 24 
16:30:00 2016
@@ -1,9 +1,14 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit 2 %s
+//
+// FIXME: Disable this test when Clang was built with ASan, because ASan
+// increases our per-frame stack usage enough that this test no longer fits
+// within our normal stack space allocation.
+// REQUIRES: not_asan
 
 template struct X : X {};
-// expected-error-re@3 {{recursive template instantiation exceeded maximum 
depth of 1024{{$
-// expected-note@3 {{instantiation of template class}}
-// expected-note@3 {{skipping 1023 contexts in backtrace}}
-// expected-note@3 {{use -ftemplate-depth=N to increase recursive template 
instantiation depth}}
+// expected-error-re@8 {{recursive template instantiation exceeded maximum 
depth of 1024{{$
+// expected-note@8 {{instantiation of template class}}
+// expected-note@8 {{skipping 1023 contexts in backtrace}}
+// expected-note@8 {{use -ftemplate-depth=N to increase recursive template 
instantiation depth}}
 
 X<0, int> x; // expected-note {{in instantiation of}}


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


[clang-tools-extra] r279666 - [clang-tidy misc-move-const-arg] more specific messages + suggest alternative solution

2016-08-24 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Aug 24 16:23:24 2016
New Revision: 279666

URL: http://llvm.org/viewvc/llvm-project?rev=279666=rev
Log:
[clang-tidy misc-move-const-arg] more specific messages + suggest alternative 
solution

Modified:
clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-move-const-arg.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp?rev=279666=279665=279666=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp Wed 
Aug 24 16:23:24 2016
@@ -74,12 +74,17 @@ void MoveConstantArgumentCheck::check(co
 
   if (IsConstArg || IsTriviallyCopyable) {
 bool IsVariable = isa(Arg);
+const auto *Var =
+IsVariable ? dyn_cast(Arg)->getDecl() : nullptr;
 auto Diag = diag(FileMoveRange.getBegin(),
  "std::move of the %select{|const }0"
- "%select{expression|variable}1 "
- "%select{|of a trivially-copyable type }2"
- "has no effect; remove std::move()")
-<< IsConstArg << IsVariable << IsTriviallyCopyable;
+ "%select{expression|variable %4}1 "
+ "%select{|of the trivially-copyable type %5 }2"
+ "has no effect; remove std::move()"
+ "%select{| or make the variable non-const}3")
+<< IsConstArg << IsVariable << IsTriviallyCopyable
+<< (IsConstArg && IsVariable && !IsTriviallyCopyable)
+<< Var << Arg->getType();
 
 ReplaceCallWithArg(CallMove, Diag, SM, getLangOpts());
   } else if (ReceivingExpr) {

Modified: clang-tools-extra/trunk/test/clang-tidy/misc-move-const-arg.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-move-const-arg.cpp?rev=279666=279665=279666=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/misc-move-const-arg.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-move-const-arg.cpp Wed Aug 24 
16:23:24 2016
@@ -23,19 +23,19 @@ public:
 
 int f1() {
   return std::move(42);
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the expression of 
a trivially-copyable type has no effect; remove std::move() 
[misc-move-const-arg]
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the expression of 
the trivially-copyable type 'int' has no effect; remove std::move() 
[misc-move-const-arg]
   // CHECK-FIXES: return 42;
 }
 
 int f2(int x2) {
   return std::move(x2);
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the variable of a 
trivially-copyable type
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the variable 'x2' 
of the trivially-copyable type 'int'
   // CHECK-FIXES: return x2;
 }
 
 int *f3(int *x3) {
   return std::move(x3);
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the variable of a 
trivially-copyable type
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the variable 'x3' 
of the trivially-copyable type 'int *'
   // CHECK-FIXES: return x3;
 }
 
@@ -43,7 +43,7 @@ A f4(A x4) { return std::move(x4); }
 
 A f5(const A x5) {
   return std::move(x5);
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the const variable
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the const variable 
'x5' has no effect; remove std::move() or make the variable non-const 
[misc-move-const-arg]
   // CHECK-FIXES: return x5;
 }
 
@@ -55,7 +55,7 @@ void f7() { int a = f6(10); }
 void f8() {
   const A a;
   M1(A b = std::move(a);)
-  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: std::move of the const variable
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: std::move of the const variable 
'a' has no effect; remove std::move() or make the variable non-const
   // CHECK-FIXES: M1(A b = a;)
 }
 
@@ -64,7 +64,7 @@ int f9() { return M2(1); }
 
 template  T f10(const int x10) {
   return std::move(x10);
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the const variable
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: std::move of the const variable 
'x10' of the trivially-copyable type 'const int' has no effect; remove 
std::move() [misc-move-const-arg]
   // CHECK-FIXES: return x10;
 }
 void f11() {


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


Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-24 Thread Zachary Turner via cfe-commits
zturner added a comment.

BTW, since I forgot to do so in the original review, here is a screenshot of 
what the UI for the property editor looks like in this extension:

F2328405: clang-tidy.png 



Comment at: clang-tidy-vs/ClangTidy/ClangTidy.vsct:23
@@ +22,3 @@
+
+
+

This file is auto-generated by Visual Studio.  You can manually add your own 
things to it (as we've done at the end of the file), but it doesn't seem 
worthwhile to go back and fix auto-generated code.

BTW, this is just an XML file, so it gets collapse functionality in the Visual 
Studio Editor.  That is, you can collapse tags so that they are not displayed.  
Not sure if that makes a difference.


https://reviews.llvm.org/D23848



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


r279662 - [Sema][Comments] Support @param with c++ 'using' keyword

2016-08-24 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Wed Aug 24 16:11:43 2016
New Revision: 279662

URL: http://llvm.org/viewvc/llvm-project?rev=279662=rev
Log:
[Sema][Comments] Support @param with c++ 'using' keyword

Give appropriate warnings with -Wdocumentation for @param comments
that refer to function aliases defined with 'using'. Very similar
to typedef's behavior. This does not add support for
TypeAliasTemplateDecl yet.

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

rdar://problem/27300695

Modified:
cfe/trunk/lib/AST/Comment.cpp
cfe/trunk/test/Sema/warn-documentation.cpp

Modified: cfe/trunk/lib/AST/Comment.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Comment.cpp?rev=279662=279661=279662=diff
==
--- cfe/trunk/lib/AST/Comment.cpp (original)
+++ cfe/trunk/lib/AST/Comment.cpp Wed Aug 24 16:11:43 2016
@@ -226,12 +226,15 @@ void DeclInfo::fill() {
   case Decl::Namespace:
 Kind = NamespaceKind;
 break;
+  case Decl::TypeAlias:
   case Decl::Typedef: {
 Kind = TypedefKind;
-// If this is a typedef to something we consider a function, extract
+// If this is a typedef / using to something we consider a function, 
extract
 // arguments and return type.
-const TypedefDecl *TD = cast(CommentDecl);
-const TypeSourceInfo *TSI = TD->getTypeSourceInfo();
+const TypeSourceInfo *TSI =
+K == Decl::Typedef
+? cast(CommentDecl)->getTypeSourceInfo()
+: cast(CommentDecl)->getTypeSourceInfo();
 if (!TSI)
   break;
 TypeLoc TL = TSI->getTypeLoc().getUnqualifiedLoc();
@@ -302,9 +305,6 @@ void DeclInfo::fill() {
 }
 break;
   }
-  case Decl::TypeAlias:
-Kind = TypedefKind;
-break;
   case Decl::TypeAliasTemplate: {
 const TypeAliasTemplateDecl *TAT = 
cast(CommentDecl);
 Kind = TypedefKind;

Modified: cfe/trunk/test/Sema/warn-documentation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation.cpp?rev=279662=279661=279662=diff
==
--- cfe/trunk/test/Sema/warn-documentation.cpp (original)
+++ cfe/trunk/test/Sema/warn-documentation.cpp Wed Aug 24 16:11:43 2016
@@ -368,6 +368,69 @@ typedef unsigned int test_not_function_l
 /// \param aaa Meow.
 typedef foo::not_a_function_wrapper<1> test_not_function_like_typedef4;
 
+// expected-warning@+2 {{parameter 'bbb' not found in the function 
declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+using test_function_like_using1 = int (int aaa, int ccc);
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function 
declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+using test_function_like_using2 = int (*)(int aaa, int ccc);
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function 
declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+using test_function_like_using3 = int (* const)(int aaa, int ccc);
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function 
declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+using test_function_like_using4 = int (C::*)(int aaa, int ccc);
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function 
declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+using test_function_like_using5 = foo::function_wrapper;
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function 
declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+using test_function_like_using6 = foo::function_wrapper *;
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function 
declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+using test_function_like_using7 = foo::function_wrapper &;
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function 
declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+using test_function_like_using8 = foo::function_wrapper &&;
+
+using test_not_function_like_using1 = int (*)(int aaa);
+
+// expected-warning@+1 {{'\param' command used in a comment that is not 
attached to a function declaration}}
+/// \param aaa Meow.
+using test_not_function_like_using2 = test_not_function_like_using1;
+
+// Check that the diagnostic uses the same command marker as the comment.
+// expected-warning@+1 {{'@param' command used in a comment that is not 
attached to a function declaration}}
+/// @param aaa Meow.
+using test_not_function_like_using3 = unsigned int;
+
+// expected-warning@+1 {{'\param' command used in 

Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-24 Thread Zachary Turner via cfe-commits
zturner added inline comments.


Comment at: clang-tidy-vs/ClangTidy/ClangTidyProperties.cs:82
@@ +81,3 @@
+public bool CERTDCL50
+{
+get { return GetInheritableProperty("CERTDCL50").Value;  }

Are the .rst files in the repo somewhere already?  I don't see them.

As for the display name, I agree this one is bad (I forgot to change it).  But 
you can look at some of the ones below for better examples.  For example, I 
find `I.22 - Complex Global Initializers` to be a better short descriptor than 
`cppcoreguidelines-interfaces-global-init`.

What about a hand-maintained Yaml file that adheres to a format similar to the 
following?

```
---
Checks:
  - Name:cert-dcl54-cpp
Label:   Overloaded allocation function pairs
Description: Checks for violations of CERT DCL54-CPP - Overload allocation 
and deallocation functions as a pair in the same scope
Category:CERT Secure Coding Standards
  - Name:cppcoreguidelines-interfaces-global-init
Label:   I.22 - Complex Global Initializers
Description: Checks for violations of Core Guideline I.22 - Avoid complex 
initializers of global objects
Category:C++ Core Guidelines
...

```

Some file somewhere is going to have to be maintained by hand, and since a file 
such as this doesn't appear to exist in clang-tidy already, we might as well 
use a format that we already have good tools to parse at runtime, such as Yaml.


https://reviews.llvm.org/D23848



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


Re: [PATCH] D23842: [CFG] Add iterator_ranges to CFG and CFGBlock.

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Actually, there's just one comment. Otherwise it's looking good.


https://reviews.llvm.org/D23842



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


Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

In https://reviews.llvm.org/D23848#524608, @zturner wrote:

> I can fix the empty lines, but keep in mind that Visual Studio's C# editor is 
> MUCH more aggressive about auto-formatting your code.  So it seems like a 
> fruitless endeavor to me, as we will constantly be fighting against their 
> auto formatter, which does this automatically every time you add a new 
> function.


I would definitely not fight with visual editors that reset formatting every 
time you touch the file. However, if VS only adds empty lines when initially 
adding a function, that doesn't promise much resistance ;)



Comment at: CMakeLists.txt:6
@@ -5,2 +5,3 @@
 add_subdirectory(clang-tidy)
+add_subdirectory(clang-tidy-vs)
 endif()

zturner wrote:
> alexfh wrote:
> > Should the plugin be placed inside clang-tidy directory?
> I followed the same way that the clang format VS extension uses.  I don't 
> mind to move it, I just did it this way for consistency.
I don't feel strongly either way. Let's figure this out later.


Comment at: clang-tidy-vs/ClangTidy/ClangTidy.vsct:22
@@ +21,3 @@
+  
+
+

Eugene.Zelenko wrote:
> Unnecessary empty line, same below in many places here.
If there's a way to visually edit this file, I wouldn't care about formatting.


Comment at: clang-tidy-vs/ClangTidy/ClangTidyProperties.cs:81
@@ +80,3 @@
+[ClangTidyCheck("cert-dcl50-cpp")]
+public bool CERTDCL50
+{

zturner wrote:
> alexfh wrote:
> > I hope, this file is generated?
> > 
> > A way to update this file should be documented.
> No, I actually typed this entire file :-/  I don't know of a good way to auto 
> generate it.  We would need a single file, perhaps Yaml or something, 
> consisting of:
> 
> 1. Category Name
> 2. Display Name
> 3. Description
> 4. clang-tidy built in default value of check.
> 
> At that point, we wouldn't even need to generate the file, we could read it 
> at runtime and add the properties dynamically (through the 
> `ICustomTypeDescriptor` interface).
> 
> For now though, the way to update the file is to copy / paste one property 
> and change the values accordingly to add a new check.
Manually updating this file won't fly =[

I guess, we could try to use .rst files as the source of truth. They follow a 
strict naming scheme (.rst) and we could require the first 
paragraph of the text to be a single-sentence description of the check suitable 
for this purpose as well.

I'd also make the display name the same as the full clang-tidy check name 
(`DCL50-CPP` is neither more useful nor convenient than the full check name). 

The only thing we'd need to maintain manually in this case is category 
descriptions.

WDYT?


https://reviews.llvm.org/D23848



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


[PATCH] D23852: [SemaObjC] Fix crash while parsing type arguments and protocols

2016-08-24 Thread Bruno Cardoso Lopes via cfe-commits
bruno created this revision.
bruno added a reviewer: doug.gregor.
bruno added subscribers: cfe-commits, manmanren.

Fix a crash-on-invalid.

When parsing type arguments and protocols, ParseTypeName() tries to find
matching tokens for '[', '(', etc whenever they appear among potential
type names. If unmatched, ParseTypeName() yields a tok::eof token
stream. This leads to crashes since the parsing at this point is not
expected to go beyond the param list closing '>'.

ParseTypeName() can parse a variety combination of names, making this
case complicated to handle by looking tokens ahead. Fix the issue by
doing temptive parsing in the remaining type arg list, and revert the
token state in case tok::eof is reached.

rdar://problem/25063557

https://reviews.llvm.org/D23852

Files:
  lib/Parse/ParseObjc.cpp
  test/SemaObjC/crash-on-type-args-protocols.m

Index: test/SemaObjC/crash-on-type-args-protocols.m
===
--- /dev/null
+++ test/SemaObjC/crash-on-type-args-protocols.m
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -DFIRST -fsyntax-only -verify %s
+// RUN: %clang_cc1 -DSECOND -fsyntax-only -verify %s
+// RUN: %clang_cc1 -DTHIRD -fsyntax-only -verify %s
+
+@protocol P;
+@interface NSObject
+@end
+@protocol X
+@end
+@interface X : NSObject 
+@end
+
+@class A;
+
+#ifdef FIRST
+id F1(id<[P> v) { // expected-error {{expected a type}} // expected-error 
{{use of undeclared identifier 'P'}} // expected-error {{use of undeclared 
identifier 'v'}} // expected-error {{expected '>'}} // expected-error 
{{expected ')'}} // expected-note {{to match this '('}}
+  return 0;
+}
+
+id F2(id v) { // expected-error {{unknown type name 'P'}} // 
expected-error {{unexpected interface name 'X': expected expression}} // 
expected-error {{use of undeclared identifier 'v'}} // expected-error 
{{expected '>'}} // expected-error {{unexpected interface name 'X': expected 
expression}} // expected-error {{use of undeclared identifier 'v'}} // 
expected-note {{to match this '('}}
+  return 0;
+}
+#endif
+
+#ifdef SECOND
+id F3(id v) { // expected-error {{unknown type name 'P'}} // 
expected-error {{expected expression}} // expected-error {{use of undeclared 
identifier 'v'}} // expected-error {{expected '>'}} // expected-error 
{{expected expression}} // expected-error {{use of undeclared identifier 'v'}} 
// expected-note {{to match this '('}}
+  return 0;
+}
+#endif
+
+#ifdef THIRD
+id F4(id v { // expected-error {{unknown type name 'P'}} // 
expected-error {{expected ')'}} // expected-error {{expected '>'}} // 
expected-error {{expected ')'}} // expected-note {{to match this '('}} // 
expected-note {{to match this '('}} // expected-note {{to match this '('}}
+  return 0;
+}
+#endif
+
+ // expected-error {{expected ')'}} // expected-error {{expected function body 
after function declarator}}
Index: lib/Parse/ParseObjc.cpp
===
--- lib/Parse/ParseObjc.cpp
+++ lib/Parse/ParseObjc.cpp
@@ -1740,6 +1740,10 @@
 }
   }
 
+  // ParseTypeName() can advance the token stream up to tok::eof when there's
+  // an umatched token (e.g. "["). Restore the state in case this happens.
+  TentativeParsingAction TPA(*this);
+
   // Continue parsing type-names.
   do {
 Token CurTypeTok = Tok;
@@ -1763,6 +1767,11 @@
 }
   } while (TryConsumeToken(tok::comma));
 
+  if (Tok.is(tok::eof))
+TPA.Revert();
+  else
+TPA.Commit();
+
   // Diagnose the mix between type args and protocols.
   if (foundProtocolId && foundValidTypeId)
 Actions.DiagnoseTypeArgsAndProtocols(foundProtocolId, foundProtocolSrcLoc,


Index: test/SemaObjC/crash-on-type-args-protocols.m
===
--- /dev/null
+++ test/SemaObjC/crash-on-type-args-protocols.m
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -DFIRST -fsyntax-only -verify %s
+// RUN: %clang_cc1 -DSECOND -fsyntax-only -verify %s
+// RUN: %clang_cc1 -DTHIRD -fsyntax-only -verify %s
+
+@protocol P;
+@interface NSObject
+@end
+@protocol X
+@end
+@interface X : NSObject 
+@end
+
+@class A;
+
+#ifdef FIRST
+id F1(id<[P> v) { // expected-error {{expected a type}} // expected-error {{use of undeclared identifier 'P'}} // expected-error {{use of undeclared identifier 'v'}} // expected-error {{expected '>'}} // expected-error {{expected ')'}} // expected-note {{to match this '('}}
+  return 0;
+}
+
+id F2(id v) { // expected-error {{unknown type name 'P'}} // expected-error {{unexpected interface name 'X': expected expression}} // expected-error {{use of undeclared identifier 'v'}} // expected-error {{expected '>'}} // expected-error {{unexpected interface name 'X': expected expression}} // expected-error {{use of undeclared identifier 'v'}} // expected-note {{to match this '('}}
+  return 0;
+}
+#endif
+
+#ifdef SECOND
+id F3(id v) { // expected-error {{unknown type name 'P'}} // expected-error {{expected expression}} 

Re: [PATCH] D20512: [PATCH] Bug 27475 - Request header guard check processes .hpp files as well as .h files

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: docs/clang-tidy/checks/llvm-header-guard.rst:13
@@ +12,2 @@
+
+A comma-separated list of filename extensions of header files (The filename 
extension should not contain "." prefix). Default value is ",h,hh,hpp,hxx".  
For extension-less header files, using an empty string or leaving an empty 
string between "," if there are other filename extensions.

You missed the "The description should be indented by at least two columns" 
part.

With that should be fine to submit.


https://reviews.llvm.org/D20512



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


Re: [PATCH] D21968: [libcxx] Externally threaded libc++ variant - Take 2

2016-08-24 Thread Asiri Rathnayake via cfe-commits
rmaprath added inline comments.


Comment at: include/__config:830
@@ -829,1 +829,3 @@
+!defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \
+!defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
 # if defined(__FreeBSD__) || \

compnerd wrote:
> I meant on the lines that you added :-).
Will update to reflect rest of the source file.


Comment at: include/__threading_support:261
@@ -200,1 +260,3 @@
+void* __libcpp_tl_get(__libcpp_tl_key __key);
+void __libcpp_tl_set(__libcpp_tl_key __key, void* __p);
 

compnerd wrote:
> I think we should explicitly spell out `tls`.  The extra character won't hurt.
Will fix.


Comment at: lib/CMakeLists.txt:216
@@ +215,3 @@
+  )
+endif()
+

compnerd wrote:
> Have you considered a slightly alternative approach of basically implementing 
> pthreads as an "external" threading model as well?  You could override it, or 
> take the default implementation that is provided.  It avoids having a second 
> supporting DSO for threading as we could always statically link against it.
So, the particulars of this design was discussed and (generally) agreed upon 
sometime back.

Currently pthreads **is** hidden behind the same threading API as the 
externally threaded variant (on this patch). To override the default (pthread) 
implementation, you just have to drop in an `__external_threading` header and 
specify the `-DLIBCXX_HAS_EXTERNAL_THREAD_API` cmake option.

There's no need to provide a second DSO if your `__external_threading` header 
(and your  thread-system sources) are available at `libc++` build time.

But we have a **requirement** that the library needs to be build-able in such a 
way you can provide a second DSO holding the implementation of the API. That 
is, we need to be able to build and ship a library to which customers can 
drop-in their own thread implementation (i.e. the thread-support DSO).

Note that in one of my earlier patches, I proposed an even more de-coupled 
external threading system where even the types like `__libcpp_mutex_t` were 
opaque pointers. @mclow.lists opposed that (perhaps rightfully so, now I think 
about it) and currently these types need to be known at `libc++` compile time. 
The implementation of the API functions like `__libcpp_mutex_lock()` can be 
deferred to link time (this is what is provided in the second DSO).

Hope that clarifies everything here?








Comment at: test/support/external_threads.cpp:26
@@ +25,3 @@
+if (__ec)
+  goto fail;
+

compnerd wrote:
> I think this would be nicer as:
> 
>   if (int error = pthread_mutexattr_init())
> return error;
I think I'm following the conventions used in the `libc++` source files here. 
Will double check tomorrow.


Comment at: test/support/external_threads.cpp:52
@@ +51,3 @@
+fail:
+return __ec;
+}

compnerd wrote:
> I don't think that the label for failure is adding anything since you really 
> are handling the destruction of the mutex at all failure sites.
Not sure what I did here. Will double check and fix.


Comment at: test/support/external_threads.cpp:70
@@ +69,3 @@
+
+int __libcpp_mutex_destroy(__libcpp_mutex_t* __m) {
+return pthread_mutex_destroy(__m);

compnerd wrote:
> Please choose a single style.
Will fix.


Comment at: test/support/external_threads.cpp:103
@@ +102,3 @@
+
+bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2) {
+return pthread_equal(t1, t2) != 0;

compnerd wrote:
> Please choose a single style (and below).
Will fix.


Comment at: test/support/external_threads.cpp:131
@@ +130,3 @@
+// before.
+if (*__t == 0)
+return -1;

compnerd wrote:
> Can you compare to `nullptr` instead?
I can't remember exactly why, but I think there was a problem with using 
`nullptr` here. I will check and get back.


Comment at: test/support/external_threads.cpp:142
@@ +141,3 @@
+// before.
+if (*__t == 0)
+return -1;

compnerd wrote:
> Same.
Need to check.


https://reviews.llvm.org/D21968



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


Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-24 Thread Zachary Turner via cfe-commits
zturner added inline comments.


Comment at: CMakeLists.txt:6
@@ -5,2 +5,3 @@
 add_subdirectory(clang-tidy)
+add_subdirectory(clang-tidy-vs)
 endif()

alexfh wrote:
> Should the plugin be placed inside clang-tidy directory?
I followed the same way that the clang format VS extension uses.  I don't mind 
to move it, I just did it this way for consistency.


Comment at: clang-tidy-vs/ClangTidy/ClangTidyProperties.cs:81
@@ +80,3 @@
+[ClangTidyCheck("cert-dcl50-cpp")]
+public bool CERTDCL50
+{

alexfh wrote:
> I hope, this file is generated?
> 
> A way to update this file should be documented.
No, I actually typed this entire file :-/  I don't know of a good way to auto 
generate it.  We would need a single file, perhaps Yaml or something, 
consisting of:

1. Category Name
2. Display Name
3. Description
4. clang-tidy built in default value of check.

At that point, we wouldn't even need to generate the file, we could read it at 
runtime and add the properties dynamically (through the `ICustomTypeDescriptor` 
interface).

For now though, the way to update the file is to copy / paste one property and 
change the values accordingly to add a new check.


Comment at: clang-tidy-vs/ClangTidy/PropertyFileParser.cs:208
@@ +207,3 @@
+
+ClangTidyProperties.CheckMapping[] Matches = 
Props.FindChecksMatching(Check).ToArray();
+foreach (var Match in Matches)

alexfh wrote:
> Is the copy needed to avoid aliasing? (i.e. will this break if you iterate 
> over `Props.FindChecksMatching(Check)` instead?)
The copy is not needed to avoid aliasing.  It's fine to iterate over 
`Props.FindChecksMatching(Check)`.  I wrote it this way because it helps for 
debugging, as I could just add a watch for `Matches` and view the array in the 
debugger.


https://reviews.llvm.org/D23848



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


Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-24 Thread Zachary Turner via cfe-commits
zturner added a comment.

I can fix the empty lines, but keep in mind that Visual Studio's C# editor is 
MUCH more aggressive about auto-formatting your code.  So it seems like a 
fruitless endeavor to me, as we will constantly be fighting against their auto 
formatter, which does this automatically every time you add a new function.


https://reviews.llvm.org/D23848



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


Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-24 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.


Comment at: clang-tidy-vs/ClangTidy/CheckTree.cs:79
@@ +78,3 @@
+}
+
+

Unnecessary empty line.


Comment at: clang-tidy-vs/ClangTidy/CheckTree.cs:93
@@ +92,3 @@
+{
+
+}

Unnecessary empty line.


Comment at: clang-tidy-vs/ClangTidy/ClangTidy.vsct:22
@@ +21,3 @@
+  
+
+

Unnecessary empty line, same below in many places here.


Comment at: clang-tidy-vs/ClangTidy/ClangTidyPropertyGrid.cs:178
@@ +177,3 @@
+{
+
+}

Unnecessary empty line.


Comment at: clang-tidy-vs/ClangTidy/PropertyFileParser.cs:14
@@ +13,3 @@
+{
+
+public class CheckOption

Unnecessary empty line.


Comment at: clang-tidy-vs/ClangTidy/PropertyFileParser.cs:23
@@ +22,3 @@
+}
+public class ClangTidyYaml
+{

Please add empty line.


https://reviews.llvm.org/D23848



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


Re: [PATCH] D20512: [PATCH] Bug 27475 - Request header guard check processes .hpp files as well as .h files

2016-08-24 Thread Mads Ravn via cfe-commits
madsravn added inline comments.


Comment at: docs/clang-tidy/checks/llvm-header-guard.rst:13
@@ +12,3 @@
+
+  ...
+

alexfh wrote:
> `...` was meant to represent the description of the option. Not literally 
> `...` ;)
> 
> The description should be indented by at least two columns and should start 
> with `A comma-separated ...`
Sorry :) I just found the literal `  ...` in some of the other .rst files and 
it somewhat fit the context. I'll get it fixed.


https://reviews.llvm.org/D20512



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


Re: [PATCH] D20512: [PATCH] Bug 27475 - Request header guard check processes .hpp files as well as .h files

2016-08-24 Thread Mads Ravn via cfe-commits
madsravn updated this revision to Diff 69164.

https://reviews.llvm.org/D20512

Files:
  clang-tidy/llvm/HeaderGuardCheck.cpp
  clang-tidy/llvm/HeaderGuardCheck.h
  clang-tidy/utils/HeaderFileExtensionsUtils.cpp
  clang-tidy/utils/HeaderFileExtensionsUtils.h
  clang-tidy/utils/HeaderGuard.cpp
  clang-tidy/utils/HeaderGuard.h
  docs/clang-tidy/checks/llvm-header-guard.rst

Index: docs/clang-tidy/checks/llvm-header-guard.rst
===
--- docs/clang-tidy/checks/llvm-header-guard.rst
+++ docs/clang-tidy/checks/llvm-header-guard.rst
@@ -3,4 +3,11 @@
 llvm-header-guard
 =
 
-TODO: add docs
+Finds and fixes header guards that do not adhere to LLVM style.
+
+Options
+---
+
+.. option:: HeaderFileExtensions
+
+A comma-separated list of filename extensions of header files (The filename extension should not contain "." prefix). Default value is ",h,hh,hpp,hxx".  For extension-less header files, using an empty string or leaving an empty string between "," if there are other filename extensions.
Index: clang-tidy/utils/HeaderGuard.h
===
--- clang-tidy/utils/HeaderGuard.h
+++ clang-tidy/utils/HeaderGuard.h
@@ -11,16 +11,28 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADERGUARD_H
 
 #include "../ClangTidy.h"
+#include "../utils/HeaderFileExtensionsUtils.h"
 
 namespace clang {
 namespace tidy {
 namespace utils {
 
 /// Finds and fixes header guards.
+/// The check supports these options:
+///   - `HeaderFileExtensions`: a comma-separated list of filename extensions of
+/// header files (The filename extension should not contain "." prefix).
+/// ",h,hh,hpp,hxx" by default.
+/// For extension-less header files, using an empty string or leaving an
+/// empty string between "," if there are other filename extensions.
 class HeaderGuardCheck : public ClangTidyCheck {
 public:
   HeaderGuardCheck(StringRef Name, ClangTidyContext *Context)
-  : ClangTidyCheck(Name, Context) {}
+  : ClangTidyCheck(Name, Context),
+RawStringHeaderFileExtensions(
+Options.getLocalOrGlobal("HeaderFileExtensions", ",h,hh,hpp,hxx")) {
+utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
+ HeaderFileExtensions, ',');
+  }
   void registerPPCallbacks(CompilerInstance ) override;
 
   /// \brief Returns true if the checker should suggest inserting a trailing
@@ -39,6 +51,10 @@
   /// \brief Get the canonical header guard for a file.
   virtual std::string getHeaderGuard(StringRef Filename,
  StringRef OldGuard = StringRef()) = 0;
+
+private:
+  std::string RawStringHeaderFileExtensions;
+  utils::HeaderFileExtensionsSet HeaderFileExtensions;
 };
 
 } // namespace utils
Index: clang-tidy/utils/HeaderGuard.cpp
===
--- clang-tidy/utils/HeaderGuard.cpp
+++ clang-tidy/utils/HeaderGuard.cpp
@@ -20,7 +20,7 @@
 
 /// \brief canonicalize a path by removing ./ and ../ components.
 static std::string cleanPath(StringRef Path) {
-  SmallString<256> Result =  Path;
+  SmallString<256> Result = Path;
   llvm::sys::path::remove_dots(Result, true);
   return Result.str();
 }
@@ -274,13 +274,13 @@
 }
 
 bool HeaderGuardCheck::shouldSuggestEndifComment(StringRef FileName) {
-  return FileName.endswith(".h");
+  return utils::isHeaderFileExtension(FileName, HeaderFileExtensions);
 }
 
 bool HeaderGuardCheck::shouldFixHeaderGuard(StringRef FileName) { return true; }
 
 bool HeaderGuardCheck::shouldSuggestToAddHeaderGuard(StringRef FileName) {
-  return FileName.endswith(".h");
+  return utils::isHeaderFileExtension(FileName, HeaderFileExtensions);
 }
 
 std::string HeaderGuardCheck::formatEndIf(StringRef HeaderGuard) {
Index: clang-tidy/utils/HeaderFileExtensionsUtils.h
===
--- clang-tidy/utils/HeaderFileExtensionsUtils.h
+++ clang-tidy/utils/HeaderFileExtensionsUtils.h
@@ -12,8 +12,8 @@
 
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
-#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/StringRef.h"
 
 namespace clang {
 namespace tidy {
@@ -41,6 +41,10 @@
HeaderFileExtensionsSet ,
char delimiter);
 
+/// \brief Decides whether a file has a header file extension.
+bool isHeaderFileExtension(StringRef FileName,
+   HeaderFileExtensionsSet HeaderFileExtensions);
+
 } // namespace utils
 } // namespace tidy
 } // namespace clang
Index: clang-tidy/utils/HeaderFileExtensionsUtils.cpp
===
--- clang-tidy/utils/HeaderFileExtensionsUtils.cpp
+++ clang-tidy/utils/HeaderFileExtensionsUtils.cpp
@@ -61,6 +61,15 @@
   return true;
 }
 
+bool 

Re: [PATCH] D21502: Fix heuristics skipping invalid ctor-initializers with C++11

2016-08-24 Thread Richard Smith via cfe-commits
rsmith added a comment.

Please produce patches with more lines of context in future; phabricator only 
lets us comment on lines that are included in the patch, and in this case some 
of the relevant parts of the function are not in the context. (The equivalent 
of diff -U1000 is a common approach for this.)

Taking a step back, I wonder whether we have the right strategy overall for 
code completion within in-class //mem-initializer-list//s. The code after the 
code completion token is quite plausibly not even brace-balanced, in a case 
where you're writing a new constructor. Consider this completion:

  struct Foo {
Foo() : some_long_x(0), some_|
int some_long_x, some_long_y;
  };

Here, we ought to be able to complete "some_long_y", but we need to recognize 
that the next token is not part of the function definition in order to do that 
(and then we need to not try to consume a function body once we're done with 
the initializer). And conversely when completing here:

  struct Foo {
Foo() : some_long_x(0), some_| {}
int some_long_x, some_long_y;
  };

... we need to recognize that we //do// have a function body so that we can 
parse the members to find out what names we should complete.

However, this patch is an incremental improvement over what we already have, so 
I'm happy to go in this direction for now.



Comment at: lib/Parse/ParseCXXInlineMethods.cpp:840
@@ +839,3 @@
+
+  if (Tok.isOneOf(tok::identifier, tok::kw_template)) {
+Toks.push_back(Tok);

Can you delete the check for `kw_template` here? We handle the `template` 
keyword above, and any time we actually hit this case we would expect 
`template` to be followed by one of `::`, `(`, or `{`, which makes no sense.


Comment at: lib/Parse/ParseCXXInlineMethods.cpp:847-851
@@ -849,2 +846,7 @@
 } while (Tok.is(tok::coloncolon));
 
+if (Tok.is(tok::code_completion)) {
+  Toks.push_back(Tok);
+  ConsumeCodeCompletionToken();
+}
+

You should probably also handle the case of a comma immediately after the code 
completion token, for completions like this:

  struct A {
A() : new_mem|, existing_member() {}
int new_member, existing_member;
  };

... and likewise the case where the completion token is followed by an 
identifier, a `::`, or a `decltype`, for completions like this:

  struct A {
A() : new_mem| existing_member() {}
int new_member, existing_member;
  };

In all those cases, I think you can just `continue` to pick up the rest of the 
initializers after the code completion token. (And if you `continue` from here 
in those cases, I think you can remove the handling of the code_completion 
token up on line 835, since this codepath will do the right thing in all those 
cases.)


Comment at: lib/Parse/ParseCXXInlineMethods.cpp:894-897
@@ +893,6 @@
+
+  const Token  = Toks[Toks.size() - 2];
+  if (!MightBeTemplateArgument &&
+  !PreviousToken.isOneOf(tok::identifier, tok::greater,
+ tok::greatergreater)) {
+// Most likely the start of a function body rather than the start of a

Please add a comment here indicating that if the previous token is not one of 
these kinds, we've encountered an error (because this //mem-initializer// is 
missing its initializer). This is not really obvious, and it's important 
because that's what makes it correct to use a heuristic to guess whether we've 
got a function body next.


https://reviews.llvm.org/D21502



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


Re: [PATCH] D20512: [PATCH] Bug 27475 - Request header guard check processes .hpp files as well as .h files

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: docs/clang-tidy/checks/llvm-header-guard.rst:13
@@ +12,3 @@
+
+  ...
+

`...` was meant to represent the description of the option. Not literally `...` 
;)

The description should be indented by at least two columns and should start 
with `A comma-separated ...`


https://reviews.llvm.org/D20512



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


Re: [PATCH] D23815: [Clang-tidy] Documentation style. Two Google checks are aliases

2016-08-24 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279659: Clang-tidy documentation style. Two Google checks 
are aliases. (authored by eugenezelenko).

Changed prior to commit:
  https://reviews.llvm.org/D23815?vs=69138=69161#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23815

Files:
  
clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-namespace-comments.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-redundant-smartptr-get.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-namespace-comment.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-definitions-in-headers.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-constructor.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-redundant-control-flow.rst
  
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-redundant-smartptr-get.rst

Index: clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-redundant-smartptr-get.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-redundant-smartptr-get.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-redundant-smartptr-get.rst
@@ -1,16 +1,10 @@
 .. title:: clang-tidy - google-readability-redundant-smartptr-get
+.. meta::
+   :http-equiv=refresh: 5;URL=readability-redundant-smartptr-get.html
 
 google-readability-redundant-smartptr-get
 =
 
-
-Find and remove redundant calls to smart pointer's ``.get()`` method.
-
-Examples:
-
-.. code:: c++
-
-  ptr.get()->Foo()  ==>  ptr->Foo()
-  *ptr.get()  ==>  *ptr
-  *ptr->get()  ==>  **ptr
-
+The google-readability-redundant-smartptr-get check is an alias, please see
+`readability-redundant-smartptr-get `_
+for more information.
Index: clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-namespace-comment.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-namespace-comment.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-namespace-comment.rst
@@ -3,6 +3,8 @@
 llvm-namespace-comment
 ==
 
+`google-readability-namespace-comments` redirects here as an alias for this
+check.
 
 Checks that long namespaces have a closing comment.
 
Index: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-constructor.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-constructor.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-constructor.rst
@@ -9,27 +9,24 @@
 
 Examples:
 
-.. code:: c++
+.. code-block:: c++
 
   std::string('x', 50) str; // should be std::string(50, 'x') 
 
-
 Calling the string-literal constructor with a length bigger than the literal is
 suspicious and adds extra random characters to the string.
 
 Examples:
 
-.. code:: c++
+.. code-block:: c++
 
   std::string("test", 200);   // Will include random characters after "test".
 
-
 Creating an empty string from constructors with parameters is considered
 suspicious. The programmer should use the empty constructor instead.
 
 Examples:
 
-.. code:: c++
+.. code-block:: c++
 
   std::string("test", 0);   // Creation of an empty string.
-
Index: clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-namespace-comments.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-namespace-comments.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-namespace-comments.rst
@@ -1,11 +1,9 @@
 .. title:: clang-tidy - google-readability-namespace-comments
+.. meta::
+   :http-equiv=refresh: 5;URL=llvm-namespace-comment.html
 
 google-readability-namespace-comments
 =
 
-
-Checks that long namespaces have a closing comment.
-
-http://llvm.org/docs/CodingStandards.html#namespace-indentation
-
-https://google.github.io/styleguide/cppguide.html#Namespaces
+The google-readability-namespace-comments check is an alias, please see
+`llvm-namespace-comment `_ for more information.
Index: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-definitions-in-headers.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-definitions-in-headers.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-definitions-in-headers.rst
@@ -7,7 +7,7 @@
 which can lead to potential ODR violations in case these headers are included
 from multiple translation units.
 
-.. code:: c++
+.. code-block:: c++
 
// Foo.h
int a = 1; // Warning: variable definition.
@@ -38,9 +38,10 @@
}
 
class A {
-public:
+   public:
  int f1() { return 1; } // OK: 

[clang-tools-extra] r279659 - Clang-tidy documentation style. Two Google checks are aliases.

2016-08-24 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Wed Aug 24 15:05:36 2016
New Revision: 279659

URL: http://llvm.org/viewvc/llvm-project?rev=279659=rev
Log:
Clang-tidy documentation style. Two Google checks are aliases.

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

Modified:

clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-namespace-comments.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-redundant-smartptr-get.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-namespace-comment.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-definitions-in-headers.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-constructor.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/readability-redundant-control-flow.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/readability-redundant-smartptr-get.rst

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-namespace-comments.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-namespace-comments.rst?rev=279659=279658=279659=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-namespace-comments.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-namespace-comments.rst
 Wed Aug 24 15:05:36 2016
@@ -1,11 +1,9 @@
 .. title:: clang-tidy - google-readability-namespace-comments
+.. meta::
+   :http-equiv=refresh: 5;URL=llvm-namespace-comment.html
 
 google-readability-namespace-comments
 =
 
-
-Checks that long namespaces have a closing comment.
-
-http://llvm.org/docs/CodingStandards.html#namespace-indentation
-
-https://google.github.io/styleguide/cppguide.html#Namespaces
+The google-readability-namespace-comments check is an alias, please see
+`llvm-namespace-comment `_ for more information.

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-redundant-smartptr-get.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-redundant-smartptr-get.rst?rev=279659=279658=279659=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-redundant-smartptr-get.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-redundant-smartptr-get.rst
 Wed Aug 24 15:05:36 2016
@@ -1,16 +1,10 @@
 .. title:: clang-tidy - google-readability-redundant-smartptr-get
+.. meta::
+   :http-equiv=refresh: 5;URL=readability-redundant-smartptr-get.html
 
 google-readability-redundant-smartptr-get
 =
 
-
-Find and remove redundant calls to smart pointer's ``.get()`` method.
-
-Examples:
-
-.. code:: c++
-
-  ptr.get()->Foo()  ==>  ptr->Foo()
-  *ptr.get()  ==>  *ptr
-  *ptr->get()  ==>  **ptr
-
+The google-readability-redundant-smartptr-get check is an alias, please see
+`readability-redundant-smartptr-get `_
+for more information.

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst?rev=279659=279658=279659=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Wed Aug 24 15:05:36 
2016
@@ -40,8 +40,8 @@ Clang-Tidy Checks
google-readability-braces-around-statements (redirects to 
readability-braces-around-statements) 

google-readability-casting
google-readability-function-size (redirects to readability-function-size) 

-   google-readability-namespace-comments
-   google-readability-redundant-smartptr-get
+   google-readability-namespace-comments (redirects to llvm-namespace-comment) 

+   google-readability-redundant-smartptr-get (redirects to 
readability-redundant-smartptr-get) 
google-readability-todo
google-runtime-int
google-runtime-member-string-references

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-namespace-comment.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-namespace-comment.rst?rev=279659=279658=279659=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-namespace-comment.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-namespace-comment.rst 
Wed Aug 24 15:05:36 2016
@@ -3,6 +3,8 @@
 llvm-namespace-comment
 ==
 
+`google-readability-namespace-comments` redirects here as an alias for this
+check.
 
 Checks that long namespaces have a closing comment.
 

Modified: 

Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

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

Awesome!

A few comments.



Comment at: CMakeLists.txt:6
@@ -5,2 +5,3 @@
 add_subdirectory(clang-tidy)
+add_subdirectory(clang-tidy-vs)
 endif()

Should the plugin be placed inside clang-tidy directory?


Comment at: clang-tidy-vs/ClangTidy/CategoryVerb.cs:29
@@ +28,3 @@
+{
+
+}

Remove the empty line.


Comment at: clang-tidy-vs/ClangTidy/CategoryVerb.cs:34
@@ +33,3 @@
+{
+if (value.GetType() == typeof(string))
+{

Should this be `value is string`?


Comment at: clang-tidy-vs/ClangTidy/CheckTree.cs:130
@@ +129,3 @@
+CheckTree Root = new CheckTree();
+string[][] Groups = new string[][] {
+new string[] {"boost"},

Ideally, this should be configurable without re-compilation. Not necessary for 
now, but please add a FIXME.


Comment at: clang-tidy-vs/ClangTidy/ClangTidyConfigurationPage.cs:10
@@ +9,3 @@
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.InteropServices;

Are all of these actually used?


Comment at: clang-tidy-vs/ClangTidy/ClangTidyConfigurationPage.cs:26
@@ +25,3 @@
+get
+{   if (Grid == null)
+Grid = new ClangTidyPropertyGrid();

^K^F or whatever poor C# folks do to format code without clang-format ;)


Comment at: clang-tidy-vs/ClangTidy/ClangTidyPackage.cs:58
@@ +57,3 @@
+{
+//var page = (OptionPageGrid)GetDialogPage(typeof(OptionPageGrid));
+//return page.Style;

Remove commented-out code?


Comment at: clang-tidy-vs/ClangTidy/ClangTidyProperties.cs:81
@@ +80,3 @@
+[ClangTidyCheck("cert-dcl50-cpp")]
+public bool CERTDCL50
+{

I hope, this file is generated?

A way to update this file should be documented.


Comment at: clang-tidy-vs/ClangTidy/Properties/AssemblyInfo.cs:32
@@ +31,3 @@
+
+[assembly: AssemblyVersion("1.1.0.0")]
+[assembly: AssemblyFileVersion("1.1.0.0")]

Ideally, the file should be generated by CMake to use proper version number. 
Please add a FIXME.


Comment at: clang-tidy-vs/ClangTidy/PropertyFileParser.cs:80
@@ +79,3 @@
+
+string ClangTidy = Path.Combine(ClangTidyFilePath, ".clang-tidy");
+using (StreamWriter Writer = new StreamWriter(ClangTidy))

s/ClangTidy/ConfigFile/


Comment at: clang-tidy-vs/ClangTidy/PropertyFileParser.cs:208
@@ +207,3 @@
+
+ClangTidyProperties.CheckMapping[] Matches = 
Props.FindChecksMatching(Check).ToArray();
+foreach (var Match in Matches)

Is the copy needed to avoid aliasing? (i.e. will this break if you iterate over 
`Props.FindChecksMatching(Check)` instead?)


Comment at: clang-tidy-vs/ClangTidy/Utility.cs:31
@@ +30,3 @@
+{
+string RE = Regex.Escape(Pattern).Replace(@"\*", 
".*").Replace(@"\?", ".");
+return Regex.IsMatch(Value, RE);

Question marks are not supported in check patterns, so `.Replace(@"\?", ".")` 
can be dropped.


https://reviews.llvm.org/D23848



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


Re: [PATCH] D23837: Fix colored diagnostics from tools

2016-08-24 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

Hi Olivier,

Can you add a test? Can you also include some context to the patch?

Thanks,


https://reviews.llvm.org/D23837



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


Re: [PATCH] D20512: [PATCH] Bug 27475 - Request header guard check processes .hpp files as well as .h files

2016-08-24 Thread Mads Ravn via cfe-commits
madsravn updated this revision to Diff 69158.
madsravn marked 2 inline comments as done.
madsravn added a comment.

Documentation fix.


https://reviews.llvm.org/D20512

Files:
  clang-tidy/llvm/HeaderGuardCheck.cpp
  clang-tidy/llvm/HeaderGuardCheck.h
  clang-tidy/utils/HeaderFileExtensionsUtils.cpp
  clang-tidy/utils/HeaderFileExtensionsUtils.h
  clang-tidy/utils/HeaderGuard.cpp
  clang-tidy/utils/HeaderGuard.h
  docs/clang-tidy/checks/llvm-header-guard.rst

Index: docs/clang-tidy/checks/llvm-header-guard.rst
===
--- docs/clang-tidy/checks/llvm-header-guard.rst
+++ docs/clang-tidy/checks/llvm-header-guard.rst
@@ -3,4 +3,13 @@
 llvm-header-guard
 =
 
-TODO: add docs
+Finds and fixes header guards that do not adhere to LLVM style.
+
+Options
+---
+
+.. option:: HeaderFileExtensions
+
+  ...
+
+``HeaderFileExtensions``: a comma-separated list of filename extensions of header files (The filename extension should not contain "." prefix). ",h,hh,hpp,hxx" by default. For extension-less header files, using an empty string or leaving an empty string between "," if there are other filename extensions.
Index: clang-tidy/utils/HeaderGuard.h
===
--- clang-tidy/utils/HeaderGuard.h
+++ clang-tidy/utils/HeaderGuard.h
@@ -11,16 +11,28 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADERGUARD_H
 
 #include "../ClangTidy.h"
+#include "../utils/HeaderFileExtensionsUtils.h"
 
 namespace clang {
 namespace tidy {
 namespace utils {
 
 /// Finds and fixes header guards.
+/// The check supports these options:
+///   - `HeaderFileExtensions`: a comma-separated list of filename extensions of
+/// header files (The filename extension should not contain "." prefix).
+/// ",h,hh,hpp,hxx" by default.
+/// For extension-less header files, using an empty string or leaving an
+/// empty string between "," if there are other filename extensions.
 class HeaderGuardCheck : public ClangTidyCheck {
 public:
   HeaderGuardCheck(StringRef Name, ClangTidyContext *Context)
-  : ClangTidyCheck(Name, Context) {}
+  : ClangTidyCheck(Name, Context),
+RawStringHeaderFileExtensions(
+Options.getLocalOrGlobal("HeaderFileExtensions", ",h,hh,hpp,hxx")) {
+utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
+ HeaderFileExtensions, ',');
+  }
   void registerPPCallbacks(CompilerInstance ) override;
 
   /// \brief Returns true if the checker should suggest inserting a trailing
@@ -39,6 +51,10 @@
   /// \brief Get the canonical header guard for a file.
   virtual std::string getHeaderGuard(StringRef Filename,
  StringRef OldGuard = StringRef()) = 0;
+
+private:
+  std::string RawStringHeaderFileExtensions;
+  utils::HeaderFileExtensionsSet HeaderFileExtensions;
 };
 
 } // namespace utils
Index: clang-tidy/utils/HeaderGuard.cpp
===
--- clang-tidy/utils/HeaderGuard.cpp
+++ clang-tidy/utils/HeaderGuard.cpp
@@ -20,7 +20,7 @@
 
 /// \brief canonicalize a path by removing ./ and ../ components.
 static std::string cleanPath(StringRef Path) {
-  SmallString<256> Result =  Path;
+  SmallString<256> Result = Path;
   llvm::sys::path::remove_dots(Result, true);
   return Result.str();
 }
@@ -274,13 +274,13 @@
 }
 
 bool HeaderGuardCheck::shouldSuggestEndifComment(StringRef FileName) {
-  return FileName.endswith(".h");
+  return utils::isHeaderFileExtension(FileName, HeaderFileExtensions);
 }
 
 bool HeaderGuardCheck::shouldFixHeaderGuard(StringRef FileName) { return true; }
 
 bool HeaderGuardCheck::shouldSuggestToAddHeaderGuard(StringRef FileName) {
-  return FileName.endswith(".h");
+  return utils::isHeaderFileExtension(FileName, HeaderFileExtensions);
 }
 
 std::string HeaderGuardCheck::formatEndIf(StringRef HeaderGuard) {
Index: clang-tidy/utils/HeaderFileExtensionsUtils.h
===
--- clang-tidy/utils/HeaderFileExtensionsUtils.h
+++ clang-tidy/utils/HeaderFileExtensionsUtils.h
@@ -12,8 +12,8 @@
 
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
-#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/StringRef.h"
 
 namespace clang {
 namespace tidy {
@@ -41,6 +41,10 @@
HeaderFileExtensionsSet ,
char delimiter);
 
+/// \brief Decides whether a file has a header file extension.
+bool isHeaderFileExtension(StringRef FileName,
+   HeaderFileExtensionsSet HeaderFileExtensions);
+
 } // namespace utils
 } // namespace tidy
 } // namespace clang
Index: clang-tidy/utils/HeaderFileExtensionsUtils.cpp
===
--- clang-tidy/utils/HeaderFileExtensionsUtils.cpp

Re: [PATCH] D20512: [PATCH] Bug 27475 - Request header guard check processes .hpp files as well as .h files

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG with a couple of nits. Do you need me to submit the patch for you? (If yes, 
I can fix the doc myself)



Comment at: docs/clang-tidy/checks/llvm-header-guard.rst:8
@@ +7,3 @@
+
+For the user-facing documentation see: 
http://clang.llvm.org/extra/clang-tidy/checks/llvm-header-guard.html
+

This line is not needed here (it's a self-reference).


Comment at: docs/clang-tidy/checks/llvm-header-guard.rst:10
@@ +9,3 @@
+
+The check supports these options:
+``HeaderFileExtensions``: a comma-separated list of filename extensions of 
header files (The filename extension should not contain "." prefix). 
",h,hh,hpp,hxx" by default. For extension-less header files, using an empty 
string or leaving an empty string between "," if there are other filename 
extensions.

Should be

  Options
  ---

  .. option:: HeaderFileExtensions
  
...


https://reviews.llvm.org/D20512



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


[libclc] r279656 - amdgcn: Also correct get_local_size type for HSA

2016-08-24 Thread Matt Arsenault via cfe-commits
Author: arsenm
Date: Wed Aug 24 14:11:52 2016
New Revision: 279656

URL: http://llvm.org/viewvc/llvm-project?rev=279656=rev
Log:
amdgcn: Also correct get_local_size type for HSA

Modified:
libclc/trunk/amdgcn-amdhsa/lib/workitem/get_local_size.ll

Modified: libclc/trunk/amdgcn-amdhsa/lib/workitem/get_local_size.ll
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn-amdhsa/lib/workitem/get_local_size.ll?rev=279656=279655=279656=diff
==
--- libclc/trunk/amdgcn-amdhsa/lib/workitem/get_local_size.ll (original)
+++ libclc/trunk/amdgcn-amdhsa/lib/workitem/get_local_size.ll Wed Aug 24 
14:11:52 2016
@@ -1,6 +1,6 @@
 declare i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() #0
 
-define i32 @get_local_size(i32 %dim) #1 {
+define i64 @get_local_size(i32 %dim) #1 {
   %dispatch_ptr = call noalias nonnull dereferenceable(64) i8 addrspace(2)* 
@llvm.amdgcn.dispatch.ptr()
   %dispatch_ptr_i32 = bitcast i8 addrspace(2)* %dispatch_ptr to i32 
addrspace(2)*
   %xy_size_ptr = getelementptr inbounds i32, i32 addrspace(2)* 
%dispatch_ptr_i32, i64 1
@@ -13,19 +13,22 @@ define i32 @get_local_size(i32 %dim) #1
 
 x_dim:
   %x_size = and i32 %xy_size, 65535
-  ret i32 %x_size
+  %x_size.ext = zext i32 %x_size to i64
+  ret i64 %x_size.ext
 
 y_dim:
   %y_size = lshr i32 %xy_size, 16
-  ret i32 %y_size
+  %y_size.ext = zext i32 %y_size to i64
+  ret i64 %y_size.ext
 
 z_dim:
   %z_size_ptr = getelementptr inbounds i32, i32 addrspace(2)* 
%dispatch_ptr_i32, i64 2
   %z_size = load i32, i32 addrspace(2)* %z_size_ptr, align 4, !invariant.load 
!0, !range !1
-  ret i32 %z_size
+  %z_size.ext = zext i32 %z_size to i64
+  ret i64 %z_size.ext
 
 default:
-  ret i32 1
+  ret i64 1
 }
 
 attributes #0 = { nounwind readnone }


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


Re: [PATCH] D20512: [PATCH] Bug 27475 - Request header guard check processes .hpp files as well as .h files

2016-08-24 Thread Mads Ravn via cfe-commits
madsravn updated this revision to Diff 69152.
madsravn marked 5 inline comments as done.
madsravn added a comment.

More suggestions by alexfh fixed.


https://reviews.llvm.org/D20512

Files:
  clang-tidy/llvm/HeaderGuardCheck.cpp
  clang-tidy/llvm/HeaderGuardCheck.h
  clang-tidy/utils/HeaderFileExtensionsUtils.cpp
  clang-tidy/utils/HeaderFileExtensionsUtils.h
  clang-tidy/utils/HeaderGuard.cpp
  clang-tidy/utils/HeaderGuard.h
  docs/clang-tidy/checks/llvm-header-guard.rst

Index: docs/clang-tidy/checks/llvm-header-guard.rst
===
--- docs/clang-tidy/checks/llvm-header-guard.rst
+++ docs/clang-tidy/checks/llvm-header-guard.rst
@@ -3,4 +3,9 @@
 llvm-header-guard
 =
 
-TODO: add docs
+Finds and fixes header guards that do not adhere to LLVM style.
+
+For the user-facing documentation see: http://clang.llvm.org/extra/clang-tidy/checks/llvm-header-guard.html
+
+The check supports these options:
+``HeaderFileExtensions``: a comma-separated list of filename extensions of header files (The filename extension should not contain "." prefix). ",h,hh,hpp,hxx" by default. For extension-less header files, using an empty string or leaving an empty string between "," if there are other filename extensions.
Index: clang-tidy/utils/HeaderGuard.h
===
--- clang-tidy/utils/HeaderGuard.h
+++ clang-tidy/utils/HeaderGuard.h
@@ -11,16 +11,28 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADERGUARD_H
 
 #include "../ClangTidy.h"
+#include "../utils/HeaderFileExtensionsUtils.h"
 
 namespace clang {
 namespace tidy {
 namespace utils {
 
 /// Finds and fixes header guards.
+/// The check supports these options:
+///   - `HeaderFileExtensions`: a comma-separated list of filename extensions of
+/// header files (The filename extension should not contain "." prefix).
+/// ",h,hh,hpp,hxx" by default.
+/// For extension-less header files, using an empty string or leaving an
+/// empty string between "," if there are other filename extensions.
 class HeaderGuardCheck : public ClangTidyCheck {
 public:
   HeaderGuardCheck(StringRef Name, ClangTidyContext *Context)
-  : ClangTidyCheck(Name, Context) {}
+  : ClangTidyCheck(Name, Context),
+RawStringHeaderFileExtensions(
+Options.getLocalOrGlobal("HeaderFileExtensions", ",h,hh,hpp,hxx")) {
+utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
+ HeaderFileExtensions, ',');
+  }
   void registerPPCallbacks(CompilerInstance ) override;
 
   /// \brief Returns true if the checker should suggest inserting a trailing
@@ -39,6 +51,10 @@
   /// \brief Get the canonical header guard for a file.
   virtual std::string getHeaderGuard(StringRef Filename,
  StringRef OldGuard = StringRef()) = 0;
+
+private:
+  std::string RawStringHeaderFileExtensions;
+  utils::HeaderFileExtensionsSet HeaderFileExtensions;
 };
 
 } // namespace utils
Index: clang-tidy/utils/HeaderGuard.cpp
===
--- clang-tidy/utils/HeaderGuard.cpp
+++ clang-tidy/utils/HeaderGuard.cpp
@@ -20,7 +20,7 @@
 
 /// \brief canonicalize a path by removing ./ and ../ components.
 static std::string cleanPath(StringRef Path) {
-  SmallString<256> Result =  Path;
+  SmallString<256> Result = Path;
   llvm::sys::path::remove_dots(Result, true);
   return Result.str();
 }
@@ -274,13 +274,13 @@
 }
 
 bool HeaderGuardCheck::shouldSuggestEndifComment(StringRef FileName) {
-  return FileName.endswith(".h");
+  return utils::isHeaderFileExtension(FileName, HeaderFileExtensions);
 }
 
 bool HeaderGuardCheck::shouldFixHeaderGuard(StringRef FileName) { return true; }
 
 bool HeaderGuardCheck::shouldSuggestToAddHeaderGuard(StringRef FileName) {
-  return FileName.endswith(".h");
+  return utils::isHeaderFileExtension(FileName, HeaderFileExtensions);
 }
 
 std::string HeaderGuardCheck::formatEndIf(StringRef HeaderGuard) {
Index: clang-tidy/utils/HeaderFileExtensionsUtils.h
===
--- clang-tidy/utils/HeaderFileExtensionsUtils.h
+++ clang-tidy/utils/HeaderFileExtensionsUtils.h
@@ -12,8 +12,8 @@
 
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
-#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/StringRef.h"
 
 namespace clang {
 namespace tidy {
@@ -41,6 +41,10 @@
HeaderFileExtensionsSet ,
char delimiter);
 
+/// \brief Decides whether a file has a header file extension.
+bool isHeaderFileExtension(StringRef FileName,
+   HeaderFileExtensionsSet HeaderFileExtensions);
+
 } // namespace utils
 } // namespace tidy
 } // namespace clang
Index: clang-tidy/utils/HeaderFileExtensionsUtils.cpp

r279653 - Fix offload bundler tests so that diagnostic can start with caps.

2016-08-24 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Wed Aug 24 13:52:18 2016
New Revision: 279653

URL: http://llvm.org/viewvc/llvm-project?rev=279653=rev
Log:
Fix offload bundler tests so that diagnostic can start with caps.

Windows require that.

Modified:
cfe/trunk/test/Driver/clang-offload-bundler.c

Modified: cfe/trunk/test/Driver/clang-offload-bundler.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-offload-bundler.c?rev=279653=279652=279653=diff
==
--- cfe/trunk/test/Driver/clang-offload-bundler.c (original)
+++ cfe/trunk/test/Driver/clang-offload-bundler.c Wed Aug 24 13:52:18 2016
@@ -68,7 +68,7 @@
 
 // RUN: not clang-offload-bundler -type=i 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.i,%t.tgt1,%t.tgt2.notexist -outputs=%t.bundle.i 2>&1 | FileCheck %s 
--check-prefix CK-ERR5
 // RUN: not clang-offload-bundler -type=i 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -outputs=%t.i,%t.tgt1,%t.tgt2 -inputs=%t.bundle.i.notexist -unbundle 2>&1 | 
FileCheck %s --check-prefix CK-ERR5
-// CK-ERR5: error: Can't open file {{.+}}.notexist: No such file or directory
+// CK-ERR5: error: Can't open file {{.+}}.notexist: {{N|n}}o such file or 
directory
 
 // RUN: not clang-offload-bundler -type=invalid 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s 
--check-prefix CK-ERR6
 // CK-ERR6: error: invalid file type specified.


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


Re: [PATCH] D23815: [Clang-tidy] Documentation style. Two Google checks are aliases

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Awesome. Thanks! LG


Repository:
  rL LLVM

https://reviews.llvm.org/D23815



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


Re: [PATCH] D22507: Clang-tidy - Enum misuse check

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh requested changes to this revision.
This revision now requires changes to proceed.


Comment at: clang-tidy/misc/EnumMisuseCheck.cpp:215
@@ +214,3 @@
+"number(s)");
+  diag(RhsExpr->getExprLoc(), "Used here as a bitmask.",
+   DiagnosticIDs::Note);

Diagnostic messages are not full sentences, so they shouldn't start with a 
capital letter and end with a period.


Comment at: clang-tidy/misc/EnumMisuseCheck.h:26
@@ +25,3 @@
+  EnumMisuseCheck(StringRef Name, ClangTidyContext *Context)
+  : ClangTidyCheck(Name, Context), IsStrict(Options.get("IsStrict", 1)) {}
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;

1. Please move the constructor body to the .cpp file so that the code reading 
and storing options are together.
2. Let's use a global flag `StrictMode` (used by one more check currently: 
http://clang.llvm.org/extra/clang-tidy/checks/misc-argument-comment.html, 
clang-tidy/misc/ArgumentCommentCheck.cpp). It can still be configured 
separately for each check, but overall it improves consistency. Also, let's 
make it non-strict by default.

  Options.get(...)

should change to

  StrictMode(Options.getLocalOrGlobal("StrictMode", 0) != 0)


Comment at: docs/clang-tidy/checks/misc-enum-misuse.rst:21
@@ +20,3 @@
+
+  2. Investigating the right hand side of += or |= operator. (only in "Strict")
+  3. Check only the enum value side of a | or + operator if one of them is not

Please enclose inline code snippets in backquotes (`+=`, `|=`, etc.). Many 
places in this file and in doxygen comments.


Comment at: docs/clang-tidy/checks/misc-enum-misuse.rst:29
@@ +28,3 @@
+
+.. code:: c++
+

Should be `.. code-block:: c++`.


Comment at: docs/clang-tidy/checks/misc-enum-misuse.rst:31
@@ +30,3 @@
+
+//1.
+Enum {A, B, C}

Code block should be indented. Please compile the doc and make sure the result 
seems reasonable.


Comment at: docs/clang-tidy/checks/misc-enum-misuse.rst:31
@@ +30,3 @@
+
+//1.
+Enum {A, B, C}

alexfh wrote:
> Code block should be indented. Please compile the doc and make sure the 
> result seems reasonable.
> Could you add some descriptions about what 1 stands for here? strict or 
> non-strict? please leave a blank between "//" and comment words, the same 
> below. Make sure the code here align with code style.

Still not addressed.


Comment at: docs/clang-tidy/checks/misc-enum-misuse.rst:38
@@ +37,3 @@
+flag = A | H; //OK, disjoint value intervalls in the enum types > probably 
good use
+flag = B | F; //warning, have common values so they are probably misused
+  

> nit: space after //
> here and below.

This is still not addressed.


Comment at: test/clang-tidy/misc-enum-misuse-weak.cpp:2
@@ +1,3 @@
+// RUN: %check_clang_tidy %s misc-enum-misuse %t -- -config="{CheckOptions: 
[{key: misc-enum-misuse.IsStrict, value: 1}]}" --
+
+enum A { A = 1,

The format still seems off.


Comment at: test/clang-tidy/misc-enum-misuse-weak.cpp:66
@@ +65,3 @@
+  p = A | G;
+  //p = G | X;
+  return 0;

Is the commented line needed?


Comment at: test/clang-tidy/misc-enum-misuse.cpp:2
@@ +1,3 @@
+// RUN: %check_clang_tidy %s misc-enum-misuse %t -- -config="{CheckOptions: 
[{key: misc-enum-misuse.IsStrict, value: 0}]}" --
+
+enum Empty {

Doesn't seem to be done: the format is still off.


https://reviews.llvm.org/D22507



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


Re: [PATCH] D20512: [PATCH] Bug 27475 - Request header guard check processes .hpp files as well as .h files

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Thank you! I've just noticed that we had completely ignored the actual docs =\ 
See the inline comment for details.



Comment at: clang-tidy/llvm/HeaderGuardCheck.h:20
@@ -19,1 +19,3 @@
 /// Finds and fixes header guards that do not adhere to LLVM style.
+/// The check supports these options:
+///   - `HeaderFileExtensions`: a comma-separated list of filename extensions 
of

Please add 

  /// For the user-facing documentation see:
  /// http://clang.llvm.org/extra/clang-tidy/checks/llvm-header-guard.html

and copy the rest of the comment to the corresponding .rst file with proper 
formatting (see docs/clang-tidy/checks/misc-argument-comment.rst for an 
example).


Comment at: clang-tidy/utils/HeaderFileExtensionsUtils.h:44
@@ -43,1 +43,3 @@
 
+/// \brief Decides whether a file has a header file extension
+bool isHeaderFileExtension(StringRef FileName,

nit: Add a trailing period.


https://reviews.llvm.org/D20512



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


LLVM buildmaster will be updated and restarted tonight

2016-08-24 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 6 PM Pacific time
today.

Thanks

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


Re: [PATCH] D20512: [PATCH] Bug 27475 - Request header guard check processes .hpp files as well as .h files

2016-08-24 Thread Mads Ravn via cfe-commits
madsravn updated this revision to Diff 69143.
madsravn added a comment.

Fixed suggested by alexfh


https://reviews.llvm.org/D20512

Files:
  clang-tidy/llvm/HeaderGuardCheck.cpp
  clang-tidy/llvm/HeaderGuardCheck.h
  clang-tidy/utils/HeaderFileExtensionsUtils.cpp
  clang-tidy/utils/HeaderFileExtensionsUtils.h
  clang-tidy/utils/HeaderGuard.cpp
  clang-tidy/utils/HeaderGuard.h

Index: clang-tidy/utils/HeaderGuard.h
===
--- clang-tidy/utils/HeaderGuard.h
+++ clang-tidy/utils/HeaderGuard.h
@@ -11,16 +11,28 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADERGUARD_H
 
 #include "../ClangTidy.h"
+#include "../utils/HeaderFileExtensionsUtils.h"
 
 namespace clang {
 namespace tidy {
 namespace utils {
 
 /// Finds and fixes header guards.
+/// The check supports these options:
+///   - `HeaderFileExtensions`: a comma-separated list of filename extensions of
+/// header files (The filename extension should not contain "." prefix).
+/// ",h,hh,hpp,hxx" by default.
+/// For extension-less header files, using an empty string or leaving an
+/// empty string between "," if there are other filename extensions.
 class HeaderGuardCheck : public ClangTidyCheck {
 public:
   HeaderGuardCheck(StringRef Name, ClangTidyContext *Context)
-  : ClangTidyCheck(Name, Context) {}
+  : ClangTidyCheck(Name, Context),
+RawStringHeaderFileExtensions(
+Options.getLocalOrGlobal("HeaderFileExtensions", ",h,hh,hpp,hxx")) {
+utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
+ HeaderFileExtensions, ',');
+  }
   void registerPPCallbacks(CompilerInstance ) override;
 
   /// \brief Returns true if the checker should suggest inserting a trailing
@@ -39,6 +51,10 @@
   /// \brief Get the canonical header guard for a file.
   virtual std::string getHeaderGuard(StringRef Filename,
  StringRef OldGuard = StringRef()) = 0;
+
+private:
+  std::string RawStringHeaderFileExtensions;
+  utils::HeaderFileExtensionsSet HeaderFileExtensions;
 };
 
 } // namespace utils
Index: clang-tidy/utils/HeaderGuard.cpp
===
--- clang-tidy/utils/HeaderGuard.cpp
+++ clang-tidy/utils/HeaderGuard.cpp
@@ -20,7 +20,7 @@
 
 /// \brief canonicalize a path by removing ./ and ../ components.
 static std::string cleanPath(StringRef Path) {
-  SmallString<256> Result =  Path;
+  SmallString<256> Result = Path;
   llvm::sys::path::remove_dots(Result, true);
   return Result.str();
 }
@@ -274,13 +274,13 @@
 }
 
 bool HeaderGuardCheck::shouldSuggestEndifComment(StringRef FileName) {
-  return FileName.endswith(".h");
+  return utils::isHeaderFileExtension(FileName, HeaderFileExtensions);
 }
 
 bool HeaderGuardCheck::shouldFixHeaderGuard(StringRef FileName) { return true; }
 
 bool HeaderGuardCheck::shouldSuggestToAddHeaderGuard(StringRef FileName) {
-  return FileName.endswith(".h");
+  return utils::isHeaderFileExtension(FileName, HeaderFileExtensions);
 }
 
 std::string HeaderGuardCheck::formatEndIf(StringRef HeaderGuard) {
Index: clang-tidy/utils/HeaderFileExtensionsUtils.h
===
--- clang-tidy/utils/HeaderFileExtensionsUtils.h
+++ clang-tidy/utils/HeaderFileExtensionsUtils.h
@@ -12,8 +12,8 @@
 
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
-#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/StringRef.h"
 
 namespace clang {
 namespace tidy {
@@ -41,6 +41,10 @@
HeaderFileExtensionsSet ,
char delimiter);
 
+/// \brief Decides whether a file has a header file extension
+bool isHeaderFileExtension(StringRef FileName,
+   HeaderFileExtensionsSet HeaderFileExtensions);
+
 } // namespace utils
 } // namespace tidy
 } // namespace clang
Index: clang-tidy/utils/HeaderFileExtensionsUtils.cpp
===
--- clang-tidy/utils/HeaderFileExtensionsUtils.cpp
+++ clang-tidy/utils/HeaderFileExtensionsUtils.cpp
@@ -61,6 +61,15 @@
   return true;
 }
 
+bool isHeaderFileExtension(StringRef FileName,
+   HeaderFileExtensionsSet HeaderFileExtensions) {
+  StringRef extension = ::llvm::sys::path::extension(FileName);
+  if (extension.startswith("."))
+extension = extension.substr(1);
+
+  return HeaderFileExtensions.count(extension) > 0;
+}
+
 } // namespace utils
 } // namespace tidy
 } // namespace clang
Index: clang-tidy/llvm/HeaderGuardCheck.h
===
--- clang-tidy/llvm/HeaderGuardCheck.h
+++ clang-tidy/llvm/HeaderGuardCheck.h
@@ -17,13 +17,28 @@
 namespace llvm {
 
 /// Finds and fixes header guards that do not adhere to LLVM style.
+/// The check supports these options:

[libclc] r279644 - amdgcn: Fix return type for get_global_size

2016-08-24 Thread Matt Arsenault via cfe-commits
Author: arsenm
Date: Wed Aug 24 12:52:04 2016
New Revision: 279644

URL: http://llvm.org/viewvc/llvm-project?rev=279644=rev
Log:
amdgcn: Fix return type for get_global_size

Added:
libclc/trunk/amdgcn/lib/workitem/get_global_size.ll
libclc/trunk/r600/lib/workitem/get_global_size.ll
  - copied, changed from r279359, 
libclc/trunk/amdgpu/lib/workitem/get_global_size.ll
Removed:
libclc/trunk/amdgpu/lib/workitem/get_global_size.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=279644=279643=279644=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES (original)
+++ libclc/trunk/amdgcn/lib/SOURCES Wed Aug 24 12:52:04 2016
@@ -2,6 +2,7 @@ math/ldexp.cl
 synchronization/barrier_impl.ll
 workitem/get_global_offset.cl
 workitem/get_group_id.cl
+workitem/get_global_size.ll
 workitem/get_local_id.cl
 workitem/get_local_size.ll
 workitem/get_work_dim.cl

Added: libclc/trunk/amdgcn/lib/workitem/get_global_size.ll
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/workitem/get_global_size.ll?rev=279644=auto
==
--- libclc/trunk/amdgcn/lib/workitem/get_global_size.ll (added)
+++ libclc/trunk/amdgcn/lib/workitem/get_global_size.ll Wed Aug 24 12:52:04 2016
@@ -0,0 +1,21 @@
+declare i32 @llvm.r600.read.global.size.x() nounwind readnone
+declare i32 @llvm.r600.read.global.size.y() nounwind readnone
+declare i32 @llvm.r600.read.global.size.z() nounwind readnone
+
+define i64 @get_global_size(i32 %dim) nounwind readnone alwaysinline {
+  switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 
2, label %z_dim]
+x_dim:
+  %x = call i32 @llvm.r600.read.global.size.x()
+  %x.ext = zext i32 %x to i64
+  ret i64 %x.ext
+y_dim:
+  %y = call i32 @llvm.r600.read.global.size.y()
+  %y.ext = zext i32 %y to i64
+  ret i64 %y.ext
+z_dim:
+  %z = call i32 @llvm.r600.read.global.size.z()
+  %z.ext = zext i32 %z to i64
+  ret i64 %z.ext
+default:
+  ret i64 1
+}

Modified: libclc/trunk/amdgpu/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/SOURCES?rev=279644=279643=279644=diff
==
--- libclc/trunk/amdgpu/lib/SOURCES (original)
+++ libclc/trunk/amdgpu/lib/SOURCES Wed Aug 24 12:52:04 2016
@@ -17,4 +17,3 @@ image/write_imagei.cl
 image/write_imageui.cl
 image/write_image_impl.ll
 workitem/get_num_groups.ll
-workitem/get_global_size.ll

Removed: libclc/trunk/amdgpu/lib/workitem/get_global_size.ll
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/workitem/get_global_size.ll?rev=279643=auto
==
--- libclc/trunk/amdgpu/lib/workitem/get_global_size.ll (original)
+++ libclc/trunk/amdgpu/lib/workitem/get_global_size.ll (removed)
@@ -1,18 +0,0 @@
-declare i32 @llvm.r600.read.global.size.x() nounwind readnone
-declare i32 @llvm.r600.read.global.size.y() nounwind readnone
-declare i32 @llvm.r600.read.global.size.z() nounwind readnone
-
-define i32 @get_global_size(i32 %dim) nounwind readnone alwaysinline {
-  switch i32 %dim, label %default [i32 0, label %x_dim i32 1, label %y_dim i32 
2, label %z_dim]
-x_dim:
-  %x = call i32 @llvm.r600.read.global.size.x() nounwind readnone
-  ret i32 %x
-y_dim:
-  %y = call i32 @llvm.r600.read.global.size.y() nounwind readnone
-  ret i32 %y
-z_dim:
-  %z = call i32 @llvm.r600.read.global.size.z() nounwind readnone
-  ret i32 %z
-default:
-  ret i32 0
-}

Modified: libclc/trunk/r600/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES?rev=279644=279643=279644=diff
==
--- libclc/trunk/r600/lib/SOURCES (original)
+++ libclc/trunk/r600/lib/SOURCES Wed Aug 24 12:52:04 2016
@@ -1,6 +1,7 @@
 synchronization/barrier_impl.ll
 workitem/get_global_offset.cl
 workitem/get_group_id.cl
+workitem/get_global_size.ll
 workitem/get_local_id.cl
 workitem/get_local_size.ll
 workitem/get_work_dim.cl

Copied: libclc/trunk/r600/lib/workitem/get_global_size.ll (from r279359, 
libclc/trunk/amdgpu/lib/workitem/get_global_size.ll)
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/workitem/get_global_size.ll?p2=libclc/trunk/r600/lib/workitem/get_global_size.ll=libclc/trunk/amdgpu/lib/workitem/get_global_size.ll=279359=279644=279644=diff
==
--- libclc/trunk/amdgpu/lib/workitem/get_global_size.ll (original)
+++ libclc/trunk/r600/lib/workitem/get_global_size.ll Wed Aug 24 12:52:04 2016
@@ -14,5 +14,5 @@ z_dim:
   %z = call i32 @llvm.r600.read.global.size.z() nounwind readnone
   ret i32 

Re: [PATCH] D23815: [Clang-tidy] Documentation style. Two Google checks are aliases

2016-08-24 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko updated this revision to Diff 69138.
Eugene.Zelenko added a comment.

Links are already there. Sorry for not uploading full diff at beginning.


Repository:
  rL LLVM

https://reviews.llvm.org/D23815

Files:
  docs/clang-tidy/checks/google-readability-namespace-comments.rst
  docs/clang-tidy/checks/google-readability-redundant-smartptr-get.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/llvm-namespace-comment.rst
  docs/clang-tidy/checks/misc-definitions-in-headers.rst
  docs/clang-tidy/checks/misc-string-constructor.rst
  docs/clang-tidy/checks/readability-redundant-control-flow.rst
  docs/clang-tidy/checks/readability-redundant-smartptr-get.rst

Index: docs/clang-tidy/checks/readability-redundant-smartptr-get.rst
===
--- docs/clang-tidy/checks/readability-redundant-smartptr-get.rst
+++ docs/clang-tidy/checks/readability-redundant-smartptr-get.rst
@@ -3,12 +3,14 @@
 readability-redundant-smartptr-get
 ==
 
+`google-readability-redundant-smartptr-get` redirects here as an alias for this
+check.
 
 Find and remove redundant calls to smart pointer's ``.get()`` method.
 
 Examples:
 
-.. code:: c++
+.. code-block:: c++
 
   ptr.get()->Foo()  ==>  ptr->Foo()
   *ptr.get()  ==>  *ptr
Index: docs/clang-tidy/checks/readability-redundant-control-flow.rst
===
--- docs/clang-tidy/checks/readability-redundant-control-flow.rst
+++ docs/clang-tidy/checks/readability-redundant-control-flow.rst
@@ -4,17 +4,16 @@
 ==
 
 This check looks for procedures (functions returning no value) with ``return``
-statements at the end of the function.  Such ``return`` statements are
-redundant.
+statements at the end of the function. Such ``return`` statements are redundant.
 
 Loop statements (``for``, ``while``, ``do while``) are checked for redundant
 ``continue`` statements at the end of the loop body.
 
 Examples:
 
-The following function `f` contains a redundant `return` statement:
+The following function `f` contains a redundant ``return`` statement:
 
-.. code:: c++
+.. code-block:: c++
 
   extern void g();
   void f() {
@@ -24,16 +23,16 @@
 
 becomes
 
-.. code:: c++
+.. code-block:: c++
 
   extern void g();
   void f() {
 g();
   }
 
-The following function `k` contains a redundant `continue` statement:
+The following function `k` contains a redundant ``continue`` statement:
 
-.. code:: c++
+.. code-block:: c++
 
   void k() {
 for (int i = 0; i < 10; ++i) {
@@ -43,7 +42,7 @@
 
 becomes
 
-.. code:: c++
+.. code-block:: c++
 
   void k() {
 for (int i = 0; i < 10; ++i) {
Index: docs/clang-tidy/checks/google-readability-namespace-comments.rst
===
--- docs/clang-tidy/checks/google-readability-namespace-comments.rst
+++ docs/clang-tidy/checks/google-readability-namespace-comments.rst
@@ -1,11 +1,9 @@
 .. title:: clang-tidy - google-readability-namespace-comments
+.. meta::
+   :http-equiv=refresh: 5;URL=llvm-namespace-comment.html
 
 google-readability-namespace-comments
 =
 
-
-Checks that long namespaces have a closing comment.
-
-http://llvm.org/docs/CodingStandards.html#namespace-indentation
-
-https://google.github.io/styleguide/cppguide.html#Namespaces
+The google-readability-namespace-comments check is an alias, please see
+`llvm-namespace-comment `_ for more information.
Index: docs/clang-tidy/checks/misc-string-constructor.rst
===
--- docs/clang-tidy/checks/misc-string-constructor.rst
+++ docs/clang-tidy/checks/misc-string-constructor.rst
@@ -9,27 +9,24 @@
 
 Examples:
 
-.. code:: c++
+.. code-block:: c++
 
   std::string('x', 50) str; // should be std::string(50, 'x') 
 
-
 Calling the string-literal constructor with a length bigger than the literal is
 suspicious and adds extra random characters to the string.
 
 Examples:
 
-.. code:: c++
+.. code-block:: c++
 
   std::string("test", 200);   // Will include random characters after "test".
 
-
 Creating an empty string from constructors with parameters is considered
 suspicious. The programmer should use the empty constructor instead.
 
 Examples:
 
-.. code:: c++
+.. code-block:: c++
 
   std::string("test", 0);   // Creation of an empty string.
-
Index: docs/clang-tidy/checks/llvm-namespace-comment.rst
===
--- docs/clang-tidy/checks/llvm-namespace-comment.rst
+++ docs/clang-tidy/checks/llvm-namespace-comment.rst
@@ -3,6 +3,8 @@
 llvm-namespace-comment
 ==
 
+`google-readability-namespace-comments` redirects here as an alias for this
+check.
 
 Checks that long namespaces have a closing comment.
 
Index: docs/clang-tidy/checks/google-readability-redundant-smartptr-get.rst

Re: [PATCH] D21134: clang-tidy: new check readability-misplaced-array-index

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

A few nits.



Comment at: clang-tidy/readability/MisplacedArrayIndexCheck.h:19
@@ +18,3 @@
+
+/// Warn about unusual array index syntax (index[array] instead of
+/// array[index]).

Please enclose inline code snippets in backquotes.


Comment at: docs/clang-tidy/checks/readability-misplaced-array-index.rst:10
@@ +9,3 @@
+
+.. code:: c++
+

This should be `.. code-block:: c++`.


Comment at: docs/clang-tidy/checks/readability-misplaced-array-index.rst:13
@@ +12,3 @@
+  void f(int *x, int y) {
+y[x] = 0;
+  }

danielmarjamaki wrote:
> ok thanks same mistake I've done before. Should I start using uppercase 
> variable names from now on?
Interesting question. Probably, better to do so.


https://reviews.llvm.org/D21134



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


Re: [PATCH] D23842: [CFG] Add iterator_ranges to CFG and CFGBlock.

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh requested changes to this revision.
This revision now requires changes to proceed.


Comment at: include/clang/Analysis/CFG.h:526
@@ -524,1 +525,3 @@
   typedef AdjacentBlocks::const_reverse_iterator  const_pred_reverse_iterator;
+  typedef llvm::iterator_range  pred_range;
+  typedef llvm::iterator_range  pred_const_range;

Most of the time the new functions will be used in a range-based for loop. I 
don't think the type returned by the functions will need to be explicitly 
specified anywhere. I'd remove the typedefs.


https://reviews.llvm.org/D23842



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


Re: [PATCH] D20512: [PATCH] Bug 27475 - Request header guard check processes .hpp files as well as .h files

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh requested changes to this revision.
This revision now requires changes to proceed.


Comment at: clang-tidy/llvm/HeaderGuardCheck.cpp:18
@@ +17,3 @@
+  StringRef extension = ::llvm::sys::path::extension(Filename);
+  if (extension.size() > 0 && extension.front() == '.') {
+extension = extension.substr(1);

nit: In LLVM/Clang code it's not common to enclose single-line if/while/for 
bodies in braces.


Comment at: clang-tidy/llvm/HeaderGuardCheck.cpp:18
@@ +17,3 @@
+  StringRef extension = ::llvm::sys::path::extension(Filename);
+  if (extension.size() > 0 && extension.front() == '.') {
+extension = extension.substr(1);

alexfh wrote:
> nit: In LLVM/Clang code it's not common to enclose single-line if/while/for 
> bodies in braces.
`if (extension.startswith("."))`


Comment at: clang-tidy/llvm/HeaderGuardCheck.cpp:22
@@ +21,3 @@
+
+  if (HeaderFileExtensions.count(extension))
+return true;

`return HeaderFileExtensions.count(extension) > 0;`


Comment at: clang-tidy/llvm/HeaderGuardCheck.cpp:26
@@ -18,2 +25,3 @@
+  return false;
 }
 

Were you going to use `isHeaderFileExtension`, btw?


Comment at: clang-tidy/utils/HeaderFileExtensionsUtils.cpp:64
@@ -63,1 +63,3 @@
 
+bool isHeaderFileExtension(StringRef FileName, HeaderFileExtensionsSet 
HeaderFileExtensions) {
+  StringRef extension = ::llvm::sys::path::extension(FileName);

1. clang-format the code
2. see comments for `LLVMHeaderGuardCheck::shouldFixHeaderGuard` above


https://reviews.llvm.org/D20512



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


r279641 - clang-offload-bundler: Update libdeps.

2016-08-24 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Wed Aug 24 12:05:48 2016
New Revision: 279641

URL: http://llvm.org/viewvc/llvm-project?rev=279641=rev
Log:
clang-offload-bundler: Update libdeps.

Modified:
cfe/trunk/tools/clang-offload-bundler/CMakeLists.txt

Modified: cfe/trunk/tools/clang-offload-bundler/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-offload-bundler/CMakeLists.txt?rev=279641=279640=279641=diff
==
--- cfe/trunk/tools/clang-offload-bundler/CMakeLists.txt (original)
+++ cfe/trunk/tools/clang-offload-bundler/CMakeLists.txt Wed Aug 24 12:05:48 
2016
@@ -1,4 +1,4 @@
-set(LLVM_LINK_COMPONENTS support)
+set(LLVM_LINK_COMPONENTS BitWriter Core Object Support)
 
 add_clang_executable(clang-offload-bundler
   ClangOffloadBundler.cpp
@@ -6,8 +6,6 @@ add_clang_executable(clang-offload-bundl
 
 set(CLANG_OFFLOAD_BUNDLER_LIB_DEPS
   clangBasic
-  LLVMBitWriter
-  LLVMObject
   )
   
 add_dependencies(clang clang-offload-bundler)


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


r279639 - fix typo "varaible"

2016-08-24 Thread Nico Weber via cfe-commits
Author: nico
Date: Wed Aug 24 11:37:21 2016
New Revision: 279639

URL: http://llvm.org/viewvc/llvm-project?rev=279639=rev
Log:
fix typo "varaible"

Modified:
cfe/trunk/test/SemaCXX/warn-range-loop-analysis.cpp

Modified: cfe/trunk/test/SemaCXX/warn-range-loop-analysis.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-range-loop-analysis.cpp?rev=279639=279638=279639=diff
==
--- cfe/trunk/test/SemaCXX/warn-range-loop-analysis.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-range-loop-analysis.cpp Wed Aug 24 11:37:21 2016
@@ -29,7 +29,7 @@ struct Bar {
 // test1-6 are set in pairs, the odd numbers are the non-reference returning
 //   versions of the even numbers.
 // test7-9 use an array instead of a range object
-// tests use all four versions of the loop varaible, const , const T, T&, and
+// tests use all four versions of the loop variable, const , const T, T&, and
 //   T.  Versions producing errors and are commented out.
 //
 // Conversion chart:


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


Re: [PATCH] D20512: [PATCH] Bug 27475 - Request header guard check processes .hpp files as well as .h files

2016-08-24 Thread Mads Ravn via cfe-commits
madsravn updated this revision to Diff 69131.
madsravn marked 8 inline comments as done.
madsravn added a comment.

Updated the patch as suggested by hokein and alexfh.


https://reviews.llvm.org/D20512

Files:
  clang-tidy/llvm/HeaderGuardCheck.cpp
  clang-tidy/llvm/HeaderGuardCheck.h
  clang-tidy/utils/HeaderFileExtensionsUtils.cpp
  clang-tidy/utils/HeaderFileExtensionsUtils.h
  clang-tidy/utils/HeaderGuard.cpp
  clang-tidy/utils/HeaderGuard.h

Index: clang-tidy/utils/HeaderGuard.h
===
--- clang-tidy/utils/HeaderGuard.h
+++ clang-tidy/utils/HeaderGuard.h
@@ -11,16 +11,29 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_HEADERGUARD_H
 
 #include "../ClangTidy.h"
+#include "../utils/HeaderFileExtensionsUtils.h"
+#include "llvm/Support/Path.h"
 
 namespace clang {
 namespace tidy {
 namespace utils {
 
 /// Finds and fixes header guards.
+/// The check supports these options:
+///   - `HeaderFileExtensions`: a comma-separated list of filename extensions of
+/// header files (The filename extension should not contain "." prefix).
+/// ",h,hh,hpp,hxx" by default.
+/// For extension-less header files, using an empty string or leaving an
+/// empty string between "," if there are other filename extensions.
 class HeaderGuardCheck : public ClangTidyCheck {
 public:
   HeaderGuardCheck(StringRef Name, ClangTidyContext *Context)
-  : ClangTidyCheck(Name, Context) {}
+  : ClangTidyCheck(Name, Context),
+RawStringHeaderFileExtensions(
+  Options.getLocalOrGlobal("HeaderFileExtensions", ",h,hh,hpp,hxx")) {
+utils::parseHeaderFileExtensions(RawStringHeaderFileExtensions,
+ HeaderFileExtensions, ',');
+  }
   void registerPPCallbacks(CompilerInstance ) override;
 
   /// \brief Returns true if the checker should suggest inserting a trailing
@@ -39,6 +52,9 @@
   /// \brief Get the canonical header guard for a file.
   virtual std::string getHeaderGuard(StringRef Filename,
  StringRef OldGuard = StringRef()) = 0;
+private:
+  utils::HeaderFileExtensionsSet HeaderFileExtensions;
+  std::string RawStringHeaderFileExtensions;
 };
 
 } // namespace utils
Index: clang-tidy/utils/HeaderGuard.cpp
===
--- clang-tidy/utils/HeaderGuard.cpp
+++ clang-tidy/utils/HeaderGuard.cpp
@@ -274,13 +274,13 @@
 }
 
 bool HeaderGuardCheck::shouldSuggestEndifComment(StringRef FileName) {
-  return FileName.endswith(".h");
+  return utils::isHeaderFileExtension(FileName, HeaderFileExtensions);
 }
 
 bool HeaderGuardCheck::shouldFixHeaderGuard(StringRef FileName) { return true; }
 
 bool HeaderGuardCheck::shouldSuggestToAddHeaderGuard(StringRef FileName) {
-  return FileName.endswith(".h");
+  return utils::isHeaderFileExtension(FileName, HeaderFileExtensions);
 }
 
 std::string HeaderGuardCheck::formatEndIf(StringRef HeaderGuard) {
Index: clang-tidy/utils/HeaderFileExtensionsUtils.h
===
--- clang-tidy/utils/HeaderFileExtensionsUtils.h
+++ clang-tidy/utils/HeaderFileExtensionsUtils.h
@@ -41,6 +41,10 @@
HeaderFileExtensionsSet ,
char delimiter);
 
+/// \brief Decides whether a file has a header file extension
+bool isHeaderFileExtension(StringRef FileName,
+   HeaderFileExtensionsSet HeaderFileExtensions);
+
 } // namespace utils
 } // namespace tidy
 } // namespace clang
Index: clang-tidy/utils/HeaderFileExtensionsUtils.cpp
===
--- clang-tidy/utils/HeaderFileExtensionsUtils.cpp
+++ clang-tidy/utils/HeaderFileExtensionsUtils.cpp
@@ -61,6 +61,17 @@
   return true;
 }
 
+bool isHeaderFileExtension(StringRef FileName, HeaderFileExtensionsSet HeaderFileExtensions) {
+  StringRef extension = ::llvm::sys::path::extension(FileName);
+  if (extension.size() > 0 && extension.front() == '.') {
+extension = extension.substr(1);
+  }
+  if (HeaderFileExtensions.count(extension))
+return true;
+
+  return false;
+}
+
 } // namespace utils
 } // namespace tidy
 } // namespace clang
Index: clang-tidy/llvm/HeaderGuardCheck.h
===
--- clang-tidy/llvm/HeaderGuardCheck.h
+++ clang-tidy/llvm/HeaderGuardCheck.h
@@ -17,13 +17,27 @@
 namespace llvm {
 
 /// Finds and fixes header guards that do not adhere to LLVM style.
+/// The check supports these options:
+///   - `HeaderFileExtensions`: a comma-separated list of filename extensions of
+/// header files (The filename extension should not contain "." prefix).
+/// ",h,hh,hpp,hxx" by default.
+/// For extension-less header files, using an empty string or leaving an
+/// empty string between "," if there are other filename extensions.
 class LLVMHeaderGuardCheck : public 

Re: [PATCH] D23842: [CFG] Add iterator_ranges to CFG and CFGBlock.

2016-08-24 Thread Martin Böhme via cfe-commits
mboehme updated this revision to Diff 69129.
mboehme added a comment.

Re-add inadvertently deleted blank line


https://reviews.llvm.org/D23842

Files:
  include/clang/Analysis/CFG.h

Index: include/clang/Analysis/CFG.h
===
--- include/clang/Analysis/CFG.h
+++ include/clang/Analysis/CFG.h
@@ -22,6 +22,7 @@
 #include "llvm/ADT/GraphTraits.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/PointerIntPair.h"
+#include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/raw_ostream.h"
@@ -522,11 +523,15 @@
   typedef AdjacentBlocks::const_iterator  const_pred_iterator;
   typedef AdjacentBlocks::reverse_iterator  pred_reverse_iterator;
   typedef AdjacentBlocks::const_reverse_iterator  const_pred_reverse_iterator;
+  typedef llvm::iterator_range  pred_range;
+  typedef llvm::iterator_range  pred_const_range;
 
   typedef AdjacentBlocks::iterator  succ_iterator;
   typedef AdjacentBlocks::const_iterator  const_succ_iterator;
   typedef AdjacentBlocks::reverse_iterator  succ_reverse_iterator;
   typedef AdjacentBlocks::const_reverse_iterator  const_succ_reverse_iterator;
+  typedef llvm::iterator_range  succ_range;
+  typedef llvm::iterator_range  succ_const_range;
 
   pred_iteratorpred_begin(){ return Preds.begin();   }
   pred_iteratorpred_end()  { return Preds.end(); }
@@ -538,6 +543,13 @@
   const_pred_reverse_iterator  pred_rbegin() const { return Preds.rbegin();  }
   const_pred_reverse_iterator  pred_rend()   const { return Preds.rend();}
 
+  pred_range   preds() {
+return pred_range(pred_begin(), pred_end());
+  }
+  pred_const_range preds() const {
+return pred_const_range(pred_begin(), pred_end());
+  }
+
   succ_iteratorsucc_begin(){ return Succs.begin();   }
   succ_iteratorsucc_end()  { return Succs.end(); }
   const_succ_iterator  succ_begin()  const { return Succs.begin();   }
@@ -548,6 +560,13 @@
   const_succ_reverse_iterator  succ_rbegin() const { return Succs.rbegin();  }
   const_succ_reverse_iterator  succ_rend()   const { return Succs.rend();}
 
+  succ_range   succs() {
+return succ_range(succ_begin(), succ_end());
+  }
+  succ_const_range succs() const {
+return succ_const_range(succ_begin(), succ_end());
+  }
+
   unsigned succ_size()   const { return Succs.size();}
   bool succ_empty()  const { return Succs.empty();   }
 
@@ -840,6 +859,7 @@
 
   typedef llvm::DenseMap::const_iterator
 synthetic_stmt_iterator;
+  typedef llvm::iterator_range synthetic_stmt_range;
 
   /// Iterates over synthetic DeclStmts in the CFG.
   ///
@@ -855,6 +875,11 @@
 return SyntheticDeclStmts.end();
   }
 
+  /// \sa synthetic_stmt_begin
+  synthetic_stmt_range synthetic_stmts() const {
+return synthetic_stmt_range(synthetic_stmt_begin(), synthetic_stmt_end());
+  }
+
   
//======//
   // Member templates useful for various batch operations over CFGs.
   
//======//


Index: include/clang/Analysis/CFG.h
===
--- include/clang/Analysis/CFG.h
+++ include/clang/Analysis/CFG.h
@@ -22,6 +22,7 @@
 #include "llvm/ADT/GraphTraits.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/PointerIntPair.h"
+#include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/raw_ostream.h"
@@ -522,11 +523,15 @@
   typedef AdjacentBlocks::const_iterator  const_pred_iterator;
   typedef AdjacentBlocks::reverse_iterator  pred_reverse_iterator;
   typedef AdjacentBlocks::const_reverse_iterator  const_pred_reverse_iterator;
+  typedef llvm::iterator_range  pred_range;
+  typedef llvm::iterator_range  pred_const_range;
 
   typedef AdjacentBlocks::iterator  succ_iterator;
   typedef AdjacentBlocks::const_iterator  const_succ_iterator;
   typedef AdjacentBlocks::reverse_iterator  succ_reverse_iterator;
   typedef AdjacentBlocks::const_reverse_iterator  const_succ_reverse_iterator;
+  typedef llvm::iterator_range  succ_range;
+  typedef llvm::iterator_range  succ_const_range;
 
   pred_iteratorpred_begin(){ return Preds.begin();   }
   pred_iteratorpred_end()  { return Preds.end(); }
@@ -538,6 +543,13 @@
   const_pred_reverse_iterator  pred_rbegin() const { 

[PATCH] D23842: [CFG] Add iterator_ranges to CFG and CFGBlock.

2016-08-24 Thread Martin Böhme via cfe-commits
mboehme created this revision.
mboehme added a reviewer: alexfh.
mboehme added a subscriber: cfe-commits.

(Needed for D23353.)

https://reviews.llvm.org/D23842

Files:
  include/clang/Analysis/CFG.h

Index: include/clang/Analysis/CFG.h
===
--- include/clang/Analysis/CFG.h
+++ include/clang/Analysis/CFG.h
@@ -22,6 +22,7 @@
 #include "llvm/ADT/GraphTraits.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/PointerIntPair.h"
+#include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/raw_ostream.h"
@@ -522,11 +523,15 @@
   typedef AdjacentBlocks::const_iterator  const_pred_iterator;
   typedef AdjacentBlocks::reverse_iterator  pred_reverse_iterator;
   typedef AdjacentBlocks::const_reverse_iterator  const_pred_reverse_iterator;
+  typedef llvm::iterator_range  pred_range;
+  typedef llvm::iterator_range  pred_const_range;
 
   typedef AdjacentBlocks::iterator  succ_iterator;
   typedef AdjacentBlocks::const_iterator  const_succ_iterator;
   typedef AdjacentBlocks::reverse_iterator  succ_reverse_iterator;
   typedef AdjacentBlocks::const_reverse_iterator  const_succ_reverse_iterator;
+  typedef llvm::iterator_range  succ_range;
+  typedef llvm::iterator_range  succ_const_range;
 
   pred_iteratorpred_begin(){ return Preds.begin();   }
   pred_iteratorpred_end()  { return Preds.end(); }
@@ -538,6 +543,13 @@
   const_pred_reverse_iterator  pred_rbegin() const { return Preds.rbegin();  }
   const_pred_reverse_iterator  pred_rend()   const { return Preds.rend();}
 
+  pred_range   preds() {
+return pred_range(pred_begin(), pred_end());
+  }
+  pred_const_range preds() const {
+return pred_const_range(pred_begin(), pred_end());
+  }
+
   succ_iteratorsucc_begin(){ return Succs.begin();   }
   succ_iteratorsucc_end()  { return Succs.end(); }
   const_succ_iterator  succ_begin()  const { return Succs.begin();   }
@@ -548,13 +560,19 @@
   const_succ_reverse_iterator  succ_rbegin() const { return Succs.rbegin();  }
   const_succ_reverse_iterator  succ_rend()   const { return Succs.rend();}
 
+  succ_range   succs() {
+return succ_range(succ_begin(), succ_end());
+  }
+  succ_const_range succs() const {
+return succ_const_range(succ_begin(), succ_end());
+  }
+
   unsigned succ_size()   const { return Succs.size();}
   bool succ_empty()  const { return Succs.empty();   }
 
   unsigned pred_size()   const { return Preds.size();}
   bool pred_empty()  const { return Preds.empty();   }
 
-
   class FilterOptions {
   public:
 FilterOptions() {
@@ -840,6 +858,7 @@
 
   typedef llvm::DenseMap::const_iterator
 synthetic_stmt_iterator;
+  typedef llvm::iterator_range synthetic_stmt_range;
 
   /// Iterates over synthetic DeclStmts in the CFG.
   ///
@@ -855,6 +874,11 @@
 return SyntheticDeclStmts.end();
   }
 
+  /// \sa synthetic_stmt_begin
+  synthetic_stmt_range synthetic_stmts() const {
+return synthetic_stmt_range(synthetic_stmt_begin(), synthetic_stmt_end());
+  }
+
   
//======//
   // Member templates useful for various batch operations over CFGs.
   
//======//


Index: include/clang/Analysis/CFG.h
===
--- include/clang/Analysis/CFG.h
+++ include/clang/Analysis/CFG.h
@@ -22,6 +22,7 @@
 #include "llvm/ADT/GraphTraits.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/PointerIntPair.h"
+#include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/raw_ostream.h"
@@ -522,11 +523,15 @@
   typedef AdjacentBlocks::const_iterator  const_pred_iterator;
   typedef AdjacentBlocks::reverse_iterator  pred_reverse_iterator;
   typedef AdjacentBlocks::const_reverse_iterator  const_pred_reverse_iterator;
+  typedef llvm::iterator_range  pred_range;
+  typedef llvm::iterator_range  pred_const_range;
 
   typedef AdjacentBlocks::iterator  succ_iterator;
   typedef AdjacentBlocks::const_iterator  const_succ_iterator;
   typedef AdjacentBlocks::reverse_iterator  succ_reverse_iterator;
   typedef AdjacentBlocks::const_reverse_iterator  const_succ_reverse_iterator;
+  typedef llvm::iterator_range  succ_range;
+  typedef llvm::iterator_range  

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

2016-08-24 Thread Marshall Clow via cfe-commits
mclow.lists added a comment.

This diff no longer applies cleanly, and I've added some formatting concerns.  
However, the //content// looks fine to me.



Comment at: include/array:176
@@ -175,3 +175,3 @@
 _LIBCPP_INLINE_VISIBILITY
-const_iterator cend() const _NOEXCEPT {return end();}
+_LIBCPP_CONSTEXPR_AFTER_CXX14 const_iterator cend() const _NOEXCEPT 
{return end();}
 _LIBCPP_INLINE_VISIBILITY

Nit: I would put the `_LIBCPP_CONSTEXPR_AFTER_CXX14` on the same line as 
`_LIBCPP_INLINE_VISIBILITY` to keep the lines from getting too long.


Comment at: include/array:191
@@ -190,3 +190,3 @@
 // element access:
-_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) 
{return __elems_[__n];}
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference 
operator[](size_type __n) {return __elems_[__n];}
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference 
operator[](size_type __n) const {return __elems_[__n];}

And break this line after the macros for the same reason as L#176



Comment at: include/iterator:526
@@ -525,2 +525,3 @@
 template 
 inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR_AFTER_CXX14

Here, I would smoosh them all together on the same line: `inline 
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14`


https://reviews.llvm.org/D22584



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


r279635 - Add target REQUIRES directives to offload bundler test.

2016-08-24 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Wed Aug 24 10:47:06 2016
New Revision: 279635

URL: http://llvm.org/viewvc/llvm-project?rev=279635=rev
Log:
Add target REQUIRES directives to offload bundler test. 

Modified:
cfe/trunk/test/Driver/clang-offload-bundler.c

Modified: cfe/trunk/test/Driver/clang-offload-bundler.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-offload-bundler.c?rev=279635=279634=279635=diff
==
--- cfe/trunk/test/Driver/clang-offload-bundler.c (original)
+++ cfe/trunk/test/Driver/clang-offload-bundler.c Wed Aug 24 10:47:06 2016
@@ -1,3 +1,6 @@
+// REQUIRES: x86-registered-target
+// REQUIRES: powerpc-registered-target
+
 //
 // Generate all the types of files we can bundle.
 //


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


r279634 - [Driver][OpenMP][CUDA] Add capability to bundle object files in sections of the host binary format.

2016-08-24 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Wed Aug 24 10:39:07 2016
New Revision: 279634

URL: http://llvm.org/viewvc/llvm-project?rev=279634=rev
Log:
[Driver][OpenMP][CUDA] Add capability to bundle object files in sections of the 
host binary format.

Summary:
This patch adds the capability to bundle object files in sections of the host 
binary using a designated naming convention for these sections. This patch uses 
the functionality of the object reader already in the LLVM library to read 
bundled files, and invokes clang with the incremental linking options to create 
bundle files. 

Bundling files involves creating an IR file with the contents of the bundle 
assigned as initializers of globals binded to the designated sections. This way 
the bundling implementation is agnostic of the host object format.

The features added by this patch were requested in the RFC discussion in  
http://lists.llvm.org/pipermail/cfe-dev/2016-February/047547.html.

Reviewers: echristo, tra, jlebar, hfinkel, ABataev, Hahnfeld

Subscribers: mkuron, whchung, cfe-commits, andreybokhanko, Hahnfeld, 
arpith-jacob, carlo.bertolli, mehdi_amini, caomhin

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

Added:
cfe/trunk/test/Driver/clang-offload-bundler.c.o
Modified:
cfe/trunk/test/Driver/clang-offload-bundler.c
cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp

Modified: cfe/trunk/test/Driver/clang-offload-bundler.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-offload-bundler.c?rev=279634=279633=279634=diff
==
--- cfe/trunk/test/Driver/clang-offload-bundler.c (original)
+++ cfe/trunk/test/Driver/clang-offload-bundler.c Wed Aug 24 10:39:07 2016
@@ -6,6 +6,7 @@
 // RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -S -emit-llvm -o %t.ll
 // RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -c -emit-llvm -o %t.bc
 // RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -S -o %t.s
+// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -c -o %t.o
 // RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -emit-ast -o %t.ast
 
 //
@@ -215,6 +216,40 @@
 // RUN: diff %t.empty %t.res.tgt1
 // RUN: diff %t.empty %t.res.tgt2
 
+//
+// Check object bundle/unbundle. The content should be bundled into an ELF
+// section (we are using a PowerPC little-endian host which uses ELF). We
+// have an already bundled file to check the unbundle and do a dry run on the
+// bundling as it cannot be tested in all host platforms that will run these
+// tests.
+//
+
+// RUN: clang-offload-bundler -type=o 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.o,%t.tgt1,%t.tgt2 -outputs=%t.bundle3.o -### -dump-temporary-files 
2>&1 \
+// RUN: | FileCheck %s --check-prefix CK-OBJ-CMD
+// CK-OBJ-CMD: private constant [1 x i8] zeroinitializer, section 
"__CLANG_OFFLOAD_BUNDLE__host-powerpc64le-ibm-linux-gnu"
+// CK-OBJ-CMD: private constant [25 x i8] c"Content of device file 1\0A", 
section "__CLANG_OFFLOAD_BUNDLE__openmp-powerpc64le-ibm-linux-gnu"
+// CK-OBJ-CMD: private constant [25 x i8] c"Content of device file 2\0A", 
section "__CLANG_OFFLOAD_BUNDLE__openmp-x86_64-pc-linux-gnu"
+// CK-OBJ-CMD: clang" "-r" "-target" "powerpc64le-ibm-linux-gnu" "-o" 
"{{.+}}.o" "{{.+}}.o" "{{.+}}.bc" "-nostdlib"
+
+// RUN: clang-offload-bundler -type=o 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -outputs=%t.res.o,%t.res.tgt1,%t.res.tgt2 -inputs=%s.o -unbundle
+// RUN: diff %s.o %t.res.o
+// RUN: diff %t.tgt1 %t.res.tgt1
+// RUN: diff %t.tgt2 %t.res.tgt2
+// RUN: clang-offload-bundler -type=o 
-targets=openmp-powerpc64le-ibm-linux-gnu,host-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -outputs=%t.res.tgt1,%t.res.o,%t.res.tgt2 -inputs=%s.o -unbundle
+// RUN: diff %s.o %t.res.o
+// RUN: diff %t.tgt1 %t.res.tgt1
+// RUN: diff %t.tgt2 %t.res.tgt2
+
+// Check if we can unbundle a file with no magic strings.
+// RUN: clang-offload-bundler -type=o 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -outputs=%t.res.o,%t.res.tgt1,%t.res.tgt2 -inputs=%t.o -unbundle
+// RUN: diff %t.o %t.res.o
+// RUN: diff %t.empty %t.res.tgt1
+// RUN: diff %t.empty %t.res.tgt2
+// RUN: clang-offload-bundler -type=o 
-targets=openmp-powerpc64le-ibm-linux-gnu,host-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -outputs=%t.res.tgt1,%t.res.o,%t.res.tgt2 -inputs=%t.o -unbundle
+// RUN: diff %t.o %t.res.o
+// RUN: diff %t.empty %t.res.tgt1
+// RUN: diff %t.empty %t.res.tgt2
+
 // Some code so that we can create a binary out of this file.
 int A = 0;
 void test_func(void) {

Added: cfe/trunk/test/Driver/clang-offload-bundler.c.o
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-offload-bundler.c.o?rev=279634=auto
==
Binary 

Re: [PATCH] D23279: clang-reorder-fields

2016-08-24 Thread Daniel Jasper via cfe-commits
djasper added inline comments.


Comment at: clang-reorder-fields/ReorderFieldsAction.cpp:137
@@ +136,3 @@
+std::end(NewWrittenInitializersOrder), ByFieldNewPosition);
+  assert(OldWrittenInitializersOrder.size() ==
+ NewWrittenInitializersOrder.size());

djasper wrote:
> This assert seems pretty useless.
Actually no, this is fine.


Comment at: clang-reorder-fields/ReorderFieldsAction.h:31
@@ +30,3 @@
+
+public:
+  ReorderFieldsAction(

ioeric wrote:
> alexshap wrote:
> > alexshap wrote:
> > > djasper wrote:
> > > > I don't why clang-rename does what it does at the moment. My main point 
> > > > is that we have already implemented splitting up replacements by file 
> > > > in groupByReplacementsByFile. No need to reimplement that here or make 
> > > > the interface of this function more complex than it needs to be.
> > > sorry, i am not sure i got ur comment - need to think  - maybe i am too 
> > > sleepy - 
> > > the issue is not with clang-rename, but with class RefactoringTool
> > > and more precisely with the method the method getReplacements.
> > pls, take a look at my previous comments (especially regarding the diff 
> > https://reviews.llvm.org/D21748?id=64016.)
> >  
> > meanwhile: 
> > http://clang.llvm.org/doxygen/Replacement_8h_source.html
> > 
> >   **/// \brief Adds a new replacement \p R to the current set of 
> > replacements.
> >   160   /// \p R must have the same file path as all existing replacements. 
> > **
> >   161   /// Returns true if the replacement is successfully inserted; 
> > otherwise,
> >   162   /// it returns an llvm::Error, i.e. there is a conflict between R 
> > and the
> >   163   /// existing replacements or R's file path is different from the 
> > filepath of
> >   164   /// existing replacements. Callers must explicitly check the Error 
> > returned.
> >   165   /// This prevents users from adding order-dependent replacements. 
> > To control
> >   166   /// the order in which order-dependent replacements are applied, use
> >   167   /// merge({R}) with R referring to the changed code after applying 
> > all
> >   168   /// existing replacements.
> >   169   /// Replacements with offset UINT_MAX are special - we do not 
> > detect conflicts
> >   170   /// for such replacements since users may add them intentionally as 
> > a special
> >   171   /// category of replacements.
> >   172   llvm::Error add(const Replacement );
> > 
> > at this point it seems like groupReplacementsByFile was made redundant by 
> > https://reviews.llvm.org/D21748
> > 
> > @ioeric, could u comment on this ?  I apologize in advance - i might be 
> > missing smth / might be to sleepy. Will take a look at this again tomorrow
> > 
> > P.S. just in case - ReorderingFieldsAction can change different files 
> > (including headers etc) - so i simply can not use a single Replacements 
> > object
> We don't have an implementation for grouping replacements by file yet (for 
> class implementation of `tooling::Replacements`). The previous 
> `groupReplacementsByFile` indeed should have been deprecated. At this point, 
> tools which carry replacements for multiple files use a map from file names 
> to `tooling::Replacements` (usually called `FileToReplacements`) like what 
> you do here.
Ok.. Then nevermind and sorry for the noise..

Defining a typedef as Eric suggests probably makes this a bit easier to read.


Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


r279632 - clang-offload-bundler - offload files bundling/unbundling tool

2016-08-24 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Wed Aug 24 10:21:05 2016
New Revision: 279632

URL: http://llvm.org/viewvc/llvm-project?rev=279632=rev
Log:
clang-offload-bundler - offload files bundling/unbundling tool

Summary:
One of the goals of programming models that support offloading (e.g. OpenMP) is 
to enable users to offload with little effort, by annotating the code with a 
few pragmas. I'd also like to save users the trouble of changing their existent 
applications' build system. So having the compiler always return a single file 
instead of one for the host and each target even if the user is doing separate 
compilation is desirable.

This diff proposes a tool named clang-offload-bundler (happy to change the name 
if required) that is used to bundle files associated with the same user source 
file but different targets, or to unbundle a file into separate files 
associated with different targets.

This tool supports the driver support for OpenMP under review in 
http://reviews.llvm.org/D9888. The tool is used there to enable separate 
compilation, so that the very first action on input files that are not source 
files is a "unbundling action" and the very last non-linking action is a 
"bundling action".

The format of the bundled files is currently very simple: text formats are 
concatenated with comments that have a magic string and target identifying 
triple in between, and binary formats have a header that contains the triple 
and the offset and size of the code for host and each target.

The goal is to improve this tool in the future to deal with archive files so 
that each individual file in the archive is properly dealt with. We see that 
archives are very commonly used in current applications to combine separate 
compilation results. So I'm convinced users would enjoy this feature.

This tool can be used like this:

`clang-offload-bundler -targets=triple1,triple2 -type=ii 
-inputs=a.triple1.ii,a.triple2.ii -outputs=a.ii`

or 

`clang-offload-bundler -targets=triple1,triple2 -type=ii 
-outputs=a.triple1.ii,a.triple2.ii -inputs=a.ii -unbundle`

I implemented the tool under clang/tools. Please let me know if something like 
this should live somewhere else.

This patch is prerequisite for http://reviews.llvm.org/D9888.

Reviewers: hfinkel, rsmith, echristo, chandlerc, tra, jlebar, ABataev, Hahnfeld

Subscribers: whchung, caomhin, andreybokhanko, arpith-jacob, carlo.bertolli, 
mehdi_amini, guansong, Hahnfeld, cfe-commits

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

Added:
cfe/trunk/test/Driver/clang-offload-bundler.c
cfe/trunk/tools/clang-offload-bundler/
cfe/trunk/tools/clang-offload-bundler/CMakeLists.txt
cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp
Modified:
cfe/trunk/test/CMakeLists.txt
cfe/trunk/tools/CMakeLists.txt

Modified: cfe/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=279632=279631=279632=diff
==
--- cfe/trunk/test/CMakeLists.txt (original)
+++ cfe/trunk/test/CMakeLists.txt Wed Aug 24 10:21:05 2016
@@ -29,6 +29,7 @@ list(APPEND CLANG_TEST_DEPS
   clang-format
   c-index-test diagtool
   clang-tblgen
+  clang-offload-bundler
   )
   
 if(CLANG_ENABLE_STATIC_ANALYZER)

Added: cfe/trunk/test/Driver/clang-offload-bundler.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-offload-bundler.c?rev=279632=auto
==
--- cfe/trunk/test/Driver/clang-offload-bundler.c (added)
+++ cfe/trunk/test/Driver/clang-offload-bundler.c Wed Aug 24 10:21:05 2016
@@ -0,0 +1,222 @@
+//
+// Generate all the types of files we can bundle.
+//
+// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -E -o %t.i
+// RUN: %clangxx -O0 -target powerpc64le-ibm-linux-gnu -x c++ %s -E -o %t.ii
+// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -S -emit-llvm -o %t.ll
+// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -c -emit-llvm -o %t.bc
+// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -S -o %t.s
+// RUN: %clang -O0 -target powerpc64le-ibm-linux-gnu %s -emit-ast -o %t.ast
+
+//
+// Generate an empty file to help with the checks of empty files.
+//
+// RUN: touch %t.empty
+
+//
+// Generate a couple of files to bundle with.
+//
+// RUN: echo 'Content of device file 1' > %t.tgt1
+// RUN: echo 'Content of device file 2' > %t.tgt2
+
+//
+// Check help message.
+//
+// RUN: clang-offload-bundler --help | FileCheck %s --check-prefix CK-HELP
+// CK-HELP: {{.*}}OVERVIEW: A tool to bundle several input files of the 
specified type 
+// CK-HELP: {{.*}}referring to the same source file but different targets into 
a single
+// CK-HELP: {{.*}}one. The resulting file can also be unbundled into different 
files by
+// CK-HELP: {{.*}}this tool if -unbundle is provided.
+// CK-HELP: {{.*}}USAGE: clang-offload-bundler [subcommand] [options]
+// CK-HELP: 

Re: [PATCH] D13909: clang-offload-bundler - offload files bundling/unbundling tool

2016-08-24 Thread Jonas Hahnfeld via cfe-commits
Hahnfeld added a comment.

SGTM


https://reviews.llvm.org/D13909



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


Re: [PATCH] D13909: clang-offload-bundler - offload files bundling/unbundling tool

2016-08-24 Thread Samuel Antao via cfe-commits
sfantao added a comment.

Hi Jonas,

Thanks again for the review!



Comment at: test/CMakeLists.txt:27-33
@@ -26,8 +26,9 @@
 
 list(APPEND CLANG_TEST_DEPS
   clang clang-headers
   clang-format
   c-index-test diagtool
   clang-tblgen
+  clang-offload-bundler
   )
   

Hahnfeld wrote:
> Most users will get it anyway because it is built for the `install` target 
> and I think the build system should do its best to build and install all 
> needed dependencies.
> 
> I think this currently only fails when using `make clang` and then trying to 
> invoke the compiler from the build directory. I agree that this should be 
> quite rare but that could be fixed by `add_dependencies(clang 
> clang-offload-bundler)` which has worked for me. However I now don't have a 
> really strong opinion here because it works with the `install` target.
Ok, I added the line `add_dependencies(clang clang-offload-bundler) ` as you 
suggest. I was worried that referring to clang libs would cause a circular 
dependency, but it seems to work just fine.


https://reviews.llvm.org/D13909



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


Re: [PATCH] D13909: clang-offload-bundler - offload files bundling/unbundling tool

2016-08-24 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 69124.
sfantao marked an inline comment as done.
sfantao added a comment.

- Add clang-offload bundler as dependency to clang.


https://reviews.llvm.org/D13909

Files:
  test/CMakeLists.txt
  test/Driver/clang-offload-bundler.c
  tools/CMakeLists.txt
  tools/clang-offload-bundler/CMakeLists.txt
  tools/clang-offload-bundler/ClangOffloadBundler.cpp

Index: tools/clang-offload-bundler/ClangOffloadBundler.cpp
===
--- /dev/null
+++ tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -0,0 +1,681 @@
+//===-- clang-offload-bundler/ClangOffloadBundler.cpp - Clang format tool -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+///
+/// \file
+/// \brief This file implements a clang-offload-bundler that bundles different
+/// files that relate with the same source code but different targets into a
+/// single one. Also the implements the opposite functionality, i.e. unbundle
+/// files previous created by this tool.
+///
+//===--===//
+
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/Version.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Bitcode/ReaderWriter.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/Module.h"
+#include "llvm/Object/Binary.h"
+#include "llvm/Object/ELFObjectFile.h"
+#include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Program.h"
+#include "llvm/Support/Signals.h"
+
+using namespace llvm;
+using namespace llvm::object;
+
+static cl::opt Help("h", cl::desc("Alias for -help"), cl::Hidden);
+
+// Mark all our options with this category, everything else (except for -version
+// and -help) will be hidden.
+static cl::OptionCategory
+ClangOffloadBundlerCategory("clang-offload-bundler options");
+
+static cl::list
+InputFileNames("inputs", cl::CommaSeparated, cl::OneOrMore,
+   cl::desc("[,...]"),
+   cl::cat(ClangOffloadBundlerCategory));
+static cl::list
+OutputFileNames("outputs", cl::CommaSeparated, cl::OneOrMore,
+cl::desc("[,...]"),
+cl::cat(ClangOffloadBundlerCategory));
+static cl::list
+TargetNames("targets", cl::CommaSeparated, cl::OneOrMore,
+cl::desc("[-,...]"),
+cl::cat(ClangOffloadBundlerCategory));
+static cl::opt
+FilesType("type", cl::Required,
+  cl::desc("Type of the files to be bundled/unbundled.\n"
+   "Current supported types are:\n"
+   "  i   - cpp-output\n"
+   "  ii  - c++-cpp-output\n"
+   "  ll  - llvm\n"
+   "  bc  - llvm-bc\n"
+   "  s   - assembler\n"
+   "  o   - object\n"
+   "  gch - precompiled-header\n"
+   "  ast - clang AST file"),
+  cl::cat(ClangOffloadBundlerCategory));
+static cl::opt
+Unbundle("unbundle",
+ cl::desc("Unbundle bundled file into several output files.\n"),
+ cl::init(false), cl::cat(ClangOffloadBundlerCategory));
+
+/// Magic string that marks the existence of offloading data.
+#define OFFLOAD_BUNDLER_MAGIC_STR "__CLANG_OFFLOAD_BUNDLE__"
+
+/// The index of the host input in the list of inputs.
+static unsigned HostInputIndex = ~0u;
+
+/// Obtain the offload kind and real machine triple out of the target
+/// information specified by the user.
+static void getOffloadKindAndTriple(StringRef Target, StringRef ,
+StringRef ) {
+  auto KindTriplePair = Target.split('-');
+  OffloadKind = KindTriplePair.first;
+  Triple = KindTriplePair.second;
+}
+static bool hasHostKind(StringRef Target) {
+  StringRef OffloadKind;
+  StringRef Triple;
+  getOffloadKindAndTriple(Target, OffloadKind, Triple);
+  return OffloadKind == "host";
+}
+
+/// Generic file handler interface.
+class FileHandler {
+public:
+  /// Update the file handler with information from the header of the bundled
+  /// file
+  virtual void ReadHeader(MemoryBuffer ) = 0;
+  /// Read the marker of the next bundled to be read in the file. The triple of
+  /// the target associated with that bundle is returned. An empty string is
+  /// returned if there are no more bundles to be read.
+  virtual StringRef ReadBundleStart(MemoryBuffer ) = 0;
+  /// Read the marker that closes the current bundle.
+  virtual void ReadBundleEnd(MemoryBuffer ) = 0;
+  /// Read the current bundle and write the result into the stream 

[PATCH] D23840: New options -fexceptions-fp-math and -fdenormal-fp-math

2016-08-24 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: jmolloy, ddunbar, rengolin, sanjoy.
SjoerdMeijer added a subscriber: cfe-commits.

This adds options -fexceptions-fp-math and -fdenormal-fp-math, which are 
translated to function attributes. This is intended to be mapped on build 
attributes FP_exceptions and FP_denormal. Setting these build attributes allows 
better selection of floating point libraries.


https://reviews.llvm.org/D23840

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CGCall.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/denormalfpmode.c
  test/CodeGen/noexceptionsfpmath.c
  test/Driver/fast-math.c

Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -231,3 +231,20 @@
 // CHECK-NO-UNSAFE-MATH: "-cc1"
 // CHECK-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
 // CHECK-NO-UNSAFE-MATH: "-o"
+//
+// RUN: %clang -### -fexceptions-fp-math -fno-exceptions-fp-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-FP-EXCEPTIONS %s
+// RUN: %clang -### -fno-exceptions-fp-math -fexceptions-fp-math -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-EXCEPTIONS %s
+// CHECK-NO-FP-EXCEPTIONS: "-fno-exceptions-fp-math"
+// CHECK-FP-EXCEPTIONS-NOT: "-fno-exceptions-fp-math"
+//
+// RUN: %clang -### -fdenormal-fp-math=ieee -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-IEEE %s
+// RUN: %clang -### -fdenormal-fp-math=preserve-sign -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PS %s
+// RUN: %clang -### -fdenormal-fp-math=positive-zero -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-FP-DENORMAL-PZ %s
+// CHECK-FP-DENORMAL-IEEE: "-fdenormal-fp-math=ieee"
+// CHECK-FP-DENORMAL-PS: "-fdenormal-fp-math=preserve-sign"
+// CHECK-FP-DENORMAL-PZ: "-fdenormal-fp-math=positive-zero"
Index: test/CodeGen/noexceptionsfpmath.c
===
--- /dev/null
+++ test/CodeGen/noexceptionsfpmath.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -S -fno-exceptions-fp-math %s -emit-llvm -o - | FileCheck %s
+
+// CHECK-LABEL: main
+// CHECK: attributes #0 = {{.*}}"no-exceptions-fp-math"="true"{{.*}}
+
+int main() {
+  return 0;
+}
Index: test/CodeGen/denormalfpmode.c
===
--- /dev/null
+++ test/CodeGen/denormalfpmode.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -S -fdenormal-fp-math=ieee %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-IEEE
+// RUN: %clang_cc1 -S -fdenormal-fp-math=preserve-sign %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PS
+// RUN: %clang_cc1 -S -fdenormal-fp-math=positive-zero %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-PZ
+
+// CHECK-LABEL: main
+// CHECK-IEEE: attributes #0 = {{.*}}"denormal-fp-math"="ieee"{{.*}}
+// CHECK-PS: attributes #0 = {{.*}}"denormal-fp-math"="preserve-sign"{{.*}}
+// CHECK-PZ: attributes #0 = {{.*}}"denormal-fp-math"="positive-zero"{{.*}}
+
+int main() {
+  return 0;
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -575,6 +575,7 @@
   Opts.CorrectlyRoundedDivSqrt =
   Args.hasArg(OPT_cl_fp32_correctly_rounded_divide_sqrt);
   Opts.ReciprocalMath = Args.hasArg(OPT_freciprocal_math);
+  Opts.NoExceptionsFPMath = Args.hasArg(OPT_fno_exceptions_fp_math);
   Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);
   Opts.BackendOptions = Args.getAllArgValues(OPT_backend_option);
   Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags);
@@ -791,6 +792,18 @@
   Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
   }
 
+  if (Arg *A = Args.getLastArg(OPT_fdenormal_fp_math_EQ)) {
+StringRef Val = A->getValue();
+if (Val == "ieee")
+  Opts.FPDenormalMode = "ieee";
+else if (Val == "preserve-sign")
+  Opts.FPDenormalMode = "preserve-sign";
+else if (Val == "positive-zero")
+  Opts.FPDenormalMode = "positive-zero";
+else
+  Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Val;
+  }
+
   if (Arg *A = Args.getLastArg(OPT_fpcc_struct_return, OPT_freg_struct_return)) {
 if (A->getOption().matches(OPT_fpcc_struct_return)) {
   Opts.setStructReturnConvention(CodeGenOptions::SRCK_OnStack);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4362,6 +4362,15 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
+  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
+Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
+
+  if (Arg * A = 

[PATCH] D23837: Fix colored diagnostics from tools

2016-08-24 Thread Olivier Goffart via cfe-commits
ogoffart created this revision.
ogoffart added reviewers: bruno, dexonsmith, cfe-commits.
Herald added a subscriber: klimek.

r271042 changed the way the diagnostic arguments are parsed. It assumes that
the diagnostics options were already parsed by the "Driver".
For tools using clang::Tooling, the diagnostics argument were not parsed.


https://reviews.llvm.org/D23837

Files:
  lib/Tooling/Tooling.cpp

Index: lib/Tooling/Tooling.cpp
===
--- lib/Tooling/Tooling.cpp
+++ lib/Tooling/Tooling.cpp
@@ -15,6 +15,7 @@
 #include "clang/Tooling/Tooling.h"
 #include "clang/Driver/Compilation.h"
 #include "clang/Driver/Driver.h"
+#include "clang/Driver/Options.h"
 #include "clang/Driver/Tool.h"
 #include "clang/Driver/ToolChain.h"
 #include "clang/Frontend/ASTUnit.h"
@@ -26,6 +27,7 @@
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Config/llvm-config.h"
+#include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/FileSystem.h"
@@ -241,6 +243,9 @@
 Argv.push_back(Str.c_str());
   const char *const BinaryName = Argv[0];
   IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
+  unsigned MissingArgIndex, MissingArgCount;
+  llvm::opt::InputArgList ParsedArgs = 
driver::createDriverOptTable()->ParseArgs(ArrayRef(Argv).slice(1), MissingArgIndex, MissingArgCount);
+  ParseDiagnosticArgs(*DiagOpts, ParsedArgs);
   TextDiagnosticPrinter DiagnosticPrinter(
   llvm::errs(), &*DiagOpts);
   DiagnosticsEngine Diagnostics(


Index: lib/Tooling/Tooling.cpp
===
--- lib/Tooling/Tooling.cpp
+++ lib/Tooling/Tooling.cpp
@@ -15,6 +15,7 @@
 #include "clang/Tooling/Tooling.h"
 #include "clang/Driver/Compilation.h"
 #include "clang/Driver/Driver.h"
+#include "clang/Driver/Options.h"
 #include "clang/Driver/Tool.h"
 #include "clang/Driver/ToolChain.h"
 #include "clang/Frontend/ASTUnit.h"
@@ -26,6 +27,7 @@
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Config/llvm-config.h"
+#include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/FileSystem.h"
@@ -241,6 +243,9 @@
 Argv.push_back(Str.c_str());
   const char *const BinaryName = Argv[0];
   IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
+  unsigned MissingArgIndex, MissingArgCount;
+  llvm::opt::InputArgList ParsedArgs = driver::createDriverOptTable()->ParseArgs(ArrayRef(Argv).slice(1), MissingArgIndex, MissingArgCount);
+  ParseDiagnosticArgs(*DiagOpts, ParsedArgs);
   TextDiagnosticPrinter DiagnosticPrinter(
   llvm::errs(), &*DiagOpts);
   DiagnosticsEngine Diagnostics(
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21502: Fix heuristics skipping invalid ctor-initializers with C++11

2016-08-24 Thread Olivier Goffart via cfe-commits
ogoffart added a comment.

Ping!


https://reviews.llvm.org/D21502



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


Re: [PATCH] D21134: clang-tidy: new check readability-misplaced-array-index

2016-08-24 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 6 inline comments as done.


Comment at: clang-tidy/readability/MisplacedArrayIndexCheck.cpp:57
@@ +56,2 @@
+} // namespace tidy
+} // namespace clang

I removed hasMacroId() and use fixit::getText(). The replacements look good now.


Comment at: docs/clang-tidy/checks/readability-misplaced-array-index.rst:13
@@ +12,3 @@
+  void f(int *x, int y) {
+y[x] = 0;
+  }

ok thanks same mistake I've done before. Should I start using uppercase 
variable names from now on?


https://reviews.llvm.org/D21134



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


Re: [PATCH] D21134: clang-tidy: new check readability-misplaced-array-index

2016-08-24 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 69113.
danielmarjamaki added a comment.

fixed review comments


https://reviews.llvm.org/D21134

Files:
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/MisplacedArrayIndexCheck.cpp
  clang-tidy/readability/MisplacedArrayIndexCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-misplaced-array-index.rst
  test/clang-tidy/readability-misplaced-array-index.cpp

Index: test/clang-tidy/readability-misplaced-array-index.cpp
===
--- test/clang-tidy/readability-misplaced-array-index.cpp
+++ test/clang-tidy/readability-misplaced-array-index.cpp
@@ -0,0 +1,36 @@
+// RUN: %check_clang_tidy %s readability-misplaced-array-index %t
+
+#define ABC  "abc"
+
+struct XY { int *x; int *y; };
+
+void dostuff(int);
+
+void unusualSyntax(int *x, struct XY *xy)
+{
+  10[x] = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: confusing array subscript expression, usually the index is inside the []
+  // CHECK-FIXES: x[10] = 0;
+
+  10[xy->x] = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: confusing array subscript expression
+  // CHECK-FIXES: xy->x[10] = 0;
+
+  dostuff(1["abc"]);
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: confusing array subscript expression
+  // CHECK-FIXES:  dostuff("abc"[1]);
+
+  dostuff(1[ABC]);
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: confusing array subscript expression
+  // CHECK-FIXES:  dostuff(ABC[1]);
+
+  dostuff(0[0 + ABC]);
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: confusing array subscript expression
+  // CHECK-FIXES:  dostuff(0[0 + ABC]);
+  // No fixit. Probably the code should be ABC[0]
+}
+
+void normalSyntax(int *x)
+{
+  x[10] = 0;
+}
Index: docs/clang-tidy/checks/readability-misplaced-array-index.rst
===
--- docs/clang-tidy/checks/readability-misplaced-array-index.rst
+++ docs/clang-tidy/checks/readability-misplaced-array-index.rst
@@ -0,0 +1,27 @@
+.. title:: clang-tidy - readability-misplaced-array-index
+
+readability-misplaced-array-index
+=
+
+This check warns for unusual array index syntax.
+
+The following code has unusual array index syntax:
+
+.. code:: c++
+
+  void f(int *x, int y) {
+y[x] = 0;
+  }
+
+becomes
+
+.. code:: c++
+
+  void f(int *x, int y) {
+x[y] = 0;
+  }
+
+The check warns about such unusual syntax for readability reasons:
+ * There are programmers that are not familiar with this unusual syntax.
+ * It is possible that variables are mixed up.
+
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -127,6 +127,7 @@
readability-identifier-naming
readability-implicit-bool-cast
readability-inconsistent-declaration-parameter-name
+   readability-misplaced-array-index
readability-named-parameter
readability-non-const-parameter
readability-redundant-control-flow
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -85,6 +85,11 @@
   Warns about the performance overhead arising from concatenating strings using
   the ``operator+``, instead of ``operator+=``.
 
+- New `readability-misplaced-array-index
+  `_ check
+
+  Warns when there is array index before the [] instead of inside it.
+
 - New `readability-non-const-parameter
   `_ check
 
Index: clang-tidy/readability/ReadabilityTidyModule.cpp
===
--- clang-tidy/readability/ReadabilityTidyModule.cpp
+++ clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -19,6 +19,7 @@
 #include "IdentifierNamingCheck.h"
 #include "ImplicitBoolCastCheck.h"
 #include "InconsistentDeclarationParameterNameCheck.h"
+#include "MisplacedArrayIndexCheck.h"
 #include "NamedParameterCheck.h"
 #include "NonConstParameterCheck.h"
 #include "RedundantControlFlowCheck.h"
@@ -54,6 +55,8 @@
 "readability-implicit-bool-cast");
 CheckFactories.registerCheck(
 "readability-inconsistent-declaration-parameter-name");
+CheckFactories.registerCheck(
+"readability-misplaced-array-index");
 CheckFactories.registerCheck(
 "readability-static-definition-in-anonymous-namespace");
 CheckFactories.registerCheck(
Index: clang-tidy/readability/MisplacedArrayIndexCheck.h
===
--- clang-tidy/readability/MisplacedArrayIndexCheck.h
+++ clang-tidy/readability/MisplacedArrayIndexCheck.h
@@ -0,0 +1,36 @@
+//===--- 

Re: [PATCH] D23787: Add builder for clang extra tools Sphinx docs

2016-08-24 Thread Dmitri Gribenko via cfe-commits
gribozavr added a comment.

We need to ask Galina Kistanova to reload the configuration.


Repository:
  rL LLVM

https://reviews.llvm.org/D23787



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


Re: [PATCH] D23787: Add builder for clang extra tools Sphinx docs

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Do you know whether build slaves should pick this configuration change up 
automatically?


Repository:
  rL LLVM

https://reviews.llvm.org/D23787



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


Re: [PATCH] D23787: Add builder for clang extra tools Sphinx docs

2016-08-24 Thread Alexander Kornienko via cfe-commits
This revision was automatically updated to reflect the committed changes.
alexfh marked an inline comment as done.
Closed by commit rL279624: Add builder for clang extra tools Sphinx docs 
(authored by alexfh).

Changed prior to commit:
  https://reviews.llvm.org/D23787?vs=68967=69110#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23787

Files:
  zorg/trunk/buildbot/osuosl/master/config/builders.py
  zorg/trunk/zorg/buildbot/builders/SphinxDocsBuilder.py

Index: zorg/trunk/zorg/buildbot/builders/SphinxDocsBuilder.py
===
--- zorg/trunk/zorg/buildbot/builders/SphinxDocsBuilder.py
+++ zorg/trunk/zorg/buildbot/builders/SphinxDocsBuilder.py
@@ -6,18 +6,20 @@
 from zorg.buildbot.commands.NinjaCommand import NinjaCommand
 
 def getSphinxDocsBuildFactory(
-llvm_html   = False, # Build LLVM HTML documentation
-llvm_man= False, # Build LLVM man pages
-clang_html  = False, # Build Clang HTML documentation
-lld_html= False, # Build LLD HTML documentation
-libcxx_html = False  # Build Libc++ HTML documentation
+llvm_html = False, # Build LLVM HTML documentation
+llvm_man  = False, # Build LLVM man pages
+clang_html= False, # Build Clang HTML documentation
+clang_tools_html  = False, # Build Clang Extra Tools HTML documentation
+lld_html  = False, # Build LLD HTML documentation
+libcxx_html   = False  # Build Libc++ HTML documentation
 ):
 
 f = buildbot.process.factory.BuildFactory()
 
 llvm_srcdir = 'llvm/src'
 llvm_objdir = 'llvm/build'
 clang_srcdir = llvm_srcdir + '/tools/clang'
+clang_tools_srcdir = llvm_srcdir + '/tools/clang/tools/extra'
 lld_srcdir = llvm_srcdir + '/tools/lld'
 libcxx_srcdir = llvm_srcdir + '/projects/libcxx'
 libcxxabi_srcdir = llvm_srcdir + '/projects/libcxxabi'
@@ -37,6 +39,13 @@
   defaultBranch='trunk',
   workdir=clang_srcdir))
 
+if clang_tools_html:
+f.addStep(SVN(name='svn-clang-tools',
+  mode='update',
+  
baseURL='http://llvm.org/svn/llvm-project/clang-tools-extra/',
+  defaultBranch='trunk',
+  workdir=clang_tools_srcdir))
+
 if lld_html:
 f.addStep(SVN(name='svn-lld',
   mode='update',
@@ -99,6 +108,14 @@
targets=['docs-clang-html']
   ))
 
+if clang_tools_html:
+f.addStep(NinjaCommand(name="docs-clang-tools-html",
+   haltOnFailure=True,
+   description=["Build Clang Extra Tools Sphinx 
HTML documentation"],
+   workdir=llvm_objdir,
+   targets=['docs-clang-tools-html']
+  ))
+
 if lld_html:
 f.addStep(NinjaCommand(name="docs-lld-html",
haltOnFailure=True,
Index: zorg/trunk/buildbot/osuosl/master/config/builders.py
===
--- zorg/trunk/buildbot/osuosl/master/config/builders.py
+++ zorg/trunk/buildbot/osuosl/master/config/builders.py
@@ -1140,6 +1140,13 @@
'category' : 'clang'
  },
  {
+   'name':"clang-tools-sphinx-docs",
+   'slavenames':["gribozavr4"],
+   'builddir':"clang-tools-sphinx-docs",
+   'factory': 
SphinxDocsBuilder.getSphinxDocsBuildFactory(clang_tools_html=True),
+   'category' : 'clang'
+ },
+ {
'name':"lld-sphinx-docs",
'slavenames':["gribozavr4"],
'builddir':"lld-sphinx-docs",


Index: zorg/trunk/zorg/buildbot/builders/SphinxDocsBuilder.py
===
--- zorg/trunk/zorg/buildbot/builders/SphinxDocsBuilder.py
+++ zorg/trunk/zorg/buildbot/builders/SphinxDocsBuilder.py
@@ -6,18 +6,20 @@
 from zorg.buildbot.commands.NinjaCommand import NinjaCommand
 
 def getSphinxDocsBuildFactory(
-llvm_html   = False, # Build LLVM HTML documentation
-llvm_man= False, # Build LLVM man pages
-clang_html  = False, # Build Clang HTML documentation
-lld_html= False, # Build LLD HTML documentation
-libcxx_html = False  # Build Libc++ HTML documentation
+llvm_html = False, # Build LLVM HTML documentation
+llvm_man  = False, # Build LLVM man pages
+clang_html= False, # Build Clang HTML documentation
+clang_tools_html  = False, # Build Clang Extra Tools HTML documentation
+lld_html  = False, # Build LLD HTML documentation
+libcxx_html   = False  # Build Libc++ HTML documentation
 ):
 
 f = 

Re: [PATCH] D23787: Add builder for clang extra tools Sphinx docs

2016-08-24 Thread Dmitri Gribenko via cfe-commits
gribozavr accepted this revision.
gribozavr added a comment.
This revision is now accepted and ready to land.

Thanks, LGTM!


https://reviews.llvm.org/D23787



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


[PATCH] D23835: [compiler-rt] tsan/tests: Add missing -I for top-level include directory

2016-08-24 Thread Michał Górny via cfe-commits
mgorny created this revision.
mgorny added a reviewer: samsonov.
mgorny added a subscriber: cfe-commits.
Herald added subscribers: dberris, kubabrecka.

Otherwise stand-alone build for tests fails due to missing include files.

https://reviews.llvm.org/D23835

Files:
  lib/tsan/tests/CMakeLists.txt

Index: lib/tsan/tests/CMakeLists.txt
===
--- lib/tsan/tests/CMakeLists.txt
+++ lib/tsan/tests/CMakeLists.txt
@@ -8,6 +8,7 @@
   ${TSAN_CFLAGS}
   ${COMPILER_RT_UNITTEST_CFLAGS}
   ${COMPILER_RT_GTEST_CFLAGS}
+  -I${COMPILER_RT_SOURCE_DIR}/include
   -I${COMPILER_RT_SOURCE_DIR}/lib
   -I${COMPILER_RT_SOURCE_DIR}/lib/tsan/rtl
   -DGTEST_HAS_RTTI=0)


Index: lib/tsan/tests/CMakeLists.txt
===
--- lib/tsan/tests/CMakeLists.txt
+++ lib/tsan/tests/CMakeLists.txt
@@ -8,6 +8,7 @@
   ${TSAN_CFLAGS}
   ${COMPILER_RT_UNITTEST_CFLAGS}
   ${COMPILER_RT_GTEST_CFLAGS}
+  -I${COMPILER_RT_SOURCE_DIR}/include
   -I${COMPILER_RT_SOURCE_DIR}/lib
   -I${COMPILER_RT_SOURCE_DIR}/lib/tsan/rtl
   -DGTEST_HAS_RTTI=0)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23783: [Sema][Comments] Support @param with c++ 'using' keyword

2016-08-24 Thread Dmitri Gribenko via cfe-commits
gribozavr accepted this revision.
gribozavr added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


https://reviews.llvm.org/D23783



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


[PATCH] D23832: cmake: Add ordering dep between HTML Sphinx docs and manpages

2016-08-24 Thread Michał Górny via cfe-commits
mgorny created this revision.
mgorny added reviewers: rnk, axw.
mgorny added a subscriber: cfe-commits.

Add a dependency between HTML & manpage Sphinx targets to prevent two instances 
of Sphinx from running in parallel, and therefore solves race conditions 
reusing the same doctree directory.

Bug: https://llvm.org/bugs/show_bug.cgi?id=23781

Also submitted for llvm: https://reviews.llvm.org/D23755

https://reviews.llvm.org/D23832

Files:
  docs/CMakeLists.txt

Index: docs/CMakeLists.txt
===
--- docs/CMakeLists.txt
+++ docs/CMakeLists.txt
@@ -102,6 +102,9 @@
 endif()
 if (${SPHINX_OUTPUT_MAN})
   add_sphinx_target(man clang)
+  if (${SPHINX_OUTPUT_HTML})
+add_dependencies(docs-clang-html docs-clang-man)
+  endif()
 endif()
   endif()
 endif()


Index: docs/CMakeLists.txt
===
--- docs/CMakeLists.txt
+++ docs/CMakeLists.txt
@@ -102,6 +102,9 @@
 endif()
 if (${SPHINX_OUTPUT_MAN})
   add_sphinx_target(man clang)
+  if (${SPHINX_OUTPUT_HTML})
+add_dependencies(docs-clang-html docs-clang-man)
+  endif()
 endif()
   endif()
 endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D23831: Fix gcc 4.9 -Wcast-qual warning.

2016-08-24 Thread Andrey Khalyavin via cfe-commits
halyavin created this revision.
halyavin added reviewers: cfe-commits, EricWF, mclow.lists.

C-style cast from const pointer to non-const pointer causes -Wcast-qual warning 
in gcc. Fix the problem by casting away const with const_cast. Additionally, 
replace C-style cast with appropriate C++-style cast. 

https://reviews.llvm.org/D23831

Files:
  include/type_traits

Index: include/type_traits
===
--- include/type_traits
+++ include/type_traits
@@ -443,7 +443,7 @@
 _Tp*
 addressof(_Tp& __x) _NOEXCEPT
 {
-return (_Tp*)_cast(__x);
+return reinterpret_cast<_Tp*>(const_cast(_cast(__x)));
 }
 
 #endif // __has_builtin(__builtin_addressof)


Index: include/type_traits
===
--- include/type_traits
+++ include/type_traits
@@ -443,7 +443,7 @@
 _Tp*
 addressof(_Tp& __x) _NOEXCEPT
 {
-return (_Tp*)_cast(__x);
+return reinterpret_cast<_Tp*>(const_cast(_cast(__x)));
 }
 
 #endif // __has_builtin(__builtin_addressof)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23712: [OpenCL] Override supported OpenCL extensions with -cl-ext option

2016-08-24 Thread Andrew Savonichev via cfe-commits
asavonic added a comment.

In https://reviews.llvm.org/D23712#520818, @Anastasia wrote:

> What would be the use case to override the supported extensions for the end 
> user?


Some extensions may be supported by the platform in general, but not by the
specific version of the OpenCL runtime.

For example, when the platform supports fp64, the OpenCL runtime may not have a
fp64 built-ins implementation. In this case it is better to disable fp64 by the
compiler, rather than get a link error.

Actually, the use case is similar to the -target-feature option, which allows to
control supported CPU features, e.g enable or disable some instruction set.


https://reviews.llvm.org/D23712



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


Re: [PATCH] D23279: clang-reorder-fields

2016-08-24 Thread Eric Liu via cfe-commits
ioeric added inline comments.


Comment at: clang-reorder-fields/ReorderFieldsAction.h:31
@@ +30,3 @@
+
+public:
+  ReorderFieldsAction(

alexshap wrote:
> alexshap wrote:
> > djasper wrote:
> > > I don't why clang-rename does what it does at the moment. My main point 
> > > is that we have already implemented splitting up replacements by file in 
> > > groupByReplacementsByFile. No need to reimplement that here or make the 
> > > interface of this function more complex than it needs to be.
> > sorry, i am not sure i got ur comment - need to think  - maybe i am too 
> > sleepy - 
> > the issue is not with clang-rename, but with class RefactoringTool
> > and more precisely with the method the method getReplacements.
> pls, take a look at my previous comments (especially regarding the diff 
> https://reviews.llvm.org/D21748?id=64016.)
>  
> meanwhile: 
> http://clang.llvm.org/doxygen/Replacement_8h_source.html
> 
>   **/// \brief Adds a new replacement \p R to the current set of replacements.
>   160   /// \p R must have the same file path as all existing replacements. **
>   161   /// Returns true if the replacement is successfully inserted; 
> otherwise,
>   162   /// it returns an llvm::Error, i.e. there is a conflict between R and 
> the
>   163   /// existing replacements or R's file path is different from the 
> filepath of
>   164   /// existing replacements. Callers must explicitly check the Error 
> returned.
>   165   /// This prevents users from adding order-dependent replacements. To 
> control
>   166   /// the order in which order-dependent replacements are applied, use
>   167   /// merge({R}) with R referring to the changed code after applying all
>   168   /// existing replacements.
>   169   /// Replacements with offset UINT_MAX are special - we do not detect 
> conflicts
>   170   /// for such replacements since users may add them intentionally as a 
> special
>   171   /// category of replacements.
>   172   llvm::Error add(const Replacement );
> 
> at this point it seems like groupReplacementsByFile was made redundant by 
> https://reviews.llvm.org/D21748
> 
> @ioeric, could u comment on this ?  I apologize in advance - i might be 
> missing smth / might be to sleepy. Will take a look at this again tomorrow
> 
> P.S. just in case - ReorderingFieldsAction can change different files 
> (including headers etc) - so i simply can not use a single Replacements object
We don't have an implementation for grouping replacements by file yet (for 
class implementation of `tooling::Replacements`). The previous 
`groupReplacementsByFile` indeed should have been deprecated. At this point, 
tools which carry replacements for multiple files use a map from file names to 
`tooling::Replacements` (usually called `FileToReplacements`) like what you do 
here.


Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D23279: clang-reorder-fields

2016-08-24 Thread Alexander Shaposhnikov via cfe-commits
alexshap added a subscriber: ioeric.


Comment at: clang-reorder-fields/ReorderFieldsAction.h:31
@@ +30,3 @@
+
+public:
+  ReorderFieldsAction(

alexshap wrote:
> djasper wrote:
> > I don't why clang-rename does what it does at the moment. My main point is 
> > that we have already implemented splitting up replacements by file in 
> > groupByReplacementsByFile. No need to reimplement that here or make the 
> > interface of this function more complex than it needs to be.
> sorry, i am not sure i got ur comment - need to think  - maybe i am too 
> sleepy - 
> the issue is not with clang-rename, but with class RefactoringTool
> and more precisely with the method the method getReplacements.
pls, take a look at my previous comments (especially regarding the diff 
https://reviews.llvm.org/D21748?id=64016.)
 
meanwhile: 
http://clang.llvm.org/doxygen/Replacement_8h_source.html

  **/// \brief Adds a new replacement \p R to the current set of replacements.
  160   /// \p R must have the same file path as all existing replacements. **
  161   /// Returns true if the replacement is successfully inserted; otherwise,
  162   /// it returns an llvm::Error, i.e. there is a conflict between R and 
the
  163   /// existing replacements or R's file path is different from the 
filepath of
  164   /// existing replacements. Callers must explicitly check the Error 
returned.
  165   /// This prevents users from adding order-dependent replacements. To 
control
  166   /// the order in which order-dependent replacements are applied, use
  167   /// merge({R}) with R referring to the changed code after applying all
  168   /// existing replacements.
  169   /// Replacements with offset UINT_MAX are special - we do not detect 
conflicts
  170   /// for such replacements since users may add them intentionally as a 
special
  171   /// category of replacements.
  172   llvm::Error add(const Replacement );

at this point it seems like groupReplacementsByFile was made redundant by 
https://reviews.llvm.org/D21748

@ioeric, could u comment on this ?  I apologize in advance - i might be missing 
smth / might be to sleepy. Will take a look at this again tomorrow

P.S. just in case - ReorderingFieldsAction can change different files 
(including headers etc) - so i simply can not use a single Replacements object


Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D23815: [Clang-tidy] Documentation style. Two Google checks are aliases

2016-08-24 Thread Alexander Kornienko via cfe-commits
alexfh requested changes to this revision.
This revision now requires changes to proceed.


Comment at: docs/clang-tidy/checks/google-readability-namespace-comments.rst:9
@@ -8,3 @@
-
-http://llvm.org/docs/CodingStandards.html#namespace-indentation
-

Please move these links to the other document.


Repository:
  rL LLVM

https://reviews.llvm.org/D23815



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


Re: r278984 - Add test missed from r278983.

2016-08-24 Thread Yaron Keren via cfe-commits
I see the same stack overflow asan error in a local buildbot.


2016-08-22 20:30 GMT+03:00 Akira Hatanaka via cfe-commits <
cfe-commits@lists.llvm.org>:

> Hi Richard,
>
> This test has been failing since it was committed.
>
> http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_check/2277/
>
> > On Aug 17, 2016, at 2:42 PM, Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> >
> > Author: rsmith
> > Date: Wed Aug 17 16:42:10 2016
> > New Revision: 278984
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=278984=rev
> > Log:
> > Add test missed from r278983.
> >
> > Added:
> >cfe/trunk/test/SemaTemplate/instantiation-depth-default.cpp
> >
> > Added: cfe/trunk/test/SemaTemplate/instantiation-depth-default.cpp
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> SemaTemplate/instantiation-depth-default.cpp?rev=278984=auto
> > 
> ==
> > --- cfe/trunk/test/SemaTemplate/instantiation-depth-default.cpp (added)
> > +++ cfe/trunk/test/SemaTemplate/instantiation-depth-default.cpp Wed Aug
> 17 16:42:10 2016
> > @@ -0,0 +1,9 @@
> > +// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-backtrace-limit 2 %s
> > +
> > +template struct X : X {};
> > +// expected-error-re@3 {{recursive template instantiation exceeded
> maximum depth of 1024{{$
> > +// expected-note@3 {{instantiation of template class}}
> > +// expected-note@3 {{skipping 1023 contexts in backtrace}}
> > +// expected-note@3 {{use -ftemplate-depth=N to increase recursive
> template instantiation depth}}
> > +
> > +X<0, int> x; // expected-note {{in instantiation of}}
> >
> >
> > ___
> > 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
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >