Re: [PATCH] D18957: clang-rename: add missing newline at the end of 'found name:'

2016-04-27 Thread Manuel Klimek via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL267855: Add missing newline in clang-rename output. 
(authored by klimek).

Changed prior to commit:
  http://reviews.llvm.org/D18957?vs=53222&id=55380#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18957

Files:
  clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp

Index: clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp
===
--- clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp
+++ clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp
@@ -108,7 +108,7 @@
 exit(1);
 
   if (PrintName)
-errs() << "clang-rename: found name: " << PrevName;
+errs() << "clang-rename: found name: " << PrevName << "\n";
 
   // Perform the renaming.
   rename::RenamingAction RenameAction(NewName, PrevName, USRs,


Index: clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp
===
--- clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp
+++ clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp
@@ -108,7 +108,7 @@
 exit(1);
 
   if (PrintName)
-errs() << "clang-rename: found name: " << PrevName;
+errs() << "clang-rename: found name: " << PrevName << "\n";
 
   // Perform the renaming.
   rename::RenamingAction RenameAction(NewName, PrevName, USRs,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r267855 - Add missing newline in clang-rename output.

2016-04-27 Thread Manuel Klimek via cfe-commits
Author: klimek
Date: Thu Apr 28 01:46:44 2016
New Revision: 267855

URL: http://llvm.org/viewvc/llvm-project?rev=267855&view=rev
Log:
Add missing newline in clang-rename output.

Patch by Miklos Vajna.

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

Modified:
clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp

Modified: clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp?rev=267855&r1=267854&r2=267855&view=diff
==
--- clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp (original)
+++ clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp Thu Apr 28 
01:46:44 2016
@@ -108,7 +108,7 @@ int main(int argc, const char **argv) {
 exit(1);
 
   if (PrintName)
-errs() << "clang-rename: found name: " << PrevName;
+errs() << "clang-rename: found name: " << PrevName << "\n";
 
   // Perform the renaming.
   rename::RenamingAction RenameAction(NewName, PrevName, USRs,


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


Re: [PATCH] D19385: [scan-build] fix logic error warnings emitted on clang code base

2016-04-27 Thread Manuel Klimek via cfe-commits
klimek added a reviewer: djasper.


Comment at: lib/Format/AffectedRangeManager.cpp:103
@@ -102,1 +102,3 @@
 AnnotatedLine *Line, const AnnotatedLine *PreviousLine) {
+  assert(Line && "does not contain any line");
+

Perhaps we should change this to take a Line& instead? Daniel, thoughts?


http://reviews.llvm.org/D19385



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


Re: [PATCH] D19385: [scan-build] fix logic error warnings emitted on clang code base

2016-04-27 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:300-301
@@ -299,3 +299,4 @@
 
+  assert(SM && "SourceManager is NULL, cannot iterate through the 
diagnostics");
 
   for (std::vector::iterator DI = Diags.begin(),

LGTM


http://reviews.llvm.org/D19385



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


Re: [PATCH] D17841: [libclang/python] Add bindings for children of diagnostics

2016-04-27 Thread Hanson Wang via cfe-commits
hansonw added reviewers: compnerd, skalinichev.
hansonw added a comment.

Adding you guys since you reviewed some recent changes :)


http://reviews.llvm.org/D17841



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


Re: [PATCH] D17841: [libclang/python] Add bindings for children of diagnostics

2016-04-27 Thread Hanson Wang via cfe-commits
hansonw updated this revision to Diff 55378.
hansonw added a comment.

Rebase


http://reviews.llvm.org/D17841

Files:
  bindings/python/clang/cindex.py
  bindings/python/tests/cindex/test_diagnostics.py

Index: bindings/python/tests/cindex/test_diagnostics.py
===
--- bindings/python/tests/cindex/test_diagnostics.py
+++ bindings/python/tests/cindex/test_diagnostics.py
@@ -80,3 +80,15 @@
 
 assert d.option == '-Wunused-parameter'
 assert d.disable_option == '-Wno-unused-parameter'
+
+def test_diagnostic_children():
+tu = get_tu('void f(int x) {} void g() { f(); }')
+assert len(tu.diagnostics) == 1
+d = tu.diagnostics[0]
+
+children = d.children
+assert len(children) == 1
+assert children[0].severity == Diagnostic.Note
+assert children[0].spelling.endswith('declared here')
+assert children[0].location.line == 1
+assert children[0].location.column == 1
Index: bindings/python/clang/cindex.py
===
--- bindings/python/clang/cindex.py
+++ bindings/python/clang/cindex.py
@@ -360,6 +360,23 @@
 return FixItIterator(self)
 
 @property
+def children(self):
+class ChildDiagnosticsIterator:
+def __init__(self, diag):
+self.diag_set = conf.lib.clang_getChildDiagnostics(diag)
+
+def __len__(self):
+return 
int(conf.lib.clang_getNumDiagnosticsInSet(self.diag_set))
+
+def __getitem__(self, key):
+diag = conf.lib.clang_getDiagnosticInSet(self.diag_set, key)
+if not diag:
+raise IndexError
+return Diagnostic(diag)
+
+return ChildDiagnosticsIterator(self)
+
+@property
 def category_number(self):
 """The category number for this diagnostic or 0 if unavailable."""
 return conf.lib.clang_getDiagnosticCategory(self)
@@ -1120,6 +1137,9 @@
 # A type alias template declaration
 CursorKind.TYPE_ALIAS_TEMPLATE_DECL = CursorKind(601)
 
+# A code completion overload candidate.
+CursorKind.OVERLOAD_CANDIDATE = CursorKind(700)
+
 ### Template Argument Kinds ###
 class TemplateArgumentKind(BaseEnumeration):
 """
@@ -3053,6 +3073,10 @@
Type,
Type.from_result),
 
+  ("clang_getChildDiagnostics",
+   [Diagnostic],
+   c_object_p),
+
   ("clang_getCompletionAvailability",
[c_void_p],
c_int),
@@ -3173,6 +3197,10 @@
_CXString,
_CXString.from_result),
 
+  ("clang_getDiagnosticInSet",
+   [c_object_p, c_uint],
+   c_object_p),
+
   ("clang_getDiagnosticLocation",
[Diagnostic],
SourceLocation),
@@ -3274,6 +3302,10 @@
[c_object_p],
c_uint),
 
+  ("clang_getNumDiagnosticsInSet",
+   [c_object_p],
+   c_uint),
+
   ("clang_getNumElements",
[Type],
c_longlong),


Index: bindings/python/tests/cindex/test_diagnostics.py
===
--- bindings/python/tests/cindex/test_diagnostics.py
+++ bindings/python/tests/cindex/test_diagnostics.py
@@ -80,3 +80,15 @@
 
 assert d.option == '-Wunused-parameter'
 assert d.disable_option == '-Wno-unused-parameter'
+
+def test_diagnostic_children():
+tu = get_tu('void f(int x) {} void g() { f(); }')
+assert len(tu.diagnostics) == 1
+d = tu.diagnostics[0]
+
+children = d.children
+assert len(children) == 1
+assert children[0].severity == Diagnostic.Note
+assert children[0].spelling.endswith('declared here')
+assert children[0].location.line == 1
+assert children[0].location.column == 1
Index: bindings/python/clang/cindex.py
===
--- bindings/python/clang/cindex.py
+++ bindings/python/clang/cindex.py
@@ -360,6 +360,23 @@
 return FixItIterator(self)
 
 @property
+def children(self):
+class ChildDiagnosticsIterator:
+def __init__(self, diag):
+self.diag_set = conf.lib.clang_getChildDiagnostics(diag)
+
+def __len__(self):
+return int(conf.lib.clang_getNumDiagnosticsInSet(self.diag_set))
+
+def __getitem__(self, key):
+diag = conf.lib.clang_getDiagnosticInSet(self.diag_set, key)
+if not diag:
+raise IndexError
+return Diagnostic(diag)
+
+return ChildDiagnosticsIterator(self)
+
+@property
 def category_number(self):
 """The category number for this diagnostic or 0 if unavailable."""
 return conf.lib.clang_getDiagnosticCategory(self)
@@ -1120,6 +1137,9 @@
 # A type alias template declaration
 CursorKind.TYPE_ALIAS_TEMPLATE_DECL = CursorKind(601)
 
+# A code completion overload candidate.
+CursorKind.OVERLOAD_CANDIDATE = CursorKind(700)
+
 ### Template Argument Kinds ###
 class TemplateArgumentKind(BaseEnumeration):
 """
@@ -3053,6 +3073,10 @@
Type,
Type.from_resu

Re: [PATCH] D19062: Add functions in ctype.h to builtin function database (Fix)

2016-04-27 Thread Taewook Oh via cfe-commits
twoh updated this revision to Diff 55377.
twoh added a comment.

Addressing comments from @joerg. Two versions of the test provided, one for an 
architecture with signed char(x86_64) and the other for an architecture with 
unsigned char(powerpc64).


http://reviews.llvm.org/D19062

Files:
  include/clang/Basic/Builtins.def
  include/clang/Basic/Builtins.h
  lib/Sema/SemaDecl.cpp
  test/FixIt/typo.m
  test/Sema/enable_if.c
  test/Sema/libbuiltins-ctype-powerpc64.c
  test/Sema/libbuiltins-ctype-x86_64.c

Index: test/Sema/libbuiltins-ctype-x86_64.c
===
--- test/Sema/libbuiltins-ctype-x86_64.c
+++ test/Sema/libbuiltins-ctype-x86_64.c
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm < %s | FileCheck %s
+
+int isalnum(int);
+int isalpha(int);
+int isblank(int);
+int iscntrl(int);
+int isdigit(int);
+int isgraph(int);
+int islower(int);
+int isprint(int);
+int ispunct(int);
+int isspace(int);
+int isupper(int);
+int isxdigit(int);
+int tolower(int);
+int toupper(int);
+
+void test(int x) {
+  // CHECK: call i32 @isalnum(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalnum(x);
+  // CHECK: call i32 @isalpha(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalpha(x);
+  // CHECK: call i32 @isblank(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isblank(x);
+  // CHECK: call i32 @iscntrl(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)iscntrl(x);
+  // CHECK: call i32 @isdigit(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isdigit(x);
+  // CHECK: call i32 @isgraph(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isgraph(x);
+  // CHECK: call i32 @islower(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)islower(x);
+  // CHECK: call i32 @isprint(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isprint(x);
+  // CHECK: call i32 @ispunct(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)ispunct(x);
+  // CHECK: call i32 @isspace(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isspace(x);
+  // CHECK: call i32 @isupper(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isupper(x);
+  // CHECK: call i32 @isxdigit(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isxdigit(x);
+  // CHECK: call i32 @tolower(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)tolower(x);
+  // CHECK: call i32 @toupper(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)toupper(x);
+}
+
+// CHECK: declare i32 @isalnum(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isalpha(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isblank(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @iscntrl(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isdigit(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isgraph(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @islower(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isprint(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @ispunct(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isspace(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isupper(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isxdigit(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @tolower(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @toupper(i32) [[NUW_RO:#[0-9]+]]
+
+// CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} }
+// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly }
Index: test/Sema/libbuiltins-ctype-powerpc64.c
===
--- test/Sema/libbuiltins-ctype-powerpc64.c
+++ test/Sema/libbuiltins-ctype-powerpc64.c
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm < %s | FileCheck %s
+
+int isalnum(int);
+int isalpha(int);
+int isblank(int);
+int iscntrl(int);
+int isdigit(int);
+int isgraph(int);
+int islower(int);
+int isprint(int);
+int ispunct(int);
+int isspace(int);
+int isupper(int);
+int isxdigit(int);
+int tolower(int);
+int toupper(int);
+
+void test(int x) {
+  // CHECK: call signext i32 @isalnum(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalnum(x);
+  // CHECK: call signext i32 @isalpha(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalpha(x);
+  // CHECK: call signext i32 @isblank(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isblank(x);
+  // CHECK: call signext i32 @iscntrl(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)iscntrl(x);
+  // CHECK: call signext i32 @isdigit(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isdigit(x);
+  // CHECK: call signext i32 @isgraph(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isgraph(x);
+  // CHECK: call signext i32 @islower(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)islower(x);
+  // CHECK: call signext i32 @isprint(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isprint(x);
+  // CHECK: call signext i32 @ispunct(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)ispunct(x);
+  // CHECK: call signext i32 @isspace(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isspace(

Re: [PATCH] D19587: Addressed reviewer's post-submission comments from http://reviews.llvm.org/D18551.

2016-04-27 Thread Daniel Jasper via cfe-commits
djasper added inline comments.


Comment at: lib/Format/AffectedRangeManager.h:68
@@ +67,2 @@
+#endif // LLVM_CLANG_LIB_FORMAT_AFFECTEDRANGEMANAGER_H
+#

??


http://reviews.llvm.org/D19587



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


Re: [PATCH] D19587: Addressed reviewer's post-submission comments from http://reviews.llvm.org/D18551.

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

Otherwise looks good.


http://reviews.llvm.org/D19587



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


Re: [PATCH] D19619: [libc++] Remove the names of unreferenced parameters.

2016-04-27 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

r267852.


http://reviews.llvm.org/D19619



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


[libcxx] r267852 - Remove names of unreferenced parameters. Patch from s...@microsoft.com

2016-04-27 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Apr 27 22:17:56 2016
New Revision: 267852

URL: http://llvm.org/viewvc/llvm-project?rev=267852&view=rev
Log:
Remove names of unreferenced parameters. Patch from s...@microsoft.com

Modified:

libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp

libcxx/trunk/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp

libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/custom_alloc.pass.cpp

libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp

libcxx/trunk/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp

libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp

libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp

libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp

libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp

libcxx/trunk/test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp

libcxx/trunk/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/PR23141_invoke_not_constexpr.pass.cpp

libcxx/trunk/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
libcxx/trunk/test/std/utilities/intseq/intseq.general/integer_seq.pass.cpp

libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
libcxx/trunk/test/support/allocators.h
libcxx/trunk/test/support/test_allocator.h

Modified: 
libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp?rev=267852&r1=267851&r2=267852&view=diff
==
--- 
libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp
 Wed Apr 27 22:17:56 2016
@@ -21,7 +21,7 @@
 
 #include "counting_predicates.hpp"
 
-bool all_equal(int a, int b) { return false; } // everything is equal
+bool all_equal(int, int) { return false; } // everything is equal
 
 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 void test_all_equal(std::initializer_list il)

Modified: 
libcxx/trunk/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp?rev=267852&r1=267851&r2=267852&view=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
 Wed Apr 27 22:17:56 2016
@@ -37,7 +37,7 @@ test(Iterator first, Iterator last, cons
 template 
 struct implicit_conv_allocator : min_allocator
 {
-implicit_conv_allocator(void* p) {}
+implicit_conv_allocator(void*) {}
 implicit_conv_allocator(const implicit_conv_allocator&) = default;
 };
 

Modified: 
libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/custom_alloc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/custom_alloc.pass.cpp?rev=267852&r1=267851&r2=267852&view=diff
==
--- 
libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/custom_alloc.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/custom_alloc.pass.cpp
 Wed Apr 27 22:17:56 2016
@@ -18,7 +18,7 @@
 
 int called = 0;
 
-void* my_alloc(std::size_t n)
+void* my_alloc(std::size_t)
 {
 static char buf[1];
 ++called;

Modified: 
libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp?rev=267852&r1=267851&r2=267852&view=diff
==
--- 
libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor

Re: [PATCH] D19482: [include-fixer] Add a find-all-symbols tool for include-fixer.

2016-04-27 Thread NAKAMURA Takumi via cfe-commits
chapuni added a subscriber: chapuni.


Comment at: 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp:333
@@ +332,3 @@
+  static const char Code[] = R"(
+  typedef unsigned size_t;
+  typedef struct { int x; } X;

size_t clashes against built-in type. Tweaked in r267841.


Repository:
  rL LLVM

http://reviews.llvm.org/D19482



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


Re: [PATCH] D19620: [libc++] Add braces, move braces, and rename variables to avoid shadowing.

2016-04-27 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

r267844.


http://reviews.llvm.org/D19620



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


r267845 - CGOpenMPRuntime.h: Prune extra comma in \param. [-Wdocumentation]

2016-04-27 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Wed Apr 27 21:45:21 2016
New Revision: 267845

URL: http://llvm.org/viewvc/llvm-project?rev=267845&view=rev
Log:
CGOpenMPRuntime.h: Prune extra comma in \param. [-Wdocumentation]

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

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h?rev=267845&r1=267844&r2=267845&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h Wed Apr 27 21:45:21 2016
@@ -1046,7 +1046,7 @@ public:
   /// directive, or null if no if clause is used.
   /// \param Device Expression evaluated in device clause associated with the
   /// target directive, or null if no device clause is used.
-  /// \param CodeGen, Function that emits the enclosed region.
+  /// \param CodeGen Function that emits the enclosed region.
   virtual void emitTargetDataCalls(CodeGenFunction &CGF,
const OMPExecutableDirective &D,
const Expr *IfCond, const Expr *Device,


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


[libcxx] r267844 - Add braces, move braces, and rename variables to avoid shadowing. Patch from s...@microsoft.com

2016-04-27 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Apr 27 21:45:11 2016
New Revision: 267844

URL: http://llvm.org/viewvc/llvm-project?rev=267844&view=rev
Log:
Add braces, move braces, and rename variables to avoid shadowing. Patch from 
s...@microsoft.com

Modified:

libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
libcxx/trunk/test/std/containers/associative/multiset/iterator.pass.cpp

libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp

libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp

libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp

Modified: 
libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp?rev=267844&r1=267843&r2=267844&view=diff
==
--- 
libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
 Wed Apr 27 21:45:11 2016
@@ -62,6 +62,7 @@ test_larger_sorts(unsigned N)
 
 int main()
 {
+{
 int i = 0;
 std::partial_sort(&i, &i, &i);
 assert(i == 0);
@@ -73,6 +74,7 @@ int main()
 test_larger_sorts(997);
 test_larger_sorts(1000);
 test_larger_sorts(1009);
+}
 
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 {

Modified: 
libcxx/trunk/test/std/containers/associative/multiset/iterator.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/iterator.pass.cpp?rev=267844&r1=267843&r2=267844&view=diff
==
--- libcxx/trunk/test/std/containers/associative/multiset/iterator.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/associative/multiset/iterator.pass.cpp Wed 
Apr 27 21:45:11 2016
@@ -70,7 +70,7 @@ int main()
 std::multiset::const_iterator k = i;
 assert(i == k);
 for (int j = 1; j <= 8; ++j)
-for (int k = 0; k < 3; ++k, ++i)
+for (int n = 0; n < 3; ++n, ++i)
 assert(*i == j);
 }
 {
@@ -151,7 +151,7 @@ int main()
 std::multiset, min_allocator>::const_iterator 
k = i;
 assert(i == k);
 for (int j = 1; j <= 8; ++j)
-for (int k = 0; k < 3; ++k, ++i)
+for (int n = 0; n < 3; ++n, ++i)
 assert(*i == j);
 }
 {

Modified: 
libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp?rev=267844&r1=267843&r2=267844&view=diff
==
--- 
libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
 Wed Apr 27 21:45:11 2016
@@ -24,6 +24,7 @@
 
 int main()
 {
+{
 typedef int V;
 V ar[] =
 {
@@ -55,6 +56,7 @@ int main()
 assert(*next(m.begin(), 6) == 3);
 assert(*next(m.begin(), 7) == 3);
 assert(*next(m.begin(), 8) == 3);
+}
 #if _LIBCPP_STD_VER > 11
 {
 typedef int V;

Modified: 
libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp?rev=267844&r1=267843&r2=267844&view=diff
==
--- 
libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
 Wed Apr 27 21:45:11 2016
@@ -28,6 +28,7 @@
 
 int main()
 {
+{
 typedef int V;
 V ar[] =
 {
@@ -53,6 +54,7 @@ int main()
 assert(*m.begin() == 1);
 assert(*next(m.begin()) == 2);
 assert(*next(m.begin(), 2) == 3);
+}
 #if _LIBCPP_STD_VER > 11
 {
 typedef int V;

Modified: 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp?rev=267844&r1=267843&r2=267844&view=diff
==
--- 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
 Wed Apr 27 21:45:11 2016
@@ 

Re: [PATCH] D19620: [libc++] Add braces, move braces, and rename variables to avoid shadowing.

2016-04-27 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

I hope the actual warning says 'meow' in all cases.


http://reviews.llvm.org/D19620



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


Re: [PATCH] D19048: Test for a module related crash in CGDebugInfo.cpp

2016-04-27 Thread Douglas Yung via cfe-commits
dyung added a comment.

In http://reviews.llvm.org/D19048#414568, @aprantl wrote:

> Thanks!
>
> Is there anything meaningful that could be CHECKed here?
>  Usually a crash means that we previously had a code path without test 
> coverage.


This was definitely a code path without test coverage.

When you ask whether there is anything meaningful that could be checked here, 
are you asking whether we can change the test from testing only that the 
compilation succeeds to checking something that the compiler produces? If so, I 
could change the test to produce llvm assembly (-S -emit-llvm) instead, and 
then perhaps check for the presence of a DIModule within the output. Would that 
make a better test?


http://reviews.llvm.org/D19048



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


Re: [PATCH] D19622: [libc++] Implement the member functions of a local struct.

2016-04-27 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

r267843. This warning seems a bit silly though.


http://reviews.llvm.org/D19622



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


[libcxx] r267843 - Provide member function definitions to avoid warnings. Patch from s...@microsoft.com

2016-04-27 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Apr 27 21:18:48 2016
New Revision: 267843

URL: http://llvm.org/viewvc/llvm-project?rev=267843&view=rev
Log:
Provide member function definitions to avoid warnings. Patch from 
s...@microsoft.com

Modified:
libcxx/trunk/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp?rev=267843&r1=267842&r2=267843&view=diff
==
--- libcxx/trunk/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp 
Wed Apr 27 21:18:48 2016
@@ -53,7 +53,7 @@ constexpr bool throws_callable() {
 // once implementations have caught up.
 void test_noexcept_function_pointers()
 {
-struct Dummy { void foo() noexcept; static void bar() noexcept; };
+struct Dummy { void foo() noexcept {} static void bar() noexcept {} };
 #if !defined(__cpp_noexcept_function_type)
 {
 // Check that PMF's and function pointers *work*. is_nothrow_callable 
will always


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


[clang-tools-extra] r267841 - FindAllSymbolsTest.CTypedefTest: Tweak for LLP64 like x86_64-win32.

2016-04-27 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Wed Apr 27 21:15:16 2016
New Revision: 267841

URL: http://llvm.org/viewvc/llvm-project?rev=267841&view=rev
Log:
FindAllSymbolsTest.CTypedefTest: Tweak for LLP64 like x86_64-win32.

  In file included from symbol.cc:1:
  symbols.h:2:24: error: typedef redefinition with different types ('unsigned 
int'
vs 'unsigned long long')
typedef unsigned size_t;
 ^

Modified:

clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Modified: 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp?rev=267841&r1=267840&r2=267841&view=diff
==
--- 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
 (original)
+++ 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
 Wed Apr 27 21:15:16 2016
@@ -330,7 +330,7 @@ TEST_F(FindAllSymbolsTest, DecayedTypeTe
 
 TEST_F(FindAllSymbolsTest, CTypedefTest) {
   static const char Code[] = R"(
-  typedef unsigned size_t;
+  typedef unsigned size_t_;
   typedef struct { int x; } X;
   using XX = X;
   )";
@@ -338,7 +338,7 @@ TEST_F(FindAllSymbolsTest, CTypedefTest)
 
   {
 SymbolInfo Symbol =
-CreateSymbolInfo("size_t", SymbolInfo::TypedefName, HeaderName, 2, {});
+CreateSymbolInfo("size_t_", SymbolInfo::TypedefName, HeaderName, 2, 
{});
 EXPECT_TRUE(hasSymbol(Symbol));
 getSymbolExtraInfo(Symbol);
 EXPECT_EQ("unsigned int",


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


Re: [PATCH] D19393: Move Checkers.inc to clang/include/.../Checkers

2016-04-27 Thread Chih-Hung Hsieh via cfe-commits
chh closed this revision.
chh added a comment.

Was submitted in r267832 | chh | 2016-04-27 18:09:09 -0700 (Wed, 27 Apr 2016)


http://reviews.llvm.org/D19393



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


Re: [PATCH] D19621: [libc++] Rename function parameters to avoid shadowing.

2016-04-27 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

r267838.


http://reviews.llvm.org/D19621



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


[libcxx] r267838 - Rename function parameters to avoid shadowing. Patch from s...@microsoft.com

2016-04-27 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Apr 27 21:00:52 2016
New Revision: 267838

URL: http://llvm.org/viewvc/llvm-project?rev=267838&view=rev
Log:
Rename function parameters to avoid shadowing. Patch from s...@microsoft.com

Modified:
libcxx/trunk/test/std/thread/futures/futures.async/async.pass.cpp

Modified: libcxx/trunk/test/std/thread/futures/futures.async/async.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/futures/futures.async/async.pass.cpp?rev=267838&r1=267837&r2=267838&view=diff
==
--- libcxx/trunk/test/std/thread/futures/futures.async/async.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/futures/futures.async/async.pass.cpp Wed Apr 
27 21:00:52 2016
@@ -47,10 +47,10 @@ void f2()
 std::this_thread::sleep_for(ms(200));
 }
 
-std::unique_ptr f3(int i)
+std::unique_ptr f3(int j)
 {
 std::this_thread::sleep_for(ms(200));
-return std::unique_ptr(new int(i));
+return std::unique_ptr(new int(j));
 }
 
 std::unique_ptr f4(std::unique_ptr&& p)
@@ -59,10 +59,10 @@ std::unique_ptr f4(std::unique_ptr<
 return std::move(p);
 }
 
-void f5(int i)
+void f5(int j)
 {
 std::this_thread::sleep_for(ms(200));
-throw i;
+throw j;
 }
 
 int main()


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


Re: [PATCH] D19618: [libc++] Consistently guard "#pragma clang" with "#if defined(__clang__)".

2016-04-27 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

Committed in r267836. I must say it's pretty cool to review and commit a patch 
from *the* STL. Never thought that would happen when I started programming.


http://reviews.llvm.org/D19618



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


[libcxx] r267836 - Guard Clang and GCC specific pragmas. Patch from s...@microsoft.com

2016-04-27 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Apr 27 20:49:03 2016
New Revision: 267836

URL: http://llvm.org/viewvc/llvm-project?rev=267836&view=rev
Log:
Guard Clang and GCC specific pragmas. Patch from s...@microsoft.com

Modified:
libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp
libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp
libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
libcxx/trunk/test/std/utilities/template.bitset/bitset.cons/default.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/count.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/flip_all.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/index.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/left_shift.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/not_all.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/reset_all.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/right_shift.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/right_shift_eq.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/set_all.pass.cpp
libcxx/trunk/test/std/utilities/template.bitset/bitset.members/test.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.members/to_string.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp

libcxx/trunk/test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp
libcxx/trunk/test/support/disable_missing_braces_warning.h

Modified: libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp?rev=267836&r1=267835&r2=267836&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/stdio_h.pass.cpp Wed Apr 27 
20:49:03 2016
@@ -99,8 +99,10 @@
 
 #include 
 
+#if defined(__GNUC__)
 #pragma GCC diagnostic ignored "-Wformat-zero-length"
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" // for tmpnam
+#endif
 
 int main()
 {

Modified: libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp?rev=267836&r1=267835&r2=267836&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/wchar_h.pass.cpp Wed Apr 27 
20:49:03 2016
@@ -34,10 +34,14 @@ int main()
 //a complete object type other than an array type that can hold the 
conversion 
 //state information necessary to convert between sequences of multibyte 
 //characters and wide characters
+#if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wmissing-braces"
+#endif
 mbstate_t mb = {0};
+#if defined(__clang__)
 #pragma clang diagnostic pop
+#endif
 
 size_t s = 0;
 tm *tm = 0;

Modified: 
libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp?rev=267836&r1=267835&r2=267836&view=diff
==
--- libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp 
(original)
+++ libcxx/trunk/test/std/input.output/file.streams/c.files/cstdio.pass.cpp Wed 
Apr 27 20:49:03 2016
@@ -78,9 +78,11 @@
 
 #include 
 
+#if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wformat-zero-length"
 #pragma clang diagnostic ignored 

Re: [PATCH] D19249: Fix include path in ClangTidy.cpp.

2016-04-27 Thread Stephen Hines via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL267835: Fix include path in ClangTidy.cpp. (authored by 
srhines).

Changed prior to commit:
  http://reviews.llvm.org/D19249?vs=54587&id=55368#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19249

Files:
  clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp

Index: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
===
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
@@ -58,7 +58,7 @@
 #define GET_CHECKERS
 #define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN)   
\
   FULLNAME,
-#include "../../../lib/StaticAnalyzer/Checkers/Checkers.inc"
+#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
 #undef CHECKER
 #undef GET_CHECKERS
 };


Index: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
===
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
@@ -58,7 +58,7 @@
 #define GET_CHECKERS
 #define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN)   \
   FULLNAME,
-#include "../../../lib/StaticAnalyzer/Checkers/Checkers.inc"
+#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
 #undef CHECKER
 #undef GET_CHECKERS
 };
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r267835 - Fix include path in ClangTidy.cpp.

2016-04-27 Thread Stephen Hines via cfe-commits
Author: srhines
Date: Wed Apr 27 20:42:12 2016
New Revision: 267835

URL: http://llvm.org/viewvc/llvm-project?rev=267835&view=rev
Log:
Fix include path in ClangTidy.cpp.

Summary:
https://llvm.org/bugs/show_bug.cgi?id=27355
To compile with other binary output directory structures in build systems like 
Android.

Reviewers: srhines, alexfh

Subscribers: tberghammer, danalbert, cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=267835&r1=267834&r2=267835&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Wed Apr 27 20:42:12 2016
@@ -58,7 +58,7 @@ static const StringRef StaticAnalyzerChe
 #define GET_CHECKERS
 #define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN)   
\
   FULLNAME,
-#include "../../../lib/StaticAnalyzer/Checkers/Checkers.inc"
+#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
 #undef CHECKER
 #undef GET_CHECKERS
 };


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


r267832 - [analyzer] Move Checkers.inc to clang/include/...

2016-04-27 Thread Chih-Hung Hsieh via cfe-commits
Author: chh
Date: Wed Apr 27 20:09:09 2016
New Revision: 267832

URL: http://llvm.org/viewvc/llvm-project?rev=267832&view=rev
Log:
[analyzer] Move Checkers.inc to clang/include/...

Simplify sharing of Checkers.inc with other files like ClangTidy.cpp.

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


Added:
cfe/trunk/include/clang/StaticAnalyzer/Checkers/CMakeLists.txt
cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
  - copied unchanged from r266687, 
cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td
Removed:
cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td
Modified:
cfe/trunk/include/clang/CMakeLists.txt
cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
cfe/trunk/lib/StaticAnalyzer/Checkers/ClangCheckers.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/ClangSACheckers.h

Modified: cfe/trunk/include/clang/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CMakeLists.txt?rev=267832&r1=267831&r2=267832&view=diff
==
--- cfe/trunk/include/clang/CMakeLists.txt (original)
+++ cfe/trunk/include/clang/CMakeLists.txt Wed Apr 27 20:09:09 2016
@@ -4,3 +4,4 @@ add_subdirectory(Driver)
 add_subdirectory(Parse)
 add_subdirectory(Sema)
 add_subdirectory(Serialization)
+add_subdirectory(StaticAnalyzer/Checkers)

Added: cfe/trunk/include/clang/StaticAnalyzer/Checkers/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Checkers/CMakeLists.txt?rev=267832&view=auto
==
--- cfe/trunk/include/clang/StaticAnalyzer/Checkers/CMakeLists.txt (added)
+++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/CMakeLists.txt Wed Apr 27 
20:09:09 2016
@@ -0,0 +1,4 @@
+clang_tablegen(Checkers.inc -gen-clang-sa-checkers
+  -I ${CMAKE_CURRENT_SOURCE_DIR}/../../../
+  SOURCE Checkers.td
+  TARGET ClangSACheckers)

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt?rev=267832&r1=267831&r2=267832&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt Wed Apr 27 20:09:09 
2016
@@ -1,8 +1,3 @@
-clang_tablegen(Checkers.inc -gen-clang-sa-checkers
-  -I ${CMAKE_CURRENT_SOURCE_DIR}/../../../include
-  SOURCE Checkers.td
-  TARGET ClangSACheckers)
-
 set(LLVM_LINK_COMPONENTS
   Support
   )

Removed: cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td?rev=267831&view=auto
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td (removed)
@@ -1,651 +0,0 @@
-//===--- Checkers.td - Static Analyzer Checkers 
-===---===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-include "clang/StaticAnalyzer/Checkers/CheckerBase.td"
-
-//===--===//
-// Packages.
-//===--===//
-
-// The Alpha package is for checkers that have too many false positives to be
-// turned on by default. The hierarchy under Alpha should be organized in the
-// hierarchy checkers would have had if they were truly at the top level.
-// (For example, a Cocoa-specific checker that is alpha should be in
-// alpha.osx.cocoa).
-def Alpha : Package<"alpha">;
-
-def Core : Package<"core">;
-def CoreBuiltin : Package<"builtin">, InPackage;
-def CoreUninitialized  : Package<"uninitialized">, InPackage;
-def CoreAlpha : Package<"core">, InPackage, Hidden;
-
-// The OptIn package is for checkers that are not alpha and that would normally
-// be on by default but where the driver does not have enough information to
-// determine when they are applicable. For example, localizability checkers fit
-// this criterion because the driver cannot determine whether a project is
-// localized or not -- this is best determined at the IDE or build-system 
level.
-//
-// The checker hierarchy under OptIn should mirror that in Alpha: checkers
-// should be organized as if they were at the top level.
-//
-// Note: OptIn is *not* intended for checkers that are too noisy to be on by
-// default. Such checkers belong in the alpha package.
-def OptIn : Package<"optin">;
-
-def Nullability : Package<"nullability">;
-
-def Cplusplus : Package<"cplusplus">;
-def CplusplusAlpha : Package<"cplusplus">, InPa

Re: [PATCH] D18073: Add memory allocating functions

2016-04-27 Thread Alexander Riccio via cfe-commits
ariccio marked an inline comment as done.
ariccio added a comment.

Wrongly `#if defined` out test is now fixed.


http://reviews.llvm.org/D18073



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


Re: [PATCH] D18073: Add memory allocating functions

2016-04-27 Thread Alexander Riccio via cfe-commits
ariccio updated this revision to Diff 55366.
ariccio added a comment.

Conditionally check Windows methods on Windows.

Is this what you're thinking of? It's kinda ugly - I was hoping to avoid the 
`#if`s - but it does only check the Windows functions on Windows builds only.


http://reviews.llvm.org/D18073

Files:
  llvm/tools/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  llvm/tools/clang/test/Analysis/alternative-malloc-api.c
  llvm/tools/clang/test/Analysis/malloc.c

Index: llvm/tools/clang/test/Analysis/alternative-malloc-api.c
===
--- llvm/tools/clang/test/Analysis/alternative-malloc-api.c
+++ llvm/tools/clang/test/Analysis/alternative-malloc-api.c
@@ -0,0 +1,100 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,debug.ExprInspection -analyzer-store=region -verify %s
+
+#include "Inputs/system-header-simulator.h"
+
+// Without -fms-compatibility, wchar_t isn't a builtin type. MSVC defines
+// _WCHAR_T_DEFINED if wchar_t is available. Microsoft recommends that you use
+// the builtin type: "Using the typedef version can cause portability
+// problems", but we're ok here because we're not actually running anything.
+// Also of note is this cryptic warning: "The wchar_t type is not supported
+// when you compile C code".
+//
+// See the docs for more:
+// https://msdn.microsoft.com/en-us/library/dh8che7s.aspx
+#if !defined(_WCHAR_T_DEFINED)
+// "Microsoft implements wchar_t as a two-byte unsigned value"
+typedef unsigned short wchar_t;
+#define _WCHAR_T_DEFINED
+#endif // !defined(_WCHAR_T_DEFINED)
+
+void free(void *);
+
+char *tempnam(const char *dir, const char *pfx);
+
+void testTempnamLeak(const char* dir, const char* prefix) {
+  char* fileName = tempnam(dir, prefix);
+}// expected-warning {{Potential leak of memory pointed to by}}
+
+void testTempnamNoLeak(const char* dir, const char* prefix) {
+  char* fileName = tempnam(dir, prefix);
+  free(fileName);// no warning
+}
+
+
+// What does "ContentIsDefined" refer to?
+void testTempnamNoLeakContentIsDefined(const char* dir, const char* prefix) {
+  char* fileName = tempnam(dir, prefix);
+  char result = fileName[0];// no warning
+  free(fileName);
+}
+
+#if defined(_WIN32)
+char *_tempnam(const char *dir, const char *prefix);
+wchar_t *_wtempnam(const wchar_t *dir, const wchar_t *prefix);
+
+char *_tempnam_dbg(const char *dir, const char *prefix, int blockType,
+   const char *filename, int linenumber);
+
+wchar_t *_wtempnam_dbg(const wchar_t *dir, const wchar_t *prefix,
+   int blockType, const char *filename, int linenumber);
+
+void testWinTempnamLeak(const char* dir, const char* prefix) {
+  char* fileName = _tempnam(dir, prefix);
+}// expected-warning {{Potential leak of memory pointed to by}}
+
+void testWinTempnamDbgLeak(const char* dir, const char* prefix) {
+  char* fileName = _tempnam_dbg(dir, prefix, 0, __FILE__, __LINE__);
+}// expected-warning {{Potential leak of memory pointed to by}}
+
+void testWinWideTempnamLeak(const wchar_t* dir, const wchar_t* prefix) {
+  wchar_t* fileName = _wtempnam(dir, prefix);
+}// expected-warning {{Potential leak of memory pointed to by}}
+
+void testWinWideTempnaDbgmLeak(const wchar_t* dir, const wchar_t* prefix) {
+  wchar_t* fileName = _wtempnam_dbg(dir, prefix, 0, __FILE__, __LINE__);
+}// expected-warning {{Potential leak of memory pointed to by}}
+
+void testWinTempnamNoLeak(const char* dir, const char* prefix) {
+  char* fileName = _tempnam(dir, prefix);
+  free(fileName);// no warning
+}
+
+void testWinTempnamDbgNoLeak(const char* dir, const char* prefix) {
+  char* fileName = _tempnam_dbg(dir, prefix, 0, __FILE__, __LINE__);
+  free(fileName);// no warning
+}
+
+void testWinWideTempnamNoLeak(const wchar_t* dir, const wchar_t* prefix) {
+  wchar_t* fileName = _wtempnam(dir, prefix);
+  free(fileName);// no warning
+}
+
+void testWinWideTempnamDbgNoLeak(const wchar_t* dir, const wchar_t* prefix) {
+  wchar_t* fileName = _wtempnam_dbg(dir, prefix, 0, __FILE__, __LINE__);
+  free(fileName);// no warning
+}
+
+// What does "ContentIsDefined" refer to?
+void testWinTempnamNoLeakContentIsDefined(const char* dir, const char* prefix) {
+  char* fileName = _tempnam(dir, prefix);
+  char result = fileName[0];// no warning
+  free(fileName);
+}
+
+// What does "ContentIsDefined" refer to?
+void testWinWideTempnamNoLeakContentIsDefined(const wchar_t* dir, const wchar_t* prefix) {
+  wchar_t* fileName = _wtempnam(dir, prefix);
+  wchar_t result = fileName[0];// no warning
+  free(fileName);
+}
+#endif //defined(_WIN32)
Index: llvm/tools/clang/test/Analysis/malloc.c
===
--- llvm/tools/clang/test/Analysis/malloc.c
+++ llvm/tools/clang/test/Analysis/malloc.c
@@ -32,11 +32,37 @@
 char *strndup(const char *s, size_t n);
 int memcmp(const void *s1, const void *s2, size_t n);
 
+
 /

Re: [PATCH] D18088: Add a new warning to notify users of mismatched SDK and deployment target

2016-04-27 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Driver/ToolChains.cpp:722
@@ +721,3 @@
+if (BeginSDK != StringRef::npos && EndSDK != StringRef::npos) {
+  StringRef SDK = isysroot.slice(BeginSDK + 5, EndSDK);
+  if (!SDK.startswith(getPlatformFamily()))

rsmith wrote:
> According to `slice`'s documentation, if `EndSDK < BeginSDK + 5`, this 
> `slice` call will return a slice from `BeginSDK + 5` to the end of the 
> string, and you won't be checking for a `.sdk` prefix as you intended to.
Huh. That's a bug in `slice`'s documentation (fixed in r267831).


http://reviews.llvm.org/D18088



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


Re: [PATCH] D18088: Add a new warning to notify users of mismatched SDK and deployment target

2016-04-27 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith.


Comment at: lib/Driver/ToolChains.cpp:718-720
@@ +717,5 @@
+StringRef isysroot = A->getValue();
+// Assume SDK has path: SOME_PATH/SDKs/PlatformXX.YY.sdk
+size_t BeginSDK = isysroot.rfind("SDKs/");
+size_t EndSDK = isysroot.rfind(".sdk");
+if (BeginSDK != StringRef::npos && EndSDK != StringRef::npos) {

This seems to get a couple of corner cases wrong (`/` between the platform name 
and `.sdk`, `.sdk` not at the end of the path component, ...). Have you 
considered using `llvm::sys::path`'s path iterators here? Not a big deal either 
way, though.


Comment at: lib/Driver/ToolChains.cpp:722
@@ +721,3 @@
+if (BeginSDK != StringRef::npos && EndSDK != StringRef::npos) {
+  StringRef SDK = isysroot.slice(BeginSDK + 5, EndSDK);
+  if (!SDK.startswith(getPlatformFamily()))

According to `slice`'s documentation, if `EndSDK < BeginSDK + 5`, this `slice` 
call will return a slice from `BeginSDK + 5` to the end of the string, and you 
won't be checking for a `.sdk` prefix as you intended to.


http://reviews.llvm.org/D18088



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


r267830 - clang/test/CodeGenCXX/cfi-blacklist.cpp: Exclude ms targets. They would be non-cfi.

2016-04-27 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Wed Apr 27 19:53:30 2016
New Revision: 267830

URL: http://llvm.org/viewvc/llvm-project?rev=267830&view=rev
Log:
clang/test/CodeGenCXX/cfi-blacklist.cpp: Exclude ms targets. They would be 
non-cfi.

Modified:
cfe/trunk/test/CodeGenCXX/cfi-blacklist.cpp

Modified: cfe/trunk/test/CodeGenCXX/cfi-blacklist.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cfi-blacklist.cpp?rev=267830&r1=267829&r2=267830&view=diff
==
--- cfe/trunk/test/CodeGenCXX/cfi-blacklist.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/cfi-blacklist.cpp Wed Apr 27 19:53:30 2016
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -fvisibility hidden -fms-extensions -fsanitize=cfi-vcall 
-emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=NOBL %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -fvisibility hidden 
-fms-extensions -fsanitize=cfi-vcall -emit-llvm -o - %s | FileCheck 
--check-prefix=CHECK --check-prefix=NOBL %s
 // RUN: echo "type:std::*" > %t.txt
-// RUN: %clang_cc1 -fvisibility hidden -fms-extensions -fsanitize=cfi-vcall 
-fsanitize-blacklist=%t.txt -emit-llvm -o - %s | FileCheck --check-prefix=CHECK 
--check-prefix=NOSTD %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -fvisibility hidden 
-fms-extensions -fsanitize=cfi-vcall -fsanitize-blacklist=%t.txt -emit-llvm -o 
- %s | FileCheck --check-prefix=CHECK --check-prefix=NOSTD %s
 
 struct S1 {
   virtual void f();


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


RE: [PATCH] D19567: PR21823: 'nodebug' attribute on global/static variables

2016-04-27 Thread Robinson, Paul via cfe-commits
Huh.  There are strange interactions here, which makes me even more nervous 
about testing fewer cases.
As it happens, the test as written did not exercise all 3 modified paths. 
Because 'struct S2' had all its members marked with nodebug, none of the 
static-member references caused debug info for the class as a whole to be 
attempted.  I needed to add a variable of type S2 (without 'nodebug') in order 
to exercise that path.  Once that was done, then the modification to 
CollectRecordFields became necessary.
   Even in an unmodified compiler, "static_const_member" never 
shows up as a DIGlobalVariable, although the other cases all do.  So, testing 
only for DIGlobalVariable wouldn't be sufficient to show that it gets 
suppressed by 'nodebug'.
   "static_member" shows up unless we have modified both 
EmitGlobalVariable(VarDecl case) and CollectRecordFields, given that the test 
actually tries to emit debug info for S2 as a whole.

So, the genuinely most-minimal did-this-change-do-anything test would need only 
"static_member" and "const_global_int_def" to show that each path had some 
effect.  This approach does not fill me with warm fuzzies, or the feeling that 
future changes in this area will not break the intended behavior.  What do you 
think?
--paulr

From: David Blaikie [mailto:dblai...@gmail.com]
Sent: Wednesday, April 27, 2016 3:43 PM
To: reviews+d19567+public+1ee0c82c0824b...@reviews.llvm.org; Robinson, Paul
Cc: Aaron Ballman; Adrian Prantl; cfe-commits
Subject: Re: [PATCH] D19567: PR21823: 'nodebug' attribute on global/static 
variables



On Wed, Apr 27, 2016 at 3:24 PM, Paul Robinson via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
probinson added a comment.

In http://reviews.llvm.org/D19567#413997, @dblaikie wrote:

> For 3 code paths (that seem fairly independent from one another) I'd only 
> really expect to see 3 variables in the test - one to exercise each codepath. 
> What's the reason for the larger set of test cases?


I'm not interested in testing code-paths, I'm interested in testing a feature, 
and relying on the fact that (at the moment) only 3 code paths are involved is 
not really robust.  Granted there is some duplication, and I took that out 
(r267804), but there are more than 3 relevant cases from an end-user-feature 
perspective.

We generally have to assume /something/ about the implementation to constrain 
testing. eg: we don't assume that putting a variable inside a namespace would 
make a difference here so we don't go & test all these case inside a namespace 
as well as in the global namespace. So I'm not sure why we wouldn't go further 
down that path, knowing that there are only a small number of ways global 
variable definitions can impact debug info generation.


> Then it might be simpler just to include 6 variables, one of each kind with 
> the attribute, one of each kind without. & I think you could check this 
> reliably with:

>

> CHECK: DIGlobalVariable

>  CHECK-NEXT: "name"

>

> repeated three times with a CHECK-NOT: DIGlobalVariable at the end - that way 
> the CHECK wouldn't skip past an existing variable, and you'd check you got 
> the right ones. I think.


If I cared only about DIGlobalVariable that does sound like it would work.  
Sadly, the static const data member comes out as a DIDerivedType, not a 
DIGlobalVariable.  Also, it's *really* important to us that the DICompositeType 
for "S1" is not present; that's actually where we get the major benefit.

But that codepath is already tested by any test for a TU that has a static 
member without a definition, right?

As for the composite type - this is much like testing in LLVM where we test 
that a certain inlining occurred when we test the inliner - not the knock-on 
effect that that has on some other optimization which we've already tested 
separately.

Once you have more than one kind of thing to look for (or -NOT look for) it 
gets a lot more tedious to show it's all correct in one pass like you are 
suggesting.

(Re. getting rid of the types:  We have licensees with major template 
metaprogramming going on, but if they can mark those variables 'nodebug' and 
consequently suppress the instantiated types from the debug info, they should 
see a major size win.  One licensee reported that reducing some name from 19 
characters to 1 char got them a 5MB reduction. Imagine if they could get rid of 
all of those types...)


Repository:
  rL LLVM

http://reviews.llvm.org/D19567


___
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


[clang-tools-extra] r267828 - clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-member-init-cxx98.cpp: Appease ms targets with -fno-delayed-template-parsing.

2016-04-27 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Wed Apr 27 19:39:48 2016
New Revision: 267828

URL: http://llvm.org/viewvc/llvm-project?rev=267828&view=rev
Log:
clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-member-init-cxx98.cpp:
 Appease ms targets with -fno-delayed-template-parsing.

Modified:

clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init-cxx98.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init-cxx98.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init-cxx98.cpp?rev=267828&r1=267827&r2=267828&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init-cxx98.cpp
 (original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init-cxx98.cpp
 Wed Apr 27 19:39:48 2016
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-member-init %t -- -- 
-std=c++98
+// RUN: %check_clang_tidy %s cppcoreguidelines-pro-type-member-init %t -- -- 
-std=c++98 -fno-delayed-template-parsing
 
 struct PositiveFieldBeforeConstructor {
   int F;


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


Re: [PATCH] D18271: Avoid -Wshadow warnings about constructor parameters named after fields

2016-04-27 Thread Richard Smith via cfe-commits
rsmith added a comment.

LGTM


http://reviews.llvm.org/D18271



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


Re: [PATCH] D19175: Fix for PR27015 (variable template initialized with a generic lambda expression)

2016-04-27 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Parse/ParseTemplate.cpp:151-153
@@ -149,1 +150,5 @@
 
+  if (isSpecialization)
+TemplateParmScopePtr->setFlags(TemplateParmScopePtr->getFlags() ^
+   Scope::TemplateParamScope);
+

Use `ParseScopeFlags` to change the flags here rather than calling `setFlags` 
directly. Please also use `getFlags() & ~Scope::TemplateParamScope` rather than 
`^` to make it more obvious that you're clearing the flag not just flipping it.


Comment at: lib/Sema/SemaLambda.cpp:818
@@ -817,3 +817,3 @@
   if (Scope *TmplScope = CurScope->getTemplateParamParent())
-if (!TmplScope->decl_empty())
+if (TmplScope->isTemplateParamScope())
   KnownDependent = true;

This should not be necessary. It looks like `Scope::setFlags` fails to update 
`TemplateParamParent` (etc) if the relevant flag changes. Instead of adding 
this `if`, try changing the body of `Scope::setFlags` to call `Init(AnyParent, 
F);`.


http://reviews.llvm.org/D19175



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


r267824 - Driver: only produce CFI -fvisibility= error when compiling.

2016-04-27 Thread Peter Collingbourne via cfe-commits
Author: pcc
Date: Wed Apr 27 19:18:30 2016
New Revision: 267824

URL: http://llvm.org/viewvc/llvm-project?rev=267824&view=rev
Log:
Driver: only produce CFI -fvisibility= error when compiling.

The -fvisibility= flag only affects compile jobs, so there's no need to
error out because of it if we aren't compiling (e.g. if we are only linking).

Modified:
cfe/trunk/lib/Driver/SanitizerArgs.cpp
cfe/trunk/test/Driver/fsanitize.c

Modified: cfe/trunk/lib/Driver/SanitizerArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.cpp?rev=267824&r1=267823&r2=267824&view=diff
==
--- cfe/trunk/lib/Driver/SanitizerArgs.cpp (original)
+++ cfe/trunk/lib/Driver/SanitizerArgs.cpp Wed Apr 27 19:18:30 2016
@@ -561,14 +561,6 @@ SanitizerArgs::SanitizerArgs(const ToolC
   LinkCXXRuntimes =
   Args.hasArg(options::OPT_fsanitize_link_cxx_runtime) || D.CCCIsCXX();
 
-  // Require -fvisibility= flag on non-Windows if vptr CFI is enabled.
-  if ((Kinds & CFIClasses) && !TC.getTriple().isOSWindows() &&
-  !Args.hasArg(options::OPT_fvisibility_EQ)) {
-D.Diag(clang::diag::err_drv_argument_only_allowed_with)
-<< lastArgumentForMask(D, Args, Kinds & CFIClasses)
-<< "-fvisibility=";
-  }
-
   // Finally, initialize the set of available and recoverable sanitizers.
   Sanitizers.Mask |= Kinds;
   RecoverableSanitizers.Mask |= RecoverableKinds;
@@ -690,6 +682,16 @@ void SanitizerArgs::addArgs(const ToolCh
  TC.getCompilerRT(Args, "stats")));
 addIncludeLinkerOption(TC, Args, CmdArgs, "__sanitizer_stats_register");
   }
+
+  // Require -fvisibility= flag on non-Windows when compiling if vptr CFI is
+  // enabled.
+  if (Sanitizers.hasOneOf(CFIClasses) && !TC.getTriple().isOSWindows() &&
+  !Args.hasArg(options::OPT_fvisibility_EQ)) {
+TC.getDriver().Diag(clang::diag::err_drv_argument_only_allowed_with)
+<< lastArgumentForMask(TC.getDriver(), Args,
+   Sanitizers.Mask & CFIClasses)
+<< "-fvisibility=";
+  }
 }
 
 SanitizerMask parseArgValues(const Driver &D, const llvm::opt::Arg *A,

Modified: cfe/trunk/test/Driver/fsanitize.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=267824&r1=267823&r2=267824&view=diff
==
--- cfe/trunk/test/Driver/fsanitize.c (original)
+++ cfe/trunk/test/Driver/fsanitize.c Wed Apr 27 19:18:30 2016
@@ -309,8 +309,10 @@
 // RUN: %clang -target x86_64-linux-gnu -flto -fsanitize=cfi-derived-cast -c 
%s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NOVIS
 // CHECK-CFI-NOVIS: '-fsanitize=cfi-derived-cast' only allowed with 
'-fvisibility='
 
-// RUN: %clang -target x86_64-pc-win32 -flto -fsanitize=cfi-derived-cast -c %s 
-### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NOVIS-WIN
-// CHECK-CFI-NOVIS-WIN-NOT: only allowed with
+// RUN: %clang -target x86_64-pc-win32 -flto -fsanitize=cfi-derived-cast -c %s 
-### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NOVIS-NOERROR
+// RUN: echo > %t.o
+// RUN: %clang -target x86_64-linux-gnu -flto -fsanitize=cfi-derived-cast %t.o 
-### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NOVIS-NOERROR
+// CHECK-CFI-NOVIS-NOERROR-NOT: only allowed with
 
 // RUN: %clang -target mips-unknown-linux -fsanitize=cfi-icall %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CFI-ICALL-MIPS
 // CHECK-CFI-ICALL-MIPS: unsupported option '-fsanitize=cfi-icall' for target 
'mips-unknown-linux'


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


Re: [PATCH] D19443: Module Debugging: Fix the condition for determining whether a template instantiation is in a module.

2016-04-27 Thread Adrian Prantl via cfe-commits
aprantl closed this revision.
aprantl added a comment.

Thanks! Committed as 267464, 267633, 267630, 267612, 267611.


Repository:
  rL LLVM

http://reviews.llvm.org/D19443



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


Re: [PATCH] D19175: Fix for PR27015 (variable template initialized with a generic lambda expression)

2016-04-27 Thread Akira Hatanaka via cfe-commits
ahatanak updated this revision to Diff 55356.
ahatanak added a comment.

Made a couple of changes to distinguish between an explicit specialization 
('template<>') and a template declaration which doesn't have a named template 
parameter (see the variable template fn0 in test case vartemplate-lambda.cpp 
for an example).

- In Parser::ParseTemplateDeclarationOrSpecialization, clear the 
TemplateParamScope bit of the scope's flag if it's seen only explicit 
specializations.

- In Sema::ActOnStartOfLambdaDefinition, instead of checking whether the decl 
list is empty, check the TemplateParamScope bit of the template scope to see if 
it's in a "real" template declaration scope. I initially tried just removing 
the decls_empty() check, but found out that it asserted when the following code 
in test/CodeGenCXX/mangle-lambdas.cpp was compiled:

template<> double StaticMembers::z = []{return 42; }();

Also, I had to change the check in 
test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp. Because the dependent bit of 
the lambda class is now set to true, Sema::CheckTemplateArgument returns early 
(near line 4876) before printing the last two of the three diagnostic messages:

1. error: lambda expression in an unevaluated operand
2. error: non-type template argument is not a constant expression
3. note: non-literal type 'const lambdas::(lambda at p1.cpp:2:21)' cannot be 
used in a constant expression

I'm not sure whether the lambda in p1.cpp should be considered dependent, but I 
don't think we've been doing the check correctly. If we add another template 
parameter in front of "I", clang prints only the first message:

template
int f();


http://reviews.llvm.org/D19175

Files:
  lib/Parse/ParseTemplate.cpp
  lib/Sema/SemaLambda.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
  test/SemaCXX/vartemplate-lambda.cpp

Index: test/SemaCXX/vartemplate-lambda.cpp
===
--- /dev/null
+++ test/SemaCXX/vartemplate-lambda.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+template  auto fn0 = [] {};
+template  void foo0() { fn0(); }
+
+template auto fn1 = [](auto a) { return a + T(1); };
+
+template 
+int foo2() {
+  X a = 0x61;
+  fn1(a);
+  return 0;
+}
+
+int main() {
+  foo2();
+}
Index: test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
===
--- test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
+++ test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp
@@ -195,7 +195,7 @@
 namespace default_args {
 #ifdef CPP11ONLY
 namespace lambdas {
-template //expected-error 2{{constant 
expression}} expected-note{{constant expression}}
+template //expected-error {{constant expression}}
 int f();
 }
 #endif // CPP11ONLY
Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3907,9 +3907,14 @@
   PushExpressionEvaluationContext(Sema::PotentiallyEvaluated, OldVar);
 
 // Instantiate the initializer.
-ExprResult Init =
-SubstInitializer(OldVar->getInit(), TemplateArgs,
- OldVar->getInitStyle() == VarDecl::CallInit);
+ExprResult Init;
+
+{
+  ContextRAII SwitchContext(*this, Var->getDeclContext());
+  Init = SubstInitializer(OldVar->getInit(), TemplateArgs,
+  OldVar->getInitStyle() == VarDecl::CallInit);
+}
+
 if (!Init.isInvalid()) {
   bool TypeMayContainAuto = true;
   Expr *InitExpr = Init.get();
Index: lib/Sema/SemaLambda.cpp
===
--- lib/Sema/SemaLambda.cpp
+++ lib/Sema/SemaLambda.cpp
@@ -815,7 +815,7 @@
   // semantic context isn't, if it appears within a default argument of a
   // function template.
   if (Scope *TmplScope = CurScope->getTemplateParamParent())
-if (!TmplScope->decl_empty())
+if (TmplScope->isTemplateParamScope())
   KnownDependent = true;
 
   // Determine the signature of the call operator.
Index: lib/Parse/ParseTemplate.cpp
===
--- lib/Parse/ParseTemplate.cpp
+++ lib/Parse/ParseTemplate.cpp
@@ -67,6 +67,7 @@
 
   // Enter template-parameter scope.
   ParseScope TemplateParmScope(this, Scope::TemplateParamScope);
+  Scope *TemplateParmScopePtr = getCurScope();
 
   // Tell the action that names should be checked in the context of
   // the declaration to come.
@@ -147,6 +148,10 @@
 }
   } while (Tok.isOneOf(tok::kw_export, tok::kw_template));
 
+  if (isSpecialization)
+TemplateParmScopePtr->setFlags(TemplateParmScopePtr->getFlags() ^
+   Scope::TemplateParamScope);
+
   // Parse the actual template declaration.
   return ParseSingleDeclarationAfterTemplate(Context,
  

Re: [PATCH] D19249: Fix include path in ClangTidy.cpp.

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

Since http://reviews.llvm.org/D19393 is approved, this patch also looks fine.


http://reviews.llvm.org/D19249



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


Re: [PATCH] D18271: Avoid -Wshadow warnings about constructor parameters named after fields

2016-04-27 Thread Reid Kleckner via cfe-commits
rnk updated this revision to Diff 55359.
rnk added a comment.

- address comments


http://reviews.llvm.org/D18271

Files:
  include/clang/Basic/Diagnostic.h
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Sema/AnalysisBasedWarnings.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExpr.cpp
  test/SemaCXX/warn-shadow.cpp

Index: test/SemaCXX/warn-shadow.cpp
===
--- test/SemaCXX/warn-shadow.cpp
+++ test/SemaCXX/warn-shadow.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fsyntax-only -Wshadow %s
+// RUN: %clang_cc1 -verify -fsyntax-only -Wshadow-all %s
 
 namespace {
   int i; // expected-note {{previous declaration is here}}
@@ -29,7 +29,23 @@
 
 class A {
   static int data; // expected-note {{previous declaration}}
-  int field; // expected-note {{previous declaration}}
+  // expected-note@+1 {{previous declaration}}
+  int field;
+  int f1, f2, f3, f4; // expected-note 8 {{previous declaration is here}}
+
+  // The initialization is safe, but the modifications are not.
+  A(int f1, int f2, int f3, int f4) // expected-note-re 4 {{variable 'f{{[0-4]}}' is declared here}}
+	  : f1(f1) {
+f1 = 3; // expected-warning {{modifying constructor parameter 'f1' that shadows a field of 'A'}}
+f1 = 4; // one warning per shadow
+f2++; // expected-warning {{modifying constructor parameter 'f2' that shadows a field of 'A'}}
+--f3; // expected-warning {{modifying constructor parameter 'f3' that shadows a field of 'A'}}
+f4 += 2; // expected-warning {{modifying constructor parameter 'f4' that shadows a field of 'A'}}
+  }
+
+  // The initialization is safe, but the modifications are not.
+  // expected-warning-re@+1 4 {{constructor parameter 'f{{[0-4]}}' shadows the field 'f{{[0-9]}}' of 'A'}}
+  A(int f1, int f2, int f3, int f4, double overload_dummy) {}
 
   void test() {
 char *field; // expected-warning {{declaration shadows a field of 'A'}}
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -9733,6 +9733,9 @@
 /// emit an error and return true.  If so, return false.
 static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) {
   assert(!E->hasPlaceholderType(BuiltinType::PseudoObject));
+
+  S.CheckShadowingDeclModification(E, Loc);
+
   SourceLocation OrigLoc = Loc;
   Expr::isModifiableLvalueResult IsLV = E->isModifiableLvalue(S.Context,
   &Loc);
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -1609,9 +1609,19 @@
 // If this was a forward reference to a label, verify it was defined.
 if (LabelDecl *LD = dyn_cast(D))
   CheckPoppedLabel(LD, *this);
-
-// Remove this name from our lexical scope.
+
+// Remove this name from our lexical scope, and warn on it if we haven't
+// already.
 IdResolver.RemoveDecl(D);
+auto ShadowI = ShadowingDecls.find(D);
+if (ShadowI != ShadowingDecls.end()) {
+  if (const auto *FD = dyn_cast(ShadowI->second)) {
+Diag(D->getLocation(), diag::warn_ctor_parm_shadows_field)
+<< D << FD << FD->getParent();
+Diag(FD->getLocation(), diag::note_previous_declaration);
+  }
+  ShadowingDecls.erase(ShadowI);
+}
   }
 }
 
@@ -6382,6 +6392,17 @@
   return NewVD;
 }
 
+/// Enum describing the %select options in diag::warn_decl_shadow.
+enum ShadowedDeclKind { SDK_Local, SDK_Global, SDK_StaticMember, SDK_Field };
+
+/// Determine what kind of declaration we're shadowing.
+static ShadowedDeclKind computeShadowedDeclKind(const NamedDecl *ShadowedDecl,
+const DeclContext *OldDC) {
+  if (isa(OldDC))
+return isa(ShadowedDecl) ? SDK_Field : SDK_StaticMember;
+  return OldDC->isFileContext() ? SDK_Global : SDK_Local;
+}
+
 /// \brief Diagnose variable or built-in function shadowing.  Implements
 /// -Wshadow.
 ///
@@ -6410,12 +6431,23 @@
   if (!isa(ShadowedDecl) && !isa(ShadowedDecl))
 return;
 
-  // Fields are not shadowed by variables in C++ static methods.
-  if (isa(ShadowedDecl))
+  if (FieldDecl *FD = dyn_cast(ShadowedDecl)) {
+// Fields are not shadowed by variables in C++ static methods.
 if (CXXMethodDecl *MD = dyn_cast(NewDC))
   if (MD->isStatic())
 return;
 
+// Fields shadowed by constructor parameters are a special case. Usually
+// the constructor initializes the field with the parameter.
+if (isa(NewDC) && isa(D)) {
+  // Remember that this was shadowed so we can either warn about its
+  // modification or its existence depending on warning settings.
+  D = D->getCanonicalDecl();
+  ShadowingDecls.insert({D, FD});
+  return;
+}
+  }
+
   if (VarDecl *shadowedVar = dyn_c

r267814 - [OpenMP] Code generation for target exit data directive

2016-04-27 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Wed Apr 27 18:14:30 2016
New Revision: 267814

URL: http://llvm.org/viewvc/llvm-project?rev=267814&view=rev
Log:
[OpenMP] Code generation for target exit data directive

Summary:
This patch adds support for the target exit data directive code generation.

Given that, apart from the employed runtime call, target exit data requires the 
same code generation pattern as target enter data, the OpenMP codegen entry 
point was renamed and reused for both.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: cfe-commits, fraggamuffin, caomhin

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

Added:
cfe/trunk/test/OpenMP/target_exit_data_codegen.cpp
Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=267814&r1=267813&r2=267814&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Wed Apr 27 18:14:30 2016
@@ -5840,13 +5840,16 @@ void CGOpenMPRuntime::emitTargetDataCall
   }
 }
 
-void CGOpenMPRuntime::emitTargetEnterDataCall(CodeGenFunction &CGF,
-  const OMPExecutableDirective &D,
-  const Expr *IfCond,
-  const Expr *Device) {
+void CGOpenMPRuntime::emitTargetEnterOrExitDataCall(
+CodeGenFunction &CGF, const OMPExecutableDirective &D, const Expr *IfCond,
+const Expr *Device) {
   if (!CGF.HaveInsertPoint())
 return;
 
+  assert((isa(D) ||
+  isa(D)) &&
+ "Expecting either target enter or exit data directives.");
+
   // Generate the code for the opening of the data environment.
   auto &&ThenGen = [&D, &CGF, Device](CodeGenFunction &CGF, PrePostActionTy &) 
{
 // Fill up the arrays with all the mapped variables.
@@ -5888,8 +5891,11 @@ void CGOpenMPRuntime::emitTargetEnterDat
 DeviceID, PointerNum,BasePointersArrayArg,
 PointersArrayArg, SizesArrayArg, MapTypesArrayArg};
 auto &RT = CGF.CGM.getOpenMPRuntime();
-
CGF.EmitRuntimeCall(RT.createRuntimeFunction(OMPRTL__tgt_target_data_begin),
-OffloadingArgs);
+CGF.EmitRuntimeCall(
+RT.createRuntimeFunction(isa(D)
+ ? OMPRTL__tgt_target_data_begin
+ : OMPRTL__tgt_target_data_end),
+OffloadingArgs);
   };
 
   // In the event we get an if clause, we don't have to take any action on the

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h?rev=267814&r1=267813&r2=267814&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h Wed Apr 27 18:14:30 2016
@@ -1052,15 +1052,17 @@ public:
const Expr *IfCond, const Expr *Device,
const RegionCodeGenTy &CodeGen);
 
-  /// \brief Emit the target data mapping code associated with \a D.
+  /// \brief Emit the target enter or exit data mapping code associated with
+  /// directive \a D.
   /// \param D Directive to emit.
   /// \param IfCond Expression evaluated in if clause associated with the 
target
   /// directive, or null if no if clause is used.
   /// \param Device Expression evaluated in device clause associated with the
   /// target directive, or null if no device clause is used.
-  virtual void emitTargetEnterDataCall(CodeGenFunction &CGF,
-   const OMPExecutableDirective &D,
-   const Expr *IfCond, const Expr *Device);
+  virtual void emitTargetEnterOrExitDataCall(CodeGenFunction &CGF,
+ const OMPExecutableDirective &D,
+ const Expr *IfCond,
+ const Expr *Device);
 };
 
 } // namespace CodeGen

Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=267814&r1=267813&r2=267814&view=diff
==
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Wed Apr 27 18:14:30 2016
@@ -3287,12 +3287,29 @@ void CodeGenFunction::EmitOMPTargetEnter
   if (auto *C = S.getSingleClause())
 Device = C->getDevice();
 
-  CGM.getOpenMPRuntime().emitTargetEnterDataCall(*this, S, IfCond, Device);
+  CGM.getOpenMPRuntime().emitTargetEnterOrExitD

Re: [PATCH] D17369: [OpenMP] Code generation for target exit data directive

2016-04-27 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 55352.
sfantao added a comment.

- Rebase.


http://reviews.llvm.org/D17369

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGStmtOpenMP.cpp
  test/OpenMP/target_exit_data_codegen.cpp

Index: test/OpenMP/target_exit_data_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/target_exit_data_codegen.cpp
@@ -0,0 +1,221 @@
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+///==///
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -DCK1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+#ifdef CK1
+
+// CK1: [[ST:%.+]] = type { i32, double* }
+template 
+struct ST {
+  T a;
+  double *b;
+};
+
+ST gb;
+double gc[100];
+
+// CK1: [[SIZE00:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 800]
+// CK1: [[MTYPE00:@.+]] = {{.+}}constant [1 x i32] [i32 2]
+
+// CK1: [[SIZE02:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 4]
+// CK1: [[MTYPE02:@.+]] = {{.+}}constant [1 x i32] [i32 8]
+
+// CK1: [[MTYPE03:@.+]] = {{.+}}constant [1 x i32] [i32 6]
+
+// CK1: [[SIZE04:@.+]] = {{.+}}constant [2 x i[[sz]]] [i[[sz]] {{8|4}}, i[[sz]] 24]
+// CK1: [[MTYPE04:@.+]] = {{.+}}constant [2 x i32] [i32 8, i32 104]
+
+// CK1-LABEL: _Z3fooi
+void foo(int arg) {
+  int la;
+  float lb[arg];
+
+  // Region 00
+  // CK1-NOT: __tgt_target_data_begin
+  // CK1-DAG: call void @__tgt_target_data_end(i32 [[DEV:%[^,]+]], i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
+  // CK1-DAG: [[DEV]] = load i32, i32* %{{[^,]+}},
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[BP0]]
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[P0]]
+
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  #pragma omp target exit data if(1+3-5) device(arg) map(from: gc)
+  {++arg;}
+
+  // Region 01
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  #pragma omp target exit data map(release: la) if(1+3-4)
+  {++arg;}
+
+  // Region 02
+  // CK1-NOT: __tgt_target_data_begin
+  // CK1: br i1 %{{[^,]+}}, label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]]
+  // CK1: [[IFTHEN]]
+  // CK1-DAG: call void @__tgt_target_data_end(i32 4, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
+  // CK1-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
+  // CK1-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
+  // CK1-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
+  // CK1: br label %[[IFEND:[^,]+]]
+
+  // CK1: [[IFELSE]]
+  // CK1: br label %[[IFEND]]
+  // CK1: [[IFEND]]
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  #pragma omp target exit data map(release: arg) if(arg) device(4)
+  {++arg;}
+
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  {++arg;}
+
+  // Region 03
+  // CK1-NOT: __tgt_target_data_begin
+  // CK1-DAG: call void @__tgt_target_data_end(i32 -1, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: 

Re: [PATCH] D17368: [OpenMP] Code generation for target enter data directive

2016-04-27 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 55349.
sfantao added a comment.

- Rebase.


http://reviews.llvm.org/D17368

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGStmtOpenMP.cpp
  test/OpenMP/target_enter_data_codegen.cpp

Index: test/OpenMP/target_enter_data_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/target_enter_data_codegen.cpp
@@ -0,0 +1,221 @@
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+///==///
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -DCK1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+#ifdef CK1
+
+// CK1: [[ST:%.+]] = type { i32, double* }
+template 
+struct ST {
+  T a;
+  double *b;
+};
+
+ST gb;
+double gc[100];
+
+// CK1: [[SIZE00:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 800]
+// CK1: [[MTYPE00:@.+]] = {{.+}}constant [1 x i32] zeroinitializer
+
+// CK1: [[SIZE02:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 4]
+// CK1: [[MTYPE02:@.+]] = {{.+}}constant [1 x i32] [i32 1]
+
+// CK1: [[MTYPE03:@.+]] = {{.+}}constant [1 x i32] [i32 5]
+
+// CK1: [[SIZE04:@.+]] = {{.+}}constant [2 x i[[sz]]] [i[[sz]] {{8|4}}, i[[sz]] 24]
+// CK1: [[MTYPE04:@.+]] = {{.+}}constant [2 x i32] [i32 1, i32 97]
+
+// CK1-LABEL: _Z3fooi
+void foo(int arg) {
+  int la;
+  float lb[arg];
+
+  // Region 00
+  // CK1-DAG: call void @__tgt_target_data_begin(i32 [[DEV:%[^,]+]], i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
+  // CK1-DAG: [[DEV]] = load i32, i32* %{{[^,]+}},
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[BP0]]
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[P0]]
+
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  // CK1-NOT: __tgt_target_data_end
+  #pragma omp target enter data if(1+3-5) device(arg) map(alloc: gc)
+  {++arg;}
+
+  // Region 01
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  #pragma omp target enter data map(to: la) if(1+3-4)
+  {++arg;}
+
+  // Region 02
+  // CK1: br i1 %{{[^,]+}}, label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]]
+  // CK1: [[IFTHEN]]
+  // CK1-DAG: call void @__tgt_target_data_begin(i32 4, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
+  // CK1-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
+  // CK1-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
+  // CK1-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
+  // CK1: br label %[[IFEND:[^,]+]]
+
+  // CK1: [[IFELSE]]
+  // CK1: br label %[[IFEND]]
+  // CK1: [[IFEND]]
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  // CK1-NOT: __tgt_target_data_end
+  #pragma omp target enter data map(to: arg) if(arg) device(4)
+  {++arg;}
+
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  {++arg;}
+
+  // Region 03
+  // CK1-DAG: call void @__tgt_target_data_begin(i32 -1, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds

r267812 - [OpenMP] Code generation for target enter data directive

2016-04-27 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Wed Apr 27 18:07:29 2016
New Revision: 267812

URL: http://llvm.org/viewvc/llvm-project?rev=267812&view=rev
Log:
[OpenMP] Code generation for target enter data directive

Summary: This patch adds support for the target enter data directive code 
generation.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: cfe-commits, fraggamuffin, caomhin

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

Added:
cfe/trunk/test/OpenMP/target_enter_data_codegen.cpp
Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=267812&r1=267811&r2=267812&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Wed Apr 27 18:07:29 2016
@@ -5839,3 +5839,67 @@ void CGOpenMPRuntime::emitTargetDataCall
 EndThenRCG(CGF);
   }
 }
+
+void CGOpenMPRuntime::emitTargetEnterDataCall(CodeGenFunction &CGF,
+  const OMPExecutableDirective &D,
+  const Expr *IfCond,
+  const Expr *Device) {
+  if (!CGF.HaveInsertPoint())
+return;
+
+  // Generate the code for the opening of the data environment.
+  auto &&ThenGen = [&D, &CGF, Device](CodeGenFunction &CGF, PrePostActionTy &) 
{
+// Fill up the arrays with all the mapped variables.
+MappableExprsHandler::MapValuesArrayTy BasePointers;
+MappableExprsHandler::MapValuesArrayTy Pointers;
+MappableExprsHandler::MapValuesArrayTy Sizes;
+MappableExprsHandler::MapFlagsArrayTy MapTypes;
+
+// Get map clause information.
+MappableExprsHandler MCHandler(D, CGF);
+MCHandler.generateAllInfo(BasePointers, Pointers, Sizes, MapTypes);
+
+llvm::Value *BasePointersArrayArg = nullptr;
+llvm::Value *PointersArrayArg = nullptr;
+llvm::Value *SizesArrayArg = nullptr;
+llvm::Value *MapTypesArrayArg = nullptr;
+
+// Fill up the arrays and create the arguments.
+emitOffloadingArrays(CGF, BasePointersArrayArg, PointersArrayArg,
+ SizesArrayArg, MapTypesArrayArg, BasePointers,
+ Pointers, Sizes, MapTypes);
+emitOffloadingArraysArgument(
+CGF, BasePointersArrayArg, PointersArrayArg, SizesArrayArg,
+MapTypesArrayArg, BasePointersArrayArg, PointersArrayArg, 
SizesArrayArg,
+MapTypesArrayArg, BasePointers.size());
+
+// Emit device ID if any.
+llvm::Value *DeviceID = nullptr;
+if (Device)
+  DeviceID = CGF.Builder.CreateIntCast(CGF.EmitScalarExpr(Device),
+   CGF.Int32Ty, /*isSigned=*/true);
+else
+  DeviceID = CGF.Builder.getInt32(OMP_DEVICEID_UNDEF);
+
+// Emit the number of elements in the offloading arrays.
+auto *PointerNum = CGF.Builder.getInt32(BasePointers.size());
+
+llvm::Value *OffloadingArgs[] = {
+DeviceID, PointerNum,BasePointersArrayArg,
+PointersArrayArg, SizesArrayArg, MapTypesArrayArg};
+auto &RT = CGF.CGM.getOpenMPRuntime();
+
CGF.EmitRuntimeCall(RT.createRuntimeFunction(OMPRTL__tgt_target_data_begin),
+OffloadingArgs);
+  };
+
+  // In the event we get an if clause, we don't have to take any action on the
+  // else side.
+  auto &&ElseGen = [](CodeGenFunction &CGF, PrePostActionTy &) {};
+
+  if (IfCond) {
+emitOMPIfClause(CGF, IfCond, ThenGen, ElseGen);
+  } else {
+RegionCodeGenTy ThenGenRCG(ThenGen);
+ThenGenRCG(CGF);
+  }
+}

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h?rev=267812&r1=267811&r2=267812&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h Wed Apr 27 18:07:29 2016
@@ -1051,6 +1051,16 @@ public:
const OMPExecutableDirective &D,
const Expr *IfCond, const Expr *Device,
const RegionCodeGenTy &CodeGen);
+
+  /// \brief Emit the target data mapping code associated with \a D.
+  /// \param D Directive to emit.
+  /// \param IfCond Expression evaluated in if clause associated with the 
target
+  /// directive, or null if no if clause is used.
+  /// \param Device Expression evaluated in device clause associated with the
+  /// target directive, or null if no device clause is used.
+  virtual void emitTargetEnterDataCall(CodeGenFunction &CGF,
+   const OMPExecutableDirective &D,
+ 

r267811 - [OpenMP] Code generation for target data directive

2016-04-27 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Wed Apr 27 17:58:19 2016
New Revision: 267811

URL: http://llvm.org/viewvc/llvm-project?rev=267811&view=rev
Log:
[OpenMP] Code generation for target data directive

Summary:
This patch adds support for the target data directive code generation.

Part of the already existent functionality related with data maps is moved to a 
new function so that it could be reused.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: cfe-commits, fraggamuffin, caomhin

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

Added:
cfe/trunk/test/OpenMP/target_data_codegen.cpp
Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=267811&r1=267810&r2=267811&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Wed Apr 27 17:58:19 2016
@@ -638,6 +638,12 @@ enum OpenMPRTLFunction {
   OMPRTL__tgt_register_lib,
   // Call to void __tgt_unregister_lib(__tgt_bin_desc *desc);
   OMPRTL__tgt_unregister_lib,
+  // Call to void __tgt_target_data_begin(int32_t device_id, int32_t arg_num,
+  // void** args_base, void **args, size_t *arg_sizes, int32_t *arg_types);
+  OMPRTL__tgt_target_data_begin,
+  // Call to void __tgt_target_data_end(int32_t device_id, int32_t arg_num,
+  // void** args_base, void **args, size_t *arg_sizes, int32_t *arg_types);
+  OMPRTL__tgt_target_data_end,
 };
 
 /// A basic class for pre|post-action for advanced codegen sequence for OpenMP
@@ -1519,6 +1525,34 @@ CGOpenMPRuntime::createRuntimeFunction(u
 RTLFn = CGM.CreateRuntimeFunction(FnTy, "__tgt_unregister_lib");
 break;
   }
+  case OMPRTL__tgt_target_data_begin: {
+// Build void __tgt_target_data_begin(int32_t device_id, int32_t arg_num,
+// void** args_base, void **args, size_t *arg_sizes, int32_t *arg_types);
+llvm::Type *TypeParams[] = {CGM.Int32Ty,
+CGM.Int32Ty,
+CGM.VoidPtrPtrTy,
+CGM.VoidPtrPtrTy,
+CGM.SizeTy->getPointerTo(),
+CGM.Int32Ty->getPointerTo()};
+llvm::FunctionType *FnTy =
+llvm::FunctionType::get(CGM.VoidTy, TypeParams, /*isVarArg*/ false);
+RTLFn = CGM.CreateRuntimeFunction(FnTy, "__tgt_target_data_begin");
+break;
+  }
+  case OMPRTL__tgt_target_data_end: {
+// Build void __tgt_target_data_end(int32_t device_id, int32_t arg_num,
+// void** args_base, void **args, size_t *arg_sizes, int32_t *arg_types);
+llvm::Type *TypeParams[] = {CGM.Int32Ty,
+CGM.Int32Ty,
+CGM.VoidPtrPtrTy,
+CGM.VoidPtrPtrTy,
+CGM.SizeTy->getPointerTo(),
+CGM.Int32Ty->getPointerTo()};
+llvm::FunctionType *FnTy =
+llvm::FunctionType::get(CGM.VoidTy, TypeParams, /*isVarArg*/ false);
+RTLFn = CGM.CreateRuntimeFunction(FnTy, "__tgt_target_data_end");
+break;
+  }
   }
   assert(RTLFn && "Unable to find OpenMP runtime function");
   return RTLFn;
@@ -5110,6 +5144,160 @@ public:
 return;
   }
 };
+
+enum OpenMPOffloadingReservedDeviceIDs {
+  /// \brief Device ID if the device was not defined, runtime should get it
+  /// from environment variables in the spec.
+  OMP_DEVICEID_UNDEF = -1,
+};
+} // anonymous namespace
+
+/// \brief Emit the arrays used to pass the captures and map information to the
+/// offloading runtime library. If there is no map or capture information,
+/// return nullptr by reference.
+static void
+emitOffloadingArrays(CodeGenFunction &CGF, llvm::Value *&BasePointersArray,
+ llvm::Value *&PointersArray, llvm::Value *&SizesArray,
+ llvm::Value *&MapTypesArray,
+ MappableExprsHandler::MapValuesArrayTy &BasePointers,
+ MappableExprsHandler::MapValuesArrayTy &Pointers,
+ MappableExprsHandler::MapValuesArrayTy &Sizes,
+ MappableExprsHandler::MapFlagsArrayTy &MapTypes) {
+  auto &CGM = CGF.CGM;
+  auto &Ctx = CGF.getContext();
+
+  BasePointersArray = PointersArray = SizesArray = MapTypesArray = nullptr;
+
+  if (unsigned PointerNumVal = BasePointers.size()) {
+// Detect if we have any capture size requiring runtime evaluation of the
+// size so that a constant array could be eventually used.
+bool hasRuntimeEvaluationCaptureSize = false;
+for (auto *S : Sizes)
+  if (!isa(S)) {
+hasRuntimeEvaluationCaptureSize = true;
+break;
+  }
+
+llvm::APInt PointerNumAP(32, PointerNumVal, /*isSigned=*/tru

Re: [PATCH] D17367: [OpenMP] Code generation for target data directive

2016-04-27 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 55347.
sfantao added a comment.

- Rebase.


http://reviews.llvm.org/D17367

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGStmtOpenMP.cpp
  test/OpenMP/target_data_codegen.cpp

Index: test/OpenMP/target_data_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/target_data_codegen.cpp
@@ -0,0 +1,248 @@
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+///==///
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -DCK1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+#ifdef CK1
+
+// CK1: [[ST:%.+]] = type { i32, double* }
+template 
+struct ST {
+  T a;
+  double *b;
+};
+
+ST gb;
+double gc[100];
+
+// CK1: [[SIZE00:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 800]
+// CK1: [[MTYPE00:@.+]] = {{.+}}constant [1 x i32] [i32 2]
+
+// CK1: [[SIZE02:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 4]
+// CK1: [[MTYPE02:@.+]] = {{.+}}constant [1 x i32] [i32 1]
+
+// CK1: [[MTYPE03:@.+]] = {{.+}}constant [1 x i32] [i32 5]
+
+// CK1: [[SIZE04:@.+]] = {{.+}}constant [2 x i[[sz]]] [i[[sz]] {{8|4}}, i[[sz]] 24]
+// CK1: [[MTYPE04:@.+]] = {{.+}}constant [2 x i32] [i32 1, i32 97]
+
+// CK1-LABEL: _Z3fooi
+void foo(int arg) {
+  int la;
+  float lb[arg];
+
+  // Region 00
+  // CK1-DAG: call void @__tgt_target_data_begin(i32 [[DEV:%[^,]+]], i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
+  // CK1-DAG: [[DEV]] = load i32, i32* %{{[^,]+}},
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[BP0]]
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[P0]]
+
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+
+  // CK1-DAG: call void @__tgt_target_data_end(i32 [[DEV:%[^,]+]], i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
+  // CK1-DAG: [[DEV]] = load i32, i32* %{{[^,]+}},
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P]]
+  #pragma omp target data if(1+3-5) device(arg) map(from: gc)
+  {++arg;}
+
+  // Region 01
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  #pragma omp target data map(la) if(1+3-4)
+  {++arg;}
+
+  // Region 02
+  // CK1: br i1 %{{[^,]+}}, label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]]
+  // CK1: [[IFTHEN]]
+  // CK1-DAG: call void @__tgt_target_data_begin(i32 4, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
+  // CK1-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
+  // CK1-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
+  // CK1-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
+  // CK1: br label %[[IFEND:[^,]+]]
+
+  // CK1: [[IFELSE]]
+  // CK1: br label %[[IFEND]]
+  // CK1: [[IFEND]]
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  // CK1: br i1 %{{[^,]+}}, label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]]
+
+  // CK1: [[IFTHEN]]
+  // CK1-DAG: call void @__tgt_target_data_end(i32 4, i32 1, i8** [[G

Re: [PATCH] D18088: Add a new warning to notify users of mismatched SDK and deployment target

2016-04-27 Thread Chris Bieneman via cfe-commits
beanz added a comment.

Ping?


http://reviews.llvm.org/D18088



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


Re: [PATCH] D16749: [OpenMP] Map clause codegeneration.

2016-04-27 Thread Samuel Antao via cfe-commits
sfantao added a comment.

Hi Alexey,

Thanks for the review!



Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:4692-4694
@@ +4691,5 @@
+  llvm::Value *ElemSize;
+  if (auto *PTy = BaseTy->getAs()) {
+ElemSize = CGF.getTypeSize(PTy->getPointeeType().getCanonicalType());
+  } else {
+auto *ATy = cast(BaseTy.getTypePtr());

Done!


Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:5086
@@ +5085,3 @@
+? nullptr
+: cast(Cap->getCapturedVar()->getCanonicalDecl());
+

ABataev wrote:
> cast is not required, remove it
It does not work without the cast because the base class Decl returns a Decl*. 
Even if the overrides in the child classes use the child type, the base class 
is what is used for implicit cast checking.



http://reviews.llvm.org/D16749



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


Re: [PATCH] D19567: PR21823: 'nodebug' attribute on global/static variables

2016-04-27 Thread David Blaikie via cfe-commits
On Wed, Apr 27, 2016 at 3:24 PM, Paul Robinson via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> probinson added a comment.
>
> In http://reviews.llvm.org/D19567#413997, @dblaikie wrote:
>
> > For 3 code paths (that seem fairly independent from one another) I'd
> only really expect to see 3 variables in the test - one to exercise each
> codepath. What's the reason for the larger set of test cases?
>
>
> I'm not interested in testing code-paths, I'm interested in testing a
> feature, and relying on the fact that (at the moment) only 3 code paths are
> involved is not really robust.  Granted there is some duplication, and I
> took that out (r267804), but there are more than 3 relevant cases from an
> end-user-feature perspective.
>

We generally have to assume /something/ about the implementation to
constrain testing. eg: we don't assume that putting a variable inside a
namespace would make a difference here so we don't go & test all these case
inside a namespace as well as in the global namespace. So I'm not sure why
we wouldn't go further down that path, knowing that there are only a small
number of ways global variable definitions can impact debug info generation.


>
> > Then it might be simpler just to include 6 variables, one of each kind
> with the attribute, one of each kind without. & I think you could check
> this reliably with:
>
> >
>
> > CHECK: DIGlobalVariable
>
> >  CHECK-NEXT: "name"
>
> >
>
> > repeated three times with a CHECK-NOT: DIGlobalVariable at the end -
> that way the CHECK wouldn't skip past an existing variable, and you'd check
> you got the right ones. I think.
>
>
> If I cared only about DIGlobalVariable that does sound like it would
> work.  Sadly, the static const data member comes out as a DIDerivedType,
> not a DIGlobalVariable.  Also, it's *really* important to us that the
> DICompositeType for "S1" is not present; that's actually where we get the
> major benefit.
>

But that codepath is already tested by any test for a TU that has a static
member without a definition, right?

As for the composite type - this is much like testing in LLVM where we test
that a certain inlining occurred when we test the inliner - not the
knock-on effect that that has on some other optimization which we've
already tested separately.


> Once you have more than one kind of thing to look for (or -NOT look for)
> it gets a lot more tedious to show it's all correct in one pass like you
> are suggesting.
>
> (Re. getting rid of the types:  We have licensees with major template
> metaprogramming going on, but if they can mark those variables 'nodebug'
> and consequently suppress the instantiated types from the debug info, they
> should see a major size win.  One licensee reported that reducing some name
> from 19 characters to 1 char got them a 5MB reduction. Imagine if they
> could get rid of all of those types...)
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D19567
>
>
>
> ___
> 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] D17392: Embed bitcode in object file (clang cc1 part)

2016-04-27 Thread Steven Wu via cfe-commits
steven_wu added a comment.

Ping.


http://reviews.llvm.org/D17392



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


r267805 - Remove unused LangOpts private variable in HeaderSearch.

2016-04-27 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Wed Apr 27 17:28:32 2016
New Revision: 267805

URL: http://llvm.org/viewvc/llvm-project?rev=267805&view=rev
Log:
Remove unused LangOpts private variable in HeaderSearch.

Was causing warnings during the build.


Modified:
cfe/trunk/include/clang/Lex/HeaderSearch.h
cfe/trunk/lib/Lex/HeaderSearch.cpp

Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=267805&r1=267804&r2=267805&view=diff
==
--- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderSearch.h Wed Apr 27 17:28:32 2016
@@ -241,8 +241,6 @@ class HeaderSearch {
   unsigned NumMultiIncludeFileOptzn;
   unsigned NumFrameworkLookups, NumSubFrameworkLookups;
 
-  const LangOptions &LangOpts;
-
   // HeaderSearch doesn't support default or copy construction.
   HeaderSearch(const HeaderSearch&) = delete;
   void operator=(const HeaderSearch&) = delete;

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=267805&r1=267804&r2=267805&view=diff
==
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Wed Apr 27 17:28:32 2016
@@ -56,8 +56,7 @@ HeaderSearch::HeaderSearch(IntrusiveRefC
const LangOptions &LangOpts,
const TargetInfo *Target)
 : HSOpts(HSOpts), Diags(Diags), FileMgr(SourceMgr.getFileManager()),
-  FrameworkMap(64), ModMap(SourceMgr, Diags, LangOpts, Target, *this),
-  LangOpts(LangOpts) {
+  FrameworkMap(64), ModMap(SourceMgr, Diags, LangOpts, Target, *this) {
   AngledDirIdx = 0;
   SystemDirIdx = 0;
   NoCurDirSearch = false;


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


Re: [PATCH] D19623: [libc++] Initialize local doubles to 0.0.

2016-04-27 Thread Howard Hinnant via cfe-commits
howard.hinnant added a subscriber: howard.hinnant.
howard.hinnant added a comment.

When in doubt, I find initializing to nan a safe thing to do.  Either the code 
is correct, or the nan will find the bug.


http://reviews.llvm.org/D19623



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


r267804 - Minor test simplification (per David Blaikie suggestion).

2016-04-27 Thread Paul Robinson via cfe-commits
Author: probinson
Date: Wed Apr 27 17:18:46 2016
New Revision: 267804

URL: http://llvm.org/viewvc/llvm-project?rev=267804&view=rev
Log:
Minor test simplification (per David Blaikie suggestion).

Modified:
cfe/trunk/test/CodeGenCXX/debug-info-nodebug.cpp

Modified: cfe/trunk/test/CodeGenCXX/debug-info-nodebug.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-nodebug.cpp?rev=267804&r1=267803&r2=267804&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-nodebug.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-nodebug.cpp Wed Apr 27 17:18:46 2016
@@ -7,15 +7,6 @@
 #define NODEBUG
 #endif
 
-// Simple global variable declaration and definition.
-// Use the declaration so it gets emitted.
-NODEBUG int global_int_decl;
-NODEBUG int global_int_def = global_int_decl;
-// YESINFO-DAG: !DIGlobalVariable(name: "global_int_decl"
-// NOINFO-NOT:  !DIGlobalVariable(name: "global_int_decl"
-// YESINFO-DAG: !DIGlobalVariable(name: "global_int_def"
-// NOINFO-NOT:  !DIGlobalVariable(name: "global_int_def"
-
 // Const global variable. Use it so it gets emitted.
 NODEBUG static const int const_global_int_def = 1;
 void func1(int);
@@ -41,15 +32,15 @@ struct S2 {
   NODEBUG static const int static_const_member = 4;
 };
 int S2::static_member = 5;
-int junk = S2::static_const_member;
+void func3() { func1(S2::static_const_member); }
 // YESINFO-DAG: !DIGlobalVariable(name: "static_member"
 // NOINFO-NOT:  !DIGlobalVariable(name: "static_member"
 // YESINFO-DAG: !DIDerivedType({{.*}} name: "static_const_member"
 // NOINFO-NOT:  !DIDerivedType({{.*}} name: "static_const_member"
 
 // Function-local static variable.
-void func3() {
-  NODEBUG static int func_local = 6;
+void func4() {
+  NODEBUG static int static_local = 6;
 }
-// YESINFO-DAG: !DIGlobalVariable(name: "func_local"
-// NOINFO-NOT:  !DIGlobalVariable(name: "func_local"
+// YESINFO-DAG: !DIGlobalVariable(name: "static_local"
+// NOINFO-NOT:  !DIGlobalVariable(name: "static_local"


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


Re: [PATCH] D19567: PR21823: 'nodebug' attribute on global/static variables

2016-04-27 Thread Paul Robinson via cfe-commits
probinson added a comment.

In http://reviews.llvm.org/D19567#413997, @dblaikie wrote:

> For 3 code paths (that seem fairly independent from one another) I'd only 
> really expect to see 3 variables in the test - one to exercise each codepath. 
> What's the reason for the larger set of test cases?


I'm not interested in testing code-paths, I'm interested in testing a feature, 
and relying on the fact that (at the moment) only 3 code paths are involved is 
not really robust.  Granted there is some duplication, and I took that out 
(r267804), but there are more than 3 relevant cases from an end-user-feature 
perspective.

> Then it might be simpler just to include 6 variables, one of each kind with 
> the attribute, one of each kind without. & I think you could check this 
> reliably with:

> 

> CHECK: DIGlobalVariable

>  CHECK-NEXT: "name"

> 

> repeated three times with a CHECK-NOT: DIGlobalVariable at the end - that way 
> the CHECK wouldn't skip past an existing variable, and you'd check you got 
> the right ones. I think.


If I cared only about DIGlobalVariable that does sound like it would work.  
Sadly, the static const data member comes out as a DIDerivedType, not a 
DIGlobalVariable.  Also, it's *really* important to us that the DICompositeType 
for "S1" is not present; that's actually where we get the major benefit.
Once you have more than one kind of thing to look for (or -NOT look for) it 
gets a lot more tedious to show it's all correct in one pass like you are 
suggesting.

(Re. getting rid of the types:  We have licensees with major template 
metaprogramming going on, but if they can mark those variables 'nodebug' and 
consequently suppress the instantiated types from the debug info, they should 
see a major size win.  One licensee reported that reducing some name from 19 
characters to 1 char got them a 5MB reduction. Imagine if they could get rid of 
all of those types...)


Repository:
  rL LLVM

http://reviews.llvm.org/D19567



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


Re: r267756 - [CMake] On Darwin bootstrap LTO builds set DYLD_LIBRARY_PATH instead of using llvm-ar

2016-04-27 Thread Chris Bieneman via cfe-commits
Fat archives is the big thing. Since we can do fat multi-stage builds using 
llvm-ar isn’t really ideal.

-Chris

> On Apr 27, 2016, at 3:16 PM, Rafael Espíndola  
> wrote:
> 
> BTW, do you know what is missing in llvm-ar? I know of fat archive
> support, but if there is something else could you open a bug report?
> 
> Cheers,
> Rafael
> 
> 
> On 27 April 2016 at 14:52, Chris Bieneman via cfe-commits
>  wrote:
>> Author: cbieneman
>> Date: Wed Apr 27 13:52:48 2016
>> New Revision: 267756
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=267756&view=rev
>> Log:
>> [CMake] On Darwin bootstrap LTO builds set DYLD_LIBRARY_PATH instead of 
>> using llvm-ar
>> 
>> llvm-ar isn't really supported for Darwin, instead the host tools will load 
>> libLTO, so we can use the just-built libLTO.
>> 
>> This actually makes Darwin bootstrap builds a little faster because you 
>> don't need to build llvm-ar before starting the next stage.
>> 
>> Modified:
>>cfe/trunk/CMakeLists.txt
>> 
>> Modified: cfe/trunk/CMakeLists.txt
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=267756&r1=267755&r2=267756&view=diff
>> ==
>> --- cfe/trunk/CMakeLists.txt (original)
>> +++ cfe/trunk/CMakeLists.txt Wed Apr 27 13:52:48 2016
>> @@ -685,17 +685,21 @@ if (CLANG_ENABLE_BOOTSTRAP)
>> 
>>   set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-stamps/)
>>   set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-bins/)
>> +  set(cmake_command ${CMAKE_COMMAND})
>> 
>> -  # If on Darwin we need to make bootstrap depend on LTO and pass
>> -  # DARWIN_LTO_LIBRARY so that -flto will work using the just-built compiler
>> +  # If the next stage is LTO we need to depend on LTO and possibly LLVMgold
>>   if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO)
>> -set(LTO_DEP LTO llvm-ar llvm-ranlib)
>> -set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar)
>> -set(LTO_RANLIB -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib)
>> +set(LTO_DEP LTO)
>> if(APPLE)
>> +  # on Darwin we need to set DARWIN_LTO_LIBRARY so that -flto will work
>> +  # using the just-built compiler, and we need to override 
>> DYLD_LIBRARY_PATH
>> +  # so that the host object file tools will use the just-built libLTO.
>>   set(LTO_LIBRARY 
>> -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib)
>> +  set(cmake_command ${CMAKE_COMMAND} -E env 
>> DYLD_LIBRARY_PATH=${LLVM_LIBRARY_OUTPUT_INTDIR} ${CMAKE_COMMAND})
>> elseif(NOT WIN32)
>> -  list(APPEND LTO_DEP LLVMgold)
>> +  list(APPEND LTO_DEP LLVMgold llvm-ar llvm-ranlib)
>> +  set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar)
>> +  set(LTO_RANLIB 
>> -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib)
>> endif()
>>   endif()
>> 
>> @@ -791,6 +795,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
>>  -DCLANG_STAGE=${NEXT_CLANG_STAGE}
>> ${COMPILER_OPTIONS}
>> ${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose} ${PGO_OPT}
>> +CMAKE_COMMAND ${cmake_command}
>> INSTALL_COMMAND ""
>> STEP_TARGETS configure build
>> ${cmake_3_4_USES_TERMINAL_OPTIONS}
>> @@ -799,7 +804,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
>>   # exclude really-install from main target
>>   set_target_properties(${NEXT_CLANG_STAGE} PROPERTIES 
>> _EP_really-install_EXCLUDE_FROM_MAIN On)
>>   ExternalProject_Add_Step(${NEXT_CLANG_STAGE} really-install
>> -COMMAND ${CMAKE_COMMAND} --build  --target install
>> +COMMAND ${cmake_command} --build  --target install
>> COMMENT "Performing install step for '${NEXT_CLANG_STAGE}'"
>> DEPENDEES build
>> ${cmake_3_4_USES_TERMINAL}
>> @@ -815,7 +820,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
>> set_target_properties(${NEXT_CLANG_STAGE} PROPERTIES 
>> _EP_${target}_EXCLUDE_FROM_MAIN On)
>> 
>> ExternalProject_Add_Step(${NEXT_CLANG_STAGE} ${target}
>> -  COMMAND ${CMAKE_COMMAND} --build  --target ${target}
>> +  COMMAND ${cmake_command} --build  --target ${target}
>>   COMMENT "Performing ${target} for '${NEXT_CLANG_STAGE}'"
>>   DEPENDEES configure
>>   ${cmake_3_4_USES_TERMINAL}
>> 
>> 
>> ___
>> 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: r267756 - [CMake] On Darwin bootstrap LTO builds set DYLD_LIBRARY_PATH instead of using llvm-ar

2016-04-27 Thread Rafael Espíndola via cfe-commits
BTW, do you know what is missing in llvm-ar? I know of fat archive
support, but if there is something else could you open a bug report?

Cheers,
Rafael


On 27 April 2016 at 14:52, Chris Bieneman via cfe-commits
 wrote:
> Author: cbieneman
> Date: Wed Apr 27 13:52:48 2016
> New Revision: 267756
>
> URL: http://llvm.org/viewvc/llvm-project?rev=267756&view=rev
> Log:
> [CMake] On Darwin bootstrap LTO builds set DYLD_LIBRARY_PATH instead of using 
> llvm-ar
>
> llvm-ar isn't really supported for Darwin, instead the host tools will load 
> libLTO, so we can use the just-built libLTO.
>
> This actually makes Darwin bootstrap builds a little faster because you don't 
> need to build llvm-ar before starting the next stage.
>
> Modified:
> cfe/trunk/CMakeLists.txt
>
> Modified: cfe/trunk/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=267756&r1=267755&r2=267756&view=diff
> ==
> --- cfe/trunk/CMakeLists.txt (original)
> +++ cfe/trunk/CMakeLists.txt Wed Apr 27 13:52:48 2016
> @@ -685,17 +685,21 @@ if (CLANG_ENABLE_BOOTSTRAP)
>
>set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-stamps/)
>set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-bins/)
> +  set(cmake_command ${CMAKE_COMMAND})
>
> -  # If on Darwin we need to make bootstrap depend on LTO and pass
> -  # DARWIN_LTO_LIBRARY so that -flto will work using the just-built compiler
> +  # If the next stage is LTO we need to depend on LTO and possibly LLVMgold
>if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO)
> -set(LTO_DEP LTO llvm-ar llvm-ranlib)
> -set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar)
> -set(LTO_RANLIB -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib)
> +set(LTO_DEP LTO)
>  if(APPLE)
> +  # on Darwin we need to set DARWIN_LTO_LIBRARY so that -flto will work
> +  # using the just-built compiler, and we need to override 
> DYLD_LIBRARY_PATH
> +  # so that the host object file tools will use the just-built libLTO.
>set(LTO_LIBRARY 
> -DDARWIN_LTO_LIBRARY=${LLVM_SHLIB_OUTPUT_INTDIR}/libLTO.dylib)
> +  set(cmake_command ${CMAKE_COMMAND} -E env 
> DYLD_LIBRARY_PATH=${LLVM_LIBRARY_OUTPUT_INTDIR} ${CMAKE_COMMAND})
>  elseif(NOT WIN32)
> -  list(APPEND LTO_DEP LLVMgold)
> +  list(APPEND LTO_DEP LLVMgold llvm-ar llvm-ranlib)
> +  set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar)
> +  set(LTO_RANLIB 
> -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib)
>  endif()
>endif()
>
> @@ -791,6 +795,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
>   -DCLANG_STAGE=${NEXT_CLANG_STAGE}
>  ${COMPILER_OPTIONS}
>  ${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose} ${PGO_OPT}
> +CMAKE_COMMAND ${cmake_command}
>  INSTALL_COMMAND ""
>  STEP_TARGETS configure build
>  ${cmake_3_4_USES_TERMINAL_OPTIONS}
> @@ -799,7 +804,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
># exclude really-install from main target
>set_target_properties(${NEXT_CLANG_STAGE} PROPERTIES 
> _EP_really-install_EXCLUDE_FROM_MAIN On)
>ExternalProject_Add_Step(${NEXT_CLANG_STAGE} really-install
> -COMMAND ${CMAKE_COMMAND} --build  --target install
> +COMMAND ${cmake_command} --build  --target install
>  COMMENT "Performing install step for '${NEXT_CLANG_STAGE}'"
>  DEPENDEES build
>  ${cmake_3_4_USES_TERMINAL}
> @@ -815,7 +820,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
>  set_target_properties(${NEXT_CLANG_STAGE} PROPERTIES 
> _EP_${target}_EXCLUDE_FROM_MAIN On)
>
>  ExternalProject_Add_Step(${NEXT_CLANG_STAGE} ${target}
> -  COMMAND ${CMAKE_COMMAND} --build  --target ${target}
> +  COMMAND ${cmake_command} --build  --target ${target}
>COMMENT "Performing ${target} for '${NEXT_CLANG_STAGE}'"
>DEPENDEES configure
>${cmake_3_4_USES_TERMINAL}
>
>
> ___
> 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


r267802 - [modules] When diagnosing a missing module import, suggest adding a #include if

2016-04-27 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Apr 27 16:57:05 2016
New Revision: 267802

URL: http://llvm.org/viewvc/llvm-project?rev=267802&view=rev
Log:
[modules] When diagnosing a missing module import, suggest adding a #include if
the current language doesn't have an import syntax and we can figure out a
suitable file to include.

Added:
cfe/trunk/test/Modules/Inputs/suggest-include/
cfe/trunk/test/Modules/Inputs/suggest-include/empty.h
cfe/trunk/test/Modules/Inputs/suggest-include/module.modulemap
cfe/trunk/test/Modules/Inputs/suggest-include/private1.h
cfe/trunk/test/Modules/Inputs/suggest-include/private2.h
cfe/trunk/test/Modules/Inputs/suggest-include/private3.h
cfe/trunk/test/Modules/Inputs/suggest-include/textual1.h
cfe/trunk/test/Modules/Inputs/suggest-include/textual2.h
cfe/trunk/test/Modules/Inputs/suggest-include/textual3.h
cfe/trunk/test/Modules/Inputs/suggest-include/textual4.h
cfe/trunk/test/Modules/Inputs/suggest-include/textual5.h
cfe/trunk/test/Modules/Inputs/suggest-include/useprivate1.h
cfe/trunk/test/Modules/Inputs/suggest-include/useprivate3.h
cfe/trunk/test/Modules/Inputs/suggest-include/usetextual1.h
cfe/trunk/test/Modules/Inputs/suggest-include/usetextual2.h
cfe/trunk/test/Modules/Inputs/suggest-include/usetextual3.h
cfe/trunk/test/Modules/Inputs/suggest-include/usetextual4.h
cfe/trunk/test/Modules/Inputs/suggest-include/usetextual5.h
cfe/trunk/test/Modules/suggest-include.cpp
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Lex/HeaderSearch.h
cfe/trunk/include/clang/Lex/ModuleMap.h
cfe/trunk/include/clang/Lex/Preprocessor.h
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/ModuleMap.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=267802&r1=267801&r2=267802&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Apr 27 16:57:05 
2016
@@ -8262,6 +8262,10 @@ def err_module_private_local_class : Err
 def err_module_unimported_use : Error<
   "%select{declaration|definition|default argument}0 of %1 must be imported "
   "from module '%2' before it is required">;
+def err_module_unimported_use_header : Error<
+  "missing '#include %3'; "
+  "%select{declaration|definition|default argument}0 of %1 must be imported "
+  "from module '%2' before it is required">;
 def err_module_unimported_use_multiple : Error<
   "%select{declaration|definition|default argument}0 of %1 must be imported "
   "from one of the following modules before it is required:%2">;

Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=267802&r1=267801&r2=267802&view=diff
==
--- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderSearch.h Wed Apr 27 16:57:05 2016
@@ -634,13 +634,18 @@ public:
   /// \brief Retrieve a uniqued framework name.
   StringRef getUniqueFrameworkName(StringRef Framework);
   
+  /// \brief Suggest a path by which the specified file could be found, for
+  /// use in diagnostics to suggest a #include.
+  ///
+  /// \param IsSystem If non-null, filled in to indicate whether the suggested
+  ///path is relative to a system header directory.
+  std::string suggestPathToFileForDiagnostics(const FileEntry *File,
+  bool *IsSystem = nullptr);
+
   void PrintStats();
   
   size_t getTotalMemory() const;
 
-  static std::string NormalizeDashIncludePath(StringRef File,
-  FileManager &FileMgr);
-
 private:
   /// \brief Describes what happened when we tried to load a module map file.
   enum LoadModuleMapResult {

Modified: cfe/trunk/include/clang/Lex/ModuleMap.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/ModuleMap.h?rev=267802&r1=267801&r2=267802&view=diff
==
--- cfe/trunk/include/clang/Lex/ModuleMap.h (original)
+++ cfe/trunk/include/clang/Lex/ModuleMap.h Wed Apr 27 16:57:05 2016
@@ -130,6 +130,12 @@ public:
   return getModule()->isAvailable();
 }
 
+/// \brief Whether this header is accessible from the specified module.
+bool isAccessibleFrom(Module *M) const {
+  return !(getRole() & PrivateHeader) ||
+ (M && M->getTopLevelModule() == getModule()->getTopLevelModule());
+}
+
 // \brief Whether this known header is valid (i.e., it has an
 // associated module).
 explicit operator bool()

Re: [PATCH] D19623: [libc++] Initialize local doubles to 0.0.

2016-04-27 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT added a comment.

I'd be happy to deal with this in another way. Would you accept 
_MSC_VER-guarded pragmas to silence such warnings? I didn't see an easy way to 
rework the logic here so that the variables are obviously initialized on every 
codepath, which would be the ideal pragma-less solution.


http://reviews.llvm.org/D19623



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


Re: [PATCH] D18271: Avoid -Wshadow warnings about constructor parameters named after fields

2016-04-27 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
This revision is now accepted and ready to land.


Comment at: include/clang/Basic/DiagnosticGroups.td:341-342
@@ +340,4 @@
+
+def ShadowFieldInConstructor : DiagGroup<"shadow-field-in-constructor">;
+def ShadowFieldInConstructorModified : 
DiagGroup<"shadow-field-in-constructor-modified">;
+

Should `ShadowFieldInConstructorModified` be a subgroup of 
`ShadowFieldInConstructor`? I'd expect `-Wshadow-field-in-constructor` to 
enable both.


Comment at: lib/Sema/SemaDecl.cpp:6444
@@ +6443,3 @@
+  // Remember that this was shadowed so we can either warn about its
+  // modification or its existance depending on warning settings.
+  D = D->getCanonicalDecl();

existance -> existence


http://reviews.llvm.org/D18271



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


Re: [PATCH] D19623: [libc++] Initialize local doubles to 0.0.

2016-04-27 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith.
rsmith added a comment.

I don't know how the libc++ folks feel about this, but our usual policy in 
Clang and LLVM is that we don't add bogus initializers to shut up incorrect 
"maybe used uninitialized" compiler warnings, because these initializers 
prevent tools like MSan and valgrind from catching the bug if the variable ever 
is actually used uninitialized. For this reason, we turn off the portion of 
GCC's -Wuninitialized warning that has false positives too.


http://reviews.llvm.org/D19623



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


Re: [PATCH] D19072: [CodeGen] Split CGDebugInfo into CGDebugInfo and CGDebugDwarf

2016-04-27 Thread Eric Christopher via cfe-commits
This appears to be a different direction from what we'd agreed upon. Please
update the original thread with discussion and your intentions and a
breakdown of costs, long-term maintainability, and your plans here.

Thanks.

On Mon, Apr 18, 2016 at 2:07 PM Eric Christopher via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> echristo requested changes to this revision.
> echristo added a comment.
> This revision now requires changes to proceed.
>
> As a note I'm going to want to review this before it goes in.
>
>
> http://reviews.llvm.org/D19072
>
>
>
> ___
> 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] D19385: [scan-build] fix logic error warnings emitted on clang code base

2016-04-27 Thread Apelete Seketeli via cfe-commits
apelete updated this revision to Diff 55327.
apelete added a comment.

[scan-build] fix logic error warnings emitted on clang code base

Changes since last revision:

- lib/Format/AffectedRangeManager.cpp: moved the fixes from 
lib/Format/Format.cpp:AffectedRangeManager::nonPPLineAffected() here since the 
code appaears to have been moved.


http://reviews.llvm.org/D19385

Files:
  lib/AST/DeclObjC.cpp
  lib/Format/AffectedRangeManager.cpp
  lib/Frontend/CompilerInstance.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaLookup.cpp
  lib/StaticAnalyzer/Core/PlistDiagnostics.cpp

Index: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
===
--- lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
+++ lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
@@ -297,6 +297,7 @@
   if (!Diags.empty())
 SM = &Diags.front()->path.front()->getLocation().getManager();
 
+  assert(SM && "SourceManager is NULL, cannot iterate through the diagnostics");
 
   for (std::vector::iterator DI = Diags.begin(),
DE = Diags.end(); DI != DE; ++DI) {
Index: lib/Sema/SemaLookup.cpp
===
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -3744,6 +3744,7 @@
   bool AnyVisibleDecls = !NewDecls.empty();
 
   for (/**/; DI != DE; ++DI) {
+assert(*DI && "TypoCorrection iterator cannot be NULL");
 NamedDecl *VisibleDecl = *DI;
 if (!LookupResult::isVisible(SemaRef, *DI))
   VisibleDecl = findAcceptableDecl(SemaRef, *DI);
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -398,8 +398,10 @@
 SourceLocation TypeidLoc,
 Expr *E,
 SourceLocation RParenLoc) {
+  assert(E && "expression operand is NULL, cannot build C++ typeid expression");
+
   bool WasEvaluated = false;
-  if (E && !E->isTypeDependent()) {
+  if (!E->isTypeDependent()) {
 if (E->getType()->isPlaceholderType()) {
   ExprResult result = CheckPlaceholderExpr(E);
   if (result.isInvalid()) return ExprError();
Index: lib/Frontend/CompilerInstance.cpp
===
--- lib/Frontend/CompilerInstance.cpp
+++ lib/Frontend/CompilerInstance.cpp
@@ -742,7 +742,7 @@
 
   // Figure out where to get and map in the main file.
   if (InputFile != "-") {
-const FileEntry *File;
+const FileEntry *File = nullptr;
 if (Opts.FindPchSource.empty()) {
   File = FileMgr.getFile(InputFile, /*OpenFile=*/true);
 } else {
@@ -760,13 +760,14 @@
   SmallVector, 16>
   Includers;
   Includers.push_back(std::make_pair(FindFile, FindFile->getDir()));
-  File = HS->LookupFile(InputFile, SourceLocation(), /*isAngled=*/false,
-/*FromDir=*/nullptr,
-/*CurDir=*/UnusedCurDir, Includers,
-/*SearchPath=*/nullptr,
-/*RelativePath=*/nullptr,
-/*RequestingModule=*/nullptr,
-/*SuggestedModule=*/nullptr, /*SkipCache=*/true);
+  if (HS)
+File = HS->LookupFile(InputFile, SourceLocation(), /*isAngled=*/false,
+  /*FromDir=*/nullptr,
+  /*CurDir=*/UnusedCurDir, Includers,
+  /*SearchPath=*/nullptr,
+  /*RelativePath=*/nullptr,
+  /*RequestingModule=*/nullptr,
+  /*SuggestedModule=*/nullptr, /*SkipCache=*/true);
   // Also add the header to /showIncludes output.
   if (File)
 DepOpts.ShowIncludesPretendHeader = File->getName();
Index: lib/Format/AffectedRangeManager.cpp
===
--- lib/Format/AffectedRangeManager.cpp
+++ lib/Format/AffectedRangeManager.cpp
@@ -100,12 +100,15 @@
 
 bool AffectedRangeManager::nonPPLineAffected(
 AnnotatedLine *Line, const AnnotatedLine *PreviousLine) {
+  assert(Line && "does not contain any line");
+
   bool SomeLineAffected = false;
   Line->ChildrenAffected =
   computeAffectedLines(Line->Children.begin(), Line->Children.end());
   if (Line->ChildrenAffected)
 SomeLineAffected = true;
 
+  assert(Line->First && "does not have a first token");
   // Stores whether one of the line's tokens is directly affected.
   bool SomeTokenAffected = false;
   // Stores whether we need to look at the leading newlines of the next token
Index: lib/AST/DeclObjC.cpp
===
--- lib/AST/DeclObjC.cpp
+++ lib/AST/DeclObjC.cpp
@@ -1577,8 +1577,10 @@
   data().IvarList = layout[0].Ivar; Ix++;
   curIvar = data().IvarList;
 }
-for ( ; Ix != EIx; curIvar = layou

[PATCH] D19625: [libc++] Void-cast runtime-unused variables.

2016-04-27 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: mclow.lists, EricWF.
STL_MSFT added a subscriber: cfe-commits.

[libc++] Void-cast runtime-unused variables.

Also, remove unused names in exception handlers and remove an unused array.

Fixes MSVC "warning C4101: unreferenced local variable".

http://reviews.llvm.org/D19625

Files:
  test/std/depr/depr.c.headers/setjmp_h.pass.cpp
  test/std/depr/depr.c.headers/stdio_h.pass.cpp
  test/std/input.output/file.streams/c.files/cstdio.pass.cpp
  
test/std/iterators/iterator.primitives/std.iterator.tags/bidirectional_iterator_tag.pass.cpp
  
test/std/iterators/iterator.primitives/std.iterator.tags/forward_iterator_tag.pass.cpp
  
test/std/iterators/iterator.primitives/std.iterator.tags/input_iterator_tag.pass.cpp
  
test/std/iterators/iterator.primitives/std.iterator.tags/output_iterator_tag.pass.cpp
  
test/std/iterators/iterator.primitives/std.iterator.tags/random_access_iterator_tag.pass.cpp
  
test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
  
test/std/language.support/support.exception/propagation/current_exception.pass.cpp
  test/std/language.support/support.runtime/csetjmp.pass.cpp
  test/std/language.support/support.runtime/ctime.pass.cpp
  test/std/localization/c.locales/clocale.pass.cpp
  
test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
  test/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp
  test/std/numerics/rand/rand.device/eval.pass.cpp
  test/std/re/re.alg/re.alg.search/grep.pass.cpp
  
test/std/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp
  test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp
  test/std/utilities/time/date.time/ctime.pass.cpp
  test/std/utilities/utility/forward/forward.pass.cpp

Index: test/std/utilities/utility/forward/forward.pass.cpp
===
--- test/std/utilities/utility/forward/forward.pass.cpp
+++ test/std/utilities/utility/forward/forward.pass.cpp
@@ -39,6 +39,9 @@
 A a;
 const A ca = A();
 
+((void)a); // Prevent unused warning
+((void)ca); // Prevent unused warning
+
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 static_assert(sizeof(test(std::forward(a))) == 1, "");
 static_assert(sizeof(test(std::forward(a))) == 4, "");
Index: test/std/utilities/time/date.time/ctime.pass.cpp
===
--- test/std/utilities/time/date.time/ctime.pass.cpp
+++ test/std/utilities/time/date.time/ctime.pass.cpp
@@ -21,11 +21,15 @@
 int main()
 {
 std::clock_t c = 0;
-((void)c); // avoid unused warning
 std::size_t s = 0;
 std::time_t t = 0;
 std::tm tm = {0};
 char str[3];
+((void)c); // Prevent unused warning
+((void)s); // Prevent unused warning
+((void)t); // Prevent unused warning
+((void)tm); // Prevent unused warning
+((void)str); // Prevent unused warning
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
Index: test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp
===
--- test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp
+++ test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp
@@ -36,7 +36,10 @@
 {
  typename std::allocator_traits::pointervp;
  typename std::allocator_traits::const_pointer cvp;
- 
+
+ ((void)vp); // Prevent unused warning
+ ((void)cvp); // Prevent unused warning
+
  static_assert(std::is_same::value, "");
  static_assert(std::is_same::value, "");
  static_assert(std::is_same   vp)>::value, "");
@@ -70,7 +73,10 @@
 {
  typename std::allocator_traits::void_pointervp;
  typename std::allocator_traits::const_void_pointer cvp;
- 
+
+ ((void)vp); // Prevent unused warning
+ ((void)cvp); // Prevent unused warning
+
  static_assert(std::is_same::value, "");
  static_assert(std::is_same::value, "");
  static_assert(std::is_same   vp)>::value, "");
Index: test/std/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp
===
--- test/std/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp
+++ test/std/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp
@@ -37,7 +37,10 @@
 {
  typename std::allocator_traits::pointervp;
  typename std::allocator_traits::const_pointer cvp;
- 
+
+ ((void)vp); // Prevent unused warning
+ ((void)cvp); // Prevent unused warning
+
  static_assert(std::is_same::value, "");
  static_assert(std::is_same::value, "");
  static_assert(std::is_same   vp)>::value, "");
@@ -71,7 +74,10 @@
 {
  typenam

[PATCH] D19623: [libc++] Initialize local doubles to 0.0.

2016-04-27 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

[libc++] Initialize local doubles to 0.0.

(Zero is a strict subset of garbage.)

Fixes MSVC "warning C4701: potentially uninitialized local variable 'meow' 
used".

http://reviews.llvm.org/D19623

Files:
  
test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
  
test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp

Index: test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
===
--- test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
+++ test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval_param.pass.cpp
@@ -59,10 +59,10 @@
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;
-double bk;
-double c;
+double a = 0.0;
+double m = 0.0;
+double bk = 0.0;
+double c = 0.0;
 std::vector areas(Np);
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
Index: test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
===
--- test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
+++ test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/eval.pass.cpp
@@ -60,10 +60,10 @@
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;
-double bk;
-double c;
+double a = 0.0;
+double m = 0.0;
+double bk = 0.0;
+double c = 0.0;
 std::vector areas(Np);
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
@@ -110,10 +110,10 @@
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;
-double bk;
-double c;
+double a = 0.0;
+double m = 0.0;
+double bk = 0.0;
+double c = 0.0;
 std::vector areas(Np);
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
@@ -160,10 +160,10 @@
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;
-double bk;
-double c;
+double a = 0.0;
+double m = 0.0;
+double bk = 0.0;
+double c = 0.0;
 std::vector areas(Np);
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
@@ -210,10 +210,10 @@
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;
-double bk;
-double c;
+double a = 0.0;
+double m = 0.0;
+double bk = 0.0;
+double c = 0.0;
 std::vector areas(Np);
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
@@ -260,10 +260,10 @@
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;
-double bk;
-double c;
+double a = 0.0;
+double m = 0.0;
+double bk = 0.0;
+double c = 0.0;
 std::vector areas(Np);
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
@@ -310,10 +310,10 @@
 }
 std::sort(u.begin(), u.end());
 int kp = -1;
-double a;
-double m;
-double bk;
-double c;
+double a = 0.0;
+double m = 0.0;
+double bk = 0.0;
+double c = 0.0;
 std::vector areas(Np);
 double S = 0;
 for (int i = 0; i < areas.size(); ++i)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D19622: [libc++] Implement the member functions of a local struct.

2016-04-27 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

[libc++] Implement the member functions of a local struct.

Fixes MSVC "warning C4822: local class member function does not have a body".

http://reviews.llvm.org/D19622

Files:
  test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp

Index: test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp
===
--- test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp
+++ test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp
@@ -53,7 +53,7 @@
 // once implementations have caught up.
 void test_noexcept_function_pointers()
 {
-struct Dummy { void foo() noexcept; static void bar() noexcept; };
+struct Dummy { void foo() noexcept {} static void bar() noexcept {} };
 #if !defined(__cpp_noexcept_function_type)
 {
 // Check that PMF's and function pointers *work*. is_nothrow_callable 
will always


Index: test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp
===
--- test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp
+++ test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp
@@ -53,7 +53,7 @@
 // once implementations have caught up.
 void test_noexcept_function_pointers()
 {
-struct Dummy { void foo() noexcept; static void bar() noexcept; };
+struct Dummy { void foo() noexcept {} static void bar() noexcept {} };
 #if !defined(__cpp_noexcept_function_type)
 {
 // Check that PMF's and function pointers *work*. is_nothrow_callable will always
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19048: Test for a module related crash in CGDebugInfo.cpp

2016-04-27 Thread Adrian Prantl via cfe-commits
aprantl added a comment.

Thanks!

Is there anything meaningful that could be CHECKed here?
Usually a crash means that we previously had a code path without test coverage.


http://reviews.llvm.org/D19048



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


[PATCH] D19621: [libc++] Rename function parameters to avoid shadowing.

2016-04-27 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: mclow.lists, EricWF.
STL_MSFT added a subscriber: cfe-commits.

[libc++] Rename function parameters to avoid shadowing.

Fixes MSVC "warning C4459: declaration of 'meow' hides global declaration".

http://reviews.llvm.org/D19621

Files:
  test/std/thread/futures/futures.async/async.pass.cpp

Index: test/std/thread/futures/futures.async/async.pass.cpp
===
--- test/std/thread/futures/futures.async/async.pass.cpp
+++ test/std/thread/futures/futures.async/async.pass.cpp
@@ -47,22 +47,22 @@
 std::this_thread::sleep_for(ms(200));
 }
 
-std::unique_ptr f3(int i)
+std::unique_ptr f3(int j)
 {
 std::this_thread::sleep_for(ms(200));
-return std::unique_ptr(new int(i));
+return std::unique_ptr(new int(j));
 }
 
 std::unique_ptr f4(std::unique_ptr&& p)
 {
 std::this_thread::sleep_for(ms(200));
 return std::move(p);
 }
 
-void f5(int i)
+void f5(int j)
 {
 std::this_thread::sleep_for(ms(200));
-throw i;
+throw j;
 }
 
 int main()


Index: test/std/thread/futures/futures.async/async.pass.cpp
===
--- test/std/thread/futures/futures.async/async.pass.cpp
+++ test/std/thread/futures/futures.async/async.pass.cpp
@@ -47,22 +47,22 @@
 std::this_thread::sleep_for(ms(200));
 }
 
-std::unique_ptr f3(int i)
+std::unique_ptr f3(int j)
 {
 std::this_thread::sleep_for(ms(200));
-return std::unique_ptr(new int(i));
+return std::unique_ptr(new int(j));
 }
 
 std::unique_ptr f4(std::unique_ptr&& p)
 {
 std::this_thread::sleep_for(ms(200));
 return std::move(p);
 }
 
-void f5(int i)
+void f5(int j)
 {
 std::this_thread::sleep_for(ms(200));
-throw i;
+throw j;
 }
 
 int main()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D19620: [libc++] Add braces, move braces, and rename variables to avoid shadowing.

2016-04-27 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: mclow.lists, EricWF.
STL_MSFT added a subscriber: cfe-commits.

[libc++] Add braces, move braces, and rename variables to avoid shadowing.

Fixes MSVC "warning C4456: declaration of 'meow' hides previous local 
declaration".

http://reviews.llvm.org/D19620

Files:
  
test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
  test/std/containers/associative/multiset/iterator.pass.cpp
  
test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
  test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
  test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp

Index: 
test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
===
--- test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
+++ test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
@@ -46,10 +46,10 @@
 {
 typedef std::unique_ptr P;
 static_assert(std::is_same::value, "");
-
+}
 {
 typedef std::unique_ptr P;
 static_assert(std::is_same::value, "");
-}}
+}
 #endif
 }
Index: test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
===
--- test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
+++ test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
@@ -28,6 +28,7 @@
 
 int main()
 {
+{
 typedef int V;
 V ar[] =
 {
@@ -53,6 +54,7 @@
 assert(*m.begin() == 1);
 assert(*next(m.begin()) == 2);
 assert(*next(m.begin(), 2) == 3);
+}
 #if _LIBCPP_STD_VER > 11
 {
 typedef int V;
Index: 
test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
===
--- 
test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
+++ 
test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
@@ -24,6 +24,7 @@
 
 int main()
 {
+{
 typedef int V;
 V ar[] =
 {
@@ -55,6 +56,7 @@
 assert(*next(m.begin(), 6) == 3);
 assert(*next(m.begin(), 7) == 3);
 assert(*next(m.begin(), 8) == 3);
+}
 #if _LIBCPP_STD_VER > 11
 {
 typedef int V;
Index: test/std/containers/associative/multiset/iterator.pass.cpp
===
--- test/std/containers/associative/multiset/iterator.pass.cpp
+++ test/std/containers/associative/multiset/iterator.pass.cpp
@@ -70,7 +70,7 @@
 std::multiset::const_iterator k = i;
 assert(i == k);
 for (int j = 1; j <= 8; ++j)
-for (int k = 0; k < 3; ++k, ++i)
+for (int n = 0; n < 3; ++n, ++i)
 assert(*i == j);
 }
 {
@@ -151,7 +151,7 @@
 std::multiset, min_allocator>::const_iterator 
k = i;
 assert(i == k);
 for (int j = 1; j <= 8; ++j)
-for (int k = 0; k < 3; ++k, ++i)
+for (int n = 0; n < 3; ++n, ++i)
 assert(*i == j);
 }
 {
Index: 
test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
===
--- 
test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
+++ 
test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp
@@ -62,6 +62,7 @@
 
 int main()
 {
+{
 int i = 0;
 std::partial_sort(&i, &i, &i);
 assert(i == 0);
@@ -73,6 +74,7 @@
 test_larger_sorts(997);
 test_larger_sorts(1000);
 test_larger_sorts(1009);
+}
 
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 {


Index: test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
===
--- test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
+++ test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
@@ -46,10 +46,10 @@
 {
 typedef std::unique_ptr P;
 static_assert(std::is_same::value, "");
-
+}
 {
 typedef std::unique_ptr P;
 static_assert(std::is_same::value, "");
-}}
+}
 #endif
 }
Index: test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
===
--- test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
+++ test/std/containers/associative/set/set.cons/iter_iter_alloc.pass.cpp
@@ -28,6 +28,7 @@
 
 int main()
 {
+{
 typedef int V;
 V ar[] =
 {
@@ -53,6 +54,7 @@
 assert(*m.begin() == 1);
 assert(*next(m.begin()) == 2);
 assert(*next(m.begin(), 2) == 3);
+}
 #if _LIBCPP_STD_VER > 11
 {
 typedef int V;
Index: test/std/containers/associative/multiset/multiset.cons/iter_iter_all

[PATCH] D19619: [libc++] Remove the names of unreferenced parameters.

2016-04-27 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

[libc++] Remove the names of unreferenced parameters.

Fixes MSVC "warning C4100: unreferenced formal parameter".

http://reviews.llvm.org/D19619

Files:
  test/std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp
  
test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
  
test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.cons/custom_alloc.pass.cpp
  
test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.nonvirtuals/default_ctor.pass.cpp
  
test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp
  
test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.get/sgetn.pass.cpp
  
test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sputbackc.pass.cpp
  
test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.pback/sungetc.pass.cpp
  
test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputc.pass.cpp
  
test/std/input.output/stream.buffers/streambuf/streambuf.members/streambuf.pub.put/sputn.pass.cpp
  
test/std/utilities/function.objects/bind/func.bind/func.bind.bind/PR23141_invoke_not_constexpr.pass.cpp
  
test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
  test/std/utilities/intseq/intseq.general/integer_seq.pass.cpp
  test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
  test/support/allocators.h
  test/support/test_allocator.h

Index: test/support/test_allocator.h
===
--- test/support/test_allocator.h
+++ test/support/test_allocator.h
@@ -76,7 +76,7 @@
 ++alloc_count;
 return (pointer)::operator new(n * sizeof(T));
 }
-void deallocate(pointer p, size_type n)
+void deallocate(pointer p, size_type)
 {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p);}
 size_type max_size() const throw()
 {return UINT_MAX / sizeof(T);}
@@ -136,7 +136,7 @@
 ++alloc_count;
 return (pointer)::operator new (n * sizeof(T));
 }
-void deallocate(pointer p, size_type n)
+void deallocate(pointer p, size_type)
 {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p); }
 size_type max_size() const throw()
 {return UINT_MAX / sizeof(T);}
@@ -201,7 +201,7 @@
 : data_(a.data_) {}
 T* allocate(std::size_t n)
 {return (T*)::operator new(n * sizeof(T));}
-void deallocate(T* p, std::size_t n)
+void deallocate(T* p, std::size_t)
 {::operator delete((void*)p);}
 
 other_allocator select_on_container_copy_construction() const
Index: test/support/allocators.h
===
--- test/support/allocators.h
+++ test/support/allocators.h
@@ -101,7 +101,7 @@
 A2& operator=(const A2& a) TEST_NOEXCEPT { id_ = a.id(); copy_called = true; return *this;}
 A2& operator=(A2&& a)  TEST_NOEXCEPT { id_ = a.id(); move_called = true; return *this;}
 
-T* allocate(std::size_t n, const void* hint)
+T* allocate(std::size_t, const void* hint)
 {
 allocate_called = true;
 return (T*)hint;
Index: test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
===
--- test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
+++ test/std/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
@@ -20,7 +20,7 @@
 
 template 
 void
-test0(const Tuple& t)
+test0(const Tuple&)
 {
 static_assert(std::tuple_size::value == 0, "");
 }
@@ -57,7 +57,7 @@
 #if _LIBCPP_STD_VER > 11
 template 
 constexpr int 
-test3(const Tuple& t)
+test3(const Tuple&)
 {
 return std::tuple_size::value;
 }
Index: test/std/utilities/intseq/intseq.general/integer_seq.pass.cpp
===
--- test/std/utilities/intseq/intseq.general/integer_seq.pass.cpp
+++ test/std/utilities/intseq/intseq.general/integer_seq.pass.cpp
@@ -19,7 +19,7 @@
 #if _LIBCPP_STD_VER > 11
 
 template 
-auto extract ( const AtContainer &t, const std::integer_sequence idx )
+auto extract ( const AtContainer &t, const std::integer_sequence )
 -> decltype ( std::make_tuple ( std::get(t)... ))
 { return  std::make_tuple ( std::get(t)... ); }
 
Index: test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
===
--- test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
+++ test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
@@ -23,7 +23,7 @@

[PATCH] D19618: [libc++] Consistently guard "#pragma clang" with "#if defined(__clang__)".

2016-04-27 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: mclow.lists, EricWF.
STL_MSFT added a subscriber: cfe-commits.

[libc++] Consistently guard "#pragma clang" with "#if defined(__clang__)".

Similarly, consistently guard "#pragma GCC" with "#if defined(__GNUC__)".

Fixes MSVC "warning C4068: unknown pragma".

http://reviews.llvm.org/D19618

Files:
  test/std/depr/depr.c.headers/stdio_h.pass.cpp
  test/std/depr/depr.c.headers/wchar_h.pass.cpp
  test/std/input.output/file.streams/c.files/cstdio.pass.cpp
  test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
  test/std/utilities/template.bitset/bitset.cons/default.pass.cpp
  test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp
  test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
  test/std/utilities/template.bitset/bitset.members/count.pass.cpp
  test/std/utilities/template.bitset/bitset.members/flip_all.pass.cpp
  test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp
  test/std/utilities/template.bitset/bitset.members/index.pass.cpp
  test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp
  test/std/utilities/template.bitset/bitset.members/left_shift.pass.cpp
  test/std/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp
  test/std/utilities/template.bitset/bitset.members/not_all.pass.cpp
  test/std/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp
  test/std/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp
  test/std/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp
  test/std/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp
  test/std/utilities/template.bitset/bitset.members/reset_all.pass.cpp
  test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp
  test/std/utilities/template.bitset/bitset.members/right_shift.pass.cpp
  test/std/utilities/template.bitset/bitset.members/right_shift_eq.pass.cpp
  test/std/utilities/template.bitset/bitset.members/set_all.pass.cpp
  test/std/utilities/template.bitset/bitset.members/test.pass.cpp
  test/std/utilities/template.bitset/bitset.members/to_string.pass.cpp
  test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp
  test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp
  test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp
  test/support/disable_missing_braces_warning.h

Index: test/support/disable_missing_braces_warning.h
===
--- test/support/disable_missing_braces_warning.h
+++ test/support/disable_missing_braces_warning.h
@@ -11,6 +11,8 @@
 
 // std::array is explicitly allowed to be initialized with A a = { init-list };.
 // Disable the missing braces warning for this reason.
+#if defined(__GNUC__)
 #pragma GCC diagnostic ignored "-Wmissing-braces"
+#endif
 
 #endif // SUPPORT_DISABLE_MISSING_BRACES_WARNING_H
Index: test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp
===
--- test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp
+++ test/std/utilities/template.bitset/bitset.operators/op_or.pass.cpp
@@ -13,7 +13,9 @@
 #include 
 #include 
 
+#if defined(__clang__)
 #pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
 
 template 
 std::bitset
Index: test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp
===
--- test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp
+++ test/std/utilities/template.bitset/bitset.operators/op_not.pass.cpp
@@ -13,7 +13,9 @@
 #include 
 #include 
 
+#if defined(__clang__)
 #pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
 
 template 
 std::bitset
Index: test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp
===
--- test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp
+++ test/std/utilities/template.bitset/bitset.operators/op_and.pass.cpp
@@ -13,7 +13,9 @@
 #include 
 #include 
 
+#if defined(__clang__)
 #pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
 
 template 
 std::bitset
Index: test/std/utilities/template.bitset/bitset.members/to_string.pass.cpp
===
--- test/std/utilities/template.bitset/bitset.members/to_string.pass.cpp
+++ test/std/utilities/template.bitset/bitset.members/to_string.pass.cpp
@@ -26,7 +26,9 @@
 #include 
 #include 
 
+#if defined(__clang__)
 #pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
 
 template 
 std::bitset
Index: test/std/utilities/template.bitset/bitset.members/test.pass.cpp
===
--- test/std/utilities/template.bitset/bitset.members/test.pass.cpp
+++ test/std/utilities/template.bitset/bitset.members/test.pass.cpp
@@ -14,7 +14,9 @@
 #include 
 #inclu

Re: [PATCH] D19048: Test for a module related crash in CGDebugInfo.cpp

2016-04-27 Thread Douglas Yung via cfe-commits
dyung added a comment.

ping


http://reviews.llvm.org/D19048



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


Re: [PATCH] D18963: PR27216: Only define __ARM_FEATURE_FMA when the target has VFPv4

2016-04-27 Thread Renato Golin via cfe-commits
rengolin added a comment.

LGTM! Thanks!


http://reviews.llvm.org/D18963



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


r267788 - Revert unnecessary tblgen change.

2016-04-27 Thread Peter Collingbourne via cfe-commits
Author: pcc
Date: Wed Apr 27 15:49:44 2016
New Revision: 267788

URL: http://llvm.org/viewvc/llvm-project?rev=267788&view=rev
Log:
Revert unnecessary tblgen change.

Modified:
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=267788&r1=267787&r2=267788&view=diff
==
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Wed Apr 27 15:49:44 2016
@@ -2524,7 +2524,6 @@ static std::string CalculateDiagnostic(c
 case ObjCProtocol | ObjCInterface:
   return "ExpectedObjectiveCInterfaceOrProtocol";
 case Field | Var: return "ExpectedFieldOrGlobalVar";
-case GenericRecord | Namespace: return "ExpectedRecordOrNamespace";
   }
 
   PrintFatalError(S.getLoc(),


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


[clang-tools-extra] r267786 - Wdocumentation fix

2016-04-27 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Wed Apr 27 15:43:32 2016
New Revision: 267786

URL: http://llvm.org/viewvc/llvm-project?rev=267786&view=rev
Log:
Wdocumentation fix

Modified:
clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp

Modified: clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp?rev=267786&r1=267785&r2=267786&view=diff
==
--- clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp Wed Apr 27 
15:43:32 2016
@@ -21,7 +21,7 @@ namespace {
 cl::OptionCategory IncludeFixerCategory("Tool options");
 
 enum DatabaseFormatTy {
-  fixed, //< Hard-coded mapping.
+  fixed, ///< Hard-coded mapping.
 };
 
 cl::opt DatabaseFormat(


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


Re: [PATCH] D18635: Rework interface for bitset-using features to use a notion of LTO visibility.

2016-04-27 Thread Peter Collingbourne via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL267784: Rework interface for bitset-using features to use a 
notion of LTO visibility. (authored by pcc).

Changed prior to commit:
  http://reviews.llvm.org/D18635?vs=54439&id=55307#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18635

Files:
  cfe/trunk/docs/ControlFlowIntegrity.rst
  cfe/trunk/docs/LTOVisibility.rst
  cfe/trunk/docs/UsersManual.rst
  cfe/trunk/docs/index.rst
  cfe/trunk/include/clang/Basic/Attr.td
  cfe/trunk/include/clang/Basic/AttrDocs.td
  cfe/trunk/include/clang/Driver/CC1Options.td
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/include/clang/Frontend/CodeGenOptions.def
  cfe/trunk/include/clang/Frontend/CodeGenOptions.h
  cfe/trunk/lib/CodeGen/CGClass.cpp
  cfe/trunk/lib/CodeGen/CGVTables.cpp
  cfe/trunk/lib/CodeGen/CodeGenModule.cpp
  cfe/trunk/lib/CodeGen/CodeGenModule.h
  cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
  cfe/trunk/lib/Driver/SanitizerArgs.cpp
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/lib/Sema/SemaDeclAttr.cpp
  cfe/trunk/runtime/CMakeLists.txt
  cfe/trunk/runtime/vtables_blacklist.txt
  cfe/trunk/test/CodeGenCXX/bitset-blacklist.cpp
  cfe/trunk/test/CodeGenCXX/bitset-inference.cpp
  cfe/trunk/test/CodeGenCXX/bitsets.cpp
  cfe/trunk/test/CodeGenCXX/cfi-blacklist.cpp
  cfe/trunk/test/CodeGenCXX/cfi-cast.cpp
  cfe/trunk/test/CodeGenCXX/cfi-cross-dso.cpp
  cfe/trunk/test/CodeGenCXX/cfi-ms-rtti.cpp
  cfe/trunk/test/CodeGenCXX/cfi-nvcall.cpp
  cfe/trunk/test/CodeGenCXX/cfi-stats.cpp
  cfe/trunk/test/Driver/cl-runtime-flags.c
  cfe/trunk/test/Driver/fsanitize.c
  cfe/trunk/test/Driver/whole-program-vtables.c
  cfe/trunk/test/Frontend/dependency-gen.c
  cfe/trunk/test/SemaCXX/attr-lto-visibility-public.cpp
  cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Index: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
===
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
@@ -2524,6 +2524,7 @@
 case ObjCProtocol | ObjCInterface:
   return "ExpectedObjectiveCInterfaceOrProtocol";
 case Field | Var: return "ExpectedFieldOrGlobalVar";
+case GenericRecord | Namespace: return "ExpectedRecordOrNamespace";
   }
 
   PrintFatalError(S.getLoc(),
Index: cfe/trunk/docs/index.rst
===
--- cfe/trunk/docs/index.rst
+++ cfe/trunk/docs/index.rst
@@ -31,6 +31,7 @@
SanitizerStats
SanitizerSpecialCaseList
ControlFlowIntegrity
+   LTOVisibility
SafeStack
Modules
MSVCCompatibility
Index: cfe/trunk/docs/LTOVisibility.rst
===
--- cfe/trunk/docs/LTOVisibility.rst
+++ cfe/trunk/docs/LTOVisibility.rst
@@ -0,0 +1,111 @@
+==
+LTO Visibility
+==
+
+*LTO visibility* is a property of an entity that specifies whether it can be
+referenced from outside the current LTO unit. A *linkage unit* is a set of
+translation units linked together into an executable or DSO, and a linkage
+unit's *LTO unit* is the subset of the linkage unit that is linked together
+using link-time optimization; in the case where LTO is not being used, the
+linkage unit's LTO unit is empty. Each linkage unit has only a single LTO unit.
+
+The LTO visibility of a class is used by the compiler to determine which
+classes the virtual function call optimization and control flow integrity
+features apply to. These features use whole-program information, so they
+require the entire class hierarchy to be visible in order to work correctly.
+
+If any translation unit in the program uses either of the virtual function
+call optimization or control flow integrity features, it is effectively an
+ODR violation to define a class with hidden LTO visibility in multiple linkage
+units. A class with public LTO visibility may be defined in multiple linkage
+units, but the tradeoff is that the virtual function call optimization and
+control flow integrity features can only be applied to classes with hidden LTO
+visibility. A class's LTO visibility is treated as an ODR-relevant property
+of its definition, so it must be consistent between translation units.
+
+In translation units built with LTO, LTO visibility is based on symbol
+visibility or, on the Windows platform, the dllimport and dllexport
+attributes. When targeting non-Windows platforms, classes with a visibility
+other than hidden visibility receive public LTO visibility. When targeting
+Windows, classes with dllimport or dllexport attributes receive public LTO
+visibility. All other classes receive hidden LTO visibility. Classes with
+internal linkage (e.g. classes declared in unnamed namespaces) also receive
+hidden LTO visibility.
+
+A class defined in a translation unit built without LTO receives public
+LTO visibility regardless of its object file v

r267784 - Rework interface for bitset-using features to use a notion of LTO visibility.

2016-04-27 Thread Peter Collingbourne via cfe-commits
Author: pcc
Date: Wed Apr 27 15:39:53 2016
New Revision: 267784

URL: http://llvm.org/viewvc/llvm-project?rev=267784&view=rev
Log:
Rework interface for bitset-using features to use a notion of LTO visibility.

Bitsets, and the compiler features they rely on (vtable opt, CFI),
only have visibility within the LTO'd part of the linkage unit. Therefore,
only enable these features for classes with hidden LTO visibility. This
notion is based on object file visibility or (on Windows)
dllimport/dllexport attributes.

We provide the [[clang::lto_visibility_public]] attribute to override the
compiler's LTO visibility inference in cases where the class is defined
in the non-LTO'd part of the linkage unit, or where the ABI supports
calling classes derived from abstract base classes with hidden visibility
in other linkage units (e.g. COM on Windows).

If the cross-DSO CFI mode is enabled, bitset checks are emitted even for
classes with public LTO visibility, as that mode uses a separate mechanism
to cause bitsets to be exported.

This mechanism replaces the whole-program-vtables blacklist, so remove the
-fwhole-program-vtables-blacklist flag.

Because __declspec(uuid()) now implies [[clang::lto_visibility_public]], the
support for the special attr:uuid blacklist entry is removed.

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

Added:
cfe/trunk/docs/LTOVisibility.rst
cfe/trunk/test/CodeGenCXX/bitset-inference.cpp
cfe/trunk/test/CodeGenCXX/cfi-blacklist.cpp
cfe/trunk/test/SemaCXX/attr-lto-visibility-public.cpp
Removed:
cfe/trunk/runtime/vtables_blacklist.txt
cfe/trunk/test/CodeGenCXX/bitset-blacklist.cpp
Modified:
cfe/trunk/docs/ControlFlowIntegrity.rst
cfe/trunk/docs/UsersManual.rst
cfe/trunk/docs/index.rst
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/include/clang/Frontend/CodeGenOptions.h
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/CodeGen/CGVTables.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
cfe/trunk/lib/Driver/SanitizerArgs.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/runtime/CMakeLists.txt
cfe/trunk/test/CodeGenCXX/bitsets.cpp
cfe/trunk/test/CodeGenCXX/cfi-cast.cpp
cfe/trunk/test/CodeGenCXX/cfi-cross-dso.cpp
cfe/trunk/test/CodeGenCXX/cfi-ms-rtti.cpp
cfe/trunk/test/CodeGenCXX/cfi-nvcall.cpp
cfe/trunk/test/CodeGenCXX/cfi-stats.cpp
cfe/trunk/test/Driver/cl-runtime-flags.c
cfe/trunk/test/Driver/fsanitize.c
cfe/trunk/test/Driver/whole-program-vtables.c
cfe/trunk/test/Frontend/dependency-gen.c
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/docs/ControlFlowIntegrity.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ControlFlowIntegrity.rst?rev=267784&r1=267783&r2=267784&view=diff
==
--- cfe/trunk/docs/ControlFlowIntegrity.rst (original)
+++ cfe/trunk/docs/ControlFlowIntegrity.rst Wed Apr 27 15:39:53 2016
@@ -25,13 +25,25 @@ As currently implemented, all schemes re
 so it is required to specify ``-flto``, and the linker used must support LTO,
 for example via the `gold plugin`_.
 
-To allow the checks to be implemented efficiently, the program must be
-structured such that certain object files are compiled with CFI
+To allow the checks to be implemented efficiently, the program must
+be structured such that certain object files are compiled with CFI
 enabled, and are statically linked into the program. This may preclude
-the use of shared libraries in some cases. Experimental support for
-:ref:`cross-DSO control flow integrity ` exists that
-does not have these requirements. This cross-DSO support has unstable
-ABI at this time.
+the use of shared libraries in some cases.
+
+The compiler will only produce CFI checks for a class if it can infer hidden
+LTO visibility for that class. LTO visibility is a property of a class that
+is inferred from flags and attributes. For more details, see the documentation
+for :doc:`LTO visibility `.
+
+The ``-fsanitize=cfi-{vcall,nvcall,derived-cast,unrelated-cast}`` flags
+require that a ``-fvisibility=`` flag also be specified. This is because the
+default visibility setting is ``-fvisibility=default``, which would disable
+CFI checks for classes without visibility attributes. Most users will want
+to specify ``-fvisibility=hidden``, which enables CFI checks for such classes.
+
+Experimental support for :ref:`cross-DSO control flow integrity
+` exists that does not require classes to have hidden LTO
+visibility. This cross-DSO support has unstable ABI at this time.
 
 .. _gold plugin: http

Re: [PATCH] D19361: [MS] Improved implementation of MS stack pragmas (vtordisp, *_seg)

2016-04-27 Thread Nico Weber via cfe-commits
thakis added a subscriber: thakis.
thakis added a comment.

Thanks for the patch! To add to your proposed todo list (which sounds great): 
All these stack-using pragmas aren't serialized to pch files at the moment 
either. Maybe you want to work on that too (either serialize the stacks, or 
emit a warning if the stacks aren't completely popped at the end of the pch 
header).


http://reviews.llvm.org/D19361



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


Re: [PATCH] D18635: Rework interface for bitset-using features to use a notion of LTO visibility.

2016-04-27 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
This revision is now accepted and ready to land.


Comment at: docs/ControlFlowIntegrity.rst:268-269
@@ -262,1 +267,4 @@
 
+Normally, the compiler will disable CFI checks for classes that do not
+have hidden LTO visibility. With this flag enabled, the compiler will emit
+cross-DSO CFI checks for all classes, except for those which appear in the

Maybe reverse the sense of this to avoid the double negative:

  Normally, CFI checks will only be performed for classes that have hidden LTO 
visibility.

or similar?


http://reviews.llvm.org/D18635



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


Re: [PATCH] D19412: [libcxx] Refactor pthread usage - II

2016-04-27 Thread Asiri Rathnayake via cfe-commits
rmaprath added inline comments.


Comment at: src/algorithm.cpp:51
@@ -50,3 +50,3 @@
 #ifndef _LIBCPP_HAS_NO_THREADS
-static pthread_mutex_t __rs_mut = PTHREAD_MUTEX_INITIALIZER;
+static mutex __rs_mut;
 #endif

bcraig wrote:
> rmaprath wrote:
> > mclow.lists wrote:
> > > What happened to the initializer here?
> > I'm expecting the constructor of `mutex` to be run here at load time 
> > (before `main`). Note that this a libc++ mutex rather than a pthreads mutex 
> > (which does not required a constructor call like this). Would that be too 
> > much of an overhead?
> std::mutex's default ctor is constexpr.  As long as the compiler supports 
> constexpr, this initialization shouldn't require runtime code.
Missed that!. The same applied to std::condition_variable (used below). From 
the sources it looks like we do cater for compilers that do not support 
`constexpr`, so for those compilers it would depend on how clever they are in 
optimizing out this kind of trivial constructor calls.


http://reviews.llvm.org/D19412



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


Re: [PATCH] D19432: [SystemZ] Support Swift calling convention

2016-04-27 Thread Ulrich Weigand via cfe-commits
uweigand accepted this revision.
uweigand added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D19432



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


Re: [PATCH] D19586: Misleading Indentation check

2016-04-27 Thread Nick Lewycky via cfe-commits
nlewycky added a subscriber: nlewycky.


Comment at: clang-tidy/readability/MisleadingIndentationCheck.cpp:31
@@ +30,3 @@
+  Result.SourceManager->getExpansionColumnNumber(ElseLoc))
+diag(ElseLoc, "potentional dangling else");
+}

Typo of "potential" as "potentional".


Comment at: clang-tidy/readability/MisleadingIndentationCheck.cpp:54
@@ +53,3 @@
+
+if (Result.SourceManager->getExpansionColumnNumber(StmtLoc) ==
+Result.SourceManager->getExpansionColumnNumber(NextLoc))

What about a one-line "if (x) foo(); else bar();"? Warn on it anyways?


Comment at: clang-tidy/readability/MisleadingIndentationCheck.cpp:56
@@ +55,3 @@
+Result.SourceManager->getExpansionColumnNumber(NextLoc))
+  diag(NextLoc, "Wrong Indentation - statement is indentated as a member "
+"of if statement");

Typo of "indented" as "indentated".


Comment at: test/clang-tidy/readability-misleading-indentation.cpp:48
@@ +47,3 @@
+   }
+  foo2();  // ok
+

This is arguably misleading indentation, but I'm ok with not warning on it if 
you think it will cause too many false positives.


http://reviews.llvm.org/D19586



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


Re: [PATCH] D19062: Add functions in ctype.h to builtin function database (Fix)

2016-04-27 Thread Joerg Sonnenberger via cfe-commits
joerg added a comment.

Looking again at the failure mode, I think the best approach is to go back to 
the original test case and just select a fixed target. The problematic IR 
difference is purely an ABI choice of the target and not even related to 
-fsigned-char vs -funsigned-char. As such, the extensive use of regular 
expressions just makes the test case harder to read and maintain.


http://reviews.llvm.org/D19062



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


Re: [PATCH] D19361: [MS] Improved implementation of MS stack pragmas (vtordisp, *_seg)

2016-04-27 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm, thanks this is a nice cleanup!



Comment at: include/clang/Sema/Sema.h:338-342
@@ +337,7 @@
+PSK_Reset = 0x0,// #pragma ()
+PSK_Set   = 0x1,// #pragma ("name")
+PSK_Push  = 0x2,// #pragma (push[, id])
+PSK_Pop   = 0x4,// #pragma (pop[, id])
+PSK_Push_Set  = PSK_Push | PSK_Set, // #pragma (push[, id], "name")
+PSK_Pop_Set   = PSK_Pop | PSK_Set,  // #pragma (pop[, id], "name")
+  };

These are now used for more than just section names. Can you replace `"name"` 
with `value` in all the comments?


Comment at: include/clang/Sema/Sema.h:385-386
@@ +384,4 @@
+: DefaultValue(Default), CurrentValue(Default) {}
+explicit PragmaStack(const ValueType &Default, const ValueType &Value)
+: DefaultValue(Default), CurrentValue(Value) {}
+

I don't see any users of this overload, where is it needed?


http://reviews.llvm.org/D19361



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


Re: [PATCH] D19412: [libcxx] Refactor pthread usage - II

2016-04-27 Thread Ben Craig via cfe-commits
bcraig added inline comments.


Comment at: src/algorithm.cpp:51
@@ -50,3 +50,3 @@
 #ifndef _LIBCPP_HAS_NO_THREADS
-static pthread_mutex_t __rs_mut = PTHREAD_MUTEX_INITIALIZER;
+static mutex __rs_mut;
 #endif

rmaprath wrote:
> mclow.lists wrote:
> > What happened to the initializer here?
> I'm expecting the constructor of `mutex` to be run here at load time (before 
> `main`). Note that this a libc++ mutex rather than a pthreads mutex (which 
> does not required a constructor call like this). Would that be too much of an 
> overhead?
std::mutex's default ctor is constexpr.  As long as the compiler supports 
constexpr, this initialization shouldn't require runtime code.


http://reviews.llvm.org/D19412



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


Re: [PATCH] D19003: Set C99 as default C Standard for PS4 target

2016-04-27 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL267772: Set the default C standard to C99 when targeting the 
PS4. (authored by ssrivastava).

Changed prior to commit:
  http://reviews.llvm.org/D19003?vs=54956&id=55299#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19003

Files:
  cfe/trunk/include/clang/Frontend/CompilerInvocation.h
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/FixIt/fixit-errors.c
  cfe/trunk/test/Preprocessor/init.c
  cfe/trunk/test/Sema/attr-deprecated.c
  cfe/trunk/test/Sema/nullability.c
  cfe/trunk/test/SemaObjC/objcbridge-attribute-arc.m

Index: cfe/trunk/include/clang/Frontend/CompilerInvocation.h
===
--- cfe/trunk/include/clang/Frontend/CompilerInvocation.h
+++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h
@@ -153,8 +153,10 @@
   ///
   /// \param Opts - The LangOptions object to set up.
   /// \param IK - The input language.
+  /// \param T - The target triple.
   /// \param LangStd - The input language standard.
   static void setLangDefaults(LangOptions &Opts, InputKind IK,
+   const llvm::Triple &T,
LangStandard::Kind LangStd = LangStandard::lang_unspecified);
   
   /// \brief Retrieve a module hash string that is suitable for uniquely 
Index: cfe/trunk/test/Preprocessor/init.c
===
--- cfe/trunk/test/Preprocessor/init.c
+++ cfe/trunk/test/Preprocessor/init.c
@@ -88,7 +88,6 @@
 // COMMON:#define __ORDER_LITTLE_ENDIAN__ 1234
 // COMMON:#define __ORDER_PDP_ENDIAN__ 3412
 // COMMON:#define __STDC_HOSTED__ 1
-// COMMON:#define __STDC_VERSION__ 201112L
 // COMMON:#define __STDC__ 1
 // COMMON:#define __VERSION__ {{.*}}
 // COMMON:#define __clang__ 1
@@ -98,7 +97,13 @@
 // COMMON:#define __clang_version__ {{.*}}
 // COMMON:#define __llvm__ 1
 //
+// RUN: %clang_cc1 -E -dM -triple=x86_64-pc-win32 < /dev/null | FileCheck -match-full-lines -check-prefix C-DEFAULT %s
+// RUN: %clang_cc1 -E -dM -triple=x86_64-pc-linux-gnu < /dev/null | FileCheck -match-full-lines -check-prefix C-DEFAULT %s
+// RUN: %clang_cc1 -E -dM -triple=x86_64-apple-darwin < /dev/null | FileCheck -match-full-lines -check-prefix C-DEFAULT %s
+// RUN: %clang_cc1 -E -dM -triple=armv7a-apple-darwin < /dev/null | FileCheck -match-full-lines -check-prefix C-DEFAULT %s
 // 
+// C-DEFAULT:#define __STDC_VERSION__ 201112L
+//
 // RUN: %clang_cc1 -ffreestanding -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix FREESTANDING %s
 // FREESTANDING:#define __STDC_HOSTED__ 0
 //
@@ -8361,6 +8366,7 @@
 // PS4:#define __SSE2__ 1
 // PS4:#define __SSE_MATH__ 1
 // PS4:#define __SSE__ 1
+// PS4:#define __STDC_VERSION__ 199901L
 // PS4:#define __UINTMAX_TYPE__ long unsigned int
 // PS4:#define __USER_LABEL_PREFIX__
 // PS4:#define __WCHAR_MAX__ 65535
Index: cfe/trunk/test/Sema/attr-deprecated.c
===
--- cfe/trunk/test/Sema/attr-deprecated.c
+++ cfe/trunk/test/Sema/attr-deprecated.c
@@ -122,5 +122,10 @@
 };
 
 typedef int test23_ty __attribute((deprecated));
+// Redefining a typedef is a C11 feature.
+#if __STDC_VERSION__ <= 199901L
+// expected-note@-3 {{'test23_ty' has been explicitly marked deprecated here}}
+#else
 typedef int test23_ty; // expected-note {{'test23_ty' has been explicitly marked deprecated here}}
+#endif
 test23_ty test23_v; // expected-warning {{'test23_ty' is deprecated}}
Index: cfe/trunk/test/Sema/nullability.c
===
--- cfe/trunk/test/Sema/nullability.c
+++ cfe/trunk/test/Sema/nullability.c
@@ -8,7 +8,11 @@
 typedef int * int_ptr;
 
 // Parse nullability type specifiers.
-typedef int * _Nonnull nonnull_int_ptr; // expected-note{{'_Nonnull' specified here}}
+// This note requires C11.
+#if __STDC_VERSION__ > 199901L
+// expected-note@+2{{'_Nonnull' specified here}}
+#endif
+typedef int * _Nonnull nonnull_int_ptr;
 typedef int * _Nullable nullable_int_ptr;
 typedef int * _Null_unspecified null_unspecified_int_ptr;
 
@@ -23,9 +27,14 @@
 typedef nonnull_int_ptr _Nonnull redundant_okay_1;
 
 // Conflicting nullability specifiers via a typedef are not.
+// Some of these errors require C11.
+#if __STDC_VERSION__ > 199901L
 typedef nonnull_int_ptr _Nullable conflicting_2; // expected-error{{nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'}}
+#endif
 typedef nonnull_int_ptr nonnull_int_ptr_typedef;
+#if __STDC_VERSION__ > 199901L
 typedef nonnull_int_ptr_typedef _Nullable conflicting_2; // expected-error{{nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'}}
+#endif
 typedef nonnull_int_ptr_typedef nonnull_int_ptr_typedef_typedef;
 typedef nonnull_int_ptr_typedef_typedef _Null_unspecified conflicting_3; // expected-error{{nullability specifier '_Null_unspecified' conflicts with existing specifie

r267772 - Set the default C standard to C99 when targeting the PS4.

2016-04-27 Thread Sunil Srivastava via cfe-commits
Author: ssrivastava
Date: Wed Apr 27 14:53:03 2016
New Revision: 267772

URL: http://llvm.org/viewvc/llvm-project?rev=267772&view=rev
Log:
Set the default C standard to C99 when targeting the PS4.

Patch by Douglas Yung!

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

Modified:
cfe/trunk/include/clang/Frontend/CompilerInvocation.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/FixIt/fixit-errors.c
cfe/trunk/test/Preprocessor/init.c
cfe/trunk/test/Sema/attr-deprecated.c
cfe/trunk/test/Sema/nullability.c
cfe/trunk/test/SemaObjC/objcbridge-attribute-arc.m

Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=267772&r1=267771&r2=267772&view=diff
==
--- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Wed Apr 27 14:53:03 
2016
@@ -153,8 +153,10 @@ public:
   ///
   /// \param Opts - The LangOptions object to set up.
   /// \param IK - The input language.
+  /// \param T - The target triple.
   /// \param LangStd - The input language standard.
   static void setLangDefaults(LangOptions &Opts, InputKind IK,
+   const llvm::Triple &T,
LangStandard::Kind LangStd = 
LangStandard::lang_unspecified);
   
   /// \brief Retrieve a module hash string that is suitable for uniquely 

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=267772&r1=267771&r2=267772&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed Apr 27 14:53:03 2016
@@ -1344,6 +1344,7 @@ static void ParseHeaderSearchArgs(Header
 }
 
 void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
+ const llvm::Triple &T,
  LangStandard::Kind LangStd) {
   // Set some properties which depend solely on the input kind; it would be 
nice
   // to move these to the language standard, and have the driver resolve the
@@ -1376,7 +1377,11 @@ void CompilerInvocation::setLangDefaults
 case IK_PreprocessedC:
 case IK_ObjC:
 case IK_PreprocessedObjC:
-  LangStd = LangStandard::lang_gnu11;
+  // The PS4 uses C99 as the default C standard.
+  if (T.isPS4())
+LangStd = LangStandard::lang_gnu99;
+  else
+LangStd = LangStandard::lang_gnu11;
   break;
 case IK_CXX:
 case IK_PreprocessedCXX:
@@ -1529,7 +1534,8 @@ static void ParseLangArgs(LangOptions &O
   LangStd = OpenCLLangStd;
   }
 
-  CompilerInvocation::setLangDefaults(Opts, IK, LangStd);
+  llvm::Triple T(TargetOpts.Triple);
+  CompilerInvocation::setLangDefaults(Opts, IK, T, LangStd);
 
   // We abuse '-f[no-]gnu-keywords' to force overriding all GNU-extension
   // keywords. This behavior is provided by GCC's poorly named '-fasm' flag,
@@ -1851,7 +1857,6 @@ static void ParseLangArgs(LangOptions &O
   // Provide diagnostic when a given target is not expected to be an OpenMP
   // device or host.
   if (Opts.OpenMP && !Opts.OpenMPIsDevice) {
-llvm::Triple T(TargetOpts.Triple);
 switch (T.getArch()) {
 default:
   break;

Modified: cfe/trunk/test/FixIt/fixit-errors.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit-errors.c?rev=267772&r1=267771&r2=267772&view=diff
==
--- cfe/trunk/test/FixIt/fixit-errors.c (original)
+++ cfe/trunk/test/FixIt/fixit-errors.c Wed Apr 27 14:53:03 2016
@@ -22,6 +22,8 @@ void test_point() {
   (void)get_origin->x; // expected-error {{base of member reference is a 
function; perhaps you meant to call it with no arguments?}}
 }
 
+// These errors require C11.
+#if __STDC_VERSION__ > 199901L
 void noreturn_1() _Noreturn; // expected-error {{must precede function 
declarator}}
 void noreturn_1() {
   return; // expected-warning {{should not return}}
@@ -29,3 +31,4 @@ void noreturn_1() {
 void noreturn_2() _Noreturn { // expected-error {{must precede function 
declarator}}
   return; // expected-warning {{should not return}}
 }
+#endif

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=267772&r1=267771&r2=267772&view=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Wed Apr 27 14:53:03 2016
@@ -88,7 +88,6 @@
 // COMMON:#define __ORDER_LITTLE_ENDIAN__ 1234
 // COMMON:#define __ORDER_PDP_ENDIAN__ 3412
 // COMMON:#define __STDC_HOSTED__ 1
-// COMMON:#define __STDC

Re: [PATCH] D19412: [libcxx] Refactor pthread usage - II

2016-04-27 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

> On a bikeshed note: is `<__os_support>` the right name? Or should it be 
> something like `<__thread>`  or `<__threading_support>`?


I went with `__os_support`  in case if we'd want to group further external 
dependencies (like, for example, if some non-c POSIX calls are used in the 
upcoming `filesystem` library). I can revert back to `__threading_support` if 
that's preferred.

Thanks.

/ Asiri



Comment at: include/__os_support:32
@@ +31,3 @@
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __os_mutex_init(__libcpp_mutex* __m, bool is_recursive = false)

mclow.lists wrote:
> These should all be marked with `_LIBCPP_ALWAYS_INLINE`.
Got it. Will update.


Comment at: src/algorithm.cpp:51
@@ -50,3 +50,3 @@
 #ifndef _LIBCPP_HAS_NO_THREADS
-static pthread_mutex_t __rs_mut = PTHREAD_MUTEX_INITIALIZER;
+static mutex __rs_mut;
 #endif

mclow.lists wrote:
> What happened to the initializer here?
I'm expecting the constructor of `mutex` to be run here at load time (before 
`main`). Note that this a libc++ mutex rather than a pthreads mutex (which does 
not required a constructor call like this). Would that be too much of an 
overhead?


Comment at: src/memory.cpp:130
@@ -129,11 +129,3 @@
 static const std::size_t __sp_mut_count = 16;
-static pthread_mutex_t mut_back_imp[__sp_mut_count] =
-{
-PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 
PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER,
-PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 
PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER,
-PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 
PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER,
-PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 
PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER
-};
-
-static mutex* mut_back = reinterpret_cast(mut_back_imp);
+static mutex mut_back[__sp_mut_count];
 

mclow.lists wrote:
> How does this array get initialized now?
Same as above, but bigger (this now requires 16 constructor calls during load 
time). I can check if clang would figure out that this is a trivial 
construction (at least for the default pthreads implementation) and be able to 
avoid the constructor calls altogether, but may be relying on such behaviour is 
not good.


Comment at: src/mutex.cpp:201
@@ -222,1 +200,3 @@
+static mutex mut;
+static condition_variable cv;
 #endif

mclow.lists wrote:
> These two variables used to be initialized. Now they're not.
Same, relying on initialization at load time.


http://reviews.llvm.org/D19412



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


Re: [PATCH] D18635: Rework interface for bitset-using features to use a notion of LTO visibility.

2016-04-27 Thread Peter Collingbourne via cfe-commits
pcc added a comment.

Ping.


http://reviews.llvm.org/D18635



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


Re: [PATCH] D19183: [clang-tidy] Add modernize-make-shared check

2016-04-27 Thread Piotr Padlewski via cfe-commits
Prazek removed rL LLVM as the repository for this revision.
Prazek updated this revision to Diff 55295.

http://reviews.llvm.org/D19183

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/MakeSharedCheck.cpp
  clang-tidy/modernize/MakeSharedCheck.h
  clang-tidy/modernize/MakeSmartPtrCheck.cpp
  clang-tidy/modernize/MakeSmartPtrCheck.h
  clang-tidy/modernize/MakeUniqueCheck.cpp
  clang-tidy/modernize/MakeUniqueCheck.h
  clang-tidy/modernize/ModernizeTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-make-shared.rst
  test/clang-tidy/modernize-make-shared.cpp

Index: test/clang-tidy/modernize-make-shared.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-make-shared.cpp
@@ -0,0 +1,200 @@
+// RUN: %check_clang_tidy %s modernize-make-shared %t
+
+namespace std {
+
+template 
+class shared_ptr {
+public:
+  shared_ptr(type *ptr);
+  shared_ptr(const shared_ptr &t) {}
+  shared_ptr(shared_ptr &&t) {}
+  ~shared_ptr();
+  type &operator*() { return *ptr; }
+  type *operator->() { return ptr; }
+  type *release();
+  void reset();
+  void reset(type *pt);
+
+private:
+  type *ptr;
+};
+}
+
+struct Base {
+  Base();
+  Base(int, int);
+};
+
+struct Derived : public Base {
+  Derived();
+  Derived(int, int);
+};
+
+struct APair {
+  int a, b;
+};
+
+struct DPair {
+  DPair() : a(0), b(0) {}
+  DPair(int x, int y) : a(y), b(x) {}
+  int a, b;
+};
+
+struct Empty {};
+
+template 
+using shared_ptr_ = std::shared_ptr;
+
+void *operator new(__SIZE_TYPE__ Count, void *Ptr);
+
+int g(std::shared_ptr P);
+
+std::shared_ptr getPointer() {
+  return std::shared_ptr(new Base);
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use std::make_shared instead
+  // CHECK-FIXES: return std::make_shared();
+}
+
+void basic() {
+  std::shared_ptr P1 = std::shared_ptr(new int());
+  // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: use std::make_shared instead [modernize-make-shared]
+  // CHECK-FIXES: std::shared_ptr P1 = std::make_shared();
+
+  // Without parenthesis.
+  std::shared_ptr P2 = std::shared_ptr(new int);
+  // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: use std::make_shared instead [modernize-make-shared]
+  // CHECK-FIXES: std::shared_ptr P2 = std::make_shared();
+
+  // With auto.
+  auto P3 = std::shared_ptr(new int());
+  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use std::make_shared instead
+  // CHECK-FIXES: auto P3 = std::make_shared();
+
+  {
+// No std.
+using namespace std;
+shared_ptr Q = shared_ptr(new int());
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: use std::make_shared instead
+// CHECK-FIXES: shared_ptr Q = std::make_shared();
+  }
+
+  std::shared_ptr R(new int());
+
+  // Create the shared_ptr as a parameter to a function.
+  int T = g(std::shared_ptr(new int()));
+  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use std::make_shared instead
+  // CHECK-FIXES: int T = g(std::make_shared());
+
+  // Only replace if the type in the template is the same than the type returned
+  // by the new operator.
+  auto Pderived = std::shared_ptr(new Derived());
+
+  // The pointer is returned by the function, nothing to do.
+  std::shared_ptr RetPtr = getPointer();
+
+  // This emulates std::move.
+  std::shared_ptr Move = static_cast &&>(P1);
+
+  // Placemenet arguments should not be removed.
+  int *PInt = new int;
+  std::shared_ptr Placement = std::shared_ptr(new (PInt) int{3});
+}
+
+void initialization(int T, Base b) {
+  // Test different kinds of initialization of the pointee.
+
+  // Direct initialization with parenthesis.
+  std::shared_ptr PDir1 = std::shared_ptr(new DPair(1, T));
+  // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: use std::make_shared instead
+  // CHECK-FIXES: std::shared_ptr PDir1 = std::make_shared(1, T);
+
+  // Direct initialization with braces.
+  std::shared_ptr PDir2 = std::shared_ptr(new DPair{2, T});
+  // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: use std::make_shared instead
+  // CHECK-FIXES: std::shared_ptr PDir2 = std::make_shared(2, T);
+
+  // Aggregate initialization.
+  std::shared_ptr PAggr = std::shared_ptr(new APair{T, 1});
+  // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: use std::make_shared instead
+  // CHECK-FIXES: std::shared_ptr PAggr = std::make_shared(APair{T, 1});
+
+  // Test different kinds of initialization of the pointee, when the shared_ptr
+  // is initialized with braces.
+
+  // Direct initialization with parenthesis.
+  std::shared_ptr PDir3 = std::shared_ptr{new DPair(3, T)};
+  // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: use std::make_shared instead
+  // CHECK-FIXES: std::shared_ptr PDir3 = std::make_shared(3, T);
+
+  // Direct initialization with braces.
+  std::shared_ptr PDir4 = std::shared_ptr{new DPair{4, T}};
+  // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: use std::make_shared instead
+  // CHECK-FIXES: std::shared_ptr PDir4 = std::make_shared(4, T);
+
+  // Aggregate initialization.
+  

Re: r267534 - [MSVC] PR27337: allow static_cast from private base to derived for WTL

2016-04-27 Thread Dmitry Polukhin via cfe-commits
So it seems that there is an agreement that Clang don't need this MSVC
"feature" so I'll revert my patch tomorrow when I get to the office.

On Wed, Apr 27, 2016 at 10:09 PM, Stephan T. Lavavej <
s...@exchange.microsoft.com> wrote:

> [Richard Smith]
> > You can find a description of the problem in http://llvm.org/PR27337
> > Brief summary:
> > The WTL bug is the missing 'public' on the second base class on this
> line:
> https://sourceforge.net/p/wtl/code/HEAD/tree/trunk/wtl/Samples/MDIDocVw/mainfrm.h#l636
> > The C1xx bug is that it accepts a (non-C-style) cast from a base class
> to an inaccessible derived class.
>
> Thanks, I've asked my boss if MS devs still maintain WTL and if so, who.
>
> As for C1XX, I've filed VSO#216958 "C1XX shouldn't allow static_cast to
> bypass private inheritance" with a self-contained repro.
>
> STL
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19612: Use the new path for coverage related headers and update CMakeLists.txt

2016-04-27 Thread David Li via cfe-commits
davidxl accepted this revision.
davidxl added a reviewer: davidxl.
davidxl added a comment.
This revision is now accepted and ready to land.

lgtm


http://reviews.llvm.org/D19612



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


[PATCH] D19612: Use the new path for coverage related headers and update CMakeLists.txt

2016-04-27 Thread Easwaran Raman via cfe-commits
eraman created this revision.
eraman added a reviewer: vsk.
eraman added subscribers: cfe-commits, davidxl.

http://reviews.llvm.org/D19612

Files:
  lib/CodeGen/CMakeLists.txt
  lib/CodeGen/CoverageMappingGen.cpp

Index: lib/CodeGen/CoverageMappingGen.cpp
===
--- lib/CodeGen/CoverageMappingGen.cpp
+++ lib/CodeGen/CoverageMappingGen.cpp
@@ -18,9 +18,9 @@
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Optional.h"
-#include "llvm/ProfileData/CoverageMapping.h"
-#include "llvm/ProfileData/CoverageMappingReader.h"
-#include "llvm/ProfileData/CoverageMappingWriter.h"
+#include "llvm/ProfileData/Coverage/CoverageMapping.h"
+#include "llvm/ProfileData/Coverage/CoverageMappingReader.h"
+#include "llvm/ProfileData/Coverage/CoverageMappingWriter.h"
 #include "llvm/ProfileData/InstrProfReader.h"
 #include "llvm/Support/FileSystem.h"
 
Index: lib/CodeGen/CMakeLists.txt
===
--- lib/CodeGen/CMakeLists.txt
+++ lib/CodeGen/CMakeLists.txt
@@ -3,6 +3,7 @@
   BitReader
   BitWriter
   Core
+  Coverage
   IPO
   IRReader
   InstCombine


Index: lib/CodeGen/CoverageMappingGen.cpp
===
--- lib/CodeGen/CoverageMappingGen.cpp
+++ lib/CodeGen/CoverageMappingGen.cpp
@@ -18,9 +18,9 @@
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Optional.h"
-#include "llvm/ProfileData/CoverageMapping.h"
-#include "llvm/ProfileData/CoverageMappingReader.h"
-#include "llvm/ProfileData/CoverageMappingWriter.h"
+#include "llvm/ProfileData/Coverage/CoverageMapping.h"
+#include "llvm/ProfileData/Coverage/CoverageMappingReader.h"
+#include "llvm/ProfileData/Coverage/CoverageMappingWriter.h"
 #include "llvm/ProfileData/InstrProfReader.h"
 #include "llvm/Support/FileSystem.h"
 
Index: lib/CodeGen/CMakeLists.txt
===
--- lib/CodeGen/CMakeLists.txt
+++ lib/CodeGen/CMakeLists.txt
@@ -3,6 +3,7 @@
   BitReader
   BitWriter
   Core
+  Coverage
   IPO
   IRReader
   InstCombine
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18274: [clang-tidy] Add boost module

2016-04-27 Thread Piotr Padlewski via cfe-commits
Prazek updated this revision to Diff 55287.

http://reviews.llvm.org/D18274

Files:
  clang-tidy/CMakeLists.txt
  clang-tidy/boost/BoostTidyModule.cpp
  clang-tidy/boost/CMakeLists.txt
  clang-tidy/plugin/CMakeLists.txt
  clang-tidy/tool/CMakeLists.txt
  clang-tidy/tool/ClangTidyMain.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/index.rst

Index: docs/clang-tidy/index.rst
===
--- docs/clang-tidy/index.rst
+++ docs/clang-tidy/index.rst
@@ -67,6 +67,8 @@
 
 * Clang static analyzer checks are named starting with ``clang-analyzer-``.
 
+* Checks related to Boost library starts with ``boost-``. 
+  
 Clang diagnostics are treated in a similar way as check diagnostics. Clang
 diagnostics are displayed by clang-tidy and can be filtered out using
 ``-checks=`` option. However, the ``-checks=`` option does not affect
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -206,6 +206,8 @@
 
   Finds static function and variable definitions in anonymous namespace.
 
+  - New Boost module containing checks for issues with Boost library
+
 Fixed bugs:
 
 - Crash when running on compile database with relative source files paths.
Index: clang-tidy/tool/ClangTidyMain.cpp
===
--- clang-tidy/tool/ClangTidyMain.cpp
+++ clang-tidy/tool/ClangTidyMain.cpp
@@ -393,6 +393,11 @@
 static int LLVM_ATTRIBUTE_UNUSED CERTModuleAnchorDestination =
 CERTModuleAnchorSource;
 
+// This anchor is used to force the linker to link the BoostModule.
+extern volatile int BoostModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED BoostModuleAnchorDestination =
+BoostModuleAnchorSource;
+
 // This anchor is used to force the linker to link the LLVMModule.
 extern volatile int LLVMModuleAnchorSource;
 static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination =
Index: clang-tidy/tool/CMakeLists.txt
===
--- clang-tidy/tool/CMakeLists.txt
+++ clang-tidy/tool/CMakeLists.txt
@@ -10,6 +10,7 @@
   clangASTMatchers
   clangBasic
   clangTidy
+  clangTidyBoostModule
   clangTidyCERTModule
   clangTidyCppCoreGuidelinesModule
   clangTidyGoogleModule
Index: clang-tidy/plugin/CMakeLists.txt
===
--- clang-tidy/plugin/CMakeLists.txt
+++ clang-tidy/plugin/CMakeLists.txt
@@ -8,6 +8,7 @@
   clangFrontend
   clangSema
   clangTidy
+  clangTidyBoostModule
   clangTidyCERTModule
   clangTidyCppCoreGuidelinesModule
   clangTidyGoogleModule
Index: clang-tidy/boost/CMakeLists.txt
===
--- /dev/null
+++ clang-tidy/boost/CMakeLists.txt
@@ -0,0 +1,13 @@
+set(LLVM_LINK_COMPONENTS support)
+
+add_clang_library(clangTidyBoostModule
+  BoostTidyModule.cpp
+
+  LINK_LIBS
+  clangAST
+  clangASTMatchers
+  clangBasic
+  clangLex
+  clangTidy
+  clangTidyUtils
+  )
Index: clang-tidy/boost/BoostTidyModule.cpp
===
--- /dev/null
+++ clang-tidy/boost/BoostTidyModule.cpp
@@ -0,0 +1,35 @@
+//===--- BoostTidyModule.cpp - clang-tidy -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "../ClangTidy.h"
+#include "../ClangTidyModule.h"
+#include "../ClangTidyModuleRegistry.h"
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace boost {
+
+class BoostModule : public ClangTidyModule {
+public:
+  void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {}
+};
+
+// Register the BoostModule using this statically initialized variable.
+static ClangTidyModuleRegistry::Add X("boost-module",
+   "Add boost checks.");
+
+} // namespace boost
+
+// This anchor is used to force the linker to link in the generated object file
+// and thus register the BoostModule.
+volatile int BoostModuleAnchorSource = 0;
+
+} // namespace tidy
+} // namespace clang
Index: clang-tidy/CMakeLists.txt
===
--- clang-tidy/CMakeLists.txt
+++ clang-tidy/CMakeLists.txt
@@ -27,6 +27,7 @@
 
 add_subdirectory(tool)
 add_subdirectory(plugin)
+add_subdirectory(boost)
 add_subdirectory(cert)
 add_subdirectory(llvm)
 add_subdirectory(cppcoreguidelines)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19183: [clang-tidy] Add modernize-make-shared check

2016-04-27 Thread Piotr Padlewski via cfe-commits
Prazek marked 3 inline comments as done.
Prazek added a comment.

Repository:
  rL LLVM

http://reviews.llvm.org/D19183



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


r267764 - Call TargetMachine::addEarlyAsPossiblePasses from BackendUtil.

2016-04-27 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Wed Apr 27 14:12:56 2016
New Revision: 267764

URL: http://llvm.org/viewvc/llvm-project?rev=267764&view=rev
Log:
Call TargetMachine::addEarlyAsPossiblePasses from BackendUtil.

Summary:
As of D18614, TargetMachine exposes a hook to add a set of passes that should
be run as early as possible.  Invoke this hook from clang when setting up the
pass manager.

Reviewers: chandlerc

Subscribers: rnk, cfe-commits, tra

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

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

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=267764&r1=267763&r2=267764&view=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Wed Apr 27 14:12:56 2016
@@ -354,6 +354,14 @@ void EmitAssemblyHelper::CreatePasses(Mo
 return;
   }
 
+  // Add target-specific passes that need to run as early as possible.
+  if (TM)
+PMBuilder.addExtension(
+PassManagerBuilder::EP_EarlyAsPossible,
+[&](const PassManagerBuilder &, legacy::PassManagerBase &PM) {
+  TM->addEarlyAsPossiblePasses(PM);
+});
+
   PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
  addAddDiscriminatorsPass);
 


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


Re: [PATCH] D18617: Call TargetMachine::addEarlyAsPossiblePasses from BackendUtil.

2016-04-27 Thread Justin Lebar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL267764: Call TargetMachine::addEarlyAsPossiblePasses from 
BackendUtil. (authored by jlebar).

Changed prior to commit:
  http://reviews.llvm.org/D18617?vs=53415&id=55290#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18617

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

Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp
===
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp
@@ -354,6 +354,14 @@
 return;
   }
 
+  // Add target-specific passes that need to run as early as possible.
+  if (TM)
+PMBuilder.addExtension(
+PassManagerBuilder::EP_EarlyAsPossible,
+[&](const PassManagerBuilder &, legacy::PassManagerBase &PM) {
+  TM->addEarlyAsPossiblePasses(PM);
+});
+
   PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
  addAddDiscriminatorsPass);
 


Index: cfe/trunk/lib/CodeGen/BackendUtil.cpp
===
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp
@@ -354,6 +354,14 @@
 return;
   }
 
+  // Add target-specific passes that need to run as early as possible.
+  if (TM)
+PMBuilder.addExtension(
+PassManagerBuilder::EP_EarlyAsPossible,
+[&](const PassManagerBuilder &, legacy::PassManagerBase &PM) {
+  TM->addEarlyAsPossiblePasses(PM);
+});
+
   PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
  addAddDiscriminatorsPass);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r267534 - [MSVC] PR27337: allow static_cast from private base to derived for WTL

2016-04-27 Thread Stephan T. Lavavej via cfe-commits
[Richard Smith]
> You can find a description of the problem in http://llvm.org/PR27337
> Brief summary:
> The WTL bug is the missing 'public' on the second base class on this line: 
> https://sourceforge.net/p/wtl/code/HEAD/tree/trunk/wtl/Samples/MDIDocVw/mainfrm.h#l636
> The C1xx bug is that it accepts a (non-C-style) cast from a base class to an 
> inaccessible derived class.

Thanks, I've asked my boss if MS devs still maintain WTL and if so, who.

As for C1XX, I've filed VSO#216958 "C1XX shouldn't allow static_cast to bypass 
private inheritance" with a self-contained repro.

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


Re: [PATCH] D18136: boost-use-to-string check

2016-04-27 Thread Piotr Padlewski via cfe-commits
Prazek updated this revision to Diff 55280.

http://reviews.llvm.org/D18136

Files:
  clang-tidy/boost/BoostTidyModule.cpp
  clang-tidy/boost/CMakeLists.txt
  clang-tidy/boost/UseToStringCheck.cpp
  clang-tidy/boost/UseToStringCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/boost-use-to-string.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/boost-use-to-string.cpp

Index: test/clang-tidy/boost-use-to-string.cpp
===
--- /dev/null
+++ test/clang-tidy/boost-use-to-string.cpp
@@ -0,0 +1,149 @@
+// RUN: %check_clang_tidy %s boost-use-to-string %t
+
+namespace std {
+
+template 
+class basic_string {};
+
+using string = basic_string;
+using wstring = basic_string;
+}
+
+namespace boost {
+template 
+T lexical_cast(const V &) {
+  return T();
+};
+}
+
+struct my_weird_type {};
+
+std::string fun(const std::string &) {}
+
+void test_to_string1() {
+
+  auto xa = boost::lexical_cast(5);
+  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+  // CHECK-FIXES: auto xa = std::to_string(5);
+
+  auto z = boost::lexical_cast(42LL);
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use std::to_string {{..}}
+  // CHECK-FIXES: auto z = std::to_string(42LL);
+
+  // this should not trigger
+  fun(boost::lexical_cast(42.0));
+  auto non = boost::lexical_cast(42);
+  boost::lexical_cast("12");
+}
+
+void test_to_string2() {
+  int a;
+  long b;
+  long long c;
+  unsigned d;
+  unsigned long e;
+  unsigned long long f;
+  float g;
+  double h;
+  long double i;
+  bool j;
+
+  fun(boost::lexical_cast(a));
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-FIXES: fun(std::to_string(a));
+  fun(boost::lexical_cast(b));
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-FIXES: fun(std::to_string(b));
+  fun(boost::lexical_cast(c));
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-FIXES: fun(std::to_string(c));
+  fun(boost::lexical_cast(d));
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-FIXES: fun(std::to_string(d));
+  fun(boost::lexical_cast(e));
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-FIXES: fun(std::to_string(e));
+  fun(boost::lexical_cast(f));
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+  // CHECK-FIXES: fun(std::to_string(f));
+
+  // No change for floating numbers.
+  fun(boost::lexical_cast(g));
+  fun(boost::lexical_cast(h));
+  fun(boost::lexical_cast(i));
+  // And bool.
+  fun(boost::lexical_cast(j));
+}
+
+std::string fun(const std::wstring &) {}
+
+void test_to_wstring() {
+  int a;
+  long b;
+  long long c;
+  unsigned d;
+  unsigned long e;
+  unsigned long long f;
+  float g;
+  double h;
+  long double i;
+  bool j;
+
+  fun(boost::lexical_cast(a));
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring instead of boost::lexical_cast [boost-use-to-string]
+  // CHECK-FIXES: fun(std::to_wstring(a));
+  fun(boost::lexical_cast(b));
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-FIXES: fun(std::to_wstring(b));
+  fun(boost::lexical_cast(c));
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-FIXES: fun(std::to_wstring(c));
+  fun(boost::lexical_cast(d));
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-FIXES: fun(std::to_wstring(d));
+  fun(boost::lexical_cast(e));
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-FIXES: fun(std::to_wstring(e));
+  fun(boost::lexical_cast(f));
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+  // CHECK-FIXES: fun(std::to_wstring(f));
+
+  // No change for floating numbers
+  fun(boost::lexical_cast(g));
+  fun(boost::lexical_cast(h));
+  fun(boost::lexical_cast(i));
+  // and bool.
+  fun(boost::lexical_cast(j));
+}
+
+const auto glob = boost::lexical_cast(42);
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: use std::to_string{{..}}
+// CHECK-FIXES: const auto glob = std::to_string(42);
+
+template 
+void string_as_T(T t = T()) {
+  boost::lexical_cast(42);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use std::to_string{{..}}
+  // CHECK-FIXES: std::to_string(42);
+
+  boost::lexical_cast(42);
+  string_as_T(boost::lexical_cast(42));
+  auto p = boost::lexical_cast(42);
+  auto p2 = (T)boost::lexical_cast(42);
+  auto p3 = static_cast(boost::lexical_cast(42));
+}
+
+#define my_to_string boost::lexical_cast
+
+void no_fixup_inside_macro() {
+  my_to_string(12);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use std::to_string{{..}}
+}
+
+void no_warnings() {
+  fun(boost::lexical_cast("abc"));
+  fun(boost::lexical_cast("abc"));
+  fun(boost::lexical_cast(my_weird_type{}));
+  string_as_T();
+  string_as_T();
+}
Index: docs/clang-tidy/checks

  1   2   >