r290166 - Add test for DR692.

2016-12-19 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Dec 20 01:24:53 2016
New Revision: 290166

URL: http://llvm.org/viewvc/llvm-project?rev=290166=rev
Log:
Add test for DR692.

Modified:
cfe/trunk/test/CXX/drs/dr6xx.cpp

Modified: cfe/trunk/test/CXX/drs/dr6xx.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr6xx.cpp?rev=290166=290165=290166=diff
==
--- cfe/trunk/test/CXX/drs/dr6xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr6xx.cpp Tue Dec 20 01:24:53 2016
@@ -353,3 +353,66 @@ namespace dr639 { // dr639: yes
 void((i = 0) + (i = 0)); // expected-warning {{unsequenced}}
   }
 }
+
+namespace dr692 { // dr692: no
+  namespace temp_func_order_example2 {
+template  struct A {};
+template  void f(U, A *p = 0); // 
expected-note {{candidate}}
+template  int (U, A *p = 0); // expected-note 
{{candidate}}
+template  void g(T, T = T());
+template  void g(T, U...); // expected-error 
0-1{{C++11}}
+void h() {
+  int  = f(42, (A *)0);
+  f(42); // expected-error {{ambiguous}}
+  // FIXME: We should reject this due to ambiguity between the pack and the
+  // default argument. Only parameters with arguments are considered during
+  // partial ordering of function templates.
+  g(42);
+}
+  }
+
+  namespace temp_func_order_example3 {
+template  void f(T, U...); // expected-error 
0-1{{C++11}}
+template  void f(T);
+template  int (T *, U...); // expected-error 
0-1{{C++11}}
+template  void g(T);
+void h(int i) {
+  // This is made ambiguous by dr692, but made valid again by dr1395.
+  f();
+  int  = g();
+}
+  }
+
+  namespace temp_deduct_partial_example {
+template  char (Args... args); // expected-error 
0-1{{C++11}}
+template  short (T1 a1, Args... args); // 
expected-error 0-1{{C++11}}
+template  int (T1 a1, T2 a2);
+void g() {
+  char  = f();
+  short  = f(1, 2, 3);
+  int  = f(1, 2);
+}
+  }
+
+  namespace temp_deduct_type_example1 {
+template  class S; // expected-error 0-1{{C++11}}
+template  class S; // 
expected-error 0-1{{C++11}}
+template  class S {};
+S s;
+
+// FIXME: This should select the first partial specialization. Deduction of
+// the second from the first should succeed, because we should ignore the
+// trailing pack in A with no corresponding P.
+template struct A; // expected-error 0-1{{C++11}}
+template struct A; // 
expected-note {{matches}} expected-error 0-1{{C++11}}
+template struct A {}; // expected-note 
{{matches}}
+template struct A; // expected-error {{ambiguous}}
+  }
+
+  namespace temp_deduct_type_example3 {
+// FIXME: This should select the first template, as in the case above.
+template void f(T*, U...){} // expected-note 
{{candidate}} expected-error 0-1{{C++11}}
+template void f(T){} // expected-note {{candidate}}
+template void f(int*); // expected-error {{ambiguous}}
+  }
+}


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


[PATCH] D27971: Make FormatStyle.GetStyleOfFile test work on MSVC

2016-12-19 Thread Antonio Maiorano via Phabricator via cfe-commits
amaiorano created this revision.
amaiorano added reviewers: klimek, djasper, hans, cfe-commits.

This is more a workaround than a real fix. The real problem is that FS.addFile 
uses clang::vfs::FileSystem::makeAbsolute to convert the input path to an 
absolute path, while getStyle uses llvm::sys::fs::make_absolute, which while 
named similarly,  behave differently. Both will join the input path to the 
current working directory (CWD), except that in the former case, you need to 
have set the CWD explicitly via 
clang::vfs::FileSystem::setCurrentWorkingDirectory, while the latter retrieves 
the CWD from the platform abstraction (llvm::sys::fs::current_path).

A better fix might be to make clang::vfs::FileSystem match the behaviour of 
llvm::sys::fs, having it retrieve the CWD from the platform, rather than having 
the client set it explicitly. Or perhaps clang::vfs::FileSystem should be 
rewritten in terms of llvm::sys::fs, and deprecate the former so that code 
moves towards using the latter.


https://reviews.llvm.org/D27971

Files:
  unittests/Format/FormatTest.cpp


Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -10907,12 +10907,16 @@
 format("auto a = unique_ptr < Foo < Bar>[10]> ;", Spaces));
 }
 
-// Since this test case uses UNIX-style file path. We disable it for MS
-// compiler.
-#if !defined(_MSC_VER) && !defined(__MINGW32__)
-
 TEST(FormatStyle, GetStyleOfFile) {
   vfs::InMemoryFileSystem FS;
+
+  // Set CWD so that clang::vfs::FileSystem::makeAbsolute and
+  // llvm::sys::fs::make_absolute return the same thing.
+  llvm::SmallString<128> InitialDirectory;
+  std::error_code EC = llvm::sys::fs::current_path(InitialDirectory);
+  EXPECT_EQ(EC.value(), 0);
+  FS.setCurrentWorkingDirectory(InitialDirectory);
+
   // Test 1: format file in the same directory.
   ASSERT_TRUE(
   FS.addFile("/a/.clang-format", 0,
@@ -10938,8 +10942,6 @@
   ASSERT_EQ(Style3, getGoogleStyle());
 }
 
-#endif // _MSC_VER
-
 TEST_F(ReplacementTest, FormatCodeAfterReplacements) {
   // Column limit is 20.
   std::string Code = "Type *a =\n"


Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -10907,12 +10907,16 @@
 format("auto a = unique_ptr < Foo < Bar>[10]> ;", Spaces));
 }
 
-// Since this test case uses UNIX-style file path. We disable it for MS
-// compiler.
-#if !defined(_MSC_VER) && !defined(__MINGW32__)
-
 TEST(FormatStyle, GetStyleOfFile) {
   vfs::InMemoryFileSystem FS;
+
+  // Set CWD so that clang::vfs::FileSystem::makeAbsolute and
+  // llvm::sys::fs::make_absolute return the same thing.
+  llvm::SmallString<128> InitialDirectory;
+  std::error_code EC = llvm::sys::fs::current_path(InitialDirectory);
+  EXPECT_EQ(EC.value(), 0);
+  FS.setCurrentWorkingDirectory(InitialDirectory);
+
   // Test 1: format file in the same directory.
   ASSERT_TRUE(
   FS.addFile("/a/.clang-format", 0,
@@ -10938,8 +10942,6 @@
   ASSERT_EQ(Style3, getGoogleStyle());
 }
 
-#endif // _MSC_VER
-
 TEST_F(ReplacementTest, FormatCodeAfterReplacements) {
   // Column limit is 20.
   std::string Code = "Type *a =\n"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25206: [Parser] Correct typo after lambda capture initializer is parsed

2016-12-19 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

Thanks all for the review.




Comment at: cfe/trunk/test/SemaCXX/lambda-expressions.cpp:572
+void foo1() {
+  auto s0 = S1{[name=]() {}}; // expected-error 2 {{expected expression}}
+  auto s1 = S1{[name=name]() {}}; // expected-error {{use of undeclared 
identifier 'name'; did you mean 'name1'?}}

"expected expression" error is emitted twice because ParseInitializer() is 
called twice: first MayBeDesignationStart is called, and then it throws away 
what was parsed, and then ParseInitializer() is called the second time at 
Parser::ParseBraceInitializer:427.

I'm not sure what's the best way to fix this.


Repository:
  rL LLVM

https://reviews.llvm.org/D25206



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


Re: [PATCH] D27683: Prepare PrettyStackTrace for LLDB adoption

2016-12-19 Thread David Blaikie via cfe-commits
On Mon, Dec 19, 2016 at 9:39 AM Sean Callanan  wrote:

> That would require making LLDB crash and collecting the relevant crash log
> data out of the user's own logs.  This isn't impossible – but additionally
> the generation of that log is asynchronous and you don't quite know when
> it'll land.
> Would you be all right with a more restricted macOS-only unit test where
> we check that __crashreporter_info__ contains what we think it does?  That
> won't check end-to-end but at least it'll give us some confidence that
> things are sane.
>

I was thinking something like a unit test of PrettyStackTraceFormat - that
wouldn't need to be OS specific, would it?


>
> Sean
>
> On Dec 19, 2016, at 9:01 AM, David Blaikie  wrote:
>
> Test coverage?
>
> On Tue, Dec 13, 2016 at 2:39 PM Sean Callanan via Phabricator via
> cfe-commits  wrote:
>
> spyffe retitled this revision from "Fix the linkage for
> __crashtracer_info__" to "Prepare PrettyStackTrace for LLDB adoption".
> spyffe updated the summary for this revision.
> spyffe updated this revision to Diff 81304.
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D27683
>
> Files:
>   include/llvm/Support/PrettyStackTrace.h
>   lib/Support/PrettyStackTrace.cpp
>
>
> Index: lib/Support/PrettyStackTrace.cpp
> ===
> --- lib/Support/PrettyStackTrace.cpp
> +++ lib/Support/PrettyStackTrace.cpp
> @@ -89,7 +89,7 @@
>  = { CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0 };
>  }
>  #elif defined (__APPLE__) && HAVE_CRASHREPORTER_INFO
> -static const char *__crashreporter_info__ = 0;
> +extern "C" const char *__crashreporter_info__
> __attribute__((visibility("hidden"))) = 0;
>  asm(".desc ___crashreporter_info__, 0x10");
>  #endif
>
> @@ -145,6 +145,28 @@
>OS << Str << "\n";
>  }
>
> +PrettyStackTraceFormat::PrettyStackTraceFormat(const char *format, ...) {
> +  va_list ap;
> +
> +  va_start(ap, format);
> +  const int size_or_error = vsnprintf(nullptr, 0, format, ap);
> +  va_end(ap);
> +
> +  if (size_or_error < 0) {
> +return;
> +  }
> +
> +  const int size = size_or_error + 1; // '\0'
> +
> +  Str.resize(size);
> +
> +  va_start(ap, format);
> +  vsnprintf(Str.data(), size, format, ap);
> +  va_end(ap);
> +}
> +
> +void PrettyStackTraceFormat::print(raw_ostream ) const { OS << Str <<
> "\n"; }
> +
>  void PrettyStackTraceProgram::print(raw_ostream ) const {
>OS << "Program arguments: ";
>// Print the argument list.
> Index: include/llvm/Support/PrettyStackTrace.h
> ===
> --- include/llvm/Support/PrettyStackTrace.h
> +++ include/llvm/Support/PrettyStackTrace.h
> @@ -16,6 +16,7 @@
>  #ifndef LLVM_SUPPORT_PRETTYSTACKTRACE_H
>  #define LLVM_SUPPORT_PRETTYSTACKTRACE_H
>
> +#include "llvm/ADT/SmallVector.h"
>  #include "llvm/Support/Compiler.h"
>
>  namespace llvm {
> @@ -55,6 +56,16 @@
>  void print(raw_ostream ) const override;
>};
>
> +  /// PrettyStackTraceFormat - This object prints a string (which may use
> +  /// printf-style formatting but should not contain newlines) to the
> stream
> +  /// as the stack trace when a crash occurs.
> +  class PrettyStackTraceFormat : public PrettyStackTraceEntry {
> +llvm::SmallVector Str;
> +  public:
> +PrettyStackTraceFormat(const char *format, ...);
> +void print(raw_ostream ) const override;
> +  };
> +
>/// PrettyStackTraceProgram - This object prints a specified program
> arguments
>/// to the stream as the stack trace when a crash occurs.
>class PrettyStackTraceProgram : public PrettyStackTraceEntry {
>
>
> ___
> 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] D27180: Testbed and skeleton of a new expression parser

2016-12-19 Thread David Blaikie via cfe-commits
I don't know much about who owns this sort of code, nor Vassil's
work/responsibility in this area - but if he's OK with it/feels able to
sign off on it, that'd be sufficient/fine by me (& others closer to it can
pipe up if he seems like not the right person to approve).

Thanks!
- Dave

On Mon, Dec 19, 2016 at 9:48 AM Sean Callanan  wrote:

> David,
>
> thanks for keeping an eye on this and sorry for the breach of process.
> Would having Vassil approve the changelist (
> https://reviews.llvm.org/D27180) be appropriate?
> Let's say if he has any concerns or can't get to it by tomorrow, we revert
> my patches since they're pretty self-contained.
>
> Sean
>
> On Dec 19, 2016, at 8:55 AM, David Blaikie  wrote:
>
>
>
> On Thu, Dec 15, 2016 at 2:18 PM Sean Callanan via Phabricator via
> cfe-commits  wrote:
>
> spyffe updated this revision to Diff 81661.
> spyffe marked 2 inline comments as done.
> spyffe added a comment.
> Herald added a subscriber: jgosnell.
>
> Applied Vassil and Vedant's comments.  I will commit this soon.
>
>
> Was this change approved/accepted by anyone? "commit if no one has
> objections in " isn't generally how LLVM project changes are
> reviewed/committed.
>
>
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D27180
>
> Files:
>   test/Import/clang-flags/Inputs/S.c
>   test/Import/clang-flags/test.c
>   test/Import/empty-struct/Inputs/S.c
>   test/Import/empty-struct/test.c
>   test/Import/error-in-expression/Inputs/S.c
>   test/Import/error-in-expression/test.c
>   test/Import/error-in-import/Inputs/S.c
>   test/Import/error-in-import/test.c
>   test/Import/missing-import/test.c
>   tools/CMakeLists.txt
>   tools/clang-import-test/CMakeLists.txt
>   tools/clang-import-test/clang-import-test.cpp
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27430: [libc++] Annotate template methods with visibility

2016-12-19 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai requested a review of this revision.
smeenai added a comment.

I think this actually stands well on its own. I'll do the extern template 
annotations in a different diff.

Also, ping :)


https://reviews.llvm.org/D27430



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


[PATCH] D25208: [libc++] Make _LIBCPP_TYPE_VIS export members

2016-12-19 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai requested a review of this revision.
smeenai added a comment.

Actually, I think this can stand on its own. I'll do the extern template fixes 
in another diff.

Also, ping :)


https://reviews.llvm.org/D25208



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


[PATCH] D26949: [libc++abi] Clean up visibility

2016-12-19 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

Ping.


https://reviews.llvm.org/D26949



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


[PATCH] D27153: [libc++] Make __num_get_float hidden

2016-12-19 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

Ping.


https://reviews.llvm.org/D27153



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


[PATCH] D21113: Add support for case-insensitive header lookup

2016-12-19 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added inline comments.



Comment at: lib/Basic/VirtualFileSystem.cpp:483
+CaseInsensitiveFileSystem::openFileForRead(const Twine ) {
+  SmallVector NewPath;
+  if (std::error_code EC = findCaseInsensitivePath(Path.str(), NewPath))

I wonder whether it would help with performance to try the original path here 
first, then do the case insensitive stuff only if that failed.


https://reviews.llvm.org/D21113



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


[PATCH] D21113: Add support for case-insensitive header lookup

2016-12-19 Thread Francisco Lopes da Silva via Phabricator via cfe-commits
francisco.lopes added a comment.

I'm waiting for this to land as well, it's crucial for coding windows code with 
libclang assistance on a linux machine.


https://reviews.llvm.org/D21113



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


r290159 - Fix the spelling of 'bitfield' in diagnostics to be consistently 'bit-field'.

2016-12-19 Thread Chandler Carruth via cfe-commits
Author: chandlerc
Date: Mon Dec 19 20:43:58 2016
New Revision: 290159

URL: http://llvm.org/viewvc/llvm-project?rev=290159=rev
Log:
Fix the spelling of 'bitfield' in diagnostics to be consistently 'bit-field'.

The latter agrees with most existing diagnostics and the C and C++ standards.

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

Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/Parser/objc-property-syntax.m
cfe/trunk/test/Sema/constant-conversion.c
cfe/trunk/test/SemaCXX/conversion.cpp
cfe/trunk/test/SemaCXX/member-init.cpp
cfe/trunk/test/SemaOpenCL/unsupported.cl

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=290159=290158=290159=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Mon Dec 19 20:43:58 
2016
@@ -398,7 +398,7 @@ def err_objc_expected_selector_for_gette
   "expected selector for Objective-C %select{setter|getter}0">;
 def err_objc_property_requires_field_name : Error<
   "property requires fields to be named">;
-def err_objc_property_bitfield : Error<"property name cannot be a bitfield">;
+def err_objc_property_bitfield : Error<"property name cannot be a bit-field">;
 def err_objc_expected_property_attr : Error<"unknown property attribute %0">;
 def err_objc_properties_require_objc2 : Error<
   "properties are an Objective-C 2 feature">;
@@ -726,7 +726,7 @@ def warn_cxx98_compat_nonstatic_member_i
   "in-class initialization of non-static data members is incompatible with 
C++98">,
   InGroup, DefaultIgnore;
 def err_bitfield_member_init: Error<
-  "bitfield member cannot have an in-class initializer">;
+  "bit-field member cannot have an in-class initializer">;
 def err_incomplete_array_member_init: Error<
   "array bound cannot be deduced from an in-class initializer">;
 

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=290159=290158=290159=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Dec 19 20:43:58 
2016
@@ -2930,7 +2930,7 @@ def warn_impcast_integer_precision_const
   "implicit conversion from %2 to %3 changes value from %0 to %1">,
   InGroup;
 def warn_impcast_bitfield_precision_constant : Warning<
-  "implicit truncation from %2 to bitfield changes value from %0 to %1">,
+  "implicit truncation from %2 to bit-field changes value from %0 to %1">,
   InGroup;
 
 def warn_impcast_literal_float_to_integer : Warning<
@@ -8088,7 +8088,7 @@ def err_opencl_function_variable : Error
 def err_static_function_scope : Error<
   "variables in function scope cannot be declared static">;
 def err_opencl_bitfields : Error<
-  "bitfields are not supported in OpenCL">;
+  "bit-fields are not supported in OpenCL">;
 def err_opencl_vla : Error<
   "variable length arrays are not supported in OpenCL">;
 def err_bad_kernel_param_type : Error<

Modified: cfe/trunk/test/Parser/objc-property-syntax.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objc-property-syntax.m?rev=290159=290158=290159=diff
==
--- cfe/trunk/test/Parser/objc-property-syntax.m (original)
+++ cfe/trunk/test/Parser/objc-property-syntax.m Mon Dec 19 20:43:58 2016
@@ -4,7 +4,7 @@
   int prop;
 };
 @property unsigned char bufferedUTF8Bytes[4];  // expected-error {{property 
cannot have array or function type}}
-@property unsigned char bufferedUTFBytes:1;// expected-error {{property 
name cannot be a bitfield}}
+@property unsigned char bufferedUTFBytes:1;// expected-error {{property 
name cannot be a bit-field}}
 @property(nonatomic, retain, setter=ab_setDefaultToolbarItems) MyClass 
*ab_defaultToolbarItems; // expected-error {{method name referenced in property 
setter attribute must end with ':'}}
 
 @property int prop;

Modified: cfe/trunk/test/Sema/constant-conversion.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/constant-conversion.c?rev=290159=290158=290159=diff
==
--- cfe/trunk/test/Sema/constant-conversion.c (original)
+++ cfe/trunk/test/Sema/constant-conversion.c Mon Dec 19 20:43:58 2016
@@ -11,7 +11,7 @@ void test_6792488(void) {
 void test_7809123(void) {
   struct { int i5 : 5; } a;
 
-  a.i5 = 36; // expected-warning {{implicit truncation from 'int' to bitfield 
changes value from 36 to 4}}
+  a.i5 = 36; // expected-warning {{implicit truncation from 'int' to 

[PATCH] D26530: Fix the spelling of 'bitfield' in diagnostics to be consistently 'bit-field'.

2016-12-19 Thread Chandler Carruth via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL290159: Fix the spelling of 'bitfield' in diagnostics to be 
consistently 'bit-field'. (authored by chandlerc).

Changed prior to commit:
  https://reviews.llvm.org/D26530?vs=81008=82055#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26530

Files:
  cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
  cfe/trunk/test/Parser/objc-property-syntax.m
  cfe/trunk/test/Sema/constant-conversion.c
  cfe/trunk/test/SemaCXX/conversion.cpp
  cfe/trunk/test/SemaCXX/member-init.cpp
  cfe/trunk/test/SemaOpenCL/unsupported.cl

Index: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
@@ -398,7 +398,7 @@
   "expected selector for Objective-C %select{setter|getter}0">;
 def err_objc_property_requires_field_name : Error<
   "property requires fields to be named">;
-def err_objc_property_bitfield : Error<"property name cannot be a bitfield">;
+def err_objc_property_bitfield : Error<"property name cannot be a bit-field">;
 def err_objc_expected_property_attr : Error<"unknown property attribute %0">;
 def err_objc_properties_require_objc2 : Error<
   "properties are an Objective-C 2 feature">;
@@ -726,7 +726,7 @@
   "in-class initialization of non-static data members is incompatible with C++98">,
   InGroup, DefaultIgnore;
 def err_bitfield_member_init: Error<
-  "bitfield member cannot have an in-class initializer">;
+  "bit-field member cannot have an in-class initializer">;
 def err_incomplete_array_member_init: Error<
   "array bound cannot be deduced from an in-class initializer">;
 
Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
@@ -2930,7 +2930,7 @@
   "implicit conversion from %2 to %3 changes value from %0 to %1">,
   InGroup;
 def warn_impcast_bitfield_precision_constant : Warning<
-  "implicit truncation from %2 to bitfield changes value from %0 to %1">,
+  "implicit truncation from %2 to bit-field changes value from %0 to %1">,
   InGroup;
 
 def warn_impcast_literal_float_to_integer : Warning<
@@ -8088,7 +8088,7 @@
 def err_static_function_scope : Error<
   "variables in function scope cannot be declared static">;
 def err_opencl_bitfields : Error<
-  "bitfields are not supported in OpenCL">;
+  "bit-fields are not supported in OpenCL">;
 def err_opencl_vla : Error<
   "variable length arrays are not supported in OpenCL">;
 def err_bad_kernel_param_type : Error<
Index: cfe/trunk/test/SemaCXX/conversion.cpp
===
--- cfe/trunk/test/SemaCXX/conversion.cpp
+++ cfe/trunk/test/SemaCXX/conversion.cpp
@@ -50,7 +50,7 @@
 namespace test2 {
   struct A {
 unsigned int x : 2;
-A() : x(10) {} // expected-warning {{implicit truncation from 'int' to bitfield changes value from 10 to 2}}
+A() : x(10) {} // expected-warning {{implicit truncation from 'int' to bit-field changes value from 10 to 2}}
   };
 }
 
Index: cfe/trunk/test/SemaCXX/member-init.cpp
===
--- cfe/trunk/test/SemaCXX/member-init.cpp
+++ cfe/trunk/test/SemaCXX/member-init.cpp
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -verify -std=c++11 -Wall %s
 
 struct Bitfield {
-  int n : 3 = 7; // expected-error {{bitfield member cannot have an in-class initializer}}
+  int n : 3 = 7; // expected-error {{bit-field member cannot have an in-class initializer}}
 };
 
 int a;
Index: cfe/trunk/test/Parser/objc-property-syntax.m
===
--- cfe/trunk/test/Parser/objc-property-syntax.m
+++ cfe/trunk/test/Parser/objc-property-syntax.m
@@ -4,7 +4,7 @@
   int prop;
 };
 @property unsigned char bufferedUTF8Bytes[4];  // expected-error {{property cannot have array or function type}}
-@property unsigned char bufferedUTFBytes:1;// expected-error {{property name cannot be a bitfield}}
+@property unsigned char bufferedUTFBytes:1;// expected-error {{property name cannot be a bit-field}}
 @property(nonatomic, retain, setter=ab_setDefaultToolbarItems) MyClass *ab_defaultToolbarItems; // expected-error {{method name referenced in property setter attribute must end with ':'}}
 
 @property int prop;
Index: cfe/trunk/test/SemaOpenCL/unsupported.cl
===
--- cfe/trunk/test/SemaOpenCL/unsupported.cl
+++ cfe/trunk/test/SemaOpenCL/unsupported.cl
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -verify %s
 
 struct {
-  int a : 1; // expected-error {{bitfields are not supported in OpenCL}}
+  int a 

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

2016-12-19 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added inline comments.



Comment at: llvm/include/llvm/ADT/APFloat.h:800
 
-  void makeLargest(bool Neg) { getIEEE().makeLargest(Neg); }
+  void makeLargest(bool Neg) {
+if (usesLayout(getSemantics())) {

jtony wrote:
> I know it is allowed to return a void function call inside a void function, 
> but I think this reduces the code readability in general and causes some 
> confusing to some people. Maybe it is better to avoid using this kind of 
> coding style. I think we can simply call each function in each branch without 
> the 'return' keyword, by default, the program will reach the end of function 
> and return.  
> 
> One possible equivalent code:
> 
> void makeNaN(bool SNaN, bool Neg, const APInt *fill) {
> if (usesLayout(getSemantics())) {
>   U.IEEE.makeNaN(SNaN, Neg, fill);
> } else if (usesLayout(getSemantics())) {
>   U.Double.makeNaN(SNaN, Neg, fill);
> } else {
>   llvm_unreachable("Unexpected semantics");
> }
>   }
Two reasons not to do that:

1) It makes it less consistent with all the other cases, and consistency is a 
high criteria for readability
2) returning a function call in a void function makes it so that if the callee 
signature is changed to return something in the future, it can't be ignored 
here (i.e. it makes it less error prone somehow).

Alternatively, you can also write it this way:

```
  if (usesLayout(getSemantics())) {
U.IEEE.makeNaN(SNaN, Neg, fill);
return;
  } 
  if (usesLayout(getSemantics())) {
U.Double.makeNaN(SNaN, Neg, fill);
return;
  } 
  llvm_unreachable("Unexpected semantics");
```


https://reviews.llvm.org/D27872



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


[PATCH] D25206: [Parser] Correct typo after lambda capture initializer is parsed

2016-12-19 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL290156: [Parser] Correct typo after lambda capture 
initializer is parsed. (authored by ahatanak).

Changed prior to commit:
  https://reviews.llvm.org/D25206?vs=75819=82052#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25206

Files:
  cfe/trunk/lib/Parse/ParseExprCXX.cpp
  cfe/trunk/test/SemaCXX/lambda-expressions.cpp


Index: cfe/trunk/lib/Parse/ParseExprCXX.cpp
===
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp
@@ -902,6 +902,8 @@
   SourceLocation StartLoc = Tok.getLocation();
   InMessageExpressionRAIIObject MaybeInMessageExpression(*this, true);
   Init = ParseInitializer();
+  if (!Init.isInvalid())
+Init = Actions.CorrectDelayedTyposInExpr(Init.get());
 
   if (Tok.getLocation() != StartLoc) {
 // Back out the lexing of the token after the initializer.
Index: cfe/trunk/test/SemaCXX/lambda-expressions.cpp
===
--- cfe/trunk/test/SemaCXX/lambda-expressions.cpp
+++ cfe/trunk/test/SemaCXX/lambda-expressions.cpp
@@ -558,3 +558,18 @@
   decltype(a)::D b;
 }
 }
+
+namespace PR30566 {
+int name1; // expected-note {{'name1' declared here}}
+
+struct S1 {
+  template
+  S1(T t) { s = sizeof(t); }
+  int s;
+};
+
+void foo1() {
+  auto s0 = S1{[name=]() {}}; // expected-error 2 {{expected expression}}
+  auto s1 = S1{[name=name]() {}}; // expected-error {{use of undeclared 
identifier 'name'; did you mean 'name1'?}}
+}
+}


Index: cfe/trunk/lib/Parse/ParseExprCXX.cpp
===
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp
@@ -902,6 +902,8 @@
   SourceLocation StartLoc = Tok.getLocation();
   InMessageExpressionRAIIObject MaybeInMessageExpression(*this, true);
   Init = ParseInitializer();
+  if (!Init.isInvalid())
+Init = Actions.CorrectDelayedTyposInExpr(Init.get());
 
   if (Tok.getLocation() != StartLoc) {
 // Back out the lexing of the token after the initializer.
Index: cfe/trunk/test/SemaCXX/lambda-expressions.cpp
===
--- cfe/trunk/test/SemaCXX/lambda-expressions.cpp
+++ cfe/trunk/test/SemaCXX/lambda-expressions.cpp
@@ -558,3 +558,18 @@
   decltype(a)::D b;
 }
 }
+
+namespace PR30566 {
+int name1; // expected-note {{'name1' declared here}}
+
+struct S1 {
+  template
+  S1(T t) { s = sizeof(t); }
+  int s;
+};
+
+void foo1() {
+  auto s0 = S1{[name=]() {}}; // expected-error 2 {{expected expression}}
+  auto s1 = S1{[name=name]() {}}; // expected-error {{use of undeclared identifier 'name'; did you mean 'name1'?}}
+}
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r290156 - [Parser] Correct typo after lambda capture initializer is parsed.

2016-12-19 Thread Akira Hatanaka via cfe-commits
Author: ahatanak
Date: Mon Dec 19 20:11:29 2016
New Revision: 290156

URL: http://llvm.org/viewvc/llvm-project?rev=290156=rev
Log:
[Parser] Correct typo after lambda capture initializer is parsed.

This patch fixes an assertion that is triggered when RecordLayoutBuilder
tries to compute the size of a field (for capture "name" in the test
case) whose type hasn't been deduced. The patch fixes the bug by
correcting the typo of the capture initializer after the initializer is
parsed and before setting the expression for the annotation token.

Fixes PR30566.

rdar://problem/23380132

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

Modified:
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/test/SemaCXX/lambda-expressions.cpp

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=290156=290155=290156=diff
==
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Mon Dec 19 20:11:29 2016
@@ -902,6 +902,8 @@ Optional Parser::ParseLambdaIn
   SourceLocation StartLoc = Tok.getLocation();
   InMessageExpressionRAIIObject MaybeInMessageExpression(*this, true);
   Init = ParseInitializer();
+  if (!Init.isInvalid())
+Init = Actions.CorrectDelayedTyposInExpr(Init.get());
 
   if (Tok.getLocation() != StartLoc) {
 // Back out the lexing of the token after the initializer.

Modified: cfe/trunk/test/SemaCXX/lambda-expressions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/lambda-expressions.cpp?rev=290156=290155=290156=diff
==
--- cfe/trunk/test/SemaCXX/lambda-expressions.cpp (original)
+++ cfe/trunk/test/SemaCXX/lambda-expressions.cpp Mon Dec 19 20:11:29 2016
@@ -558,3 +558,18 @@ int func() {
   decltype(a)::D b;
 }
 }
+
+namespace PR30566 {
+int name1; // expected-note {{'name1' declared here}}
+
+struct S1 {
+  template
+  S1(T t) { s = sizeof(t); }
+  int s;
+};
+
+void foo1() {
+  auto s0 = S1{[name=]() {}}; // expected-error 2 {{expected expression}}
+  auto s1 = S1{[name=name]() {}}; // expected-error {{use of undeclared 
identifier 'name'; did you mean 'name1'?}}
+}
+}


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


r290155 - Update for LLVM global variable debug info API change.

2016-12-19 Thread Adrian Prantl via cfe-commits
Author: adrian
Date: Mon Dec 19 20:10:02 2016
New Revision: 290155

URL: http://llvm.org/viewvc/llvm-project?rev=290155=rev
Log:
Update for LLVM global variable debug info API change.

This reapplies r289921.

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/test/CodeGen/2009-10-20-GlobalDebug.c
cfe/trunk/test/CodeGen/2010-08-10-DbgConstant.c
cfe/trunk/test/CodeGen/debug-info-atomic.c
cfe/trunk/test/CodeGen/debug-info-global-constant.c
cfe/trunk/test/CodeGen/debug-info-static-const-fp.c
cfe/trunk/test/CodeGen/debug-info-static.c
cfe/trunk/test/CodeGenCXX/debug-info-global.cpp
cfe/trunk/test/CodeGenCXX/debug-info-static-member.cpp
cfe/trunk/test/CodeGenCXX/debug-info-template-member.cpp
cfe/trunk/test/CodeGenCXX/debug-info-template.cpp
cfe/trunk/test/CodeGenCXX/debug-info.cpp
cfe/trunk/test/CodeGenCXX/inline-dllexport-member.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=290155=290154=290155=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Dec 19 20:10:02 2016
@@ -2855,7 +2855,7 @@ CGDebugInfo::getGlobalVariableForwardDec
   auto Align = getDeclAlignIfRequired(VD, CGM.getContext());
   auto *GV = DBuilder.createTempGlobalVariableFwdDecl(
   DContext, Name, LinkageName, Unit, Line, getOrCreateType(T, Unit),
-  !VD->isExternallyVisible(), nullptr, nullptr, Align);
+  !VD->isExternallyVisible(), nullptr, Align);
   FwdDeclReplaceMap.emplace_back(
   std::piecewise_construct,
   std::make_tuple(cast(VD->getCanonicalDecl())),
@@ -2873,8 +2873,12 @@ llvm::DINode *CGDebugInfo::getDeclaratio
getOrCreateFile(TD->getLocation()));
   auto I = DeclCache.find(D->getCanonicalDecl());
 
-  if (I != DeclCache.end())
-return dyn_cast_or_null(I->second);
+  if (I != DeclCache.end()) {
+auto N = I->second;
+if (auto *GVE = dyn_cast_or_null(N))
+  return GVE->getVariable();
+return dyn_cast_or_null(N);
+  }
 
   // No definition for now. Emit a forward definition that might be
   // merged with a potential upcoming definition.
@@ -3650,10 +3654,10 @@ CGDebugInfo::getOrCreateStaticDataMember
   return CreateRecordStaticField(D, Ctxt, cast(DC));
 }
 
-llvm::DIGlobalVariable *CGDebugInfo::CollectAnonRecordDecls(
+llvm::DIGlobalVariableExpression *CGDebugInfo::CollectAnonRecordDecls(
 const RecordDecl *RD, llvm::DIFile *Unit, unsigned LineNo,
 StringRef LinkageName, llvm::GlobalVariable *Var, llvm::DIScope *DContext) 
{
-  llvm::DIGlobalVariable *GV = nullptr;
+  llvm::DIGlobalVariableExpression *GVE = nullptr;
 
   for (const auto *Field : RD->fields()) {
 llvm::DIType *FieldTy = getOrCreateType(Field->getType(), Unit);
@@ -3662,16 +3666,17 @@ llvm::DIGlobalVariable *CGDebugInfo::Col
 // Ignore unnamed fields, but recurse into anonymous records.
 if (FieldName.empty()) {
   if (const auto *RT = dyn_cast(Field->getType()))
-GV = CollectAnonRecordDecls(RT->getDecl(), Unit, LineNo, LinkageName,
+GVE = CollectAnonRecordDecls(RT->getDecl(), Unit, LineNo, LinkageName,
 Var, DContext);
   continue;
 }
 // Use VarDecl's Tag, Scope and Line number.
-GV = DBuilder.createGlobalVariable(DContext, FieldName, LinkageName, Unit,
-   LineNo, FieldTy, 
Var->hasLocalLinkage());
-Var->addDebugInfo(GV);
+GVE = DBuilder.createGlobalVariableExpression(
+DContext, FieldName, LinkageName, Unit, LineNo, FieldTy,
+Var->hasLocalLinkage());
+Var->addDebugInfo(GVE);
   }
-  return GV;
+  return GVE;
 }
 
 void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
@@ -3684,7 +3689,8 @@ void CGDebugInfo::EmitGlobalVariable(llv
   // it to the llvm::GlobalVariable.
   auto Cached = DeclCache.find(D->getCanonicalDecl());
   if (Cached != DeclCache.end())
-return Var->addDebugInfo(cast(Cached->second));
+return Var->addDebugInfo(
+cast(Cached->second));
 
   // Create global variable debug descriptor.
   llvm::DIFile *Unit = nullptr;
@@ -3696,7 +3702,7 @@ void CGDebugInfo::EmitGlobalVariable(llv
 
   // Attempt to store one global variable for the declaration - even if we
   // emit a lot of fields.
-  llvm::DIGlobalVariable *GV = nullptr;
+  llvm::DIGlobalVariableExpression *GVE = nullptr;
 
   // If this is an anonymous union then we'll want to emit a global
   // variable for each member of the anonymous union so that it's possible
@@ -3705,16 +3711,16 @@ void CGDebugInfo::EmitGlobalVariable(llv
 const RecordDecl *RD = T->castAs()->getDecl();
 assert(RD->isAnonymousStructOrUnion() &&
"unnamed non-anonymous struct or union?");
-GV = CollectAnonRecordDecls(RD, Unit, LineNo, 

Re: r289996 - IRGen: Fix assertion failure when creating debug info for an integer constant wider than 64 bits.

2016-12-19 Thread Adrian Prantl via cfe-commits

> On Dec 16, 2016, at 2:10 PM, Peter Collingbourne via cfe-commits 
>  wrote:
> 
> Author: pcc
> Date: Fri Dec 16 16:10:52 2016
> New Revision: 289996
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=289996=rev
> Log:
> IRGen: Fix assertion failure when creating debug info for an integer constant 
> wider than 64 bits.
> 
> Added:
>cfe/trunk/test/CodeGen/dbg-const-int128.c
> Modified:
>cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=289996=289995=289996=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Dec 16 16:10:52 2016
> @@ -3759,12 +3759,15 @@ void CGDebugInfo::EmitGlobalVariable(con
>   if (GV)
> return;
>   llvm::DIExpression *InitExpr = nullptr;
> -  if (Init.isInt())
> -InitExpr =
> -DBuilder.createConstantValueExpression(Init.getInt().getExtValue());
> -  else if (Init.isFloat() && CGM.getContext().getTypeSize(VD->getType()) <= 
> 64)
> -InitExpr = DBuilder.createConstantValueExpression(
> -Init.getFloat().bitcastToAPInt().getZExtValue());
> +  if (CGM.getContext().getTypeSize(VD->getType()) <= 64) {
> +// FIXME: Add a representation for integer constants wider than 64 bits.

FYI, that representation is the somewhat unwieldy composition of:

  DIGlobalVariableExpression(var: ![v], expr: !DIExpression(DW_OP_constu, [lo], 
DW_OP_stack_value, DW_OP_LLVM_fragment, 64, 0))
  DIGlobalVariableExpression(var: ![v], expr: !DIExpression(DW_OP_constu, [hi], 
DW_OP_stack_value, DW_OP_LLVM_fragment, 64, 64))

-- adrian

> +if (Init.isInt())
> +  InitExpr =
> +  
> DBuilder.createConstantValueExpression(Init.getInt().getExtValue());
> +else if (Init.isFloat())
> +  InitExpr = DBuilder.createConstantValueExpression(
> +  Init.getFloat().bitcastToAPInt().getZExtValue());
> +  }
>   GV.reset(DBuilder.createGlobalVariable(
>   DContext, Name, StringRef(), Unit, getLineNumber(VD->getLocation()), Ty,
>   true, InitExpr, getOrCreateStaticDataMemberDeclarationOrNull(VarD),
> 
> Added: cfe/trunk/test/CodeGen/dbg-const-int128.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/dbg-const-int128.c?rev=289996=auto
> ==
> --- cfe/trunk/test/CodeGen/dbg-const-int128.c (added)
> +++ cfe/trunk/test/CodeGen/dbg-const-int128.c Fri Dec 16 16:10:52 2016
> @@ -0,0 +1,8 @@
> +// RUN: %clang_cc1 -S -emit-llvm -debug-info-kind=limited  %s -o - | 
> FileCheck %s
> +// CHECK: !DIGlobalVariable({{.*}}
> +// CHECK-NOT: expr:
> +
> +static const __uint128_t ro = 18446744073709551615;
> +
> +void bar(__uint128_t);
> +void foo() { bar(ro); }
> 
> 
> ___
> 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


buildbot numbers for the week of 12/11/2016 - 12/17/2016

2016-12-19 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 12/11/2016 -
12/17/2016.

Please see the same data in attached csv files:

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

Thanks

Galina


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

buildername | was_red
+-
 clang-cuda-build   | 91:11:26
 clang-ppc64le-linux-multistage | 62:07:22
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 54:32:40
 clang-3stage-ubuntu| 53:57:51
 sanitizer-x86_64-linux-autoconf| 45:37:38
 sanitizer-x86_64-linux | 42:49:24
 clang-x86-windows-msvc2015 | 42:27:27
 sanitizer-windows  | 42:07:49
 clang-native-arm-lnt   | 41:12:15
 sanitizer-x86_64-linux-fast| 39:41:57
 sanitizer-x86_64-linux-bootstrap   | 38:35:49
 lldb-x86_64-ubuntu-14.04-android   | 38:04:19
 lldb-x86_64-darwin-13.4| 26:14:11
 clang-native-aarch64-full  | 24:25:06
 perf-x86_64-penryn-O3-polly-before-vectorizer  | 15:10:30
 clang-ppc64be-linux-multistage | 14:49:15
 clang-s390x-linux  | 14:24:17
 clang-ppc64be-linux-lnt| 14:12:40
 clang-ppc64be-linux| 14:11:52
 perf-x86_64-penryn-O3  | 10:37:15
 clang-x86_64-linux-selfhost-modules-2  | 10:34:56
 polly-amd64-linux  | 10:26:03
 clang-x86_64-linux-selfhost-modules| 10:10:19
 perf-x86_64-penryn-O3-polly| 10:08:41
 clang-cmake-thumbv7-a15-full-sh| 10:01:45
 clang-cmake-armv7-a15-selfhost-neon| 09:59:07
 clang-cmake-armv7-a15-full | 09:37:24
 clang-x64-ninja-win7   | 09:22:34
 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only  | 08:48:40
 clang-cmake-aarch64-lld| 07:28:40
 clang-with-lto-ubuntu  | 07:21:48
 perf-x86_64-penryn-O3-polly-fast   | 07:09:00
 sanitizer-ppc64be-linux| 07:03:33
 clang-cmake-armv7-a15-selfhost | 06:10:17
 perf-x86_64-penryn-O3-polly-unprofitable   | 05:50:36
 perf-x86_64-penryn-O3-polly-parallel-fast  | 05:40:33
 clang-ppc64le-linux-lnt| 05:32:39
 clang-ppc64le-linux| 05:18:00
 lldb-windows7-android  | 05:13:26
 sanitizer-ppc64le-linux| 05:12:02
 clang-cmake-armv7-a15  | 05:04:57
 clang-with-thin-lto-ubuntu | 04:55:29
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 04:31:11
 clang-hexagon-elf  | 04:26:52
 clang-cmake-thumbv7-a15| 04:23:15
 clang-cmake-aarch64-39vma  | 04:15:01
 libcxx-libcxxabi-libunwind-aarch64-linux   | 03:49:54
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11   | 03:41:24
 lldb-x86_64-ubuntu-14.04-buildserver   | 03:27:16
 clang-cmake-aarch64-full   | 03:21:56
 clang-cmake-aarch64-quick  | 03:15:39
 clang-atom-d525-fedora-rel | 03:01:46
 clang-cmake-aarch64-42vma  | 02:52:57
 clang-x86_64-debian-fast   | 02:28:53
 llvm-hexagon-elf   | 02:21:00
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 02:17:45
 sanitizer-x86_64-linux-fuzzer  | 02:15:28
 llvm-avr-linux | 01:30:53
 lldb-amd64-ninja-netbsd7   | 01:27:55
 lld-x86_64-freebsd  

Buildbot numbers for the week of 12/04/2016 - 12/10/2016

2016-12-19 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the week of 12/04/2016 - 12/10/2016.

Please see the same data in attached csv files:

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

Thanks

Galina


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

buildername | was_red
+-
 clang-x86_64-linux-selfhost-modules-2  | 59:28:33
 lldb-x86_64-darwin-13.4| 59:11:44
 clang-native-aarch64-full  | 55:06:28
 sanitizer-x86_64-linux-bootstrap   | 33:22:08
 clang-x86_64-linux-selfhost-modules| 25:16:27
 sanitizer-x86_64-linux | 22:55:48
 lld-x86_64-win7| 13:35:17
 llvm-avr-linux | 13:29:20
 sanitizer-x86_64-linux-fuzzer  | 12:13:58
 lldb-windows7-android  | 09:27:48
 lldb-x86_64-ubuntu-14.04-cmake | 08:40:59
 lldb-x86_64-ubuntu-14.04-android   | 08:32:39
 clang-cmake-armv7-a15-selfhost-neon| 07:29:45
 perf-x86_64-penryn-O3-polly-fast   | 07:27:18
 llvm-mips-linux| 06:45:40
 clang-cmake-mips   | 06:38:02
 perf-x86_64-penryn-O3  | 06:20:14
 clang-with-lto-ubuntu  | 05:48:35
 clang-3stage-ubuntu| 05:28:25
 clang-with-thin-lto-ubuntu | 05:16:37
 clang-native-arm-lnt   | 04:33:53
 clang-cmake-aarch64-full   | 04:20:01
 clang-cmake-armv7-a15-selfhost | 04:18:34
 clang-x86_64-debian-fast   | 04:17:51
 clang-cmake-armv7-a15  | 04:16:21
 clang-x86-windows-msvc2015 | 04:10:27
 clang-x64-ninja-win7   | 03:59:04
 sanitizer-x86_64-linux-autoconf| 03:45:55
 sanitizer-x86_64-linux-fast| 03:44:29
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan  | 03:29:23
 polly-amd64-linux  | 03:25:21
 libcxx-libcxxabi-x86_64-linux-ubuntu-tsan  | 03:24:52
 libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan | 03:24:45
 libcxx-libcxxabi-libunwind-x86_64-linux-ubuntu | 03:24:34
 libcxx-libcxxabi-x86_64-linux-ubuntu-asan  | 03:24:05
 clang-ppc64be-linux-multistage | 03:11:06
 sanitizer-ppc64le-linux| 03:08:30
 lld-x86_64-darwin13| 03:08:12
 lldb-x86_64-ubuntu-14.04-buildserver   | 03:07:52
 clang-ppc64le-linux-lnt| 03:06:55
 sanitizer-ppc64be-linux| 03:03:37
 clang-cmake-aarch64-lld| 02:47:55
 lldb-amd64-ninja-netbsd7   | 02:44:48
 perf-x86_64-penryn-O3-polly-parallel-fast  | 02:41:17
 clang-bpf-build| 02:38:44
 clang-cmake-aarch64-39vma  | 02:38:13
 clang-cmake-thumbv7-a15-full-sh| 02:27:23
 clang-ppc64be-linux| 02:20:54
 clang-cmake-aarch64-42vma  | 02:19:46
 clang-cmake-aarch64-quick  | 02:18:46
 clang-hexagon-elf  | 02:16:59
 clang-s390x-linux  | 02:15:05
 clang-atom-d525-fedora-rel | 02:13:22
 clang-ppc64be-linux-lnt| 02:13:06
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 02:10:42
 clang-ppc64le-linux| 02:08:55
 llvm-hexagon-elf   | 02:06:34
 lld-x86_64-freebsd | 02:04:33
 clang-cmake-thumbv7-a15| 02:04:04
 clang-x86_64-linux-abi-test  

Re: Regression caused by r276159 - [modules] Don't emit initializers for VarDecls within a module eagerly whenever

2016-12-19 Thread Manman via cfe-commits

> On Dec 14, 2016, at 1:20 PM, Manman  wrote:
> 
> 
>> On Jul 20, 2016, at 12:10 PM, Richard Smith via cfe-commits 
>>  wrote:
>> 
>> Author: rsmith
>> Date: Wed Jul 20 14:10:16 2016
>> New Revision: 276159
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=276159=rev
>> Log:
>> [modules] Don't emit initializers for VarDecls within a module eagerly 
>> whenever
>> we first touch any part of that module. Instead, defer them until the first
>> time that module is (transitively) imported. The initializer step for a 
>> module
>> then recursively initializes modules that its own headers imported.
>> 
>> For example, this avoids running the  global initializer in 
>> programs
>> that don't actually use iostreams, but do use other parts of the standard
>> library.
>> 
>> Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=276159=276158=276159=diff
>> ==
>> --- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
>> +++ cfe/trunk/lib/Serialization/ASTWriter.cpp Wed Jul 20 14:10:16 2016
>> @@ -1017,6 +1017,7 @@ void ASTWriter::WriteBlockInfoBlock() {
>>  RECORD(SUBMODULE_PRIVATE_HEADER);
>>  RECORD(SUBMODULE_TEXTUAL_HEADER);
>>  RECORD(SUBMODULE_PRIVATE_TEXTUAL_HEADER);
>> +  RECORD(SUBMODULE_INITIALIZERS);
>> 
>>  // Comments Block.
>>  BLOCK(COMMENTS_BLOCK);
>> @@ -2417,7 +2418,9 @@ unsigned ASTWriter::getLocalOrImportedSu
>>  if (Known != SubmoduleIDs.end())
>>return Known->second;
>> 
>> -  if (Mod->getTopLevelModule() != WritingModule)
>> +  auto *Top = Mod->getTopLevelModule();
>> +  if (Top != WritingModule &&
>> +  !Top->fullModuleNameIs(StringRef(getLangOpts().CurrentModule)))
>>return 0;
>> 
>>  return SubmoduleIDs[Mod] = NextSubmoduleID++;
>> @@ -2649,6 +2652,13 @@ void ASTWriter::WriteSubmodules(Module *
>>  Stream.EmitRecordWithBlob(ConfigMacroAbbrev, Record, CM);
>>}
>> 
>> +// Emit the initializers, if any.
>> +RecordData Inits;
>> +for (Decl *D : Context->getModuleInitializers(Mod))
>> +  Inits.push_back(GetDeclRef(D));
>> +if (!Inits.empty())
>> +  Stream.EmitRecord(SUBMODULE_INITIALIZERS, Inits);
>> +
>>// Queue up the submodules of this module.
>>for (auto *M : Mod->submodules())
>>  Q.push(M);
>> @@ -4514,6 +4524,17 @@ uint64_t ASTWriter::WriteASTCore(Sema 
>>  // If we're emitting a module, write out the submodule information.  
>>  if (WritingModule)
>>WriteSubmodules(WritingModule);
>> +  else if (!getLangOpts().CurrentModule.empty()) {
>> +// If we're building a PCH in the implementation of a module, we may 
>> need
>> +// the description of the current module.
> 
> Hi Richard,
> 
> Sorry to dig up this old commit. We are seeing a regression with the 
> following simplified testing case.
> cat test.h 
> #include "A.h"
> cat test.m 
> #include "C.h"
> cat run.sh 
> rm -rf tmp
> clang -cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=tmp -I 
> Inputs -emit-pch -o tmp-A.pch test.h -fmodule-name=Contacts -x 
> objective-c-header
> clang -cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=tmp -I 
> Inputs -include-pch tmp-A.pch test.m -fsyntax-only -fmodule-name=Contacts
> test.m:1:2: fatal error: module 'Contacts' is defined in both 
> '/Users/Ren/projects/module/screen/r29542516/tmp/2BSZ9VNPW89EZ/Contacts-389KKPMFZ1XO7.pcm'
>  and 'tmp-A.pch'
> #include "C.h"
> ^
> test.m:1:2: note: imported by module 'CloudKit' in 
> '/Users/Ren/projects/module/screen/r29542516/tmp/2BSZ9VNPW89EZ/CloudKit-389KKPMFZ1XO7.pcm'
> 1 error generated.
> 
> cat Inputs/module.modulemap 
> module CloudKit {
>  header "C.h"
>  export *
> }
> 
> module Contacts {
>  header "D.h"
>  export *
> }
> cat Inputs/A.h
> // in pch
> cat Inputs/C.h
> #include "D.h"
> cat Inputs/D.h
> //empty
> 
> We used to have a different option "-fmodule-implementation-of" which was 
> unified with "-fmodule-name”.
> 
> When building the pch, we pass in “-fmodule-implementation-of Contacts”, 
> because of this part of the commit, we will say the pch defines module 
> Contacts.
> The TU also pulls in module CloudKit, which imports module Contacts. Thus we 
> have this error:
> module 'Contacts' is defined in both 
> '/Users/Ren/projects/module/screen/r29542516/tmp/2BSZ9VNPW89EZ/Contacts-389KKPMFZ1XO7.pcm'
>  and 'tmp-A.pch’
> 
> I wonder why we want to say that a pch defines a module. Is this related to 
> lazily evaluating initializers?

Hi Richard,

Can you comment on why we want to say that a PCH defines a module? Any 
suggestion on fixing this regression?

Manman

> 
> Thanks,
> Manman
> 
>> +//
>> +// FIXME: We may need other modules that we did not load from an AST 
>> file,
>> +// such as if a module declares a 'conflicts' on a different module.
>> +Module *M = PP.getHeaderSearchInfo().getModuleMap().findModule(
>> +

[PATCH] D26410: [CodeGen] Don't emit the same global block multiple times.

2016-12-19 Thread George Burgess IV via Phabricator via cfe-commits
george.burgess.iv abandoned this revision.
george.burgess.iv added a comment.

Committed in https://reviews.llvm.org/rL290149. Thanks again!


https://reviews.llvm.org/D26410



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


[PATCH] D14274: Add alloc_size attribute to clang

2016-12-19 Thread George Burgess IV via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL290149: Add the alloc_size attribute to clang. (authored by 
gbiv).

Changed prior to commit:
  https://reviews.llvm.org/D14274?vs=77222=82046#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D14274

Files:
  cfe/trunk/include/clang/Basic/Attr.td
  cfe/trunk/include/clang/Basic/AttrDocs.td
  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
  cfe/trunk/lib/AST/ExprConstant.cpp
  cfe/trunk/lib/CodeGen/CGBlocks.cpp
  cfe/trunk/lib/CodeGen/CGCall.cpp
  cfe/trunk/lib/CodeGen/CodeGenFunction.h
  cfe/trunk/lib/CodeGen/CodeGenModule.h
  cfe/trunk/lib/Sema/SemaDeclAttr.cpp
  cfe/trunk/test/CodeGen/alloc-size.c
  cfe/trunk/test/CodeGenCXX/alloc-size.cpp
  cfe/trunk/test/CodeGenCXX/block-in-ctor-dtor.cpp
  cfe/trunk/test/CodeGenCXX/global-init.cpp
  cfe/trunk/test/CodeGenOpenCL/cl20-device-side-enqueue.cl
  cfe/trunk/test/Sema/alloc-size.c
  cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp

Index: cfe/trunk/lib/CodeGen/CGBlocks.cpp
===
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp
@@ -686,6 +686,8 @@
   // If the block has no captures, we won't have a pre-computed
   // layout for it.
   if (!blockExpr->getBlockDecl()->hasCaptures()) {
+if (llvm::Constant *Block = CGM.getAddrOfGlobalBlockIfEmitted(blockExpr))
+  return Block;
 CGBlockInfo blockInfo(blockExpr->getBlockDecl(), CurFn->getName());
 computeBlockInfo(CGM, this, blockInfo);
 blockInfo.BlockExpression = blockExpr;
@@ -1047,9 +1049,19 @@
   return addr;
 }
 
+void CodeGenModule::setAddrOfGlobalBlock(const BlockExpr *BE,
+ llvm::Constant *Addr) {
+  bool Ok = EmittedGlobalBlocks.insert(std::make_pair(BE, Addr)).second;
+  (void)Ok;
+  assert(Ok && "Trying to replace an already-existing global block!");
+}
+
 llvm::Constant *
 CodeGenModule::GetAddrOfGlobalBlock(const BlockExpr *BE,
 StringRef Name) {
+  if (llvm::Constant *Block = getAddrOfGlobalBlockIfEmitted(BE))
+return Block;
+
   CGBlockInfo blockInfo(BE->getBlockDecl(), Name);
   blockInfo.BlockExpression = BE;
 
@@ -1074,6 +1086,11 @@
 const CGBlockInfo ,
 llvm::Constant *blockFn) {
   assert(blockInfo.CanBeGlobal);
+  // Callers should detect this case on their own: calling this function
+  // generally requires computing layout information, which is a waste of time
+  // if we've already emitted this block.
+  assert(!CGM.getAddrOfGlobalBlockIfEmitted(blockInfo.BlockExpression) &&
+ "Refusing to re-emit a global block.");
 
   // Generate the constants for the block literal initializer.
   ConstantInitBuilder builder(CGM);
@@ -1103,9 +1120,12 @@
  /*constant*/ true);
 
   // Return a constant of the appropriately-casted type.
-  llvm::Type *requiredType =
+  llvm::Type *RequiredType =
 CGM.getTypes().ConvertType(blockInfo.getBlockExpr()->getType());
-  return llvm::ConstantExpr::getBitCast(literal, requiredType);
+  llvm::Constant *Result =
+  llvm::ConstantExpr::getBitCast(literal, RequiredType);
+  CGM.setAddrOfGlobalBlock(blockInfo.BlockExpression, Result);
+  return Result;
 }
 
 void CodeGenFunction::setBlockContextParameter(const ImplicitParamDecl *D,
Index: cfe/trunk/lib/CodeGen/CodeGenModule.h
===
--- cfe/trunk/lib/CodeGen/CodeGenModule.h
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h
@@ -455,6 +455,10 @@
   bool isTriviallyRecursive(const FunctionDecl *F);
   bool shouldEmitFunction(GlobalDecl GD);
 
+  /// Map of the global blocks we've emitted, so that we don't have to re-emit
+  /// them if the constexpr evaluator gets aggressive.
+  llvm::DenseMap EmittedGlobalBlocks;
+
   /// @name Cache for Blocks Runtime Globals
   /// @{
 
@@ -776,6 +780,16 @@
 
   /// Gets the address of a block which requires no captures.
   llvm::Constant *GetAddrOfGlobalBlock(const BlockExpr *BE, StringRef Name);
+
+  /// Returns the address of a block which requires no caputres, or null if
+  /// we've yet to emit the block for BE.
+  llvm::Constant *getAddrOfGlobalBlockIfEmitted(const BlockExpr *BE) {
+return EmittedGlobalBlocks.lookup(BE);
+  }
+
+  /// Notes that BE's global block is available via Addr. Asserts that BE
+  /// isn't already emitted.
+  void setAddrOfGlobalBlock(const BlockExpr *BE, llvm::Constant *Addr);
   
   /// Return a pointer to a constant CFString object for the given string.
   ConstantAddress GetAddrOfConstantCFString(const StringLiteral *Literal);
Index: cfe/trunk/lib/CodeGen/CodeGenFunction.h
===
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h
@@ -1499,7 +1499,6 @@
   

[PATCH] D14274: Add alloc_size attribute to clang

2016-12-19 Thread George Burgess IV via Phabricator via cfe-commits
george.burgess.iv marked an inline comment as done.
george.burgess.iv added a comment.

Thanks, everyone! :)


Repository:
  rL LLVM

https://reviews.llvm.org/D14274



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


r290149 - Add the alloc_size attribute to clang.

2016-12-19 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Mon Dec 19 19:05:42 2016
New Revision: 290149

URL: http://llvm.org/viewvc/llvm-project?rev=290149=rev
Log:
Add the alloc_size attribute to clang.

This patch does three things:

- Gives us the alloc_size attribute in clang, which lets us infer the
  number of bytes handed back to us by malloc/realloc/calloc/any user
  functions that act in a similar manner.
- Teaches our constexpr evaluator that evaluating some `const` variables
  is OK sometimes. This is why we have a change in
  test/SemaCXX/constant-expression-cxx11.cpp and other seemingly
  unrelated tests. Richard Smith okay'ed this idea some time ago in
  person.
- Uniques some Blocks in CodeGen, which was reviewed separately at
  D26410. Lack of uniquing only really shows up as a problem when
  combined with our new eagerness in the face of const.

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

Added:
cfe/trunk/test/CodeGen/alloc-size.c
cfe/trunk/test/CodeGenCXX/alloc-size.cpp
cfe/trunk/test/Sema/alloc-size.c
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/CodeGen/CGBlocks.cpp
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/lib/CodeGen/CodeGenModule.h
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/CodeGenCXX/block-in-ctor-dtor.cpp
cfe/trunk/test/CodeGenCXX/global-init.cpp
cfe/trunk/test/CodeGenOpenCL/cl20-device-side-enqueue.cl
cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=290149=290148=290149=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Mon Dec 19 19:05:42 2016
@@ -780,6 +780,15 @@ def EmptyBases : InheritableAttr, Target
   let Documentation = [EmptyBasesDocs];
 }
 
+def AllocSize : InheritableAttr {
+  let Spellings = [GCC<"alloc_size">];
+  let Subjects = SubjectList<[HasFunctionProto], WarnDiag,
+ "ExpectedFunctionWithProtoType">;
+  let Args = [IntArgument<"ElemSizeParam">, IntArgument<"NumElemsParam", 1>];
+  let TemplateDependent = 1;
+  let Documentation = [AllocSizeDocs];
+}
+
 def EnableIf : InheritableAttr {
   let Spellings = [GNU<"enable_if">];
   let Subjects = SubjectList<[Function]>;

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=290149=290148=290149=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Mon Dec 19 19:05:42 2016
@@ -206,6 +206,44 @@ to enforce the provided alignment assump
   }];
 }
 
+def AllocSizeDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+The ``alloc_size`` attribute can be placed on functions that return pointers in
+order to hint to the compiler how many bytes of memory will be available at the
+returned poiner. ``alloc_size`` takes one or two arguments.
+
+- ``alloc_size(N)`` implies that argument number N equals the number of
+  available bytes at the returned pointer.
+- ``alloc_size(N, M)`` implies that the product of argument number N and
+  argument number M equals the number of available bytes at the returned
+  pointer.
+
+Argument numbers are 1-based.
+
+An example of how to use ``alloc_size``
+
+.. code-block:: c
+
+  void *my_malloc(int a) __attribute__((alloc_size(1)));
+  void *my_calloc(int a, int b) __attribute__((alloc_size(1, 2)));
+
+  int main() {
+void *const p = my_malloc(100);
+assert(__builtin_object_size(p, 0) == 100);
+void *const a = my_calloc(20, 5);
+assert(__builtin_object_size(a, 0) == 100);
+  }
+
+.. Note:: This attribute works differently in clang than it does in GCC.
+  Specifically, clang will only trace ``const`` pointers (as above); we give up
+  on pointers that are not marked as ``const``. In the vast majority of cases,
+  this is unimportant, because LLVM has support for the ``alloc_size``
+  attribute. However, this may cause mildly unintuitive behavior when used with
+  other attributes, such as ``enable_if``.
+  }];
+}
+
 def EnableIfDocs : Documentation {
   let Category = DocCatFunction;
   let Content = [{

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=290149=290148=290149=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Dec 19 19:05:42 
2016
@@ -2297,6 

Re: r290146 - Fix completely bogus types for some builtins:

2016-12-19 Thread Friedman, Eli via cfe-commits

On 12/19/2016 3:59 PM, Richard Smith via cfe-commits wrote:

Author: rsmith
Date: Mon Dec 19 17:59:34 2016
New Revision: 290146

URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/vfprintf-valid-redecl.c?rev=290146=290145=290146=diff
==
--- cfe/trunk/test/Sema/vfprintf-valid-redecl.c (original)
+++ cfe/trunk/test/Sema/vfprintf-valid-redecl.c Mon Dec 19 17:59:34 2016
@@ -1,16 +1,18 @@
  // RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify
  // RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify -DPREDECLARE
-// expected-no-diagnostics
  
  #ifdef PREDECLARE

  // PR16344
  // Clang has defined 'vfprint' in builtin list. If the following line occurs 
before any other
  // `vfprintf' in this file, and we getPreviousDecl()->getTypeSourceInfo() on 
it, then we will
  // get a null pointer since the one in builtin list doesn't has valid 
TypeSourceInfo.
-int vfprintf(void) { return 0; }
+int vfprintf(void) { return 0; } // expected-warning {{requires inclusion of the 
header }}
  #endif
  
  // PR4290

  // The following declaration is compatible with vfprintf, so we shouldn't
-// warn.
+// reject.
  int vfprintf();
+#ifndef PREDECLARE
+// expected-warning@-2 {{requires inclusion of the header }}
+#endif


We shouldn't warn here; this declaration of vfprintf() is compatible 
with the actual prototype.  (Granted, you can't call vfprintf() without 
including stdio.h, but that's a separate problem.)


-Eli

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
Foundation Collaborative Project

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


[Diffusion] rL290025: [libclang] Remove the 'extern "C"' blocks from the implementation files.

2016-12-19 Thread NAKAMURA Takumi via Phabricator via cfe-commits
chapuni added subscribers: cfe-commits, chapuni.
chapuni added a comment.

See r290113.

I saw linker error on mingw dll build.

  Cannot export clang_findIncludesInFileWithBlock: symbol not defined
  Cannot export clang_findReferencesInFileWithBlock: symbol not defined
  Cannot export clang_visitChildrenWithBlock: symbol not defined

They are excluded from header files in clang/include/clang-c along 
has_feature(blocks).
mingw32-ld doesn't ignore nonexistent symbols but reports errors.

I suggest;

1. Define dummy bodies (or define dummy decls in headers)
2. Enhance add_llvm_symbol_exports to be capable of optional entries.


/cfe/trunk/tools/libclang/CIndexHigh.cpp:410 They are activated along 
has_feature(blocks).
/cfe/trunk/tools/libclang/CIndex.cpp:4165 It is activated when not 
has_feature(blocks).

https://reviews.llvm.org/rL290025



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


Re: r289754 - [c++1z] Permit constant evaluation of a call through a function pointer whose

2016-12-19 Thread Richard Smith via cfe-commits
On 19 December 2016 at 13:22, Mike Aizatsky  wrote:

> Richard,
>
> Clang crashes for me on this code while doing "check-all". This change
> seems to introduce the assert. Can you take a look?
>
> BTW I'm not sure why bots are green. Do we build libcxx with bootstrap
> compiler?
>

Apparently not in C++1z mode at least. The cause was an
extremely-longstanding bug whereby we would create K C function
prototypes for some builtin functions in C++! Should be fixed in r290146
(I'm still running through the libc++ testsuite with an asserts-enabled
clang with the fix, but it looks good so far).


> FAIL: libc++ :: std/experimental/string.view/
> string.view.find/find_last_of_pointer_size_size.pass.cpp (34988 of 39764)
>  TEST 'libc++ :: std/experimental/string.view/
> string.view.find/find_last_of_pointer_size_size.pass.cpp' FAILED
> 
> Command: ['/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang++',
> '-o', '/usr/local/google/home/aizatsky/out/llvm/default/
> projects/libcxx/test/std/experimental/string.view/
> string.view.find/Output/find
> _last_of_pointer_size_size.pass.cpp.o', '-x', 'c++',
> '/usr/local/google/home/aizatsky/src/llvm/projects/
> libcxx/test/std/experimental/string.view/string.view.find/
> find_last_of_pointer_size_size.pass.cpp', '-c',
> '-v', '-Werror=thread-safety', '-std=c++1z', '-include',
> '/usr/local/google/home/aizatsky/src/llvm/projects/
> libcxx/test/support/nasty_macros.hpp', '-nostdinc++',
> '-I/usr/local/google/home/aizatsky/src/llvm/proj
> ects/libcxx/include', '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS',
> '-D__STDC_CONSTANT_MACROS', '-I/usr/local/google/home/
> aizatsky/src/llvm/projects/libcxx/test/support',
> '-DLIBCXX_FILESYSTEM_STATIC_TEST_R
> OOT="/usr/local/google/home/aizatsky/src/llvm/projects/
> libcxx/test/std/experimental/filesystem/Inputs/static_test_env"',
> '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/usr/local/google/
> home/aizatsky/out/llvm/default/
> projects/libcxx/test/filesystem/Output/dynamic_env"',
> '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python2.7
> /usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support/
> filesystem_dynamic_test_h
> elper.py"', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', '-Wextra',
> '-Werror', '-Wshadow', '-Wshadow', '-Wno-unused-command-line-argument',
> '-Wno-attributes', '-Wno-pessimizing-move', '-Wno-c++11-extension
> s', '-Wno-user-defined-literals', '-Wno-sign-compare',
> '-Wno-unused-variable', '-Wno-unused-parameter',
> '-Wno-unused-local-typedef', '-c']
> Exit Code: 254
> Standard Error:
> --
> clang version 4.0.0 (trunk 290130) (llvm/trunk 290127)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> InstalledDir: /usr/local/google/home/aizatsky/out/llvm/bootstrap/bin
> Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
> Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.4
> Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
> Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
> Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
> Candidate multilib: .;@m64
> Candidate multilib: 32;@m32
> Candidate multilib: x32;@mx32
> Selected multilib: .;@m64
>  "/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8" -cc1
> -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
> -main-file-name find_last_of_pointer_size_size.pass.cpp -mrelocation
> -model static -mthread-model posix -mdisable-fp-elim -fmath-errno
> -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
> -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -coverage-not
> es-file /usr/local/google/home/aizatsky/out/llvm/default/
> projects/libcxx/test/std/experimental/string.view/
> string.view.find/Output/find_last_of_pointer_size_size.pass.cpp.gcno
> -nostdinc++ -resource-dir /usr/loc
> al/google/home/aizatsky/out/llvm/bootstrap/bin/../lib/clang/4.0.0
> -include /usr/local/google/home/aizatsky/src/llvm/projects/
> libcxx/test/support/nasty_macros.hpp -I /usr/local/google/home/
> aizatsky/src/llvm/proj
> ects/libcxx/include -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D
> __STDC_CONSTANT_MACROS -I /usr/local/google/home/
> aizatsky/src/llvm/projects/libcxx/test/support -D
> "LIBCXX_FILESYSTEM_STATIC_TEST_ROOT=\"/us
> r/local/google/home/aizatsky/src/llvm/projects/libcxx/test/
> std/experimental/filesystem/Inputs/static_test_env\"" -D
> "LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT=\"/usr/local/google/
> 

r290146 - Fix completely bogus types for some builtins:

2016-12-19 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Dec 19 17:59:34 2016
New Revision: 290146

URL: http://llvm.org/viewvc/llvm-project?rev=290146=rev
Log:
Fix completely bogus types for some builtins:

 * In C++, never create a FunctionNoProtoType for a builtin (fixes C++1z
   crasher from r289754).

 * Fix type of __sync_synchronize to be a no-parameter function rather than a
   varargs function. This matches GCC.

 * Fix type of vfprintf to match its actual type. We gave it a wrong type due
   to PR4290 (apparently autoconf generates invalid code and expects compilers
   to choke it down or it miscompiles the program; the relevant error in clang
   was downgraded to a warning in r122744 to fix other occurrences of this
   autoconf brokenness, so we don't need this workaround any more).

 * Turn off vararg argument checking for __noop, since it's not *really* a
   varargs function. Alternatively we could add custom type checking for it
   and synthesize parameter types matching the actual arguments in each call,
   but that seemed like overkill.

Modified:
cfe/trunk/include/clang/Basic/Builtins.def
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
cfe/trunk/test/Sema/vfprintf-invalid-redecl.c
cfe/trunk/test/Sema/vfprintf-valid-redecl.c
cfe/trunk/test/SemaCXX/builtins.cpp

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=290146=290145=290146=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Mon Dec 19 17:59:34 2016
@@ -702,7 +702,7 @@ BUILTIN(__atomic_is_lock_free, "izvCD*",
 #undef ATOMIC_BUILTIN
 
 // Non-overloaded atomic builtins.
-BUILTIN(__sync_synchronize, "v.", "n")
+BUILTIN(__sync_synchronize, "v", "n")
 // GCC does not support these, they are a Clang extension.
 BUILTIN(__sync_fetch_and_min, "iiD*i", "n")
 BUILTIN(__sync_fetch_and_max, "iiD*i", "n")
@@ -813,7 +813,7 @@ LIBBUILTIN(fprintf, "iP*cC*.","fp:1:
 LIBBUILTIN(snprintf, "ic*zcC*.",  "fp:2:", "stdio.h", ALL_LANGUAGES)
 LIBBUILTIN(sprintf, "ic*cC*.","fp:1:", "stdio.h", ALL_LANGUAGES)
 LIBBUILTIN(vprintf, "icC*a",  "fP:0:", "stdio.h", ALL_LANGUAGES)
-LIBBUILTIN(vfprintf, "i.","fP:1:", "stdio.h", ALL_LANGUAGES)
+LIBBUILTIN(vfprintf, "iP*cC*a",   "fP:1:", "stdio.h", ALL_LANGUAGES)
 LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h", ALL_LANGUAGES)
 LIBBUILTIN(vsprintf, "ic*cC*a",   "fP:1:", "stdio.h", ALL_LANGUAGES)
 LIBBUILTIN(scanf, "icC*R.",   "fs:0:", "stdio.h", ALL_LANGUAGES)

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=290146=290145=290146=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Dec 19 17:59:34 2016
@@ -8729,8 +8729,8 @@ QualType ASTContext::GetBuiltinType(unsi
 
   bool Variadic = (TypeStr[0] == '.');
 
-  // We really shouldn't be making a no-proto type here, especially in C++.
-  if (ArgTypes.empty() && Variadic)
+  // We really shouldn't be making a no-proto type here.
+  if (ArgTypes.empty() && Variadic && !getLangOpts().CPlusPlus)
 return getFunctionNoProtoType(ResType, EI);
 
   FunctionProtoType::ExtProtoInfo EPI;

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=290146=290145=290146=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Mon Dec 19 17:59:34 2016
@@ -2448,7 +2448,9 @@ void Sema::checkCall(NamedDecl *FDecl, c
 
   // Refuse POD arguments that weren't caught by the format string
   // checks above.
-  if (CallType != VariadicDoesNotApply) {
+  auto *FD = dyn_cast_or_null(FDecl);
+  if (CallType != VariadicDoesNotApply &&
+  (!FD || FD->getBuiltinID() != Builtin::BI__noop)) {
 unsigned NumParams = Proto ? Proto->getNumParams()
: FDecl && isa(FDecl)
? cast(FDecl)->getNumParams()

Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=290146=290145=290146=diff
==
--- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Mon Dec 19 17:59:34 2016
@@ -288,14 +288,15 @@ bool Sema::CheckEquivalentExceptionSpec(
   // The new function declaration is only missing an empty exception
   // specification "throw()". If the throw() specification came from a
   // function in a system header that has C linkage, just add an empty
-  // exception 

[PATCH] D26546: [PPC] Add vec_insert4b/vec_extract4b to altivec.h

2016-12-19 Thread Sean Fertile via Phabricator via cfe-commits
sfertile updated this revision to Diff 82031.
sfertile marked 6 inline comments as done.
sfertile added a comment.

Updated to swap the arguments when generating the intrinsic. Updated a number 
of the comments, and added some tests with the index out of range.


Repository:
  rL LLVM

https://reviews.llvm.org/D26546

Files:
  include/clang/Basic/BuiltinsPPC.def
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/altivec.h
  test/CodeGen/builtins-ppc-error.c
  test/CodeGen/builtins-ppc-extractword-error.c
  test/CodeGen/builtins-ppc-insertword-error.c
  test/CodeGen/builtins-ppc-p9vector.c

Index: test/CodeGen/builtins-ppc-p9vector.c
===
--- test/CodeGen/builtins-ppc-p9vector.c
+++ test/CodeGen/builtins-ppc-p9vector.c
@@ -1166,17 +1166,52 @@
 // CHECK-BE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> 
 // CHECK-BE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}})
 // CHECK-BE-NEXT: ret <4 x float>
-// CHECK-LE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> 
-// CHECK-LE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}})
-// CHECK-LE-NEXT: ret <4 x float>
+// CHECK: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> 
+// CHECK: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}})
+// CHECK-NEXT: ret <4 x float>
   return vec_extract_fp32_from_shorth(vusa);
 }
 vector float test115(void) {
 // CHECK-BE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> 
 // CHECK-BE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}})
 // CHECK-BE-NEXT: ret <4 x float>
-// CHECK-LE: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> 
-// CHECK-LE: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}})
-// CHECK-LE-NEXT: ret <4 x float>
+// CHECK: shufflevector <8 x i16> {{.+}}, <8 x i16> {{.+}}, <8 x i32> 
+// CHECK: @llvm.ppc.vsx.xvcvhpsp(<8 x i16> {{.+}})
+// CHECK-NEXT: ret <4 x float>
   return vec_extract_fp32_from_shortl(vusa);
 }
+vector unsigned char test116(void) {
+// CHECK-BE: [[T1:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxinsertw(<4 x i32> {{.+}}, <2 x i64> {{.+}}, i32 7)
+// CHECK-BE-NEXT: bitcast <4 x i32> [[T1]] to <16 x i8>
+// CHECK: [[T1:%.+]] = shufflevector <2 x i64> {{.+}}, <2 x i64> {{.+}}, <2 x i32> 
+// CHECK-NEXT: [[T2:%.+]] =  bitcast <2 x i64> [[T1]] to <4 x i32>
+// CHECK-NEXT: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxinsertw(<4 x i32> [[T2]], <2 x i64> {{.+}}, i32 5)
+// CHECK-NEXT: bitcast <4 x i32> [[T3]] to <16 x i8>
+  return vec_insert4b(vuia, vuca, 7);
+}
+vector unsigned char test117(void) {
+// CHECK-BE: [[T1:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxinsertw(<4 x i32> {{.+}}, <2 x i64> {{.+}}, i32 12)
+// CHECK-BE-NEXT: bitcast <4 x i32> [[T1]] to <16 x i8>
+// CHECK: [[T1:%.+]] = shufflevector <2 x i64> {{.+}}, <2 x i64> {{.+}}, <2 x i32> 
+// CHECK-NEXT: [[T2:%.+]] =  bitcast <2 x i64> [[T1]] to <4 x i32>
+// CHECK-NEXT: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxinsertw(<4 x i32> [[T2]], <2 x i64> {{.+}}, i32 0)
+// CHECK-NEXT: bitcast <4 x i32> [[T3]] to <16 x i8>
+  return vec_insert4b(vuia, vuca, 13);
+}
+vector unsigned long long test118(void) {
+// CHECK-BE: call <2 x i64> @llvm.ppc.vsx.xxextractuw(<2 x i64> {{.+}}, i32 11)
+// CHECK-BE-NEXT: ret <2 x i64>
+// CHECK: [[T1:%.+]] = call <2 x i64> @llvm.ppc.vsx.xxextractuw(<2 x i64> {{.+}}, i32 1)
+// CHECK-NEXT: shufflevector <2 x i64> [[T1]], <2 x i64> [[T1]], <2 x i32> 
+// CHECK-NEXT: ret <2 x i64>
+  return vec_extract4b(vuca, 11);
+}
+vector unsigned long long test119(void) {
+// CHECK-BE: call <2 x i64> @llvm.ppc.vsx.xxextractuw(<2 x i64> {{.+}}, i32 0)
+// CHECK-BE-NEXT: ret <2 x i64>
+// CHECK: [[T1:%.+]] = call <2 x i64> @llvm.ppc.vsx.xxextractuw(<2 x i64> {{.+}}, i32 12)
+// CHECK-NEXT: shufflevector <2 x i64> [[T1]], <2 x i64> [[T1]], <2 x i32> 
+// CHECK-NEXT: ret <2 x i64>
+  return vec_extract4b(vuca, -5);
+}
+
Index: test/CodeGen/builtins-ppc-insertword-error.c
===
--- /dev/null
+++ test/CodeGen/builtins-ppc-insertword-error.c
@@ -0,0 +1,16 @@
+// REQUIRES: powerpc-registered-target
+// XFAIL: powerpc
+
+// RUN: %clang -faltivec -target powerpc64le-unknown-unknown -mcpu=power8 \
+// RUN: -Wall -Werror -c %s
+
+// RUN: %clang -faltivec -target powerpc64-unknown-unknown -mcpu=power8 \
+// RUN: -Wall -Werror -c %s
+
+// expect to fail  with diagnostic: "cannot compile this builtin function yet"
+extern vector signed int vsi;
+extern vector unsigned char vuc;
+
+vector  unsigned char testInsertWord(void) {
+  return __builtin_vsx_insertword(vsi, vuc, 0);
+}
Index: test/CodeGen/builtins-ppc-extractword-error.c
===
--- /dev/null
+++ test/CodeGen/builtins-ppc-extractword-error.c
@@ -0,0 +1,15 @@
+// REQUIRES: powerpc-registered-target
+// XFAIL: powerpc
+
+// RUN: %clang -faltivec -target powerpc64le-unknown-unknown  -mcpu=power8 \
+// RUN: -Wall -Wextra -c %s
+// RUN: %clang -faltivec -target powerpc64-unknown-unknown  -mcpu=power8 \
+// RUN: 

r290145 - Make another test insensitive to the default C++ dialect.

2016-12-19 Thread Paul Robinson via cfe-commits
Author: probinson
Date: Mon Dec 19 17:32:10 2016
New Revision: 290145

URL: http://llvm.org/viewvc/llvm-project?rev=290145=rev
Log:
Make another test insensitive to the default C++ dialect.

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

Modified:
cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp

Modified: cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp?rev=290145=290144=290145=diff
==
--- cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp Mon Dec 19 17:32:10 2016
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage | FileCheck %s
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage -std=c++03 | FileCheck %s -check-prefixes=CHECK
 
 // This isn't really testing anything ARM-specific; it's just a convenient
 // 32-bit platform.


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


[PATCH] D27955: Make CodeGenCXX/arm-swiftcall.cpp tolerate C++11

2016-12-19 Thread Paul Robinson via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL290145: Make another test insensitive to the default C++ 
dialect. (authored by probinson).

Changed prior to commit:
  https://reviews.llvm.org/D27955?vs=82021=82028#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27955

Files:
  cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp


Index: cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp
===
--- cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp
+++ cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage | FileCheck %s
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage -std=c++03 | FileCheck %s -check-prefixes=CHECK
 
 // This isn't really testing anything ARM-specific; it's just a convenient
 // 32-bit platform.


Index: cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp
===
--- cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp
+++ cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s -Wno-return-type-c-linkage | FileCheck %s
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s -Wno-return-type-c-linkage -std=c++03 | FileCheck %s -check-prefixes=CHECK
 
 // This isn't really testing anything ARM-specific; it's just a convenient
 // 32-bit platform.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27955: Make CodeGenCXX/arm-swiftcall.cpp tolerate C++11

2016-12-19 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


https://reviews.llvm.org/D27955



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


r290143 - [analyzer] Add checker modeling gtest APIs.

2016-12-19 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Mon Dec 19 16:50:31 2016
New Revision: 290143

URL: http://llvm.org/viewvc/llvm-project?rev=290143=rev
Log:
[analyzer] Add checker modeling gtest APIs.

gtest is a widely-used unit-testing API. It provides macros for unit test
assertions:

  ASSERT_TRUE(p != nullptr);

that expand into an if statement that constructs an object representing
the result of the assertion and returns when the assertion is false:

  if (AssertionResult gtest_ar_ = AssertionResult(p == nullptr))
  ;
  else
return ...;

Unfortunately, the analyzer does not model the effect of the constructor
precisely because (1) the copy constructor implementation is missing from the
the header (so it can't be inlined) and (2) the boolean-argument constructor
is constructed into a temporary (so the analyzer decides not to inline it since
it doesn't reliably call temporary destructors right now).

This results in false positives because the analyzer does not realize that the
the assertion must hold along the non-return path.

This commit addresses the false positives by explicitly modeling the effects
of the two un-inlined constructors on the AssertionResult state.

I've added a new package, "apiModeling", for these kinds of checkers that
model APIs but don't emit any diagnostics. I envision all the checkers in
this package always being on by default.

This addresses the false positives reported in PR30936.

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

rdar://problem/22705813

Added:
cfe/trunk/lib/StaticAnalyzer/Checkers/GTestChecker.cpp
cfe/trunk/test/Analysis/gtest.cpp
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
cfe/trunk/test/Driver/analyzer-target-enabled-checkers.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td?rev=290143=290142=290143=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Checkers/Checkers.td Mon Dec 19 
16:50:31 2016
@@ -79,6 +79,13 @@ def LocalizabilityOptIn : Package<"local
 def MPI : Package<"mpi">, InPackage;
 
 def LLVM : Package<"llvm">;
+
+// The APIModeling package is for checkers that model APIs and don't perform
+// any diagnostics. These checkers are always turned on; this package is
+// intended for API modeling that is not controlled by the the target triple.
+def APIModeling : Package<"apiModeling">, Hidden;
+def GoogleAPIModeling : Package<"google">, InPackage;
+
 def Debug : Package<"debug">;
 
 def CloneDetectionAlpha : Package<"clone">, InPackage, Hidden;
@@ -643,6 +650,17 @@ def LLVMConventionsChecker : Checker<"Co
   HelpText<"Check code for LLVM codebase conventions">,
   DescFile<"LLVMConventionsChecker.cpp">;
 
+
+
+//===--===//
+// Checkers modeling Google APIs.
+//===--===//
+
+def GTestChecker : Checker<"GTest">,
+  InPackage,
+  HelpText<"Model gtest assertion APIs">,
+  DescFile<"GTestChecker.cpp">;
+
 
//===--===//
 // Debugging checkers (for analyzer development).
 
//===--===//

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=290143=290142=290143=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Dec 19 16:50:31 2016
@@ -4263,6 +4263,7 @@ void Clang::ConstructJob(Compilation ,
 // Add default argument set.
 if (!Args.hasArg(options::OPT__analyzer_no_default_checks)) {
   CmdArgs.push_back("-analyzer-checker=core");
+  CmdArgs.push_back("-analyzer-checker=apiModeling");
 
 if (!IsWindowsMSVC) {
   CmdArgs.push_back("-analyzer-checker=unix");

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt?rev=290143=290142=290143=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CMakeLists.txt Mon Dec 19 16:50:31 
2016
@@ -37,6 +37,7 @@ add_clang_library(clangStaticAnalyzerChe
   ExprInspectionChecker.cpp
   FixedAddressChecker.cpp
   GenericTaintChecker.cpp
+  GTestChecker.cpp
   IdenticalExprChecker.cpp
   IvarInvalidationChecker.cpp
   LLVMConventionsChecker.cpp

Added: cfe/trunk/lib/StaticAnalyzer/Checkers/GTestChecker.cpp
URL: 

[PATCH] D27769: Update MSVC compat docs about debug info.

2016-12-19 Thread Nico Weber via Phabricator via cfe-commits
thakis closed this revision.
thakis added a comment.

r289712


https://reviews.llvm.org/D27769



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


[PATCH] D27955: Make CodeGenCXX/arm-swiftcall.cpp tolerate C++11

2016-12-19 Thread Paul Robinson via Phabricator via cfe-commits
probinson updated this revision to Diff 82021.
probinson added a comment.

Force C++03 on this test, to make it insensitive to future changes in the 
default dialect.


https://reviews.llvm.org/D27955

Files:
  test/CodeGenCXX/arm-swiftcall.cpp


Index: test/CodeGenCXX/arm-swiftcall.cpp
===
--- test/CodeGenCXX/arm-swiftcall.cpp
+++ test/CodeGenCXX/arm-swiftcall.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage | FileCheck %s
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage -std=c++03 | FileCheck %s -check-prefixes=CHECK
 
 // This isn't really testing anything ARM-specific; it's just a convenient
 // 32-bit platform.


Index: test/CodeGenCXX/arm-swiftcall.cpp
===
--- test/CodeGenCXX/arm-swiftcall.cpp
+++ test/CodeGenCXX/arm-swiftcall.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s -Wno-return-type-c-linkage | FileCheck %s
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s -Wno-return-type-c-linkage -std=c++03 | FileCheck %s -check-prefixes=CHECK
 
 // This isn't really testing anything ARM-specific; it's just a convenient
 // 32-bit platform.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r290141 - Don't try to emit nullability fix-its within/around macros.

2016-12-19 Thread Jordan Rose via cfe-commits
Author: jrose
Date: Mon Dec 19 16:35:24 2016
New Revision: 290141

URL: http://llvm.org/viewvc/llvm-project?rev=290141=rev
Log:
Don't try to emit nullability fix-its within/around macros.

The newly-added notes from r290132 are too noisy even when the fix-it
is valid. For the existing warning from r286521, it's probably the
right decision 95% of the time to put the change outside the macro if
the array is outside the macro and inside otherwise, but I don't want
to overthink it right now.

Caught by the ASan bot!

More rdar://problem/29524992

Modified:
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/FixIt/Inputs/nullability.h
cfe/trunk/test/FixIt/nullability.mm

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=290141=290140=290141=diff
==
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Mon Dec 19 16:35:24 2016
@@ -3443,31 +3443,39 @@ static FileID getNullabilityCompleteness
 
 /// Creates a fix-it to insert a C-style nullability keyword at \p pointerLoc,
 /// taking into account whitespace before and after.
-static FixItHint fixItNullability(Sema , SourceLocation PointerLoc,
-  NullabilityKind Nullability) {
+static void fixItNullability(Sema , DiagnosticBuilder ,
+ SourceLocation PointerLoc,
+ NullabilityKind Nullability) {
   assert(PointerLoc.isValid());
+  if (PointerLoc.isMacroID())
+return;
+
+  SourceLocation FixItLoc = S.getLocForEndOfToken(PointerLoc);
+  if (!FixItLoc.isValid() || FixItLoc == PointerLoc)
+return;
+
+  const char *NextChar = S.SourceMgr.getCharacterData(FixItLoc);
+  if (!NextChar)
+return;
 
   SmallString<32> InsertionTextBuf{" "};
   InsertionTextBuf += getNullabilitySpelling(Nullability);
   InsertionTextBuf += " ";
   StringRef InsertionText = InsertionTextBuf.str();
 
-  SourceLocation FixItLoc = S.getLocForEndOfToken(PointerLoc);
-  if (const char *NextChar = S.SourceMgr.getCharacterData(FixItLoc)) {
-if (isWhitespace(*NextChar)) {
-  InsertionText = InsertionText.drop_back();
-} else if (NextChar[-1] == '[') {
-  if (NextChar[0] == ']')
-InsertionText = InsertionText.drop_back().drop_front();
-  else
-InsertionText = InsertionText.drop_front();
-} else if (!isIdentifierBody(NextChar[0], /*allow dollar*/true) &&
-   !isIdentifierBody(NextChar[-1], /*allow dollar*/true)) {
+  if (isWhitespace(*NextChar)) {
+InsertionText = InsertionText.drop_back();
+  } else if (NextChar[-1] == '[') {
+if (NextChar[0] == ']')
   InsertionText = InsertionText.drop_back().drop_front();
-}
+else
+  InsertionText = InsertionText.drop_front();
+  } else if (!isIdentifierBody(NextChar[0], /*allow dollar*/true) &&
+ !isIdentifierBody(NextChar[-1], /*allow dollar*/true)) {
+InsertionText = InsertionText.drop_back().drop_front();
   }
 
-  return FixItHint::CreateInsertion(FixItLoc, InsertionText);
+  Diag << FixItHint::CreateInsertion(FixItLoc, InsertionText);
 }
 
 static void emitNullabilityConsistencyWarning(Sema ,
@@ -3482,11 +3490,14 @@ static void emitNullabilityConsistencyWa
   << static_cast(PointerKind);
   }
 
+  if (PointerLoc.isMacroID())
+return;
+
   auto addFixIt = [&](NullabilityKind Nullability) {
-S.Diag(PointerLoc, diag::note_nullability_fix_it)
-  << static_cast(Nullability)
-  << static_cast(PointerKind)
-  << fixItNullability(S, PointerLoc, Nullability);
+auto Diag = S.Diag(PointerLoc, diag::note_nullability_fix_it);
+Diag << static_cast(Nullability);
+Diag << static_cast(PointerKind);
+fixItNullability(S, Diag, PointerLoc, Nullability);
   };
   addFixIt(NullabilityKind::Nullable);
   addFixIt(NullabilityKind::NonNull);
@@ -3888,9 +3899,10 @@ static TypeSourceInfo *GetFullTypeForDec
   if (pointerLoc.isValid() &&
   complainAboutInferringWithinChunk !=
 PointerWrappingDeclaratorKind::None) {
-S.Diag(pointerLoc, diag::warn_nullability_inferred_on_nested_type)
-  << static_cast(complainAboutInferringWithinChunk)
-  << fixItNullability(S, pointerLoc, NullabilityKind::NonNull);
+auto Diag =
+S.Diag(pointerLoc, diag::warn_nullability_inferred_on_nested_type);
+Diag << static_cast(complainAboutInferringWithinChunk);
+fixItNullability(S, Diag, pointerLoc, NullabilityKind::NonNull);
   }
 
   if (inferNullabilityInnerOnly)

Modified: cfe/trunk/test/FixIt/Inputs/nullability.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/Inputs/nullability.h?rev=290141=290140=290141=diff
==
--- cfe/trunk/test/FixIt/Inputs/nullability.h (original)
+++ cfe/trunk/test/FixIt/Inputs/nullability.h Mon Dec 19 

[PATCH] D27956: Make CodeGenCXX/stack-reuse-miscompile.cpp tolerate C++11

2016-12-19 Thread Paul Robinson via Phabricator via cfe-commits
probinson created this revision.
probinson added a reviewer: lenykholodov.
probinson added a subscriber: cfe-commits.

In this test, the allocas for the temps come out in a different order depending 
on whether the dialect is C++03 or C++11.  To avoid depending on the default 
dialect, I forced it to C++03.

I am concerned, though, because the commentary says there should be no lifetime 
intrinsics.  While that was true in Clang 3.8, it is no longer true in Clang 
3.9, regardless of dialect.  However, the test does not actually verify that 
there are no lifetime intrinsics.

Is it still true that there should be no lifetime intrinsics?  If so, then 
there is a bug that the test has failed to detect.  If not, then the comment 
should be updated.


https://reviews.llvm.org/D27956

Files:
  test/CodeGenCXX/stack-reuse-miscompile.cpp


Index: test/CodeGenCXX/stack-reuse-miscompile.cpp
===
--- test/CodeGenCXX/stack-reuse-miscompile.cpp
+++ test/CodeGenCXX/stack-reuse-miscompile.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang -S -target armv7l-unknown-linux-gnueabihf -emit-llvm -O1 -mllvm 
-disable-llvm-optzns -S %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -O1 
-disable-llvm-optzns -std=c++03 %s -o - | FileCheck %s
 
 // This test should not to generate llvm.lifetime.start/llvm.lifetime.end for
 // f function because all temporary objects in this function are used for the


Index: test/CodeGenCXX/stack-reuse-miscompile.cpp
===
--- test/CodeGenCXX/stack-reuse-miscompile.cpp
+++ test/CodeGenCXX/stack-reuse-miscompile.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang -S -target armv7l-unknown-linux-gnueabihf -emit-llvm -O1 -mllvm -disable-llvm-optzns -S %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -O1 -disable-llvm-optzns -std=c++03 %s -o - | FileCheck %s
 
 // This test should not to generate llvm.lifetime.start/llvm.lifetime.end for
 // f function because all temporary objects in this function are used for the
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27955: Make CodeGenCXX/arm-swiftcall.cpp tolerate C++11

2016-12-19 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Yes, I think being more specific about the dialect would be better.


https://reviews.llvm.org/D27955



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


r290140 - [analyzer] Add sink after construction of temporary with no-return destructor.

2016-12-19 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Mon Dec 19 16:23:22 2016
New Revision: 290140

URL: http://llvm.org/viewvc/llvm-project?rev=290140=rev
Log:
[analyzer] Add sink after construction of temporary with no-return destructor.

The analyzer's CFG currently doesn't have nodes for calls to temporary
destructors. This causes the analyzer to explore infeasible paths in which
a no-return destructor would have stopped exploration and so results in false
positives when no-return destructors are used to implement assertions.

To mitigate these false positives, this patch stops generates a sink after
evaluating a constructor on a temporary object that has a no-return destructor.
This results in a loss of coverage because the time at which the destructor is
called may be after the time of construction (especially for lifetime-extended
temporaries).

This addresses PR15599.

rdar://problem/29131566

Modified:
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
cfe/trunk/test/Analysis/temporaries.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp?rev=290140=290139=290140=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp Mon Dec 19 16:23:22 2016
@@ -346,6 +346,30 @@ void ExprEngine::VisitCXXConstructExpr(c
   defaultEvalCall(Bldr, *I, *Call);
   }
 
+  // If the CFG was contructed without elements for temporary destructors
+  // and the just-called constructor created a temporary object then
+  // stop exploration if the temporary object has a noreturn constructor.
+  // This can lose coverage because the destructor, if it were present
+  // in the CFG, would be called at the end of the full expression or
+  // later (for life-time extended temporaries) -- but avoids infeasible
+  // paths when no-return temporary destructors are used for assertions.
+  const AnalysisDeclContext *ADC = LCtx->getAnalysisDeclContext();
+  if (!ADC->getCFGBuildOptions().AddTemporaryDtors) {
+  const MemRegion *Target = Call->getCXXThisVal().getAsRegion();
+  if (Target && isa(Target) &&
+  Call->getDecl()->getParent()->isAnyDestructorNoReturn()) {
+
+  for (ExplodedNode *N : DstEvaluated) {
+Bldr.generateSink(CE, N, N->getState());
+  }
+
+  // There is no need to run the PostCall and PostStmtchecker
+  // callbacks because we just generated sinks on all nodes in th
+  // frontier.
+  return;
+}
+ }
+
   ExplodedNodeSet DstPostCall;
   getCheckerManager().runCheckersForPostCall(DstPostCall, DstEvaluated,
  *Call, *this);

Modified: cfe/trunk/test/Analysis/temporaries.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/temporaries.cpp?rev=290140=290139=290140=diff
==
--- cfe/trunk/test/Analysis/temporaries.cpp (original)
+++ cfe/trunk/test/Analysis/temporaries.cpp Mon Dec 19 16:23:22 2016
@@ -413,6 +413,32 @@ namespace destructors {
   value ? DefaultParam(42) : DefaultParam(42);
 }
   }
+#else // !TEMPORARY_DTORS
+
+// Test for fallback logic that conservatively stops exploration after
+// executing a temporary constructor for a class with a no-return destructor
+// when temporary destructors are not enabled in the CFG.
+
+  struct CtorWithNoReturnDtor {
+CtorWithNoReturnDtor() = default;
+
+~CtorWithNoReturnDtor() __attribute__((noreturn));
+  };
+
+  void testDefaultContructorWithNoReturnDtor() {
+CtorWithNoReturnDtor();
+clang_analyzer_warnIfReached();  // no-warning
+  }
+
+  void testLifeExtensionWithNoReturnDtor() {
+const CtorWithNoReturnDtor  = CtorWithNoReturnDtor();
+
+// This represents an (expected) loss of coverage, since the destructor
+// of the lifetime-exended temporary is executed at at the end of
+// scope.
+clang_analyzer_warnIfReached();  // no-warning
+  }
+
 #endif // TEMPORARY_DTORS
 }
 


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


[PATCH] D27955: Make CodeGenCXX/arm-swiftcall.cpp tolerate C++11

2016-12-19 Thread Paul Robinson via Phabricator via cfe-commits
probinson created this revision.
probinson added a reviewer: rjmccall.
probinson added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.

The test conjures up and returns a temp which has a struct type, and the struct 
has some empty/padding bytes in the middle.  In C++03 these are handled as 
zero, so the code uses 'llvm.memset' to initialize the temp.
In C++11, the padding is handled as undef, so the code uses 'llvm.memcpy' 
instead, making the test fail.

I've made the test run twice, once per dialect, and check for the appropriate 
intrinsic.
It doesn't look like this is the point of the test, though,. so maybe 
hard-coding the dialect would be preferable.


https://reviews.llvm.org/D27955

Files:
  test/CodeGenCXX/arm-swiftcall.cpp


Index: test/CodeGenCXX/arm-swiftcall.cpp
===
--- test/CodeGenCXX/arm-swiftcall.cpp
+++ test/CodeGenCXX/arm-swiftcall.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage | FileCheck %s
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage -std=c++03 | FileCheck %s 
-check-prefixes=CHECK,CHECKv03
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage -std=c++11 | FileCheck %s 
-check-prefixes=CHECK,CHECKv11
 
 // This isn't really testing anything ARM-specific; it's just a convenient
 // 32-bit platform.
@@ -48,7 +49,8 @@
 TEST(struct_1);
 // CHECK-LABEL: define {{.*}} @return_struct_1()
 // CHECK:   [[RET:%.*]] = alloca [[REC:%.*]], align 4
-// CHECK:   @llvm.memset
+// CHECKv03:   @llvm.memset
+// CHECKv11:   @llvm.memcpy
 // CHECK:   [[CAST_TMP:%.*]] = bitcast [[REC]]* [[RET]] to [[AGG:{ i32, \[2 x 
i8\], i8, \[1 x i8\], float, float }]]*
 // CHECK:   [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* 
[[CAST_TMP]], i32 0, i32 0
 // CHECK:   [[FIRST:%.*]] = load i32, i32* [[T0]], align 4


Index: test/CodeGenCXX/arm-swiftcall.cpp
===
--- test/CodeGenCXX/arm-swiftcall.cpp
+++ test/CodeGenCXX/arm-swiftcall.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s -Wno-return-type-c-linkage | FileCheck %s
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s -Wno-return-type-c-linkage -std=c++03 | FileCheck %s -check-prefixes=CHECK,CHECKv03
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s -Wno-return-type-c-linkage -std=c++11 | FileCheck %s -check-prefixes=CHECK,CHECKv11
 
 // This isn't really testing anything ARM-specific; it's just a convenient
 // 32-bit platform.
@@ -48,7 +49,8 @@
 TEST(struct_1);
 // CHECK-LABEL: define {{.*}} @return_struct_1()
 // CHECK:   [[RET:%.*]] = alloca [[REC:%.*]], align 4
-// CHECK:   @llvm.memset
+// CHECKv03:   @llvm.memset
+// CHECKv11:   @llvm.memcpy
 // CHECK:   [[CAST_TMP:%.*]] = bitcast [[REC]]* [[RET]] to [[AGG:{ i32, \[2 x i8\], i8, \[1 x i8\], float, float }]]*
 // CHECK:   [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* [[CAST_TMP]], i32 0, i32 0
 // CHECK:   [[FIRST:%.*]] = load i32, i32* [[T0]], align 4
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27180: Testbed and skeleton of a new expression parser

2016-12-19 Thread Sean Callanan via Phabricator via cfe-commits
spyffe updated this revision to Diff 81991.
spyffe marked 3 inline comments as done.
spyffe added a comment.

Applied Aleksei's comments, and integrated all the CMakeFiles fixes required to 
make the bots happy.


Repository:
  rL LLVM

https://reviews.llvm.org/D27180

Files:
  test/CMakeLists.txt
  test/Import/clang-flags/Inputs/S.c
  test/Import/clang-flags/test.c
  test/Import/empty-struct/Inputs/S.c
  test/Import/empty-struct/test.c
  test/Import/error-in-expression/Inputs/S.c
  test/Import/error-in-expression/test.c
  test/Import/error-in-import/Inputs/S.c
  test/Import/error-in-import/test.c
  test/Import/missing-import/test.c
  tools/CMakeLists.txt
  tools/clang-import-test/CMakeLists.txt
  tools/clang-import-test/clang-import-test.cpp

Index: tools/clang-import-test/clang-import-test.cpp
===
--- tools/clang-import-test/clang-import-test.cpp
+++ tools/clang-import-test/clang-import-test.cpp
@@ -0,0 +1,319 @@
+//===-- import-test.cpp - ASTImporter/ExternalASTSource testbed ---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/ASTImporter.h"
+#include "clang/Basic/Builtins.h"
+#include "clang/Basic/IdentifierTable.h"
+#include "clang/Basic/SourceLocation.h"
+#include "clang/Basic/TargetInfo.h"
+#include "clang/Basic/TargetOptions.h"
+#include "clang/CodeGen/ModuleBuilder.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/TextDiagnosticBuffer.h"
+#include "clang/Lex/Lexer.h"
+#include "clang/Lex/Preprocessor.h"
+#include "clang/Parse/ParseAST.h"
+
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/Host.h"
+#include "llvm/Support/Signals.h"
+
+#include 
+#include 
+
+using namespace clang;
+
+static llvm::cl::opt Expression(
+"expression", llvm::cl::Required,
+llvm::cl::desc("Path to a file containing the expression to parse"));
+
+static llvm::cl::list
+Imports("import", llvm::cl::ZeroOrMore,
+llvm::cl::desc("Path to a file containing declarations to import"));
+
+static llvm::cl::list
+ClangArgs("Xcc", llvm::cl::ZeroOrMore,
+  llvm::cl::desc("Argument to pass to the CompilerInvocation"),
+  llvm::cl::CommaSeparated);
+
+namespace init_convenience {
+class TestDiagnosticConsumer : public DiagnosticConsumer {
+private:
+  std::unique_ptr Passthrough;
+  const LangOptions *LangOpts = nullptr;
+
+public:
+  TestDiagnosticConsumer()
+  : Passthrough(llvm::make_unique()) {}
+
+  virtual void BeginSourceFile(const LangOptions ,
+   const Preprocessor *PP = nullptr) override {
+this->LangOpts = 
+return Passthrough->BeginSourceFile(LangOpts, PP);
+  }
+
+  virtual void EndSourceFile() override {
+this->LangOpts = nullptr;
+Passthrough->EndSourceFile();
+  }
+
+  virtual bool IncludeInDiagnosticCounts() const override {
+return Passthrough->IncludeInDiagnosticCounts();
+  }
+
+private:
+  static void PrintSourceForLocation(const SourceLocation ,
+ SourceManager ) {
+const char *LocData = SM.getCharacterData(Loc, /*Invalid=*/nullptr);
+unsigned LocColumn =
+SM.getSpellingColumnNumber(Loc, /*Invalid=*/nullptr) - 1;
+FileID FID = SM.getFileID(Loc);
+llvm::MemoryBuffer *Buffer = SM.getBuffer(FID, Loc, /*Invalid=*/nullptr);
+
+assert(LocData >= Buffer->getBufferStart() &&
+   LocData < Buffer->getBufferEnd());
+
+const char *LineBegin = LocData - LocColumn;
+
+assert(LineBegin >= Buffer->getBufferStart());
+
+const char *LineEnd = nullptr;
+
+for (LineEnd = LineBegin; *LineEnd != '\n' && *LineEnd != '\r' &&
+  LineEnd < Buffer->getBufferEnd();
+ ++LineEnd)
+  ;
+
+llvm::StringRef LineString(LineBegin, LineEnd - LineBegin);
+
+llvm::errs() << LineString << '\n';
+llvm::errs().indent(LocColumn);
+llvm::errs() << '^';
+  }
+
+  virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
+const Diagnostic ) override {
+if (Info.hasSourceManager() && LangOpts) {
+  SourceManager  = Info.getSourceManager();
+
+  if (Info.getLocation().isValid()) {
+Info.getLocation().print(llvm::errs(), SM);
+llvm::errs() << ": ";
+  }
+
+  SmallString<16> DiagText;
+  Info.FormatDiagnostic(DiagText);
+  llvm::errs() << DiagText << '\n';
+
+  if (Info.getLocation().isValid()) {
+PrintSourceForLocation(Info.getLocation(), SM);
+  }
+
+  for (const CharSourceRange  : Info.getRanges()) {
+bool Invalid = true;
+StringRef Ref = 

Re: r289754 - [c++1z] Permit constant evaluation of a call through a function pointer whose

2016-12-19 Thread Mike Aizatsky via cfe-commits
Richard,

Clang crashes for me on this code while doing "check-all". This change
seems to introduce the assert. Can you take a look?

BTW I'm not sure why bots are green. Do we build libcxx with bootstrap
compiler?


FAIL: libc++ ::
std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp
(34988 of 39764)
 TEST 'libc++ ::
std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp'
FAILED 
Command: ['/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang++',
'-o',
'/usr/local/google/home/aizatsky/out/llvm/default/projects/libcxx/test/std/experimental/string.view/string.view.find/Output/find
_last_of_pointer_size_size.pass.cpp.o', '-x', 'c++',
'/usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp',
'-c',
'-v', '-Werror=thread-safety', '-std=c++1z', '-include',
'/usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support/nasty_macros.hpp',
'-nostdinc++', '-I/usr/local/google/home/aizatsky/src/llvm/proj
ects/libcxx/include', '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS',
'-D__STDC_CONSTANT_MACROS',
'-I/usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support',
'-DLIBCXX_FILESYSTEM_STATIC_TEST_R
OOT="/usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/std/experimental/filesystem/Inputs/static_test_env"',
'-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/usr/local/google/home/aizatsky/out/llvm/default/
projects/libcxx/test/filesystem/Output/dynamic_env"',
'-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python2.7
/usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support/filesystem_dynamic_test_h
elper.py"', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', '-Wextra',
'-Werror', '-Wshadow', '-Wshadow', '-Wno-unused-command-line-argument',
'-Wno-attributes', '-Wno-pessimizing-move', '-Wno-c++11-extension
s', '-Wno-user-defined-literals', '-Wno-sign-compare',
'-Wno-unused-variable', '-Wno-unused-parameter',
'-Wno-unused-local-typedef', '-c']
Exit Code: 254
Standard Error:
--
clang version 4.0.0 (trunk 290130) (llvm/trunk 290127)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/google/home/aizatsky/out/llvm/bootstrap/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
 "/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8" -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name find_last_of_pointer_size_size.pass.cpp -mrelocation
-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -coverage-not
es-file
/usr/local/google/home/aizatsky/out/llvm/default/projects/libcxx/test/std/experimental/string.view/string.view.find/Output/find_last_of_pointer_size_size.pass.cpp.gcno
-nostdinc++ -resource-dir /usr/loc
al/google/home/aizatsky/out/llvm/bootstrap/bin/../lib/clang/4.0.0 -include
/usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support/nasty_macros.hpp
-I /usr/local/google/home/aizatsky/src/llvm/proj
ects/libcxx/include -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D
__STDC_CONSTANT_MACROS -I
/usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support -D
"LIBCXX_FILESYSTEM_STATIC_TEST_ROOT=\"/us
r/local/google/home/aizatsky/src/llvm/projects/libcxx/test/std/experimental/filesystem/Inputs/static_test_env\""
-D
"LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT=\"/usr/local/google/home/aizatsky/out/llvm/default/projec
ts/libcxx/test/filesystem/Output/dynamic_env\"" -D
"LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER=\"/usr/bin/python2.7
/usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support/filesystem_dynamic_test_helpe
r.py\"" -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem
/usr/local/include -internal-isystem
/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/../lib/clang/4.0.0/include
-internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -Werror=thread-safety -Wall -Wextra

r290135 - [Format] Remove dead code.

2016-12-19 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Mon Dec 19 15:10:50 2016
New Revision: 290135

URL: http://llvm.org/viewvc/llvm-project?rev=290135=rev
Log:
[Format] Remove dead code.

No functionality change.

Modified:
cfe/trunk/lib/Format/Encoding.h
cfe/trunk/lib/Format/TokenAnalyzer.h
cfe/trunk/lib/Format/WhitespaceManager.cpp
cfe/trunk/lib/Format/WhitespaceManager.h

Modified: cfe/trunk/lib/Format/Encoding.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Encoding.h?rev=290135=290134=290135=diff
==
--- cfe/trunk/lib/Format/Encoding.h (original)
+++ cfe/trunk/lib/Format/Encoding.h Mon Dec 19 15:10:50 2016
@@ -40,26 +40,6 @@ inline Encoding detectEncoding(StringRef
   return Encoding_Unknown;
 }
 
-inline unsigned getCodePointCountUTF8(StringRef Text) {
-  unsigned CodePoints = 0;
-  for (size_t i = 0, e = Text.size(); i < e;
-   i += llvm::getNumBytesForUTF8(Text[i])) {
-++CodePoints;
-  }
-  return CodePoints;
-}
-
-/// \brief Gets the number of code points in the Text using the specified
-/// Encoding.
-inline unsigned getCodePointCount(StringRef Text, Encoding Encoding) {
-  switch (Encoding) {
-  case Encoding_UTF8:
-return getCodePointCountUTF8(Text);
-  default:
-return Text.size();
-  }
-}
-
 /// \brief Returns the number of columns required to display the \p Text on a
 /// generic Unicode-capable terminal. Text is assumed to use the specified
 /// \p Encoding.

Modified: cfe/trunk/lib/Format/TokenAnalyzer.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnalyzer.h?rev=290135=290134=290135=diff
==
--- cfe/trunk/lib/Format/TokenAnalyzer.h (original)
+++ cfe/trunk/lib/Format/TokenAnalyzer.h Mon Dec 19 15:10:50 2016
@@ -55,15 +55,12 @@ public:
 
   FileID getFileID() const { return ID; }
 
-  StringRef getFileName() const { return FileName; }
-
   ArrayRef getCharRanges() const { return CharRanges; }
 
   const SourceManager () const { return SM; }
 
 private:
   FileID ID;
-  StringRef FileName;
   SmallVector CharRanges;
   SourceManager 
 

Modified: cfe/trunk/lib/Format/WhitespaceManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/WhitespaceManager.cpp?rev=290135=290134=290135=diff
==
--- cfe/trunk/lib/Format/WhitespaceManager.cpp (original)
+++ cfe/trunk/lib/Format/WhitespaceManager.cpp Mon Dec 19 15:10:50 2016
@@ -42,11 +42,6 @@ WhitespaceManager::Change::Change(
   TokenLength(0), PreviousEndOfTokenColumn(0), EscapedNewlineColumn(0),
   StartOfBlockComment(nullptr), IndentationOffset(0) {}
 
-void WhitespaceManager::reset() {
-  Changes.clear();
-  Replaces.clear();
-}
-
 void WhitespaceManager::replaceWhitespace(FormatToken , unsigned Newlines,
   unsigned IndentLevel, unsigned 
Spaces,
   unsigned StartOfTokenColumn,

Modified: cfe/trunk/lib/Format/WhitespaceManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/WhitespaceManager.h?rev=290135=290134=290135=diff
==
--- cfe/trunk/lib/Format/WhitespaceManager.h (original)
+++ cfe/trunk/lib/Format/WhitespaceManager.h Mon Dec 19 15:10:50 2016
@@ -41,9 +41,6 @@ public:
 bool UseCRLF)
   : SourceMgr(SourceMgr), Style(Style), UseCRLF(UseCRLF) {}
 
-  /// \brief Prepares the \c WhitespaceManager for another run.
-  void reset();
-
   /// \brief Replaces the whitespace in front of \p Tok. Only call once for
   /// each \c AnnotatedToken.
   void replaceWhitespace(FormatToken , unsigned Newlines,


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


[PATCH] D24812: Lit C++11 Compatibility Patch #11

2016-12-19 Thread Charles Li via Phabricator via cfe-commits
tigerleapgorge updated the summary for this revision.
tigerleapgorge updated this revision to Diff 81987.
tigerleapgorge added a comment.

Update Lit patch #11 to match latest Clang behavior
2 minor changes in this update

1. Back out test/CodeGenCXX/mangle-unnamed.cpp   because it has already been 
fixed.

2. Modified test/CodeGenCXX/static-init.cpp to match latest IR.

Also, this patch contained full context diff while the previous one does not.
Previous revision: svn diff
This revision svn diff --diff-cmd=diff -x -U99

Also reorder summery for the tests to be in the order of the patch.


https://reviews.llvm.org/D24812

Files:
  test/CodeGenCXX/arm.cpp
  test/CodeGenCXX/debug-info-class.cpp
  test/CodeGenCXX/eh-aggregate-copy-destroy.cpp
  test/CodeGenCXX/exceptions.cpp
  test/CodeGenCXX/goto.cpp
  test/CodeGenCXX/linetable-cleanup.cpp
  test/CodeGenCXX/lpad-linetable.cpp
  test/CodeGenCXX/mangle-unnamed.cpp
  test/CodeGenCXX/static-init.cpp
  test/CodeGenCXX/value-init.cpp
  test/CodeGenCXX/volatile-1.cpp
  test/CodeGenCXX/volatile.cpp
  test/Index/comment-cplus-decls.cpp
  test/OpenMP/atomic_codegen.cpp
  test/OpenMP/threadprivate_codegen.cpp
  test/PCH/macro-undef.cpp

Index: test/PCH/macro-undef.cpp
===
--- test/PCH/macro-undef.cpp
+++ test/PCH/macro-undef.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -verify
-// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++98 -emit-pch -o %t %s
+// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -verify
+// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s
 
 #ifndef HEADER
 #define HEADER
Index: test/OpenMP/threadprivate_codegen.cpp
===
--- test/OpenMP/threadprivate_codegen.cpp
+++ test/OpenMP/threadprivate_codegen.cpp
@@ -275,7 +275,7 @@
 // CHECK:  {{.*}}[[ARR_LOOP]]{{.*}}
 // CHECK-NEXT: [[ARR_ELEMENTPAST:%.*]] = phi [[S1]]* [ [[ARR_CUR]], {{.*}} ], [ [[ARR_ELEMENT:%.*]], {{.*}} ]
 // CHECK-NEXT: [[ARR_ELEMENT:%.*]] = getelementptr inbounds [[S1]], [[S1]]* [[ARR_ELEMENTPAST]], i{{.*}} -1
-// CHECK-NEXT: invoke {{.*}} [[S1_DTOR]]([[S1]]* [[ARR_ELEMENT]])
+// CHECK-NEXT: {{call|invoke}} {{.*}} [[S1_DTOR]]([[S1]]* [[ARR_ELEMENT]])
 // CHECK:  [[ARR_DONE:%.*]] = icmp eq [[S1]]* [[ARR_ELEMENT]], [[ARR_BEGIN]]
 // CHECK-NEXT: br i1 [[ARR_DONE]], label %[[ARR_EXIT:.*]], label %[[ARR_LOOP]]
 // CHECK:  {{.*}}[[ARR_EXIT]]{{.*}}
Index: test/OpenMP/atomic_codegen.cpp
===
--- test/OpenMP/atomic_codegen.cpp
+++ test/OpenMP/atomic_codegen.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm -std=c++98 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm -std=c++11 %s -o - | FileCheck %s
 // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -debug-info-kind=line-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
 // expected-no-diagnostics
 
@@ -21,14 +23,15 @@
   // CHECK: [[SCALAR_ADDR:%.+]] = invoke dereferenceable(4) i32* @_ZN2St3getEv(%struct.St* [[TEMP_ST_ADDR]])
   // CHECK: [[SCALAR_VAL:%.+]] = load atomic i32, i32* [[SCALAR_ADDR]] monotonic
   // CHECK: store i32 [[SCALAR_VAL]], i32* @b
-  // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+  // CHECK98: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+  // CHECK11: call void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
 #pragma omp atomic read
   b = St().get();
   // CHECK-DAG: invoke void @_ZN2StC1Ev(%struct.St* [[TEMP_ST_ADDR:%.+]])
   // CHECK-DAG: [[SCALAR_ADDR:%.+]] = invoke dereferenceable(4) i32* @_ZN2St3getEv(%struct.St* [[TEMP_ST_ADDR]])
   // CHECK-DAG: [[B_VAL:%.+]] = load i32, i32* @b
   // CHECK: store atomic i32 [[B_VAL]], i32* [[SCALAR_ADDR]] monotonic
-  // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+  // CHECK: {{invoke|call}} void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
 #pragma omp atomic write
   St().get() = b;
   // CHECK: invoke void @_ZN2StC1Ev(%struct.St* [[TEMP_ST_ADDR:%.+]])
@@ -46,7 +49,7 @@
   // CHECK: [[COND:%.+]] = extractvalue { i32, i1 } [[RES]], 1
   // CHECK: br i1 [[COND]], label %[[OMP_DONE:.+]], label %[[OMP_UPDATE]]
   // CHECK: [[OMP_DONE]]
-  // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+

r290134 - [ASTReader] Sort RawComments before merging

2016-12-19 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Mon Dec 19 15:06:06 2016
New Revision: 290134

URL: http://llvm.org/viewvc/llvm-project?rev=290134=rev
Log:
[ASTReader] Sort RawComments before merging

`RawComments` are sorted by comparing underlying `SourceLocation`'s. This is
done by comparing `FileID` and `Offset`; when the `FileID` is the same it means
the locations are within the same TU and the `Offset` is used.

FileID, from the source code: "A mostly-opaque identifier, where 0 is
"invalid", >0 is this module, and <-1 is something loaded from another
module.". That said, when de-serializing SourceLocations, FileID's from
RawComments loaded from other modules get negative IDs where previously they
were positive. This makes imported RawComments unsorted, leading to a wrong
merge with other comments from the current TU. Fix that by sorting RawComments
properly after de-serialization and before merge.

This fixes an assertion in `ASTContext::getRawCommentForDeclNoCache`,
which fires only in a debug build of clang.

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

rdar://problem/29287314

Modified:
cfe/trunk/lib/Serialization/ASTReader.cpp

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=290134=290133=290134=diff
==
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Mon Dec 19 15:06:06 2016
@@ -8471,6 +8471,10 @@ void ASTReader::ReadComments() {
   }
 }
   NextCursor:
+// De-serialized SourceLocations get negative FileIDs for other modules,
+// potentially invalidating the original order. Sort it again.
+std::sort(Comments.begin(), Comments.end(),
+  BeforeThanCompare(SourceMgr));
 Context.Comments.addDeserializedComments(Comments);
   }
 }


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


Re: [libcxx] r289963 - [CMake] Put headers relative to clang

2016-12-19 Thread Chris Bieneman via cfe-commits
Sorry I didn't reply to this email over the weekend. I did push a fix in 
r290052. My weekend was just a bit nuts, so I didn't take the time to reply 
here.

The bot went green after that fix. If there are other issues please let me know.

-Chris

> On Dec 16, 2016, at 5:58 PM, Evgenii Stepanov  
> wrote:
> 
> FTR,
> 
> buildbot logs:
> 
> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/2585/steps/test%20tsan%20in%20debug%20compiler-rt%20build/logs/stdio
> 
> External project cmake error log:
> 
> CMake Error at include/CMakeLists.txt:15 (file):
>  file COPY cannot make directory "/include/c++/v1/.": No such file or
>  directory
> 
> 
> On Fri, Dec 16, 2016 at 5:56 PM, Evgenii Stepanov
>  wrote:
>> Hi,
>> 
>> this is using LLVM_BINARY_DIR when NOT LIBCXX_USING_INSTALLED_LLVM.
>> 
>> HandleOutOfTreeLLVM.cmake defines LLVM_BINARY_DIR only when
>> LIBCXX_USING_INSTALLED_LLVM. Is it supposed to come from the user
>> cmake arguments?
>> 
>> This broke sanitizer tests on Linux (check-tsan, check-msan). See
>> add_custom_libcxx() in compiler-rt cmake scripts.
>> 
>> On Fri, Dec 16, 2016 at 9:30 AM, Chris Bieneman via cfe-commits
>>  wrote:
>>> Author: cbieneman
>>> Date: Fri Dec 16 11:30:51 2016
>>> New Revision: 289963
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=289963=rev
>>> Log:
>>> [CMake] Put headers relative to clang
>>> 
>>> When libcxx isn't building with an installed LLVM we copy the libcxx 
>>> headers into the LLVM build directory so that a clang in that build tree 
>>> can find the headers relative to itself.
>>> 
>>> This is only important in situations where you don't have headers installed 
>>> under /, which is common these days on Darwin.
>>> 
>>> Modified:
>>>libcxx/trunk/include/CMakeLists.txt
>>> 
>>> Modified: libcxx/trunk/include/CMakeLists.txt
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/CMakeLists.txt?rev=289963=289962=289963=diff
>>> ==
>>> --- libcxx/trunk/include/CMakeLists.txt (original)
>>> +++ libcxx/trunk/include/CMakeLists.txt Fri Dec 16 11:30:51 2016
>>> @@ -10,18 +10,14 @@ set(LIBCXX_HEADER_PATTERN
>>>   ${LIBCXX_SUPPORT_HEADER_PATTERN}
>>>   )
>>> 
>>> -if (LIBCXX_STANDALONE_BUILD)
>>> -  set(LIBCXX_BUILD_ROOT "${LIBCXX_BINARY_DIR}")
>>> -else()
>>> -  set(LIBCXX_BUILD_ROOT "${LLVM_BINARY_DIR}")
>>> +if(NOT LIBCXX_USING_INSTALLED_LLVM)
>>> +  file(COPY .
>>> +DESTINATION "${LLVM_BINARY_DIR}/include/c++/v1"
>>> +FILES_MATCHING
>>> +${LIBCXX_HEADER_PATTERN}
>>> +)
>>> endif()
>>> 
>>> -file(COPY .
>>> -  DESTINATION "${LIBCXX_BUILD_ROOT}/include/c++/v1"
>>> -  FILES_MATCHING
>>> -  ${LIBCXX_HEADER_PATTERN}
>>> -)
>>> -
>>> if (LIBCXX_INSTALL_HEADERS)
>>>   install(DIRECTORY .
>>> DESTINATION include/c++/v1
>>> 
>>> 
>>> ___
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


[PATCH] D27837: Add fix-it notes to the nullability consistency warning

2016-12-19 Thread Jordan Rose via Phabricator via cfe-commits
jordan_rose accepted this revision.
jordan_rose added a reviewer: jordan_rose.
jordan_rose added a comment.
This revision is now accepted and ready to land.

Doug was okay with the idea and I trust Alex and Akira would have caught any 
major problems. Committed in r290132.


Repository:
  rL LLVM

https://reviews.llvm.org/D27837



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


r290132 - Add fix-it notes to the nullability consistency warning.

2016-12-19 Thread Jordan Rose via cfe-commits
Author: jrose
Date: Mon Dec 19 14:58:20 2016
New Revision: 290132

URL: http://llvm.org/viewvc/llvm-project?rev=290132=rev
Log:
Add fix-it notes to the nullability consistency warning.

This is especially important for arrays, since no one knows the proper
syntax for putting qualifiers in arrays.

nullability.h:3:26: warning: array parameter is missing a nullability type 
specifier (_Nonnull, _Nullable, or _Null_unspecified)
void arrayParameter(int x[]);
 ^
nullability.h:3:26: note: insert '_Nullable' if the array parameter may be 
null
void arrayParameter(int x[]);
 ^
  _Nullable
nullability.h:3:26: note: insert '_Nonnull' if the array parameter should 
never be null
void arrayParameter(int x[]);
 ^
  _Nonnull

rdar://problem/29524992

Added:
cfe/trunk/test/FixIt/Inputs/
cfe/trunk/test/FixIt/Inputs/nullability.h
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/FixIt/nullability.mm
cfe/trunk/test/SemaObjCXX/Inputs/nullability-consistency-1.h
cfe/trunk/test/SemaObjCXX/Inputs/nullability-consistency-2.h
cfe/trunk/test/SemaObjCXX/Inputs/nullability-consistency-3.h
cfe/trunk/test/SemaObjCXX/Inputs/nullability-consistency-4.h
cfe/trunk/test/SemaObjCXX/Inputs/nullability-consistency-5.h
cfe/trunk/test/SemaObjCXX/Inputs/nullability-consistency-6.h
cfe/trunk/test/SemaObjCXX/Inputs/nullability-consistency-7.h
cfe/trunk/test/SemaObjCXX/Inputs/nullability-consistency-8.h
cfe/trunk/test/SemaObjCXX/Inputs/nullability-consistency-arrays.h

cfe/trunk/test/SemaObjCXX/Inputs/nullability-consistency-system/nullability-consistency-system.h
cfe/trunk/test/SemaObjCXX/Inputs/nullability-pragmas-1.h

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=290132=290131=290132=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Dec 19 14:58:20 
2016
@@ -8770,6 +8770,10 @@ def warn_nullability_missing_array : War
   "array parameter is missing a nullability type specifier (_Nonnull, "
   "_Nullable, or _Null_unspecified)">,
   InGroup;
+def note_nullability_fix_it : Note<
+  "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
+  "%select{pointer|block pointer|member pointer|array parameter}1 "
+  "%select{should never be null|may be null|should not declare nullability}0">;
 
 def warn_nullability_inferred_on_nested_type : Warning<
   "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=290132=290131=290132=diff
==
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Mon Dec 19 14:58:20 2016
@@ -3441,6 +3441,57 @@ static FileID getNullabilityCompleteness
   return file;
 }
 
+/// Creates a fix-it to insert a C-style nullability keyword at \p pointerLoc,
+/// taking into account whitespace before and after.
+static FixItHint fixItNullability(Sema , SourceLocation PointerLoc,
+  NullabilityKind Nullability) {
+  assert(PointerLoc.isValid());
+
+  SmallString<32> InsertionTextBuf{" "};
+  InsertionTextBuf += getNullabilitySpelling(Nullability);
+  InsertionTextBuf += " ";
+  StringRef InsertionText = InsertionTextBuf.str();
+
+  SourceLocation FixItLoc = S.getLocForEndOfToken(PointerLoc);
+  if (const char *NextChar = S.SourceMgr.getCharacterData(FixItLoc)) {
+if (isWhitespace(*NextChar)) {
+  InsertionText = InsertionText.drop_back();
+} else if (NextChar[-1] == '[') {
+  if (NextChar[0] == ']')
+InsertionText = InsertionText.drop_back().drop_front();
+  else
+InsertionText = InsertionText.drop_front();
+} else if (!isIdentifierBody(NextChar[0], /*allow dollar*/true) &&
+   !isIdentifierBody(NextChar[-1], /*allow dollar*/true)) {
+  InsertionText = InsertionText.drop_back().drop_front();
+}
+  }
+
+  return FixItHint::CreateInsertion(FixItLoc, InsertionText);
+}
+
+static void emitNullabilityConsistencyWarning(Sema ,
+  SimplePointerKind PointerKind,
+  SourceLocation PointerLoc) {
+  assert(PointerLoc.isValid());
+
+  if (PointerKind == SimplePointerKind::Array) {
+S.Diag(PointerLoc, diag::warn_nullability_missing_array);
+  } else {
+S.Diag(PointerLoc, diag::warn_nullability_missing)
+  << static_cast(PointerKind);
+  }
+
+  auto 

[PATCH] D27936: C++11 test cleanup: nonthrowing destructors

2016-12-19 Thread Paul Robinson via Phabricator via cfe-commits
probinson created this revision.
probinson added a reviewer: rsmith.
probinson added a subscriber: cfe-commits.

If a dtor has no interesting members, then it ends up being nothrow, which 
affects the generated IR.
Modify some tests to tolerate this difference between C++03 and C++11.

In C++11, a destructor without an explicit exception-spec gets an implicit 
exception-spec.
If the dtor has a body, the implicit exception-spec permits throwing exactly 
the set of types thrown by anything the dtor calls.  If the dtor doesn't have a 
body, use what would be the default dtor's body to determine the implicit 
exception-spec.  If there are no calls, the implicit exception-spec is nothrow.


https://reviews.llvm.org/D27936

Files:
  test/CodeGenCXX/destructors.cpp
  test/CodeGenCXX/nrvo.cpp
  test/CodeGenCXX/partial-destruction.cpp

Index: test/CodeGenCXX/partial-destruction.cpp
===
--- test/CodeGenCXX/partial-destruction.cpp
+++ test/CodeGenCXX/partial-destruction.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions -std=c++03 | FileCheck %s -check-prefixes=CHECK,CHECKv03
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions -std=c++11 | FileCheck %s -check-prefixes=CHECK,CHECKv11
 
 // Test IR generation for partial destruction of aggregates.
 
@@ -45,7 +46,8 @@
   // CHECK-NEXT: br label
   // CHECK:  [[ED_AFTER:%.*]] = phi [[A]]* [ [[ED_END]], {{%.*}} ], [ [[ED_CUR:%.*]], {{%.*}} ]
   // CHECK-NEXT: [[ED_CUR]] = getelementptr inbounds [[A]], [[A]]* [[ED_AFTER]], i64 -1
-  // CHECK-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[ED_CUR]])
+  // CHECKv03-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[ED_CUR]])
+  // CHECKv11-NEXT: call   void @_ZN5test01AD1Ev([[A]]* [[ED_CUR]])
   // CHECK:  [[T0:%.*]] = icmp eq [[A]]* [[ED_CUR]], [[ED_BEGIN]]
   // CHECK-NEXT: br i1 [[T0]],
   // CHECK:  ret void
@@ -58,7 +60,8 @@
   // CHECK-NEXT: br i1 [[T0]],
   // CHECK:  [[E_AFTER:%.*]] = phi [[A]]* [ [[PARTIAL_END]], {{%.*}} ], [ [[E_CUR:%.*]], {{%.*}} ]
   // CHECK-NEXT: [[E_CUR]] = getelementptr inbounds [[A]], [[A]]* [[E_AFTER]], i64 -1
-  // CHECK-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[E_CUR]])
+  // CHECKv03-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[E_CUR]])
+  // CHECKv11-NEXT: call   void @_ZN5test01AD1Ev([[A]]* [[E_CUR]])
   // CHECK:  [[T0:%.*]] = icmp eq [[A]]* [[E_CUR]], [[E_BEGIN]]
   // CHECK-NEXT: br i1 [[T0]],
 
@@ -73,20 +76,21 @@
   // FIXME: There's some really bad block ordering here which causes
   // the partial destroy for the primary normal destructor to fall
   // within the primary EH destructor.
-  // CHECK:  landingpad { i8*, i32 }
-  // CHECK-NEXT:   cleanup
-  // CHECK:  [[T0:%.*]] = icmp eq [[A]]* [[ED_BEGIN]], [[ED_CUR]]
-  // CHECK-NEXT: br i1 [[T0]]
-  // CHECK:  [[EDD_AFTER:%.*]] = phi [[A]]* [ [[ED_CUR]], {{%.*}} ], [ [[EDD_CUR:%.*]], {{%.*}} ]
-  // CHECK-NEXT: [[EDD_CUR]] = getelementptr inbounds [[A]], [[A]]* [[EDD_AFTER]], i64 -1
-  // CHECK-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[EDD_CUR]])
-  // CHECK:  [[T0:%.*]] = icmp eq [[A]]* [[EDD_CUR]], [[ED_BEGIN]]
-  // CHECK-NEXT: br i1 [[T0]]
+  // CHECKv03:  landingpad { i8*, i32 }
+  // CHECKv03-NEXT:   cleanup
+  // CHECKv03:  [[T0:%.*]] = icmp eq [[A]]* [[ED_BEGIN]], [[ED_CUR]]
+  // CHECKv03-NEXT: br i1 [[T0]]
+  // CHECKv03:  [[EDD_AFTER:%.*]] = phi [[A]]* [ [[ED_CUR]], {{%.*}} ], [ [[EDD_CUR:%.*]], {{%.*}} ]
+  // CHECKv03-NEXT: [[EDD_CUR]] = getelementptr inbounds [[A]], [[A]]* [[EDD_AFTER]], i64 -1
+  // CHECKv03-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[EDD_CUR]])
+  // CHECKv03:  [[T0:%.*]] = icmp eq [[A]]* [[EDD_CUR]], [[ED_BEGIN]]
+  // CHECKv03-NEXT: br i1 [[T0]]
 
   // Back to the primary EH destructor.
   // CHECK:  [[E_AFTER:%.*]] = phi [[A]]* [ [[E_END]], {{%.*}} ], [ [[E_CUR:%.*]], {{%.*}} ]
   // CHECK-NEXT: [[E_CUR]] = getelementptr inbounds [[A]], [[A]]* [[E_AFTER]], i64 -1
-  // CHECK-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[E_CUR]])
+  // CHECKv03-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[E_CUR]])
+  // CHECKv11-NEXT: call   void @_ZN5test01AD1Ev([[A]]* [[E_CUR]])
   // CHECK:  [[T0:%.*]] = icmp eq [[A]]* [[E_CUR]], [[E0]]
   // CHECK-NEXT: br i1 [[T0]],
 
@@ -120,8 +124,10 @@
   // CHECK-NEXT:   cleanup
   // CHECK:  landingpad { i8*, i32 }
   // CHECK-NEXT:   cleanup
-  // CHECK:  invoke void @_ZN5test11AD1Ev([[A]]* [[Y]])
-  // CHECK:  invoke void @_ZN5test11AD1Ev([[A]]* [[X]])
+  // CHECKv03:  invoke void @_ZN5test11AD1Ev([[A]]* [[Y]])
+  // CHECKv03:  invoke void @_ZN5test11AD1Ev([[A]]* [[X]])
+  // CHECKv11:  call   void @_ZN5test11AD1Ev([[A]]* [[Y]])
+  // CHECKv11:  call   void @_ZN5test11AD1Ev([[A]]* [[X]])
 }
 
 

[PATCH] D27165: Add format_dynamic_key_arg attribute to improve "-Wformat" warnings for functions that load the formatting string dynamically based on a key value

2016-12-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: include/clang/Basic/Attr.td:862
+def FormatDynamicKeyArg : InheritableAttr {
+  let Spellings = [GCC<"format_dynamic_key_arg">];
+  let Args = [IntArgument<"FormatIdx">];

arphaman wrote:
> aaron.ballman wrote:
> > Does GCC support this attribute as well? If not, this should use the GNU 
> > spelling instead of the GCC one. Also, should this have a C++11 spelling in 
> > the clang namespace?
> > 
> > The name doesn't really convey much about what the attribute is doing, 
> > mostly because it doesn't seem obvious what "key" means.
> > 
> > It seems that the crux of what this attribute says is that the attributed 
> > function accepts a string argument of a format specifier and returns the 
> > same format specifier. Perhaps `returns_format_specifier` is a better name?
> > Does GCC support this attribute as well? If not, this should use the GNU 
> > spelling instead of the GCC one. 
> 
> No, it doesn't. Thanks for pointing that out, I fixed it.
> 
> > Also, should this have a C++11 spelling in the clang namespace?
> 
> I don't know, is that required for new attributes? I don't need the C++11 
> spelling personally, and I don't know if there is anyone else who's 
> interested in this attribute.  
> 
> > The name doesn't really convey much about what the attribute is doing, 
> > mostly because it doesn't seem obvious what "key" means.
> > 
> > It seems that the crux of what this attribute says is that the attributed 
> > function accepts a string argument of a format specifier and returns the 
> > same format specifier. Perhaps returns_format_specifier is a better name?
> 
> You're right, the name should convey the intended meaning better. I switched 
> to `loads_format_specifier_value_using_key`, how does that sound?
> I think it sounds better than just `returns_format_specifier` because I would 
> like to see this attribute used only for a particular kind of function. This 
> kind of function should load the value at runtime using the key from a 
> platform-specific file/database that might also be accessible at 
> compile-time. It shouldn't be used for functions that might just modify the 
> given key, which, IMO, `returns_format_specifier` can imply.
>> Also, should this have a C++11 spelling in the clang namespace?
> I don't know, is that required for new attributes? I don't need the C++11 
> spelling personally, and I don't know if there is anyone else who's 
> interested in this attribute.

It's not required, but not everyone likes GNU-style attributes, so having 
something a bit less awful is a kindness.

>> The name doesn't really convey much about what the attribute is doing, 
>> mostly because it doesn't seem obvious what "key" means.
>> It seems that the crux of what this attribute says is that the attributed 
>> function accepts a string argument of a format specifier and returns the 
>> same format specifier. Perhaps returns_format_specifier is a better name?
>You're right, the name should convey the intended meaning better. I switched 
>to loads_format_specifier_value_using_key, how does that sound?
> I think it sounds better than just returns_format_specifier because I would 
> like to see this attribute used only for a particular kind of function. This 
> kind of function should load the value at runtime using the key from a 
> platform-specific file/database that might also be accessible at 
> compile-time. It shouldn't be used for functions that might just modify the 
> given key, which, IMO, returns_format_specifier can imply.

It's a bit wordy, but I think it's better than the original name.



Comment at: include/clang/Basic/AttrDocs.td:1759
+function accepts a key string that corresponds to some external ``printf`` or
+``scanf``-like format string value, loads the value that corresponds to the
+given key and returns that value.

value -> specifier (same below).



Comment at: include/clang/Basic/AttrDocs.td:1766
+specifiers found in the key string.
+  }];
+}

Given that this is uses novel terminology like "key string", I think an example 
would be useful to add.

The docs should also mention that this attribute accepts an argument, and that 
the argument is 1-based instead of 0-based (I can't count how many times that's 
tripped me up).



Comment at: lib/Sema/SemaChecking.cpp:4408
+static void CheckFormatString(
+Sema , const FormatStringLiteral *FExpr, const Expr *OrigFormatExpr,
+ArrayRef Args, bool HasVAListArg, unsigned format_idx,

I think the original formatting was easier to read.



Comment at: lib/Sema/SemaChecking.cpp:4418
 // True string literals are then checked by CheckFormatString.
-static StringLiteralCheckType
-checkFormatStringExpr(Sema , const Expr *E, ArrayRef Args,
-  bool HasVAListArg, unsigned format_idx,
-  unsigned 

[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name

2016-12-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:22
+
+const internal::VariadicDynCastAllOfMatcher tagDecl;
+

We may want to consider adding this to ASTMatchers.h at some point (can be done 
in a future patch).



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:25
+static bool isWhitespaceExceptNL(unsigned char C);
+static std::string removeMultiLineComments(std::string Str);
+static std::string getCurrentLineIndent(SourceLocation Loc,

This should accept by `const std::string &`.



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:32
+  // Matches all non-single declaration within a compound statement {...}.
+  // Unless, the variable declaration is a object definition directly after
+  // a tag declaration (e.g. struct, class etc.):

is a object -> is an object



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:34
+  // a tag declaration (e.g. struct, class etc.):
+  // class A { } Object1, Object2;  <-- won't be matched
+  Finder->addMatcher(

Why do we not want to match this?



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:44
+  const auto *DeclStatement = Result.Nodes.getNodeAs("declstmt");
+  if (DeclStatement == nullptr)
+return;

No need to compare against nullptr explicitly (I think we have a clang-tidy 
check that will warn on this, in fact).



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:53
+  const LangOptions  = getLangOpts();
+  const auto DeclGroup = DeclStatement->getDeclGroup();
+

Please don't use `auto` as the type is not spelled out explicitly in the 
initialization. Same elsewhere, though it is fine with `diag()` and in for loop 
initializers.



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:61
+  DeclStmtStart,
+  "declaration statement can be split up into single line declarations");
+

This reads a bit awkwardly since it doesn't explain why the code is 
problematic. Perhaps: "multiple declarations should be split into individual 
declarations to improve readability" or something like that?



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:67
+  for (auto It = DeclGroup.begin() + 1; It != DeclGroup.end(); ++It) {
+
+const auto NameLocation = dyn_cast(*It)->getLocation();

No need for the newline.



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:81
+
+  // Check for pre-processor directive and add appropriate newline
+  if (AnyTokenBetweenCommaAndVarName.front() == '#')

Missing a full stop at the end of the sentence. Also, no hyphen in 
preprocessor, and it should be "add an appropriate".



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:83
+  if (AnyTokenBetweenCommaAndVarName.front() == '#')
+AnyTokenBetweenCommaAndVarName.insert(0, "\n");
+

Will this (and the below `\n`) be converted into a CRLF automatically on 
platforms where that is the newline character sequence in the source?



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:87
+   << FixItHint::CreateReplacement(AfterCommaToVarNameRange,
+   "\n" + CurrentIndent +
+   UserWrittenType + " " +

This should probably use a `Twine` to avoid a bunch of copies.



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:101
+  QualType Type;
+  if (const auto *FirstVar = dyn_cast(*FirstVarIt)) {
+Location = FirstVar->getLocation();

You can drop the `const` from the `dyn_cast`, here and elsewhere.



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:107
+Type = FirstVar->getTypeSourceInfo()->getType();
+while (Type->isLValueReferenceType()) {
+  Type = Type->getPointeeType();

Why references and not pointers? Perhaps this needs a comment.



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:131
+  Type->isFunctionPointerType() || Type->isFunctionProtoType()) {
+Pos = UserWrittenType.find_first_of("&*(");
+if (Pos != std::string::npos) { // might be hidden behind typedef etc.

You may want to include tests for pathological code, like:
```
int *(i), (*j), (((k)));
```



Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:132
+Pos = UserWrittenType.find_first_of("&*(");
+if (Pos != std::string::npos) { // might be hidden behind typedef etc.
+  UserWrittenType.erase(Pos);

`m` 

[PATCH] D26750: [clang-tidy] Add modernize-use-default-member-init check

2016-12-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:77-78
+static bool sameValue(const Expr *E1, const Expr *E2) {
+  E1 = ignoreUnaryPlus(getInitializer(E1->IgnoreImpCasts()));
+  E2 = ignoreUnaryPlus(getInitializer(E2->IgnoreImpCasts()));
+

malcolm.parsons wrote:
> aaron.ballman wrote:
> > malcolm.parsons wrote:
> > > aaron.ballman wrote:
> > > > Do you also want to ignore paren expressions?
> > > Maybe. 
> > > Am I reimplementing some existing clang function here?
> > You can use `IgnoreParenImpCasts()` instead.
> I mean is sameValue() implemented elsewhere?
Not in a general form in Clang, at least that I am aware of.


https://reviews.llvm.org/D26750



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


[PATCH] D26750: [clang-tidy] Add modernize-use-default-member-init check

2016-12-19 Thread Malcolm Parsons via Phabricator via cfe-commits
malcolm.parsons added inline comments.



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:77-78
+static bool sameValue(const Expr *E1, const Expr *E2) {
+  E1 = ignoreUnaryPlus(getInitializer(E1->IgnoreImpCasts()));
+  E2 = ignoreUnaryPlus(getInitializer(E2->IgnoreImpCasts()));
+

aaron.ballman wrote:
> malcolm.parsons wrote:
> > aaron.ballman wrote:
> > > Do you also want to ignore paren expressions?
> > Maybe. 
> > Am I reimplementing some existing clang function here?
> You can use `IgnoreParenImpCasts()` instead.
I mean is sameValue() implemented elsewhere?


https://reviews.llvm.org/D26750



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


[PATCH] D26750: [clang-tidy] Add modernize-use-default-member-init check

2016-12-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:77-78
+static bool sameValue(const Expr *E1, const Expr *E2) {
+  E1 = ignoreUnaryPlus(getInitializer(E1->IgnoreImpCasts()));
+  E2 = ignoreUnaryPlus(getInitializer(E2->IgnoreImpCasts()));
+

malcolm.parsons wrote:
> aaron.ballman wrote:
> > Do you also want to ignore paren expressions?
> Maybe. 
> Am I reimplementing some existing clang function here?
You can use `IgnoreParenImpCasts()` instead.


https://reviews.llvm.org/D26750



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


[PATCH] D26750: [clang-tidy] Add modernize-use-default-member-init check

2016-12-19 Thread Malcolm Parsons via Phabricator via cfe-commits
malcolm.parsons marked 9 inline comments as done.
malcolm.parsons added inline comments.



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:77-78
+static bool sameValue(const Expr *E1, const Expr *E2) {
+  E1 = ignoreUnaryPlus(getInitializer(E1->IgnoreImpCasts()));
+  E2 = ignoreUnaryPlus(getInitializer(E2->IgnoreImpCasts()));
+

aaron.ballman wrote:
> Do you also want to ignore paren expressions?
Maybe. 
Am I reimplementing some existing clang function here?



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:123
+
+void UseDefaultMemberInitCheck::registerMatchers(MatchFinder *Finder) {
+  auto Init =

aaron.ballman wrote:
> This check should not register matchers for C++ < 11.
I always forget to add a condition here; maybe add_new_check.py could remind me.


https://reviews.llvm.org/D26750



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


[PATCH] D27832: Add -plugin-opt=sample-profile for thinLTO build.

2016-12-19 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno added inline comments.



Comment at: lib/Driver/Tools.cpp:2211
+  if (Arg *A = Args.getLastArg(options::OPT_fprofile_sample_use_EQ)) {
+StringRef fname = A->getValue();
+if (!llvm::sys::fs::exists(fname))

"fname" -> "FName", "FileName", etc, or any name that starts with a capital 
letter


https://reviews.llvm.org/D27832



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


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

2016-12-19 Thread Tim Shen via Phabricator via cfe-commits
timshen updated this revision to Diff 81981.
timshen added a comment.

Remove more 'else' after return.


https://reviews.llvm.org/D27872

Files:
  clang/test/CodeGen/ppc64-complex-parms.c
  llvm/include/llvm/ADT/APFloat.h
  llvm/lib/Support/APFloat.cpp
  llvm/test/CodeGen/PowerPC/fp128-bitcast-after-operation.ll
  llvm/unittests/ADT/APFloatTest.cpp

Index: llvm/unittests/ADT/APFloatTest.cpp
===
--- llvm/unittests/ADT/APFloatTest.cpp
+++ llvm/unittests/ADT/APFloatTest.cpp
@@ -9,6 +9,7 @@
 
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APSInt.h"
+#include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"
@@ -3262,7 +3263,7 @@
 << formatv("({0:x} + {1:x}) + ({2:x} + {3:x})", Op1[0], Op1[1], Op2[0],
Op2[1])
.str();
-EXPECT_EQ(Expected[1], A1.getSecondFloat().bitcastToAPInt().getRawData()[0])
+EXPECT_EQ(Expected[1], A1.bitcastToAPInt().getRawData()[1])
 << formatv("({0:x} + {1:x}) + ({2:x} + {3:x})", Op1[0], Op1[1], Op2[0],
Op2[1])
.str();
@@ -3296,7 +3297,7 @@
 << formatv("({0:x} + {1:x}) - ({2:x} + {3:x})", Op1[0], Op1[1], Op2[0],
Op2[1])
.str();
-EXPECT_EQ(Expected[1], A1.getSecondFloat().bitcastToAPInt().getRawData()[0])
+EXPECT_EQ(Expected[1], A1.bitcastToAPInt().getRawData()[1])
 << formatv("({0:x} + {1:x}) - ({2:x} + {3:x})", Op1[0], Op1[1], Op2[0],
Op2[1])
.str();
@@ -3496,12 +3497,53 @@
 APFloat A1(APFloat::PPCDoubleDouble(), APInt(128, 2, Op1));
 APFloat A2(APFloat::PPCDoubleDouble(), APInt(128, 2, Op2));
 EXPECT_EQ(Expected, A1.compare(A2))
-<< formatv("({0:x} + {1:x}) - ({2:x} + {3:x})", Op1[0], Op1[1], Op2[0],
+<< formatv("compare(({0:x} + {1:x}), ({2:x} + {3:x}))", Op1[0], Op1[1],
+   Op2[0], Op2[1])
+   .str();
+  }
+}
+
+TEST(APFloatTest, PPCDoubleDoubleBitwiseIsEqual) {
+  using DataType = std::tuple;
+
+  DataType Data[] = {
+  // (1 + 0) = (1 + 0)
+  std::make_tuple(0x3ff0ull, 0, 0x3ff0ull, 0, true),
+  // (1 + 0) != (1.00...1 + 0)
+  std::make_tuple(0x3ff0ull, 0, 0x3ff1ull, 0,
+  false),
+  // NaN = NaN
+  std::make_tuple(0x7ff8ull, 0, 0x7ff8ull, 0, true),
+  // NaN != NaN with a different bit pattern
+  std::make_tuple(0x7ff8ull, 0, 0x7ff8ull,
+  0x3ff0ull, false),
+  // Inf = Inf
+  std::make_tuple(0x7ff0ull, 0, 0x7ff0ull, 0, true),
+  };
+
+  for (auto Tp : Data) {
+uint64_t Op1[2], Op2[2];
+bool Expected;
+std::tie(Op1[0], Op1[1], Op2[0], Op2[1], Expected) = Tp;
+
+APFloat A1(APFloat::PPCDoubleDouble(), APInt(128, 2, Op1));
+APFloat A2(APFloat::PPCDoubleDouble(), APInt(128, 2, Op2));
+EXPECT_EQ(Expected, A1.bitwiseIsEqual(A2))
+<< formatv("({0:x} + {1:x}) = ({2:x} + {3:x})", Op1[0], Op1[1], Op2[0],
Op2[1])
.str();
   }
 }
 
+TEST(APFloatTest, PPCDoubleDoubleHashValue) {
+  uint64_t Data1[] = {0x3ff1ull, 0x0001ull};
+  uint64_t Data2[] = {0x3ff1ull, 0};
+  // The hash values are *hopefully* different.
+  EXPECT_NE(
+  hash_value(APFloat(APFloat::PPCDoubleDouble(), APInt(128, 2, Data1))),
+  hash_value(APFloat(APFloat::PPCDoubleDouble(), APInt(128, 2, Data2;
+}
+
 TEST(APFloatTest, PPCDoubleDoubleChangeSign) {
   uint64_t Data[] = {
   0x400full, 0xbcb0ull,
@@ -3531,6 +3573,13 @@
   }
   {
 uint64_t Data[] = {
+0x7fefull, 0x7c8eull,
+};
+EXPECT_EQ(APInt(128, 2, Data),
+  APFloat::getLargest(APFloat::PPCDoubleDouble()).bitcastToAPInt());
+  }
+  {
+uint64_t Data[] = {
 0x0001ull, 0,
 };
 EXPECT_EQ(
@@ -3553,24 +3602,72 @@
   }
   {
 uint64_t Data[] = {
+0xffefull, 0xfc8eull,
+};
+EXPECT_EQ(
+APInt(128, 2, Data),
+APFloat::getLargest(APFloat::PPCDoubleDouble(), true).bitcastToAPInt());
+  }
+  {
+uint64_t Data[] = {
 0x8001ull, 0xull,
 };
 EXPECT_EQ(APInt(128, 2, Data),
   APFloat::getSmallest(APFloat::PPCDoubleDouble(), true)
   .bitcastToAPInt());
   }
-
-  EXPECT_EQ(0x8360ull,
-APFloat::getSmallestNormalized(APFloat::PPCDoubleDouble(), true)
-.bitcastToAPInt()
-.getRawData()[0]);
-  EXPECT_EQ(0xull,
-APFloat::getSmallestNormalized(APFloat::PPCDoubleDouble(), true)
-

[PATCH] D23325: [WIP] Binding of references to packed fields

2016-12-19 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: include/clang/AST/Decl.h:2388
+  /// its alignment is smaller than the alignment of its field type.
+  bool isPackedField(const ASTContext& context) const;
+

Should be `` instead of `& context`.



Comment at: include/clang/AST/Expr.h:412
 
+  /// States that this object is ordinary, packed field or bitfield
   bool isOrdinaryOrBitFieldObject() const {

bit-field instead of bitfield (we're starting to standardize on the spelling 
used by the standards).



Comment at: include/clang/AST/Expr.h:432
   ///
-  /// In C++, whether a gl-value refers to a bitfield is essentially
+  /// In C++, whether a glvalue refers to a itfield is essentially
   /// an aspect of the value-kind type system.

typo: bit-field.



Comment at: include/clang/AST/Expr.h:440
+  ///
+  /// Like bitfields, we model glvalues referring to packed fields as
+  /// an aspect of the object kind type system.

s/bitfields/bit-fields



Comment at: include/clang/Basic/Specifiers.h:126
 
+/// A packed-field is a field on a C or C++ packed record.
+OK_PackedField,

Remove the hyphen from packed-field.



Comment at: lib/Sema/SemaInit.cpp:4459
+if (RefRelationship == Sema::Ref_Compatible)
+{
+  if (Initializer->refersToPackedField()) {

Move the brace to the preceding line.


https://reviews.llvm.org/D23325



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


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

2016-12-19 Thread Tim Shen via Phabricator via cfe-commits
timshen updated this revision to Diff 81980.
timshen added a comment.

Remove 'else' after return.
Remove 'return' on void type.


https://reviews.llvm.org/D27872

Files:
  clang/test/CodeGen/ppc64-complex-parms.c
  llvm/include/llvm/ADT/APFloat.h
  llvm/lib/Support/APFloat.cpp
  llvm/test/CodeGen/PowerPC/fp128-bitcast-after-operation.ll
  llvm/unittests/ADT/APFloatTest.cpp

Index: llvm/unittests/ADT/APFloatTest.cpp
===
--- llvm/unittests/ADT/APFloatTest.cpp
+++ llvm/unittests/ADT/APFloatTest.cpp
@@ -9,6 +9,7 @@
 
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APSInt.h"
+#include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"
@@ -3262,7 +3263,7 @@
 << formatv("({0:x} + {1:x}) + ({2:x} + {3:x})", Op1[0], Op1[1], Op2[0],
Op2[1])
.str();
-EXPECT_EQ(Expected[1], A1.getSecondFloat().bitcastToAPInt().getRawData()[0])
+EXPECT_EQ(Expected[1], A1.bitcastToAPInt().getRawData()[1])
 << formatv("({0:x} + {1:x}) + ({2:x} + {3:x})", Op1[0], Op1[1], Op2[0],
Op2[1])
.str();
@@ -3296,7 +3297,7 @@
 << formatv("({0:x} + {1:x}) - ({2:x} + {3:x})", Op1[0], Op1[1], Op2[0],
Op2[1])
.str();
-EXPECT_EQ(Expected[1], A1.getSecondFloat().bitcastToAPInt().getRawData()[0])
+EXPECT_EQ(Expected[1], A1.bitcastToAPInt().getRawData()[1])
 << formatv("({0:x} + {1:x}) - ({2:x} + {3:x})", Op1[0], Op1[1], Op2[0],
Op2[1])
.str();
@@ -3496,12 +3497,53 @@
 APFloat A1(APFloat::PPCDoubleDouble(), APInt(128, 2, Op1));
 APFloat A2(APFloat::PPCDoubleDouble(), APInt(128, 2, Op2));
 EXPECT_EQ(Expected, A1.compare(A2))
-<< formatv("({0:x} + {1:x}) - ({2:x} + {3:x})", Op1[0], Op1[1], Op2[0],
+<< formatv("compare(({0:x} + {1:x}), ({2:x} + {3:x}))", Op1[0], Op1[1],
+   Op2[0], Op2[1])
+   .str();
+  }
+}
+
+TEST(APFloatTest, PPCDoubleDoubleBitwiseIsEqual) {
+  using DataType = std::tuple;
+
+  DataType Data[] = {
+  // (1 + 0) = (1 + 0)
+  std::make_tuple(0x3ff0ull, 0, 0x3ff0ull, 0, true),
+  // (1 + 0) != (1.00...1 + 0)
+  std::make_tuple(0x3ff0ull, 0, 0x3ff1ull, 0,
+  false),
+  // NaN = NaN
+  std::make_tuple(0x7ff8ull, 0, 0x7ff8ull, 0, true),
+  // NaN != NaN with a different bit pattern
+  std::make_tuple(0x7ff8ull, 0, 0x7ff8ull,
+  0x3ff0ull, false),
+  // Inf = Inf
+  std::make_tuple(0x7ff0ull, 0, 0x7ff0ull, 0, true),
+  };
+
+  for (auto Tp : Data) {
+uint64_t Op1[2], Op2[2];
+bool Expected;
+std::tie(Op1[0], Op1[1], Op2[0], Op2[1], Expected) = Tp;
+
+APFloat A1(APFloat::PPCDoubleDouble(), APInt(128, 2, Op1));
+APFloat A2(APFloat::PPCDoubleDouble(), APInt(128, 2, Op2));
+EXPECT_EQ(Expected, A1.bitwiseIsEqual(A2))
+<< formatv("({0:x} + {1:x}) = ({2:x} + {3:x})", Op1[0], Op1[1], Op2[0],
Op2[1])
.str();
   }
 }
 
+TEST(APFloatTest, PPCDoubleDoubleHashValue) {
+  uint64_t Data1[] = {0x3ff1ull, 0x0001ull};
+  uint64_t Data2[] = {0x3ff1ull, 0};
+  // The hash values are *hopefully* different.
+  EXPECT_NE(
+  hash_value(APFloat(APFloat::PPCDoubleDouble(), APInt(128, 2, Data1))),
+  hash_value(APFloat(APFloat::PPCDoubleDouble(), APInt(128, 2, Data2;
+}
+
 TEST(APFloatTest, PPCDoubleDoubleChangeSign) {
   uint64_t Data[] = {
   0x400full, 0xbcb0ull,
@@ -3531,6 +3573,13 @@
   }
   {
 uint64_t Data[] = {
+0x7fefull, 0x7c8eull,
+};
+EXPECT_EQ(APInt(128, 2, Data),
+  APFloat::getLargest(APFloat::PPCDoubleDouble()).bitcastToAPInt());
+  }
+  {
+uint64_t Data[] = {
 0x0001ull, 0,
 };
 EXPECT_EQ(
@@ -3553,24 +3602,72 @@
   }
   {
 uint64_t Data[] = {
+0xffefull, 0xfc8eull,
+};
+EXPECT_EQ(
+APInt(128, 2, Data),
+APFloat::getLargest(APFloat::PPCDoubleDouble(), true).bitcastToAPInt());
+  }
+  {
+uint64_t Data[] = {
 0x8001ull, 0xull,
 };
 EXPECT_EQ(APInt(128, 2, Data),
   APFloat::getSmallest(APFloat::PPCDoubleDouble(), true)
   .bitcastToAPInt());
   }
-
-  EXPECT_EQ(0x8360ull,
-APFloat::getSmallestNormalized(APFloat::PPCDoubleDouble(), true)
-.bitcastToAPInt()
-.getRawData()[0]);
-  EXPECT_EQ(0xull,
-APFloat::getSmallestNormalized(APFloat::PPCDoubleDouble(), true)
- 

[PATCH] D27410: Always issue vtables when generating coverage instrumentation

2016-12-19 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added inline comments.



Comment at: llvm/tools/clang/test/CodeGenCXX/vtable-coverage-gen.cpp:3
+// RUN: FileCheck %s < %t 
+// CHECK: @_ZTV8Category = linkonce_odr unnamed_addr constant {{.*}}, comdat,
+

vsk wrote:
> ahatanak wrote:
> > I'm not sure I understood the purpose of this test, but It looks like the 
> > vtable for Category is generated in the IR with linkonce_odr without your 
> > patch.
> Yes, I'm seeing the same thing and am also confused. I can reproduce the 
> build failure without using any vtables. To me this suggests the problem 
> could be elsewhere. Here is a minimal reproducer:
> 
> ```
> struct Base {
>   static const Base *get();
> };
> 
> struct Derived : public Base {};
> 
> const Base *Base::get() {
>   static Derived d;
>   return 
> }
> 
> int main() { return 0; }
> ```
^ Please ignore my last comment, I made a mistake while trying to compile your 
reproducer. When I used a proper compile command, I could not reproduce the 
build failure on Darwin/MachO (-fprofile-instr-generate -fcoverage-mapping).


https://reviews.llvm.org/D27410



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


Re: [PATCH] D27180: Testbed and skeleton of a new expression parser

2016-12-19 Thread Sean Callanan via cfe-commits
Reverted by 290130.  I have new comments from Aleksei in 
https://reviews.llvm.org/D27180 .  I'll apply 
those and update the patch. 

Sean

> On Dec 19, 2016, at 9:48 AM, Sean Callanan  wrote:
> 
> David,
> 
> thanks for keeping an eye on this and sorry for the breach of process.
> Would having Vassil approve the changelist (https://reviews.llvm.org/D27180 
> ) be appropriate?
> Let's say if he has any concerns or can't get to it by tomorrow, we revert my 
> patches since they're pretty self-contained.
> 
> Sean
> 
>> On Dec 19, 2016, at 8:55 AM, David Blaikie > > wrote:
>> 
>> 
>> 
>> On Thu, Dec 15, 2016 at 2:18 PM Sean Callanan via Phabricator via 
>> cfe-commits > 
>> wrote:
>> spyffe updated this revision to Diff 81661.
>> spyffe marked 2 inline comments as done.
>> spyffe added a comment.
>> Herald added a subscriber: jgosnell.
>> 
>> Applied Vassil and Vedant's comments.  I will commit this soon.
>> 
>> Was this change approved/accepted by anyone? "commit if no one has 
>> objections in " isn't generally how LLVM project changes are 
>> reviewed/committed.
>>  
>> 
>> 
>> Repository:
>>   rL LLVM
>> 
>> https://reviews.llvm.org/D27180 
>> 
>> Files:
>>   test/Import/clang-flags/Inputs/S.c
>>   test/Import/clang-flags/test.c
>>   test/Import/empty-struct/Inputs/S.c
>>   test/Import/empty-struct/test.c
>>   test/Import/error-in-expression/Inputs/S.c
>>   test/Import/error-in-expression/test.c
>>   test/Import/error-in-import/Inputs/S.c
>>   test/Import/error-in-import/test.c
>>   test/Import/missing-import/test.c
>>   tools/CMakeLists.txt
>>   tools/clang-import-test/CMakeLists.txt
>>   tools/clang-import-test/clang-import-test.cpp
>> 
>> ___
>> 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


r290130 - Reverting r290004, r290006, r290010 pending review.

2016-12-19 Thread Sean Callanan via cfe-commits
Author: spyffe
Date: Mon Dec 19 13:15:43 2016
New Revision: 290130

URL: http://llvm.org/viewvc/llvm-project?rev=290130=rev
Log:
Reverting r290004, r290006, r290010 pending review.

Removed:
cfe/trunk/test/Import/
cfe/trunk/tools/clang-import-test/
Modified:
cfe/trunk/test/CMakeLists.txt
cfe/trunk/tools/CMakeLists.txt

Modified: cfe/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=290130=290129=290130=diff
==
--- cfe/trunk/test/CMakeLists.txt (original)
+++ cfe/trunk/test/CMakeLists.txt Mon Dec 19 13:15:43 2016
@@ -39,7 +39,6 @@ list(APPEND CLANG_TEST_DEPS
   c-index-test diagtool
   clang-tblgen
   clang-offload-bundler
-  clang-import-test
   )
   
 if(CLANG_ENABLE_STATIC_ANALYZER)

Modified: cfe/trunk/tools/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CMakeLists.txt?rev=290130=290129=290130=diff
==
--- cfe/trunk/tools/CMakeLists.txt (original)
+++ cfe/trunk/tools/CMakeLists.txt Mon Dec 19 13:15:43 2016
@@ -5,7 +5,6 @@ add_clang_subdirectory(driver)
 add_clang_subdirectory(clang-format)
 add_clang_subdirectory(clang-format-vs)
 add_clang_subdirectory(clang-fuzzer)
-add_clang_subdirectory(clang-import-test)
 add_clang_subdirectory(clang-offload-bundler)
 
 add_clang_subdirectory(c-index-test)


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


[PATCH] D27794: Make some diagnostic tests C++11 clean

2016-12-19 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a reviewer: rnk.
probinson updated this revision to Diff 81977.
probinson added a comment.

Remove the OpenMP tests from this review (committed in r290128).

+rnk who added test/Parser/backtrack-off-by-one.cpp originally.


https://reviews.llvm.org/D27794

Files:
  test/FixIt/fixit.cpp
  test/Parser/backtrack-off-by-one.cpp
  test/SemaCXX/copy-assignment.cpp

Index: test/SemaCXX/copy-assignment.cpp
===
--- test/SemaCXX/copy-assignment.cpp
+++ test/SemaCXX/copy-assignment.cpp
@@ -1,12 +1,22 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s 
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+
+#if __cplusplus >= 201103L
+// expected-note@+3 2 {{candidate constructor}}
+// expected-note@+2 {{passing argument to parameter here}}
+#endif
 struct A {
 };
 
 struct ConvertibleToA {
   operator A();
 };
 
 struct ConvertibleToConstA {
+#if __cplusplus >= 201103L
+// expected-note@+2 {{candidate function}}
+#endif
   operator const A();
 };
 
@@ -69,6 +79,9 @@
   na = a;
   na = constA;
   na = convertibleToA;
+#if __cplusplus >= 201103L
+// expected-error@+2 {{no viable conversion}}
+#endif
   na = convertibleToConstA;
   na += a; // expected-error{{no viable overloaded '+='}}
 
Index: test/Parser/backtrack-off-by-one.cpp
===
--- test/Parser/backtrack-off-by-one.cpp
+++ test/Parser/backtrack-off-by-one.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -verify %s
+// RUN: %clang_cc1 -verify %s -std=c++98
+// RUN: %clang_cc1 -verify %s -std=c++11
 
 // PR25946
 // We had an off-by-one error in an assertion when annotating A below.  Our
@@ -10,8 +12,10 @@
 
 // expected-error@+1 {{expected '{' after base class list}}
 template  class B : T // not ',' or '{'
-// expected-error@+3 {{C++ requires a type specifier for all declarations}}
-// expected-error@+2 {{expected ';' after top level declarator}}
+#if __cplusplus < 201103L
+// expected-error@+4 {{expected ';' after top level declarator}}
+#endif
+// expected-error@+2 {{C++ requires a type specifier for all declarations}}
 // expected-error@+1 {{expected ';' after class}}
 A {
 };
Index: test/FixIt/fixit.cpp
===
--- test/FixIt/fixit.cpp
+++ test/FixIt/fixit.cpp
@@ -1,8 +1,12 @@
-// RUN: %clang_cc1 -pedantic -Wall -Wno-comment -verify -fcxx-exceptions -x c++ %s
+// RUN: %clang_cc1 -pedantic -Wall -Wno-comment -verify -fcxx-exceptions -x c++ -std=c++98 %s
+// RUN: cp %s %t-98
+// RUN: not %clang_cc1 -pedantic -Wall -Wno-comment -fcxx-exceptions -fixit -x c++ -std=c++98 %t-98
+// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -Wno-comment -fcxx-exceptions -x c++ -std=c++98 %t-98
 // RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -x c++ -std=c++11 %s 2>&1 | FileCheck %s
-// RUN: cp %s %t
-// RUN: not %clang_cc1 -pedantic -Wall -Wno-comment -fcxx-exceptions -fixit -x c++ %t
-// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -Wno-comment -fcxx-exceptions -x c++ %t
+// RUN: %clang_cc1 -pedantic -Wall -Wno-comment -verify -fcxx-exceptions -x c++ -std=c++11 %s
+// RUN: cp %s %t-11
+// RUN: not %clang_cc1 -pedantic -Wall -Wno-comment -fcxx-exceptions -fixit -x c++ -std=c++11 %t-11
+// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -Wno-comment -fcxx-exceptions -x c++ -std=c++11 %t-11
 
 /* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
@@ -21,7 +25,10 @@
 
 template struct CT { template struct Inner; }; // expected-note{{previous use is here}}
 
+// In C++11 this gets 'expected unqualified-id' which fixit can't fix.
+#if __cplusplus < 201103L
 CT<10 >> 2> ct; // expected-warning{{require parentheses}}
+#endif
 
 class C3 {
 public:
@@ -41,7 +48,11 @@
 };
 
 class B : public A {
+#if __cplusplus >= 201103L
+  A::foo; // expected-error{{ISO C++11 does not allow access declarations}}
+#else
   A::foo; // expected-warning{{access declarations are deprecated}}
+#endif
 };
 
 void f() throw(); // expected-note{{previous}}
@@ -285,8 +296,10 @@
 void (*p)() = ;
 (void)(==p); // expected-error {{use '> ='}}
 (void)(>=p); // expected-error {{use '> >'}}
+#if __cplusplus < 201103L
 (void)(>=p); // expected-error {{use '> >'}}
 (Shr)>>=p; // expected-error {{use '> >'}}
+#endif
 
 // FIXME: We correct this to ' > >= p;' not ' >>= p;'
 //(Shr)>>=p;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27410: Always issue vtables when generating coverage instrumentation

vsk added inline comments.



Comment at: llvm/tools/clang/test/CodeGenCXX/vtable-coverage-gen.cpp:3
+// RUN: FileCheck %s < %t 
+// CHECK: @_ZTV8Category = linkonce_odr unnamed_addr constant {{.*}}, comdat,
+

ahatanak wrote:
> I'm not sure I understood the purpose of this test, but It looks like the 
> vtable for Category is generated in the IR with linkonce_odr without your 
> patch.
Yes, I'm seeing the same thing and am also confused. I can reproduce the build 
failure without using any vtables. To me this suggests the problem could be 
elsewhere. Here is a minimal reproducer:

```
struct Base {
  static const Base *get();
};

struct Derived : public Base {};

const Base *Base::get() {
  static Derived d;
  return 
}

int main() { return 0; }
```


https://reviews.llvm.org/D27410



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


[PATCH] D27180: Testbed and skeleton of a new expression parser

a.sidorin added a comment.

Sorry for being late :(




Comment at: cfe/trunk/tools/clang-import-test/clang-import-test.cpp:99
+llvm::errs() << LineString << '\n';
+std::string Space(LocColumn, ' ');
+llvm::errs() << Space.c_str() << '\n';

I still think `indent()` method is more evident here and it doesn't require 
memory allocation.



Comment at: cfe/trunk/tools/clang-import-test/clang-import-test.cpp:125
+if (!Invalid) {
+  llvm::errs() << Ref.str() << '\n';
+}

No `str()` is needed here, `raw_ostream` works well even with non 
null-terminated StringRefs.



Comment at: cfe/trunk/tools/clang-import-test/clang-import-test.cpp:303
+  for (auto I : Imports) {
+  llvm::Expected ImportCI = Parse(I, 
{});
+  if (auto E = ImportCI.takeError()) {

Broken indentation.


Repository:
  rL LLVM

https://reviews.llvm.org/D27180



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


[PATCH] D26544: [PPC] support for arithmetic builtins in the FE

amehsan closed this revision.
amehsan added a comment.

https://reviews.llvm.org/rL287872


https://reviews.llvm.org/D26544



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


r290128 - Make a few OpenMP tests "C++11 clean."

Author: probinson
Date: Mon Dec 19 12:43:26 2016
New Revision: 290128

URL: http://llvm.org/viewvc/llvm-project?rev=290128=rev
Log:
Make a few OpenMP tests "C++11 clean."

This time trying to commit just the relevant 3 tests!
Reviewed by abataev (in D27794)


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

cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_collapse_messages.cpp

Modified: cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp?rev=290128=290127=290128=diff
==
--- cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp Mon Dec 19 
12:43:26 2016
@@ -1,8 +1,13 @@
 // RUN: %clang_cc1 -verify -fopenmp %s
+// RUN: %clang_cc1 -verify -fopenmp %s -std=c++98
+// RUN: %clang_cc1 -verify -fopenmp %s -std=c++11
 
 void foo() {
 }
 
+#if __cplusplus >= 201103L
+// expected-note@+2 4 {{declared here}}
+#endif
 bool foobool(int argc) {
   return argc;
 }
@@ -50,6 +55,9 @@ T tmain(T argc, S **argv) { //expected-n
   for (int i = ST; i < N; i++)
 argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 
for loops after '#pragma omp teams distribute', but found only 1}}
 
+#if __cplusplus >= 201103L
+// expected-note@+6 2 {{non-constexpr function 'foobool' cannot be used}}
+#endif
 // expected-error@+4 2 {{directive '#pragma omp teams distribute' cannot 
contain more than one 'collapse' clause}}
 // expected-error@+3 2 {{argument to 'collapse' clause must be a strictly 
positive integer value}}
 // expected-error@+2 2 {{expression is not an integral constant expression}}
@@ -62,7 +70,11 @@ T tmain(T argc, S **argv) { //expected-n
   for (int i = ST; i < N; i++)
 argv[0][i] = argv[0][i] - argv[0][i-ST];
 
-// expected-error@+2 2 {{expression is not an integral constant expression}}
+#if __cplusplus >= 201103L
+// expected-error@+5 2 {{integral constant expression must have integral or 
unscoped enumeration type}}
+#else
+// expected-error@+3 2 {{expression is not an integral constant expression}}
+#endif
 #pragma omp target
 #pragma omp teams distribute collapse (argv[1]=2) // expected-error {{expected 
')'}} expected-note {{to match this '('}}
   for (int i = ST; i < N; i++)
@@ -110,11 +122,17 @@ int main(int argc, char **argv) {
   for (int i = 4; i < 12; i++)
 argv[0][i] = argv[0][i] - argv[0][i-4]; // expected-error {{expected 4 for 
loops after '#pragma omp teams distribute', but found only 1}}
 
+#if __cplusplus >= 201103L
+// expected-note@+3 {{non-constexpr function 'foobool' cannot be used}}
+#endif
 #pragma omp target
 #pragma omp teams distribute collapse (foobool(1) > 0 ? 1 : 2) // 
expected-error {{expression is not an integral constant expression}}
   for (int i = 4; i < 12; i++)
 argv[0][i] = argv[0][i] - argv[0][i-4];
 
+#if __cplusplus >= 201103L
+// expected-note@+6 {{non-constexpr function 'foobool' cannot be used}}
+#endif
 // expected-error@+4 {{expression is not an integral constant expression}}
 // expected-error@+3 2 {{directive '#pragma omp teams distribute' cannot 
contain more than one 'collapse' clause}}
 // expected-error@+2 2 {{argument to 'collapse' clause must be a strictly 
positive integer value}}
@@ -128,7 +146,11 @@ int main(int argc, char **argv) {
   for (int i = 4; i < 12; i++)
 argv[0][i] = argv[0][i] - argv[0][i-4];
 
-// expected-error@+2 {{expression is not an integral constant expression}}
+#if __cplusplus >= 201103L
+// expected-error@+5 {{integral constant expression must have integral or 
unscoped enumeration type}}
+#else
+// expected-error@+3 {{expression is not an integral constant expression}}
+#endif
 #pragma omp target
 #pragma omp teams distribute collapse (argv[1]=2) // expected-error {{expected 
')'}} expected-note {{to match this '('}}
   for (int i = 4; i < 12; i++)

Modified: 
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_collapse_messages.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_collapse_messages.cpp?rev=290128=290127=290128=diff
==
--- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_collapse_messages.cpp 
(original)
+++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_collapse_messages.cpp 
Mon Dec 19 12:43:26 2016
@@ -1,8 +1,13 @@
 // RUN: %clang_cc1 -verify -fopenmp %s
+// RUN: %clang_cc1 -verify -fopenmp %s -std=c++98
+// RUN: %clang_cc1 -verify -fopenmp %s -std=c++11
 
 void foo() {
 }
 
+#if __cplusplus >= 201103L
+// expected-note@+2 4 {{declared here}}
+#endif
 bool foobool(int argc) {
   return argc;
 }
@@ -50,6 +55,9 @@ T tmain(T argc, S **argv) { //expected-n
   for (int i = ST; i < 

[PATCH] D27569: [OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand.

Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM! Thanks!


https://reviews.llvm.org/D27569



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


r290125 - Revert another accidental bit

Author: probinson
Date: Mon Dec 19 12:20:19 2016
New Revision: 290125

URL: http://llvm.org/viewvc/llvm-project?rev=290125=rev
Log:
Revert another accidental bit

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=290125=290124=290125=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Dec 19 12:20:19 2016
@@ -1570,8 +1570,6 @@ void CompilerInvocation::setLangDefaults
   break;
 case IK_CXX:
 case IK_PreprocessedCXX:
-  LangStd = LangStandard::lang_gnucxx11; // PTR
-  break;
 case IK_ObjCXX:
 case IK_PreprocessedObjCXX:
   LangStd = LangStandard::lang_gnucxx98;


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


[PATCH] D26964: Handle more declarations in DeclContextPrinter to fix -print-decl-contexts crashes

mehdi_amini accepted this revision.
mehdi_amini added a comment.
This revision is now accepted and ready to land.

Testing is in line with the existing testing.
It is not great, but at the same time is a development/debugging tool right?


Repository:
  rL LLVM

https://reviews.llvm.org/D26964



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


r290121 - Undo accidental comit

Author: probinson
Date: Mon Dec 19 12:00:45 2016
New Revision: 290121

URL: http://llvm.org/viewvc/llvm-project?rev=290121=rev
Log:
Undo accidental comit

Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp
cfe/trunk/test/CodeGenCXX/destructors.cpp
cfe/trunk/test/CodeGenCXX/global-init.cpp
cfe/trunk/test/CodeGenCXX/nrvo.cpp
cfe/trunk/test/CodeGenCXX/partial-destruction.cpp
cfe/trunk/test/CodeGenCXX/stack-reuse-miscompile.cpp
cfe/trunk/test/FixIt/fixit.cpp
cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_collapse_messages.cpp

cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_collapse_messages.cpp
cfe/trunk/test/Parser/backtrack-off-by-one.cpp
cfe/trunk/test/SemaCXX/copy-assignment.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=290121=290120=290121=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Dec 19 12:00:45 2016
@@ -1570,6 +1570,8 @@ void CompilerInvocation::setLangDefaults
   break;
 case IK_CXX:
 case IK_PreprocessedCXX:
+  LangStd = LangStandard::lang_gnucxx11; // PTR
+  break;
 case IK_ObjCXX:
 case IK_PreprocessedObjCXX:
   LangStd = LangStandard::lang_gnucxx98;

Modified: cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp?rev=290121=290120=290121=diff
==
--- cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp Mon Dec 19 12:00:45 2016
@@ -1,5 +1,4 @@
-// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage -std=c++03 | FileCheck %s 
-check-prefixes=CHECK,CHECKv03
-// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage -std=c++11 | FileCheck %s 
-check-prefixes=CHECK,CHECKv11
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage | FileCheck %s
 
 // This isn't really testing anything ARM-specific; it's just a convenient
 // 32-bit platform.
@@ -49,8 +48,7 @@ typedef struct {
 TEST(struct_1);
 // CHECK-LABEL: define {{.*}} @return_struct_1()
 // CHECK:   [[RET:%.*]] = alloca [[REC:%.*]], align 4
-// CHECKv03:   @llvm.memset
-// CHECKv11:   @llvm.memcpy
+// CHECK:   @llvm.memset
 // CHECK:   [[CAST_TMP:%.*]] = bitcast [[REC]]* [[RET]] to [[AGG:{ i32, \[2 x 
i8\], i8, \[1 x i8\], float, float }]]*
 // CHECK:   [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* 
[[CAST_TMP]], i32 0, i32 0
 // CHECK:   [[FIRST:%.*]] = load i32, i32* [[T0]], align 4

Modified: cfe/trunk/test/CodeGenCXX/destructors.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/destructors.cpp?rev=290121=290120=290121=diff
==
--- cfe/trunk/test/CodeGenCXX/destructors.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/destructors.cpp Mon Dec 19 12:00:45 2016
@@ -1,16 +1,11 @@
-// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - 
-mconstructor-aliases -fcxx-exceptions -fexceptions -O1 -disable-llvm-optzns 
-std=c++03 > %t
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - 
-mconstructor-aliases -fcxx-exceptions -fexceptions -O1 -disable-llvm-optzns > 
%t
 // RUN: FileCheck --check-prefix=CHECK1 --input-file=%t %s
 // RUN: FileCheck --check-prefix=CHECK2 --input-file=%t %s
 // RUN: FileCheck --check-prefix=CHECK3 --input-file=%t %s
-// RUN: FileCheck --check-prefixes=CHECK4,CHECK4v03 --input-file=%t %s
-// RUN: FileCheck --check-prefixes=CHECK5,CHECK5v03 --input-file=%t %s
-// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - 
-mconstructor-aliases -fcxx-exceptions -fexceptions -O1 -disable-llvm-optzns 
-std=c++11 > %t2
-// RUN: FileCheck --check-prefix=CHECK1--input-file=%t2 %s
-// RUN: FileCheck --check-prefix=CHECK2v11 --input-file=%t2 %s
-// RUN: FileCheck --check-prefix=CHECK3--input-file=%t2 %s
-// RUN: FileCheck --check-prefixes=CHECK4,CHECK4v11 --input-file=%t2 %s
-// RUN: FileCheck --check-prefixes=CHECK5,CHECK5v11 --input-file=%t2 %s
-// RUN: FileCheck --check-prefix=CHECK6--input-file=%t2 %s
+// RUN: FileCheck --check-prefix=CHECK4 --input-file=%t %s
+// RUN: FileCheck --check-prefix=CHECK5 --input-file=%t %s
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - 
-fcxx-exceptions -fexceptions -O1 -disable-llvm-optzns -std=c++11 > %t2
+// RUN: FileCheck --check-prefix=CHECK6 --input-file=%t2 %s
 // REQUIRES: asserts
 
 struct A {
@@ -103,12 +98,6 @@ namespace test0 {
 // CHECK2: invoke void 

[PATCH] D27815: [clang-tidy] Add obvious module for obvious bugs

aaron.ballman added a comment.

In https://reviews.llvm.org/D27815#626440, @Prazek wrote:

> The example of this kind of check is here:
>  https://reviews.llvm.org/D27806
>
> I am not sure if it make sense to put it as clang warning.
>
> After a little bit of thinking I guess name "typos" would be better, because 
> I want to look for checks that are mostly typos (which are obvious btw) but 
> it would make it more concrete.


When I hear "typo", I think "misspelling" and wonder how it differs from the 
typo correction that clang frontend has. I've usually heard of what your linked 
review covers as a "thinko" (https://en.wiktionary.org/wiki/thinko) because you 
made a logical mistake rather than a misspelling, but that's a pretty awful 
name for the module. ;-)

Perhaps "mistake-", "oops-", "derp-" or something along those lines (well, 
maybe not "derp")?


https://reviews.llvm.org/D27815



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


r290120 - Make a few OpenMP tests "C++11 clean."

Author: probinson
Date: Mon Dec 19 11:58:09 2016
New Revision: 290120

URL: http://llvm.org/viewvc/llvm-project?rev=290120=rev
Log:
Make a few OpenMP tests "C++11 clean."

Reviewed by abataev (in D27794)


Modified:
cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp
cfe/trunk/test/CodeGenCXX/destructors.cpp
cfe/trunk/test/CodeGenCXX/global-init.cpp
cfe/trunk/test/CodeGenCXX/nrvo.cpp
cfe/trunk/test/CodeGenCXX/partial-destruction.cpp
cfe/trunk/test/CodeGenCXX/stack-reuse-miscompile.cpp
cfe/trunk/test/FixIt/fixit.cpp
cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_collapse_messages.cpp

cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_collapse_messages.cpp
cfe/trunk/test/Parser/backtrack-off-by-one.cpp
cfe/trunk/test/SemaCXX/copy-assignment.cpp

Modified: cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp?rev=290120=290119=290120=diff
==
--- cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/arm-swiftcall.cpp Mon Dec 19 11:58:09 2016
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage | FileCheck %s
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage -std=c++03 | FileCheck %s 
-check-prefixes=CHECK,CHECKv03
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -o - %s 
-Wno-return-type-c-linkage -std=c++11 | FileCheck %s 
-check-prefixes=CHECK,CHECKv11
 
 // This isn't really testing anything ARM-specific; it's just a convenient
 // 32-bit platform.
@@ -48,7 +49,8 @@ typedef struct {
 TEST(struct_1);
 // CHECK-LABEL: define {{.*}} @return_struct_1()
 // CHECK:   [[RET:%.*]] = alloca [[REC:%.*]], align 4
-// CHECK:   @llvm.memset
+// CHECKv03:   @llvm.memset
+// CHECKv11:   @llvm.memcpy
 // CHECK:   [[CAST_TMP:%.*]] = bitcast [[REC]]* [[RET]] to [[AGG:{ i32, \[2 x 
i8\], i8, \[1 x i8\], float, float }]]*
 // CHECK:   [[T0:%.*]] = getelementptr inbounds [[AGG]], [[AGG]]* 
[[CAST_TMP]], i32 0, i32 0
 // CHECK:   [[FIRST:%.*]] = load i32, i32* [[T0]], align 4

Modified: cfe/trunk/test/CodeGenCXX/destructors.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/destructors.cpp?rev=290120=290119=290120=diff
==
--- cfe/trunk/test/CodeGenCXX/destructors.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/destructors.cpp Mon Dec 19 11:58:09 2016
@@ -1,11 +1,16 @@
-// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - 
-mconstructor-aliases -fcxx-exceptions -fexceptions -O1 -disable-llvm-optzns > 
%t
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - 
-mconstructor-aliases -fcxx-exceptions -fexceptions -O1 -disable-llvm-optzns 
-std=c++03 > %t
 // RUN: FileCheck --check-prefix=CHECK1 --input-file=%t %s
 // RUN: FileCheck --check-prefix=CHECK2 --input-file=%t %s
 // RUN: FileCheck --check-prefix=CHECK3 --input-file=%t %s
-// RUN: FileCheck --check-prefix=CHECK4 --input-file=%t %s
-// RUN: FileCheck --check-prefix=CHECK5 --input-file=%t %s
-// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - 
-fcxx-exceptions -fexceptions -O1 -disable-llvm-optzns -std=c++11 > %t2
-// RUN: FileCheck --check-prefix=CHECK6 --input-file=%t2 %s
+// RUN: FileCheck --check-prefixes=CHECK4,CHECK4v03 --input-file=%t %s
+// RUN: FileCheck --check-prefixes=CHECK5,CHECK5v03 --input-file=%t %s
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - 
-mconstructor-aliases -fcxx-exceptions -fexceptions -O1 -disable-llvm-optzns 
-std=c++11 > %t2
+// RUN: FileCheck --check-prefix=CHECK1--input-file=%t2 %s
+// RUN: FileCheck --check-prefix=CHECK2v11 --input-file=%t2 %s
+// RUN: FileCheck --check-prefix=CHECK3--input-file=%t2 %s
+// RUN: FileCheck --check-prefixes=CHECK4,CHECK4v11 --input-file=%t2 %s
+// RUN: FileCheck --check-prefixes=CHECK5,CHECK5v11 --input-file=%t2 %s
+// RUN: FileCheck --check-prefix=CHECK6--input-file=%t2 %s
 // REQUIRES: asserts
 
 struct A {
@@ -98,6 +103,12 @@ namespace test0 {
 // CHECK2: invoke void @_ZN5test04BaseD2Ev
 // CHECK2:   unwind label [[BASE_UNWIND:%[a-zA-Z0-9.]+]]
 
+// In C++11, the destructors are often known not to throw.
+// CHECK2v11-LABEL: @_ZN5test01AD1Ev = alias {{.*}} @_ZN5test01AD2Ev
+// CHECK2v11-LABEL: define void @_ZN5test01AD2Ev(%"struct.test0::A"* %this) 
unnamed_addr
+// CHECK2v11: call void @_ZN5test06MemberD1Ev
+// CHECK2v11: call void @_ZN5test04BaseD2Ev
+
   struct B : Base, virtual VBase {
 Member M;
 ~B();
@@ -111,6 +122,10 @@ namespace test0 {
 // CHECK2: invoke void @_ZN5test04BaseD2Ev
 // CHECK2:   unwind label [[BASE_UNWIND:%[a-zA-Z0-9.]+]]
 
+// CHECK2v11-LABEL: define void @_ZN5test01BD2Ev(%"struct.test0::B"* %this, 
i8** 

[PATCH] D27806: [clang-tidy] Add obvious-invalid-range

aaron.ballman added inline comments.



Comment at: clang-tidy/obvious/InvalidRangeCheck.cpp:20-36
+"std::for_each; std::find; std::find_if; std::find_end; "
+"std::find_first_of; std::adjacent_find; std::count; std::count_if;"
+"std::mismatch; std::equal; std::search; std::copy; "
+"std::copy_backward; std::swap_ranges; std::transform; std::replace"
+"std::replace_if; std::replace_copy; std::replace_copy_if; std::fill; "
+"std::fill_n; std::generate; std::generate_n; std::remove; std::remove_if"
+"std::remove_copy; std::remove_copy_if; std::unique; std::unique_copy;"

Prazek wrote:
> Prazek wrote:
> > sbarzowski wrote:
> > > Prazek wrote:
> > > > sbarzowski wrote:
> > > > > I would go with one per line. It will be much more diff-friendly this 
> > > > > way.  And also much easier to add stuff in the middle and maybe keep 
> > > > > it sorted. 
> > > > I don't expect this list to change in any way in the future, and it 
> > > > already take more than 20 lines. I don't want to put about 80 lines 
> > > > only to define the names
> > > Ok, I don't think it's important enough to argue about it if it was your 
> > > deliberate decision.
> > > 
> > > But I still think your argument is invalid :-). If anything that calls 
> > > for putting it in a separate file.
> > By moving it to another file I would expose it to other checks, which is 
> > not my intention.
> > I also want to keep this simple and short, and by making this list less 
> > readable (which is not something that some next developer should care 
> > about) I make the whole file more readable, because it is shorter.
> ok I think I will remove the list and instead will check if the name starts 
> with std::, because if someone calls std::.
You should check if the canonical name starts with `::std::`, otherwise you may 
run into issues with:
```
namespace my {
namespace std {
 // bad code goes here
}
}
```


https://reviews.llvm.org/D27806



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


Re: [PATCH] D27180: Testbed and skeleton of a new expression parser

David,

thanks for keeping an eye on this and sorry for the breach of process.
Would having Vassil approve the changelist (https://reviews.llvm.org/D27180 
) be appropriate?
Let's say if he has any concerns or can't get to it by tomorrow, we revert my 
patches since they're pretty self-contained.

Sean

> On Dec 19, 2016, at 8:55 AM, David Blaikie  wrote:
> 
> 
> 
> On Thu, Dec 15, 2016 at 2:18 PM Sean Callanan via Phabricator via cfe-commits 
> > wrote:
> spyffe updated this revision to Diff 81661.
> spyffe marked 2 inline comments as done.
> spyffe added a comment.
> Herald added a subscriber: jgosnell.
> 
> Applied Vassil and Vedant's comments.  I will commit this soon.
> 
> Was this change approved/accepted by anyone? "commit if no one has objections 
> in " isn't generally how LLVM project changes are 
> reviewed/committed.
>  
> 
> 
> Repository:
>   rL LLVM
> 
> https://reviews.llvm.org/D27180 
> 
> Files:
>   test/Import/clang-flags/Inputs/S.c
>   test/Import/clang-flags/test.c
>   test/Import/empty-struct/Inputs/S.c
>   test/Import/empty-struct/test.c
>   test/Import/error-in-expression/Inputs/S.c
>   test/Import/error-in-expression/test.c
>   test/Import/error-in-import/Inputs/S.c
>   test/Import/error-in-import/test.c
>   test/Import/missing-import/test.c
>   tools/CMakeLists.txt
>   tools/clang-import-test/CMakeLists.txt
>   tools/clang-import-test/clang-import-test.cpp
> 
> ___
> 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] D27683: Prepare PrettyStackTrace for LLDB adoption

That would require making LLDB crash and collecting the relevant crash log data 
out of the user's own logs.  This isn't impossible – but additionally the 
generation of that log is asynchronous and you don't quite know when it'll land.
Would you be all right with a more restricted macOS-only unit test where we 
check that __crashreporter_info__ contains what we think it does?  That won't 
check end-to-end but at least it'll give us some confidence that things are 
sane.

Sean

> On Dec 19, 2016, at 9:01 AM, David Blaikie  wrote:
> 
> Test coverage?
> 
> On Tue, Dec 13, 2016 at 2:39 PM Sean Callanan via Phabricator via cfe-commits 
> > wrote:
> spyffe retitled this revision from "Fix the linkage for __crashtracer_info__" 
> to "Prepare PrettyStackTrace for LLDB adoption".
> spyffe updated the summary for this revision.
> spyffe updated this revision to Diff 81304.
> 
> Repository:
>   rL LLVM
> 
> https://reviews.llvm.org/D27683 
> 
> Files:
>   include/llvm/Support/PrettyStackTrace.h
>   lib/Support/PrettyStackTrace.cpp
> 
> 
> Index: lib/Support/PrettyStackTrace.cpp
> ===
> --- lib/Support/PrettyStackTrace.cpp
> +++ lib/Support/PrettyStackTrace.cpp
> @@ -89,7 +89,7 @@
>  = { CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0 };
>  }
>  #elif defined (__APPLE__) && HAVE_CRASHREPORTER_INFO
> -static const char *__crashreporter_info__ = 0;
> +extern "C" const char *__crashreporter_info__ 
> __attribute__((visibility("hidden"))) = 0;
>  asm(".desc ___crashreporter_info__, 0x10");
>  #endif
> 
> @@ -145,6 +145,28 @@
>OS << Str << "\n";
>  }
> 
> +PrettyStackTraceFormat::PrettyStackTraceFormat(const char *format, ...) {
> +  va_list ap;
> +
> +  va_start(ap, format);
> +  const int size_or_error = vsnprintf(nullptr, 0, format, ap);
> +  va_end(ap);
> +
> +  if (size_or_error < 0) {
> +return;
> +  }
> +
> +  const int size = size_or_error + 1; // '\0'
> +
> +  Str.resize(size);
> +
> +  va_start(ap, format);
> +  vsnprintf(Str.data(), size, format, ap);
> +  va_end(ap);
> +}
> +
> +void PrettyStackTraceFormat::print(raw_ostream ) const { OS << Str << 
> "\n"; }
> +
>  void PrettyStackTraceProgram::print(raw_ostream ) const {
>OS << "Program arguments: ";
>// Print the argument list.
> Index: include/llvm/Support/PrettyStackTrace.h
> ===
> --- include/llvm/Support/PrettyStackTrace.h
> +++ include/llvm/Support/PrettyStackTrace.h
> @@ -16,6 +16,7 @@
>  #ifndef LLVM_SUPPORT_PRETTYSTACKTRACE_H
>  #define LLVM_SUPPORT_PRETTYSTACKTRACE_H
> 
> +#include "llvm/ADT/SmallVector.h"
>  #include "llvm/Support/Compiler.h"
> 
>  namespace llvm {
> @@ -55,6 +56,16 @@
>  void print(raw_ostream ) const override;
>};
> 
> +  /// PrettyStackTraceFormat - This object prints a string (which may use
> +  /// printf-style formatting but should not contain newlines) to the stream
> +  /// as the stack trace when a crash occurs.
> +  class PrettyStackTraceFormat : public PrettyStackTraceEntry {
> +llvm::SmallVector Str;
> +  public:
> +PrettyStackTraceFormat(const char *format, ...);
> +void print(raw_ostream ) const override;
> +  };
> +
>/// PrettyStackTraceProgram - This object prints a specified program 
> arguments
>/// to the stream as the stack trace when a crash occurs.
>class PrettyStackTraceProgram : public PrettyStackTraceEntry {
> 
> 
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org 
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits 
> 

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


[PATCH] D26454: Implement no_sanitize_address for global vars

dougk added a comment.

I think it probably works to have the attribute appertain to any sanitizer.  I 
did not know that it did, so I conservatively assumed that it didn't.  I'll go 
ahead and make things consistent, and confirm that it dtrt.


https://reviews.llvm.org/D26454



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


Re: [PATCH] D23921: Remove va_start diagnostic false positive with enumerations

On Fri, Dec 16, 2016 at 7:00 AM, Attila Török via Phabricator
 wrote:
> torokati44 added a comment.
>
> I see this has been reverted in r281612, but I can no longer access the build 
> log serving as a reason linked in the message: 
> https://www.mail-archive.com/cfe-commits@lists.llvm.org/msg35386.html
> We have a few false-positive warnings that (I think) would be silenced by 
> this change. I'm just wondering if something like this, if not this, could be 
> included anyway? Not critical of course, it just would be nice.

This patch was reapplied in r281632:

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160912/170772.html

Do you still have false positives even with that applied?

Thanks!

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


[PATCH] D21298: [Clang-tidy] delete null check

aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM, with one nit. You should wait for @alexfh to sign off before committing 
though, since he requested changes.




Comment at: clang-tidy/readability/DeleteNullPointerCheck.cpp:53
+  "'if' statement is unnecessary; deleting null pointer has no effect");
+  if (IfWithDelete->getElse()) {
+return;

Elide the braces.


https://reviews.llvm.org/D21298



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


Re: [PATCH] D27180: Testbed and skeleton of a new expression parser


On 19/12/16 17:55, David Blaikie wrote:



On Thu, Dec 15, 2016 at 2:18 PM Sean Callanan via Phabricator via 
cfe-commits > wrote:


spyffe updated this revision to Diff 81661.
spyffe marked 2 inline comments as done.
spyffe added a comment.
Herald added a subscriber: jgosnell.

Applied Vassil and Vedant's comments.  I will commit this soon.


Was this change approved/accepted by anyone? "commit if no one has 
objections in " isn't generally how LLVM project changes 
are reviewed/committed.
I could have greenlit this (as I personally pinged Sean on this patch. I 
need some of it to make progress on the libInterpreter part) :(




Repository:
  rL LLVM

https://reviews.llvm.org/D27180

Files:
  test/Import/clang-flags/Inputs/S.c
  test/Import/clang-flags/test.c
  test/Import/empty-struct/Inputs/S.c
  test/Import/empty-struct/test.c
  test/Import/error-in-expression/Inputs/S.c
  test/Import/error-in-expression/test.c
  test/Import/error-in-import/Inputs/S.c
  test/Import/error-in-import/test.c
  test/Import/missing-import/test.c
  tools/CMakeLists.txt
  tools/clang-import-test/CMakeLists.txt
  tools/clang-import-test/clang-import-test.cpp

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



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


[PATCH] D26750: [clang-tidy] Add modernize-use-default-member-init check

aaron.ballman added inline comments.



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:33-34
+  case Type::STK_Floating:
+  case Type::STK_IntegralComplex:
+  case Type::STK_FloatingComplex:
+return "0.0";

Do these require a literal suffix to avoid conversion?



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:62
+  auto *UnaryOp = dyn_cast(E);
+  if (UnaryOp && UnaryOp->getOpcode() == UO_Plus) {
+return UnaryOp->getSubExpr();

Elide braces.



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:70
+  auto *InitList = dyn_cast(E);
+  if (InitList && InitList->getNumInits() == 1) {
+return InitList->getInit(0);

Elide braces.



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:77-78
+static bool sameValue(const Expr *E1, const Expr *E2) {
+  E1 = ignoreUnaryPlus(getInitializer(E1->IgnoreImpCasts()));
+  E2 = ignoreUnaryPlus(getInitializer(E2->IgnoreImpCasts()));
+

Do you also want to ignore paren expressions?



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:80
+
+  if (isZero(E1) && isZero(E2)) {
+return true;

Elide braces (same elsewhere).



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:103
+return cast(E1)->getDecl() == 
cast(E2)->getDecl();
+  default:
+break;

Perhaps character and string literals as well?



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:106
+  }
+  return false;
+}

Hoist this into the `default` case and put an `llvm_unreachable()` instead?



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:119
+
+AST_MATCHER(FieldDecl, hasInClassInitializer) {
+  return Node.hasInClassInitializer();

This would be useful as a public matcher, I think. Fine to do in a follow-up 
patch if you prefer.



Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:123
+
+void UseDefaultMemberInitCheck::registerMatchers(MatchFinder *Finder) {
+  auto Init =

This check should not register matchers for C++ < 11.



Comment at: docs/clang-tidy/checks/modernize-use-default-member-init.rst:6
+
+This check converts a default constructor's member initializers into default
+member initializers. Other member initializers that match the default

You should mention that the check does nothing in versions older than C++11.



Comment at: docs/clang-tidy/checks/modernize-use-default-member-init.rst:30
+.. note::
+  Only converts member initializers for built-in types, enums and pointers.
+  The `readability-redundant-member-init` check will remove redundant member

"enums, and pointers", because Oxford commas are the best commas. ;-)


https://reviews.llvm.org/D26750



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


Re: [PATCH] D27763: Debug Info: Modified DIBuilder::createCompileUnit() to take DIFile instead of FileName and Directory. (Clang part)

Ah, sure - no worries. Good to mention/link to the other change, etc, in
the future. (if the changes on the clang side are trivial enough to not
need review, may not need to send them out for review either - or could
include them as an addendum to the llvm change ("oh, and here's what it
looks like in terms of client (clang) changes" sort of thing) - either in
comments, as a link to a review that doesn't have other subscribers (so it
doesn't go to cfe-commits), or as an attached patch to the llvm review, etc)

On Mon, Dec 19, 2016 at 9:05 AM Aboud, Amjad  wrote:

> It was approved by Reid.
>
> This patch had two parts, he did not stamp the change in Clang, but he did
> stamp the change for LLVM.
>
> https://reviews.llvm.org/D27762
>
>
>
> I assumed that this means a green light to commit.
>
> Did I misinterpret the rules?
>
>
>
> Thanks,
>
> Amjad
>
>
>
> *From:* David Blaikie [mailto:dblai...@gmail.com]
> *Sent:* Monday, December 19, 2016 19:00
> *To:* reviews+d27763+public+4530ee00cad28...@reviews.llvm.org; Amjad
> Aboud via Phabricator ; Aboud, Amjad <
> amjad.ab...@intel.com>; r...@google.com
> *Cc:* cfe-commits@lists.llvm.org
> *Subject:* Re: [PATCH] D27763: Debug Info: Modified
> DIBuilder::createCompileUnit() to take DIFile instead of FileName and
> Directory. (Clang part)
>
>
>
> Was this change approved by anyone? Generally once it's sent for review,
> you should wait until it's approved before committing (the assumption
> being, if you sent it for review it's because it needed review)
>
>
>
> On Wed, Dec 14, 2016 at 12:49 PM Amjad Aboud via Phabricator via
> cfe-commits  wrote:
>
> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL289701: [DebugInfo] Changed
> DIBuilder::createCompileUnit() to take DIFile instead of… (authored by
> aaboud).
>
> Changed prior to commit:
>   https://reviews.llvm.org/D27763?vs=81397=81438#toc
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D27763
>
> Files:
>   cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>
>
> Index: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> ===
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> @@ -466,7 +466,8 @@
>// Create new compile unit.
>// FIXME - Eliminate TheCU.
>TheCU = DBuilder.createCompileUnit(
> -  LangTag, remapDIPath(MainFileName),
> remapDIPath(getCurrentDirname()),
> +  LangTag, DBuilder.createFile(remapDIPath(MainFileName),
> +remapDIPath(getCurrentDirname())),
>Producer, LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags,
> RuntimeVers,
>CGM.getCodeGenOpts().SplitDwarfFile, EmissionKind, 0 /* DWOid */,
>CGM.getCodeGenOpts().SplitDwarfInlining);
> @@ -1977,10 +1978,11 @@
>  // but LLVM detects skeleton CUs by looking for a non-zero DWO id.
>  uint64_t Signature = Mod.getSignature() ? Mod.getSignature() : ~1ULL;
>  llvm::DIBuilder DIB(CGM.getModule());
> -DIB.createCompileUnit(TheCU->getSourceLanguage(), Mod.getModuleName(),
> -  Mod.getPath(), TheCU->getProducer(), true,
> -  StringRef(), 0, Mod.getASTFile(),
> -  llvm::DICompileUnit::FullDebug, Signature);
> +DIB.createCompileUnit(TheCU->getSourceLanguage(),
> +  DIB.createFile(Mod.getModuleName(),
> Mod.getPath()),
> +  TheCU->getProducer(), true, StringRef(), 0,
> +  Mod.getASTFile(),
> llvm::DICompileUnit::FullDebug,
> +  Signature);
>  DIB.finalize();
>}
>llvm::DIModule *Parent =
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
> -
> Intel Israel (74) Limited
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name

firolino updated this revision to Diff 81964.
firolino added a comment.

Added support for new test cases:

  int S::*mdpa1[2] = {::a, ::a}, var1 = 0;
  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration statement can be split
  // CHECK-FIXES: {{^}}int S::*mdpa1[2] = {::a, ::a};
  // CHECK-FIXES: {{^}}int var1 = 0;
  
  int S :: * * mdpa2[2] = {, }, var2 = 0;
  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration statement can be split
  // CHECK-FIXES: {{^}}int S :: * * mdpa2[2] = {, };
  // CHECK-FIXES: {{^}}int var2 = 0;
  
  void (S::*mdfp1)() = ::f, (S::*mdfp2)() = ::f;
  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration statement can be split
  // CHECK-FIXES: {{^}}void (S::*mdfp1)() = ::f;
  // CHECK-FIXES: {{^}}void (S::*mdfp2)() = ::f;
  
  void (S::*mdfpa1[2])() = {::f, ::f}, (S::*mdfpa2)() = ::f;
  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration statement can be split
  // CHECK-FIXES: {{^}}void (S::*mdfpa1[2])() = {::f, ::f};
  // CHECK-FIXES: {{^}}void (S::*mdfpa2)() = ::f;
  
  void (S::**mdfpa3[2])() = {[0], [1]}, (S::*mdfpa4)() = ::f;
  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: declaration statement can be split
  // CHECK-FIXES: {{^}}void (S::**mdfpa3[2])() = {[0], 
[1]};
  // CHECK-FIXES: {{^}}void (S::*mdfpa4)() = ::f;


https://reviews.llvm.org/D27621

Files:
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/OneNamePerDeclarationCheck.cpp
  clang-tidy/readability/OneNamePerDeclarationCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tidy/utils/LexerUtils.cpp
  clang-tidy/utils/LexerUtils.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-one-name-per-declaration.rst
  test/clang-tidy/readability-one-name-per-declaration-complex.cpp
  test/clang-tidy/readability-one-name-per-declaration-modern.cpp
  test/clang-tidy/readability-one-name-per-declaration-simple.cpp

Index: test/clang-tidy/readability-one-name-per-declaration-simple.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-one-name-per-declaration-simple.cpp
@@ -0,0 +1,142 @@
+// RUN: %check_clang_tidy %s readability-one-name-per-declaration %t
+
+int cantTouchA, cantTouchB;
+
+void simple() 
+{
+int dontTouchC;
+
+long empty;
+long long1 = 11, *long2 = , * long3 = 
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration]
+// CHECK-FIXES: {{^}}long long1 = 11;
+// CHECK-FIXES: {{^}}long *long2 = 
+// CHECK-FIXES: {{^}}long * long3 = 
+
+long ** lint1, lint2 = 0, * lint3, **linn;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration]
+// CHECK-FIXES: {{^}}long ** lint1;
+// CHECK-FIXES: {{^}}long lint2 = 0;
+// CHECK-FIXES: {{^}}long * lint3;
+// CHECK-FIXES: {{^}}long **linn;
+
+	long int* lint4, *lint5,  lint6;
+	// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration]
+	// CHECK-FIXES: {{^	}}long int* lint4;
+	// CHECK-FIXES: {{^	}}long int *lint5;
+	// CHECK-FIXES: {{^	}}long int lint6;
+
+/* *& */ int /* *& */ ** /* *& */ pp,*xx;
+// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration]
+// CHECK-FIXES: {{^}}/* *& */ int /* *& */ ** /* *& */ pp;
+// CHECK-FIXES: {{^}}int *xx;
+
+unsigned int uint1 = 0,uint2 = 44u, uint3, uint4=4;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration]
+// CHECK-FIXES: {{^}}unsigned int uint1 = 0;
+// CHECK-FIXES: {{^}}unsigned int uint2 = 44u;
+// CHECK-FIXES: {{^}}unsigned int uint3;
+// CHECK-FIXES: {{^}}unsigned int uint4=4;
+
+const int * const cpc = , simple = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration]
+// CHECK-FIXES: {{^}}const int * const cpc = 
+// CHECK-FIXES: {{^}}const int simple = 0;
+
+double darray1[] = {}, darray2[] = {1,	2},dv1 = 3,dv2;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: declaration statement can be split up into single line declarations [readability-one-name-per-declaration]
+// CHECK-FIXES: {{^}}double darray1[] = {};
+// CHECK-FIXES: {{^}}double darray2[] = {1,	2};
+// CHECK-FIXES: {{^}}double dv1 = 3;
+// CHECK-FIXES: {{^}}double dv2;
+
+int notransform[] =   {
+

RE: [PATCH] D27763: Debug Info: Modified DIBuilder::createCompileUnit() to take DIFile instead of FileName and Directory. (Clang part)

It was approved by Reid.
This patch had two parts, he did not stamp the change in Clang, but he did 
stamp the change for LLVM.
https://reviews.llvm.org/D27762

I assumed that this means a green light to commit.
Did I misinterpret the rules?

Thanks,
Amjad

From: David Blaikie [mailto:dblai...@gmail.com]
Sent: Monday, December 19, 2016 19:00
To: reviews+d27763+public+4530ee00cad28...@reviews.llvm.org; Amjad Aboud via 
Phabricator ; Aboud, Amjad ; 
r...@google.com
Cc: cfe-commits@lists.llvm.org
Subject: Re: [PATCH] D27763: Debug Info: Modified 
DIBuilder::createCompileUnit() to take DIFile instead of FileName and 
Directory. (Clang part)

Was this change approved by anyone? Generally once it's sent for review, you 
should wait until it's approved before committing (the assumption being, if you 
sent it for review it's because it needed review)

On Wed, Dec 14, 2016 at 12:49 PM Amjad Aboud via Phabricator via cfe-commits 
> wrote:
This revision was automatically updated to reflect the committed changes.
Closed by commit rL289701: [DebugInfo] Changed DIBuilder::createCompileUnit() 
to take DIFile instead of… (authored by aaboud).

Changed prior to commit:
  https://reviews.llvm.org/D27763?vs=81397=81438#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27763

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


Index: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
===
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
@@ -466,7 +466,8 @@
   // Create new compile unit.
   // FIXME - Eliminate TheCU.
   TheCU = DBuilder.createCompileUnit(
-  LangTag, remapDIPath(MainFileName), remapDIPath(getCurrentDirname()),
+  LangTag, DBuilder.createFile(remapDIPath(MainFileName),
+remapDIPath(getCurrentDirname())),
   Producer, LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers,
   CGM.getCodeGenOpts().SplitDwarfFile, EmissionKind, 0 /* DWOid */,
   CGM.getCodeGenOpts().SplitDwarfInlining);
@@ -1977,10 +1978,11 @@
 // but LLVM detects skeleton CUs by looking for a non-zero DWO id.
 uint64_t Signature = Mod.getSignature() ? Mod.getSignature() : ~1ULL;
 llvm::DIBuilder DIB(CGM.getModule());
-DIB.createCompileUnit(TheCU->getSourceLanguage(), Mod.getModuleName(),
-  Mod.getPath(), TheCU->getProducer(), true,
-  StringRef(), 0, Mod.getASTFile(),
-  llvm::DICompileUnit::FullDebug, Signature);
+DIB.createCompileUnit(TheCU->getSourceLanguage(),
+  DIB.createFile(Mod.getModuleName(), Mod.getPath()),
+  TheCU->getProducer(), true, StringRef(), 0,
+  Mod.getASTFile(), llvm::DICompileUnit::FullDebug,
+  Signature);
 DIB.finalize();
   }
   llvm::DIModule *Parent =


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
-
Intel Israel (74) Limited

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


Re: [PATCH] D27683: Prepare PrettyStackTrace for LLDB adoption

Test coverage?

On Tue, Dec 13, 2016 at 2:39 PM Sean Callanan via Phabricator via
cfe-commits  wrote:

> spyffe retitled this revision from "Fix the linkage for
> __crashtracer_info__" to "Prepare PrettyStackTrace for LLDB adoption".
> spyffe updated the summary for this revision.
> spyffe updated this revision to Diff 81304.
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D27683
>
> Files:
>   include/llvm/Support/PrettyStackTrace.h
>   lib/Support/PrettyStackTrace.cpp
>
>
> Index: lib/Support/PrettyStackTrace.cpp
> ===
> --- lib/Support/PrettyStackTrace.cpp
> +++ lib/Support/PrettyStackTrace.cpp
> @@ -89,7 +89,7 @@
>  = { CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0 };
>  }
>  #elif defined (__APPLE__) && HAVE_CRASHREPORTER_INFO
> -static const char *__crashreporter_info__ = 0;
> +extern "C" const char *__crashreporter_info__
> __attribute__((visibility("hidden"))) = 0;
>  asm(".desc ___crashreporter_info__, 0x10");
>  #endif
>
> @@ -145,6 +145,28 @@
>OS << Str << "\n";
>  }
>
> +PrettyStackTraceFormat::PrettyStackTraceFormat(const char *format, ...) {
> +  va_list ap;
> +
> +  va_start(ap, format);
> +  const int size_or_error = vsnprintf(nullptr, 0, format, ap);
> +  va_end(ap);
> +
> +  if (size_or_error < 0) {
> +return;
> +  }
> +
> +  const int size = size_or_error + 1; // '\0'
> +
> +  Str.resize(size);
> +
> +  va_start(ap, format);
> +  vsnprintf(Str.data(), size, format, ap);
> +  va_end(ap);
> +}
> +
> +void PrettyStackTraceFormat::print(raw_ostream ) const { OS << Str <<
> "\n"; }
> +
>  void PrettyStackTraceProgram::print(raw_ostream ) const {
>OS << "Program arguments: ";
>// Print the argument list.
> Index: include/llvm/Support/PrettyStackTrace.h
> ===
> --- include/llvm/Support/PrettyStackTrace.h
> +++ include/llvm/Support/PrettyStackTrace.h
> @@ -16,6 +16,7 @@
>  #ifndef LLVM_SUPPORT_PRETTYSTACKTRACE_H
>  #define LLVM_SUPPORT_PRETTYSTACKTRACE_H
>
> +#include "llvm/ADT/SmallVector.h"
>  #include "llvm/Support/Compiler.h"
>
>  namespace llvm {
> @@ -55,6 +56,16 @@
>  void print(raw_ostream ) const override;
>};
>
> +  /// PrettyStackTraceFormat - This object prints a string (which may use
> +  /// printf-style formatting but should not contain newlines) to the
> stream
> +  /// as the stack trace when a crash occurs.
> +  class PrettyStackTraceFormat : public PrettyStackTraceEntry {
> +llvm::SmallVector Str;
> +  public:
> +PrettyStackTraceFormat(const char *format, ...);
> +void print(raw_ostream ) const override;
> +  };
> +
>/// PrettyStackTraceProgram - This object prints a specified program
> arguments
>/// to the stream as the stack trace when a crash occurs.
>class PrettyStackTraceProgram : public PrettyStackTraceEntry {
>
>
> ___
> 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


r290113 - [libclang] Revert part of r290025, "Remove the 'extern "C"' blocks from the implementation files."

Author: chapuni
Date: Mon Dec 19 10:50:43 2016
New Revision: 290113

URL: http://llvm.org/viewvc/llvm-project?rev=290113=rev
Log:
[libclang] Revert part of r290025, "Remove the 'extern "C"' blocks from the 
implementation files."

mingw32-ld complains missing symbols in exports,

  Cannot export clang_findIncludesInFileWithBlock: symbol not defined
  Cannot export clang_findReferencesInFileWithBlock: symbol not defined
  Cannot export clang_visitChildrenWithBlock: symbol not defined

They are excluded conditionally in header along has_blocks.

We should do either;

  1. Exclude also function bodies conditionally, and introduce "optional" 
exporter.
  2. Give dummy function bodies for them.
  3. Implement functions w/o blocks.

Modified:
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/CIndexHigh.cpp

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=290113=290112=290113=diff
==
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Mon Dec 19 10:50:43 2016
@@ -4120,6 +4120,8 @@ static SourceLocation getLocationFromExp
   return E->getLocStart();
 }
 
+extern "C" {
+
 unsigned clang_visitChildren(CXCursor parent,
  CXCursorVisitor visitor,
  CXClientData client_data) {
@@ -5383,6 +5385,8 @@ CXSourceLocation clang_getCursorLocation
   return cxloc::translateSourceLocation(getCursorContext(C), Loc);
 }
 
+} // end extern "C"
+
 CXCursor cxcursor::getCursor(CXTranslationUnit TU, SourceLocation SLoc) {
   assert(TU);
 

Modified: cfe/trunk/tools/libclang/CIndexHigh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexHigh.cpp?rev=290113=290112=290113=diff
==
--- cfe/trunk/tools/libclang/CIndexHigh.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexHigh.cpp Mon Dec 19 10:50:43 2016
@@ -407,6 +407,8 @@ static bool findIncludesInFile(CXTransla
 // libclang public APIs.
 
//===--===//
 
+extern "C" {
+
 CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file,
 CXCursorAndRangeVisitor visitor) {
   LogRef Log = Logger::make(__func__);
@@ -532,3 +534,4 @@ CXResult clang_findIncludesInFileWithBlo
   return clang_findIncludesInFile(TU, file, visitor);
 }
 
+} // end: extern "C"


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


Re: [PATCH] D27763: Debug Info: Modified DIBuilder::createCompileUnit() to take DIFile instead of FileName and Directory. (Clang part)

Was this change approved by anyone? Generally once it's sent for review,
you should wait until it's approved before committing (the assumption
being, if you sent it for review it's because it needed review)

On Wed, Dec 14, 2016 at 12:49 PM Amjad Aboud via Phabricator via
cfe-commits  wrote:

> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL289701: [DebugInfo] Changed
> DIBuilder::createCompileUnit() to take DIFile instead of… (authored by
> aaboud).
>
> Changed prior to commit:
>   https://reviews.llvm.org/D27763?vs=81397=81438#toc
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D27763
>
> Files:
>   cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>
>
> Index: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> ===
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> @@ -466,7 +466,8 @@
>// Create new compile unit.
>// FIXME - Eliminate TheCU.
>TheCU = DBuilder.createCompileUnit(
> -  LangTag, remapDIPath(MainFileName),
> remapDIPath(getCurrentDirname()),
> +  LangTag, DBuilder.createFile(remapDIPath(MainFileName),
> +remapDIPath(getCurrentDirname())),
>Producer, LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags,
> RuntimeVers,
>CGM.getCodeGenOpts().SplitDwarfFile, EmissionKind, 0 /* DWOid */,
>CGM.getCodeGenOpts().SplitDwarfInlining);
> @@ -1977,10 +1978,11 @@
>  // but LLVM detects skeleton CUs by looking for a non-zero DWO id.
>  uint64_t Signature = Mod.getSignature() ? Mod.getSignature() : ~1ULL;
>  llvm::DIBuilder DIB(CGM.getModule());
> -DIB.createCompileUnit(TheCU->getSourceLanguage(), Mod.getModuleName(),
> -  Mod.getPath(), TheCU->getProducer(), true,
> -  StringRef(), 0, Mod.getASTFile(),
> -  llvm::DICompileUnit::FullDebug, Signature);
> +DIB.createCompileUnit(TheCU->getSourceLanguage(),
> +  DIB.createFile(Mod.getModuleName(),
> Mod.getPath()),
> +  TheCU->getProducer(), true, StringRef(), 0,
> +  Mod.getASTFile(),
> llvm::DICompileUnit::FullDebug,
> +  Signature);
>  DIB.finalize();
>}
>llvm::DIModule *Parent =
>
>
> ___
> 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] D27180: Testbed and skeleton of a new expression parser

On Thu, Dec 15, 2016 at 2:18 PM Sean Callanan via Phabricator via
cfe-commits  wrote:

> spyffe updated this revision to Diff 81661.
> spyffe marked 2 inline comments as done.
> spyffe added a comment.
> Herald added a subscriber: jgosnell.
>
> Applied Vassil and Vedant's comments.  I will commit this soon.
>

Was this change approved/accepted by anyone? "commit if no one has
objections in " isn't generally how LLVM project changes are
reviewed/committed.


>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D27180
>
> Files:
>   test/Import/clang-flags/Inputs/S.c
>   test/Import/clang-flags/test.c
>   test/Import/empty-struct/Inputs/S.c
>   test/Import/empty-struct/test.c
>   test/Import/error-in-expression/Inputs/S.c
>   test/Import/error-in-expression/test.c
>   test/Import/error-in-import/Inputs/S.c
>   test/Import/error-in-import/test.c
>   test/Import/missing-import/test.c
>   tools/CMakeLists.txt
>   tools/clang-import-test/CMakeLists.txt
>   tools/clang-import-test/clang-import-test.cpp
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D23325: [WIP] Binding of references to packed fields

rogfer01 updated this revision to Diff 81955.
rogfer01 added a comment.

Rebase to current trunk


https://reviews.llvm.org/D23325

Files:
  include/clang/AST/Decl.h
  include/clang/AST/Expr.h
  include/clang/AST/Stmt.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/Specifiers.h
  include/clang/Sema/Initialization.h
  lib/AST/ASTDumper.cpp
  lib/AST/Decl.cpp
  lib/Sema/SemaCast.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaExprMember.cpp
  lib/Sema/SemaFixItUtils.cpp
  lib/Sema/SemaInit.cpp
  test/CodeGenCXX/pod-member-memcpys.cpp
  test/SemaCXX/bind-packed-member.cpp

Index: test/SemaCXX/bind-packed-member.cpp
===
--- test/SemaCXX/bind-packed-member.cpp
+++ test/SemaCXX/bind-packed-member.cpp
@@ -0,0 +1,107 @@
+// RUN: %clang_cc1 -verify %s
+
+struct __attribute__((packed)) A {
+  char x;
+  float y;
+  char z;
+} a;
+
+char  = a.x;  // no-error
+float  = a.y; // expected-error {{reference cannot bind to packed field}}
+char  = a.z;  // no-error
+
+struct __attribute__((packed, aligned(2))) B {
+  // Regardless of aligned(2) the fields are aligned(1) because of packed.
+  // The whole struct is aligned(2), though.
+  short x;
+  float y;
+  short z;
+  char w;
+} b;
+
+const short  = b.x; // no-error
+short  = b.x; // expected-error {{reference cannot bind to packed field}}
+float  = b.y; // expected-error {{reference cannot bind to packed field}}
+short  = b.z; // expected-error {{reference cannot bind to packed field}}
+char  = b.w;  // no-error
+
+struct __attribute__((packed)) B2 {
+  short x __attribute__((aligned(2)));
+  float y;
+  short z __attribute__((aligned(4)));
+  char w;
+} b2;
+
+short  = b2.x; // no-error
+short  = b2.z; // no-error
+
+struct C {
+  int c;
+};
+
+struct __attribute__((packed)) D {
+  char x;
+  int y;
+  C z;
+} d;
+
+C  = d.z; // expected-error {{reference cannot bind to packed field}}
+int  = d.z.c; // expected-error {{reference cannot bind to packed field}}
+
+struct E {
+int x __attribute__((packed));
+C y __attribute__((packed));
+C z;
+} e;
+
+int& rex = e.x; // expected-error {{reference cannot bind to packed field}}
+C& rey = e.y; // expected-error {{reference cannot bind to packed field}}
+C& rez = e.z;  // no-error
+
+struct NonTrivialCopy
+{
+int w;
+NonTrivialCopy();
+NonTrivialCopy(const NonTrivialCopy&);
+};
+
+struct F
+{
+char c;
+NonTrivialCopy x __attribute__((packed));
+int w __attribute__((packed));
+} f;
+
+
+void fun1(int &);
+void fun2(const int &);
+
+void bar()
+{
+const NonTrivialCopy& rx = f.x; // expected-error {{reference cannot bind to packed field}}
+const int  = f.w; // no-error
+
+fun1(f.w); // expected-error {{reference cannot bind to packed field}}
+   // expected-note@76 {{passing argument to parameter here}}
+fun2(f.w); // no-error
+}
+
+struct __attribute__((packed)) IgnorePacked {
+  int c;
+  NonTrivialCopy x; // expected-warning {{ignoring packed attribute because of unpacked non-POD field}}
+} nopacked1;
+
+int  = nopacked1.c; // no-error
+
+template 
+struct __attribute__((packed)) IgnorePackedTpl {
+  int c;
+  T x;
+};
+
+IgnorePackedTpl nopacked2; // expected-warning@99 {{ignoring packed attribute because of unpacked non-POD field}}
+   // expected-note@102 {{in instantiation of template class}}
+int  = nopacked2.c; // no-error
+
+IgnorePackedTpl packed3;
+int  = packed3.c; // expected-error {{reference cannot bind to packed field}}
Index: test/CodeGenCXX/pod-member-memcpys.cpp
===
--- test/CodeGenCXX/pod-member-memcpys.cpp
+++ test/CodeGenCXX/pod-member-memcpys.cpp
@@ -168,7 +168,7 @@
 // PackedMembers copy-assignment:
 // CHECK-LABEL: define linkonce_odr dereferenceable({{[0-9]+}}) %struct.PackedMembers* @_ZN13PackedMembersaSERKS_(%struct.PackedMembers* %this, %struct.PackedMembers* dereferenceable({{[0-9]+}}))
 // CHECK: call dereferenceable({{[0-9]+}}) %struct.NonPOD* @_ZN6NonPODaSERKS_
-// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}}i64 16, i32 1{{.*}})
+// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}}i64 16, i32 4{{.*}})
 // CHECK: ret %struct.PackedMembers*
 
 // COPY-CONSTRUCTORS:
@@ -183,7 +183,7 @@
 // PackedMembers copy-assignment:
 // CHECK-LABEL: define linkonce_odr void @_ZN13PackedMembersC2ERKS_(%struct.PackedMembers* %this, %struct.PackedMembers* dereferenceable({{[0-9]+}}))
 // CHECK: call void @_ZN6NonPODC1ERKS_
-// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}}i64 16, i32 1{{.*}})
+// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}}i64 16, i32 4{{.*}})
 // CHECK: ret void
 
 CALL_CC(BitfieldMember2)
Index: lib/Sema/SemaInit.cpp
===
--- lib/Sema/SemaInit.cpp
+++ lib/Sema/SemaInit.cpp
@@ -3111,6 +3111,7 @@
   case FK_AddressOfOverloadFailed: // FIXME: Could do 

[PATCH] D27920: [find-all-symbols] Index partial template specializations.

hokein created this revision.
hokein added a reviewer: ioeric.
hokein added subscribers: bkramer, cfe-commits.

Fix no std::function index.


https://reviews.llvm.org/D27920

Files:
  include-fixer/find-all-symbols/FindAllSymbols.cpp
  unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp


Index: unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
===
--- unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
+++ unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
@@ -229,6 +229,28 @@
   EXPECT_TRUE(hasSymbol(Symbol));
 }
 
+TEST_F(FindAllSymbolsTest, DontIgnoreTemplatePartialSpecialization) {
+  static const char Code[] = R"(
+  template class Class; // undefined
+  template
+  class Class {
+  };
+
+  template void f() {};
+  template<> void f() {};
+  )";
+  runFindAllSymbols(Code);
+  SymbolInfo Symbol =
+  SymbolInfo("Class", SymbolInfo::SymbolKind::Class, HeaderName, 4, {});
+  EXPECT_TRUE(hasSymbol(Symbol));
+  Symbol =
+  SymbolInfo("f", SymbolInfo::SymbolKind::Function, HeaderName, 7, {});
+  EXPECT_TRUE(hasSymbol(Symbol));
+  Symbol =
+  SymbolInfo("f", SymbolInfo::SymbolKind::Function, HeaderName, 8, {});
+  EXPECT_FALSE(hasSymbol(Symbol));
+}
+
 TEST_F(FindAllSymbolsTest, FunctionSymbols) {
   static const char Code[] = R"(
   namespace na {
Index: include-fixer/find-all-symbols/FindAllSymbols.cpp
===
--- include-fixer/find-all-symbols/FindAllSymbols.cpp
+++ include-fixer/find-all-symbols/FindAllSymbols.cpp
@@ -32,6 +32,18 @@
   return false;
 }
 
+AST_POLYMORPHIC_MATCHER(isFullySpecialized,
+AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, VarDecl,
+CXXRecordDecl)) {
+  if (Node.getTemplateSpecializationKind() == TSK_ExplicitSpecialization) {
+bool is_partial_specialization =
+llvm::isa(Node) ||
+llvm::isa(Node);
+return !is_partial_specialization;
+  }
+  return false;
+}
+
 std::vector GetContexts(const NamedDecl *ND) {
   std::vector Contexts;
   for (const auto *Context = ND->getDeclContext(); Context;
@@ -126,8 +138,7 @@
   auto CCMatcher =
   allOf(HasNSOrTUCtxMatcher, unless(IsInSpecialization),
 unless(ast_matchers::isTemplateInstantiation()),
-unless(isInstantiated()), 
unless(classTemplateSpecializationDecl()),
-unless(isExplicitTemplateSpecialization()));
+unless(isInstantiated()), unless(isFullySpecialized()));
 
   // Matchers specific to code in extern "C" {...}.
   auto ExternCMatcher = hasDeclContext(linkageSpecDecl());
@@ -156,8 +167,7 @@
 
   // Matchers for C++ record declarations.
   auto CxxRecordDecl =
-  cxxRecordDecl(CommonFilter, CCMatcher, isDefinition(),
-unless(isExplicitTemplateSpecialization()));
+  cxxRecordDecl(CommonFilter, CCMatcher, isDefinition());
   MatchFinder->addMatcher(CxxRecordDecl.bind("decl"), this);
 
   // Matchers for function declarations.


Index: unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
===
--- unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
+++ unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
@@ -229,6 +229,28 @@
   EXPECT_TRUE(hasSymbol(Symbol));
 }
 
+TEST_F(FindAllSymbolsTest, DontIgnoreTemplatePartialSpecialization) {
+  static const char Code[] = R"(
+  template class Class; // undefined
+  template
+  class Class {
+  };
+
+  template void f() {};
+  template<> void f() {};
+  )";
+  runFindAllSymbols(Code);
+  SymbolInfo Symbol =
+  SymbolInfo("Class", SymbolInfo::SymbolKind::Class, HeaderName, 4, {});
+  EXPECT_TRUE(hasSymbol(Symbol));
+  Symbol =
+  SymbolInfo("f", SymbolInfo::SymbolKind::Function, HeaderName, 7, {});
+  EXPECT_TRUE(hasSymbol(Symbol));
+  Symbol =
+  SymbolInfo("f", SymbolInfo::SymbolKind::Function, HeaderName, 8, {});
+  EXPECT_FALSE(hasSymbol(Symbol));
+}
+
 TEST_F(FindAllSymbolsTest, FunctionSymbols) {
   static const char Code[] = R"(
   namespace na {
Index: include-fixer/find-all-symbols/FindAllSymbols.cpp
===
--- include-fixer/find-all-symbols/FindAllSymbols.cpp
+++ include-fixer/find-all-symbols/FindAllSymbols.cpp
@@ -32,6 +32,18 @@
   return false;
 }
 
+AST_POLYMORPHIC_MATCHER(isFullySpecialized,
+AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, VarDecl,
+CXXRecordDecl)) {
+  if (Node.getTemplateSpecializationKind() == TSK_ExplicitSpecialization) {
+bool is_partial_specialization =
+llvm::isa(Node) ||
+llvm::isa(Node);
+return !is_partial_specialization;
+  

[PATCH] D26454: Implement no_sanitize_address for global vars

aaron.ballman added a comment.

In https://reviews.llvm.org/D26454#609578, @dougk wrote:

> Suppression of sanitizing is necessary if the variable is magically a 
> memory-mapped device I/O address.
>  The linker can arrange for this to be the case using fancy scripts, or even 
> just as simple as a section attribute that requires that you take up exactly 
> a certain number of bytes in the section.
>  There was some thought that any non-default section should preclude 
> sanitization, but Kostya said that, no, it would make sense to require 
> explicit no-sanitize.  I (mistakenly) took that to mean "just do it", for 
> which I apologize.


Thank you for the explanation, but I'm still wondering if this applies to only 
`address` sanitization, or to others as well, such as `memory` or `thread`. The 
fact that the declarative information in Attr.td is incorrect now is a concern. 
We can either address that concern by making the conflict go away for all 
sanitizer strings (which may not be sensible), or by making some complex 
changes to the way subject lists work (which may be more work than it's worth). 
The point to having a single `no_sanitize` attribute was so that we didn't need 
to add a new attribute every time we came up with a new sanitizer, but it was 
understood that this works because all of the sanitizers apply to the same 
constructs. This change breaks that assumption so that now one of the sanitizer 
strings diverges from all the rest, and I would like to avoid that.


https://reviews.llvm.org/D26454



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


[PATCH] D27641: DebugInfo: Added support for Checksum debug info feature (Clang part)

aaboud updated this revision to Diff 81953.
aaboud marked 3 inline comments as done.
aaboud added a comment.

Addressed comments by Reid and David.


https://reviews.llvm.org/D27641

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGen/Inputs/debug-info-file-checksum.c
  test/CodeGen/debug-info-file-checksum.c

Index: lib/CodeGen/CGDebugInfo.h
===
--- lib/CodeGen/CGDebugInfo.h
+++ lib/CodeGen/CGDebugInfo.h
@@ -442,6 +442,10 @@
   /// Remap a given path with the current debug prefix map
   std::string remapDIPath(StringRef) const;
 
+  /// Get the file checksum debug info for input file ID.
+  llvm::DIFile::ChecksumKind getChecksum(FileID FID,
+ SmallString<32> ) const;
+
   /// Get the file debug info descriptor for the input location.
   llvm::DIFile *getOrCreateFile(SourceLocation Loc);
 
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -41,6 +41,7 @@
 #include "llvm/IR/Intrinsics.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/MD5.h"
 #include "llvm/Support/Path.h"
 using namespace clang;
 using namespace clang::CodeGen;
@@ -320,19 +321,46 @@
   return StringRef();
 }
 
+llvm::DIFile::ChecksumKind
+CGDebugInfo::getChecksum(FileID FID, SmallString<32> ) const {
+  Checksum.clear();
+
+  if (!CGM.getCodeGenOpts().EmitCodeView)
+return llvm::DIFile::CSK_None;
+
+  SourceManager  = CGM.getContext().getSourceManager();
+  bool Invalid;
+  llvm::MemoryBuffer *MemBuffer = SM.getBuffer(FID, );
+  if (Invalid)
+return llvm::DIFile::CSK_None;
+
+  llvm::MD5 Hash;
+  llvm::MD5::MD5Result Result;
+
+  Hash.update(MemBuffer->getBuffer());
+  Hash.final(Result);
+
+  Hash.stringifyResult(Result, Checksum);
+  return llvm::DIFile::CSK_MD5;
+}
+
 llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
   if (!Loc.isValid())
 // If Location is not valid then use main input file.
 return DBuilder.createFile(remapDIPath(TheCU->getFilename()),
-   remapDIPath(TheCU->getDirectory()));
+   remapDIPath(TheCU->getDirectory()),
+   TheCU->getFile()->getChecksumKind(),
+   TheCU->getFile()->getChecksum());
 
   SourceManager  = CGM.getContext().getSourceManager();
   PresumedLoc PLoc = SM.getPresumedLoc(Loc);
 
   if (PLoc.isInvalid() || StringRef(PLoc.getFilename()).empty())
 // If the location is not valid then use main input file.
 return DBuilder.createFile(remapDIPath(TheCU->getFilename()),
-   remapDIPath(TheCU->getDirectory()));
+   remapDIPath(TheCU->getDirectory()),
+   TheCU->getFile()->getChecksumKind(),
+   TheCU->getFile()->getChecksum());
 
   // Cache the results.
   const char *fname = PLoc.getFilename();
@@ -344,16 +372,22 @@
   return cast(V);
   }
 
+  SmallString<32> Checksum;
+  llvm::DIFile::ChecksumKind CSKind = getChecksum(SM.getFileID(Loc), Checksum);
+
   llvm::DIFile *F = DBuilder.createFile(remapDIPath(PLoc.getFilename()),
-remapDIPath(getCurrentDirname()));
+remapDIPath(getCurrentDirname()),
+CSKind, Checksum);
 
   DIFileCache[fname].reset(F);
   return F;
 }
 
 llvm::DIFile *CGDebugInfo::getOrCreateMainFile() {
   return DBuilder.createFile(remapDIPath(TheCU->getFilename()),
- remapDIPath(TheCU->getDirectory()));
+ remapDIPath(TheCU->getDirectory()),
+ TheCU->getFile()->getChecksumKind(),
+ TheCU->getFile()->getChecksum());
 }
 
 std::string CGDebugInfo::remapDIPath(StringRef Path) const {
@@ -396,6 +430,8 @@
 }
 
 void CGDebugInfo::CreateCompileUnit() {
+  SmallString<32> Checksum;
+  llvm::DIFile::ChecksumKind CSKind = llvm::DIFile::CSK_None;
 
   // Should we be asking the SourceManager for the main file name, instead of
   // accepting it as an argument? This just causes the main file name to
@@ -422,6 +458,7 @@
   llvm::sys::path::append(MainFileDirSS, MainFileName);
   MainFileName = MainFileDirSS.str();
 }
+CSKind = getChecksum(SM.getMainFileID(), Checksum);
   }
 
   llvm::dwarf::SourceLanguage LangTag;
@@ -467,7 +504,8 @@
   // FIXME - Eliminate TheCU.
   TheCU = DBuilder.createCompileUnit(
   LangTag, DBuilder.createFile(remapDIPath(MainFileName),
-remapDIPath(getCurrentDirname())),
+   remapDIPath(getCurrentDirname()), CSKind,
+   Checksum),
   Producer, LO.Optimize, 

r290110 - [ARM] Add missing -backend-option for -arm-execute-only

Author: prakhar
Date: Mon Dec 19 09:43:33 2016
New Revision: 290110

URL: http://llvm.org/viewvc/llvm-project?rev=290110=rev
Log:
[ARM] Add missing -backend-option for -arm-execute-only

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/arm-execute-only.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=290110=290109=290110=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Dec 19 09:43:33 2016
@@ -1158,6 +1158,7 @@ static void getARMTargetFeatures(const T
   D.Diag(diag::err_opt_not_valid_with_opt) << A->getAsString(Args) << 
B->getAsString(Args);
   }
 
+  CmdArgs.push_back("-backend-option");
   CmdArgs.push_back("-arm-execute-only");
 }
   }

Modified: cfe/trunk/test/Driver/arm-execute-only.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-execute-only.c?rev=290110=290109=290110=diff
==
--- cfe/trunk/test/Driver/arm-execute-only.c (original)
+++ cfe/trunk/test/Driver/arm-execute-only.c Mon Dec 19 09:43:33 2016
@@ -91,8 +91,8 @@
 // RUN:| FileCheck %s -check-prefix CHECK-EXECUTE-ONLY-LONG-CALLS
 
 //
-// CHECK-NO-EXECUTE-ONLY-NOT: "-arm-execute-only"
-// CHECK-EXECUTE-ONLY: "-arm-execute-only"
+// CHECK-NO-EXECUTE-ONLY-NOT: "-backend-option" "-arm-execute-only"
+// CHECK-EXECUTE-ONLY: "-backend-option" "-arm-execute-only"
 
 // CHECK-EXECUTE-ONLY-NOT-SUPPORTED: error: execute only is not supported for 
the thumbv6m sub-architecture
 // CHECK-EXECUTE-ONLY-NO-MOVT: error: option '-mexecute-only' cannot be 
specified with '-mno-movt'


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


[PATCH] D27165: Add format_dynamic_key_arg attribute to improve "-Wformat" warnings for functions that load the formatting string dynamically based on a key value

arphaman updated this revision to Diff 81952.
arphaman added a comment.

Update to fix a test failure.


Repository:
  rL LLVM

https://reviews.llvm.org/D27165

Files:
  include/clang/Analysis/Analyses/FormatString.h
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  lib/Analysis/PrintfFormatString.cpp
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/Sema/attr-format_arg.c
  test/SemaObjC/format-strings-objc.m

Index: test/SemaObjC/format-strings-objc.m
===
--- test/SemaObjC/format-strings-objc.m
+++ test/SemaObjC/format-strings-objc.m
@@ -302,3 +302,21 @@
 }
 
 @end
+
+@interface FormatDynamicKeyArg
+
+- (NSString *)load:(NSString *)key __attribute__((loads_format_specifier_value_using_key(1)));
+
+@end
+
+void testFormatDynamicKeyArg(FormatDynamicKeyArg *m) {
+  // Don't warn when the key has no formatting specifiers
+  NSLog([m load:@"key"], @"foo");
+  NSLog([m load:@""]);
+
+  // Warn normally when the key has formatting specifiers
+  NSLog([m load:@"correct %d"], 2);
+  NSLog([m load:@"warn %d"], "off"); // expected-warning {{format specifies type 'int' but the argument has type 'char *'}}
+  NSLog([m load:@"%@ %@"], @"name"); // expected-warning {{more '%' conversions than data arguments}}
+  NSLog([m load:@"Warn again %@"], @"name", @"void"); // expected-warning {{data argument not used by format string}}
+}
Index: test/Sema/attr-format_arg.c
===
--- test/Sema/attr-format_arg.c
+++ test/Sema/attr-format_arg.c
@@ -11,3 +11,19 @@
   printf(f("%d"), 123);
   printf(f("%d %d"), 123); // expected-warning{{more '%' conversions than data arguments}}
 }
+
+const char *loadFormattingValue(const char *key) __attribute__((loads_format_specifier_value_using_key(1)));
+
+void testFormatDynamicKeyArg() {
+  // Don't warn when the key has no formatting specifiers
+  printf(loadFormattingValue("key"), "foo");
+
+  // Warn normally when the key has formatting specifiers
+  printf(loadFormattingValue("%d"), 123);
+  printf(loadFormattingValue("%d %d"), 123); // expected-warning{{more '%' conversions than data arguments}}
+}
+
+const char *formatKeyArgError1(const char *format)
+  __attribute__((loads_format_specifier_value_using_key("foo")));  // expected-error{{'loads_format_specifier_value_using_key' attribute requires parameter 1 to be an integer constant}}
+const char *formatKeyArgError2(const char *format)
+  __attribute__((loads_format_specifier_value_using_key(0)));  // expected-error{{'loads_format_specifier_value_using_key' attribute parameter 1 is out of bounds}}
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -2748,13 +2748,14 @@
  Attr.getAttributeSpellingListIndex()));
 }
 
-/// Handle __attribute__((format_arg((idx attribute based on
-/// http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
-static void handleFormatArgAttr(Sema , Decl *D, const AttributeList ) {
+/// Checks a format_arg or loads_format_specifier_value_using_key attribute
+/// and returns true if it has any errors.
+static bool checkFormatArgAttr(Sema , Decl *D, const AttributeList ,
+   llvm::APSInt ) {
   Expr *IdxExpr = Attr.getArgAsExpr(0);
   uint64_t Idx;
   if (!checkFunctionOrMethodParameterIndex(S, D, Attr, 1, IdxExpr, Idx))
-return;
+return true;
 
   // Make sure the format string is really a string.
   QualType Ty = getFunctionOrMethodParamType(D, Idx);
@@ -2767,7 +2768,7 @@
 S.Diag(Attr.getLoc(), diag::err_format_attribute_not)
 << "a string type" << IdxExpr->getSourceRange()
 << getFunctionOrMethodParamRange(D, 0);
-return;
+return true;
   }
   Ty = getFunctionOrMethodResultType(D);
   if (!isNSStringType(Ty, S.Context) &&
@@ -2777,20 +2778,38 @@
 S.Diag(Attr.getLoc(), diag::err_format_attribute_result_not)
 << (NotNSStringTy ? "string type" : "NSString")
 << IdxExpr->getSourceRange() << getFunctionOrMethodParamRange(D, 0);
-return;
+return true;
   }
 
   // We cannot use the Idx returned from checkFunctionOrMethodParameterIndex
   // because that has corrected for the implicit this parameter, and is zero-
   // based.  The attribute expects what the user wrote explicitly.
-  llvm::APSInt Val;
   IdxExpr->EvaluateAsInt(Val, S.Context);
+  return false;
+}
 
+/// Handle __attribute__((format_arg((idx attribute based on
+/// http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
+static void handleFormatArgAttr(Sema , Decl *D, const AttributeList ) {
+  llvm::APSInt Val;
+  if (checkFormatArgAttr(S, D, Attr, Val))
+return;
   D->addAttr(::new (S.Context)
  FormatArgAttr(Attr.getRange(), S.Context, Val.getZExtValue(),
Attr.getAttributeSpellingListIndex()));
 }
 
+static void

[PATCH] D27165: Add format_dynamic_key_arg attribute to improve "-Wformat" warnings for functions that load the formatting string dynamically based on a key value

arphaman added inline comments.



Comment at: include/clang/Basic/Attr.td:862
+def FormatDynamicKeyArg : InheritableAttr {
+  let Spellings = [GCC<"format_dynamic_key_arg">];
+  let Args = [IntArgument<"FormatIdx">];

aaron.ballman wrote:
> Does GCC support this attribute as well? If not, this should use the GNU 
> spelling instead of the GCC one. Also, should this have a C++11 spelling in 
> the clang namespace?
> 
> The name doesn't really convey much about what the attribute is doing, mostly 
> because it doesn't seem obvious what "key" means.
> 
> It seems that the crux of what this attribute says is that the attributed 
> function accepts a string argument of a format specifier and returns the same 
> format specifier. Perhaps `returns_format_specifier` is a better name?
> Does GCC support this attribute as well? If not, this should use the GNU 
> spelling instead of the GCC one. 

No, it doesn't. Thanks for pointing that out, I fixed it.

> Also, should this have a C++11 spelling in the clang namespace?

I don't know, is that required for new attributes? I don't need the C++11 
spelling personally, and I don't know if there is anyone else who's interested 
in this attribute.  

> The name doesn't really convey much about what the attribute is doing, mostly 
> because it doesn't seem obvious what "key" means.
> 
> It seems that the crux of what this attribute says is that the attributed 
> function accepts a string argument of a format specifier and returns the same 
> format specifier. Perhaps returns_format_specifier is a better name?

You're right, the name should convey the intended meaning better. I switched to 
`loads_format_specifier_value_using_key`, how does that sound?
I think it sounds better than just `returns_format_specifier` because I would 
like to see this attribute used only for a particular kind of function. This 
kind of function should load the value at runtime using the key from a 
platform-specific file/database that might also be accessible at compile-time. 
It shouldn't be used for functions that might just modify the given key, which, 
IMO, `returns_format_specifier` can imply.


Repository:
  rL LLVM

https://reviews.llvm.org/D27165



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


[PATCH] D27165: Add format_dynamic_key_arg attribute to improve "-Wformat" warnings for functions that load the formatting string dynamically based on a key value

arphaman updated this revision to Diff 81950.
arphaman marked an inline comment as done.
arphaman added a comment.

The updated patch renames the attribute to 
`loads_format_specifier_value_using_key` and addresses Aaron's comments


Repository:
  rL LLVM

https://reviews.llvm.org/D27165

Files:
  include/clang/Analysis/Analyses/FormatString.h
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  lib/Analysis/PrintfFormatString.cpp
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/Sema/attr-format_arg.c
  test/SemaObjC/format-strings-objc.m

Index: test/SemaObjC/format-strings-objc.m
===
--- test/SemaObjC/format-strings-objc.m
+++ test/SemaObjC/format-strings-objc.m
@@ -302,3 +302,21 @@
 }
 
 @end
+
+@interface FormatDynamicKeyArg
+
+- (NSString *)load:(NSString *)key __attribute__((loads_format_specifier_value_using_key(1)));
+
+@end
+
+void testFormatDynamicKeyArg(FormatDynamicKeyArg *m) {
+  // Don't warn when the key has no formatting specifiers
+  NSLog([m load:@"key"], @"foo");
+  NSLog([m load:@""]);
+
+  // Warn normally when the key has formatting specifiers
+  NSLog([m load:@"correct %d"], 2);
+  NSLog([m load:@"warn %d"], "off"); // expected-warning {{format specifies type 'int' but the argument has type 'char *'}}
+  NSLog([m load:@"%@ %@"], @"name"); // expected-warning {{more '%' conversions than data arguments}}
+  NSLog([m load:@"Warn again %@"], @"name", @"void"); // expected-warning {{data argument not used by format string}}
+}
Index: test/Sema/attr-format_arg.c
===
--- test/Sema/attr-format_arg.c
+++ test/Sema/attr-format_arg.c
@@ -11,3 +11,19 @@
   printf(f("%d"), 123);
   printf(f("%d %d"), 123); // expected-warning{{more '%' conversions than data arguments}}
 }
+
+const char *loadFormattingValue(const char *key) __attribute__((loads_format_specifier_value_using_key(1)));
+
+void testFormatDynamicKeyArg() {
+  // Don't warn when the key has no formatting specifiers
+  printf(loadFormattingValue("key"), "foo");
+
+  // Warn normally when the key has formatting specifiers
+  printf(loadFormattingValue("%d"), 123);
+  printf(loadFormattingValue("%d %d"), 123); // expected-warning{{more '%' conversions than data arguments}}
+}
+
+const char *formatKeyArgError1(const char *format)
+  __attribute__((loads_format_specifier_value_using_key("foo")));  // expected-error{{'loads_format_specifier_value_using_key' attribute requires parameter 1 to be an integer constant}}
+const char *formatKeyArgError2(const char *format)
+  __attribute__((loads_format_specifier_value_using_key(0)));  // expected-error{{'loads_format_specifier_value_using_key' attribute parameter 1 is out of bounds}}
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -2748,13 +2748,14 @@
  Attr.getAttributeSpellingListIndex()));
 }
 
-/// Handle __attribute__((format_arg((idx attribute based on
-/// http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
-static void handleFormatArgAttr(Sema , Decl *D, const AttributeList ) {
+/// Checks a format_arg or loads_format_specifier_value_using_key attribute
+/// and returns true if it has any errors.
+static bool checkFormatArgAttr(Sema , Decl *D, const AttributeList ,
+   llvm::APSInt ) {
   Expr *IdxExpr = Attr.getArgAsExpr(0);
   uint64_t Idx;
   if (!checkFunctionOrMethodParameterIndex(S, D, Attr, 1, IdxExpr, Idx))
-return;
+return true;
 
   // Make sure the format string is really a string.
   QualType Ty = getFunctionOrMethodParamType(D, Idx);
@@ -2767,7 +2768,7 @@
 S.Diag(Attr.getLoc(), diag::err_format_attribute_not)
 << "a string type" << IdxExpr->getSourceRange()
 << getFunctionOrMethodParamRange(D, 0);
-return;
+return true;
   }
   Ty = getFunctionOrMethodResultType(D);
   if (!isNSStringType(Ty, S.Context) &&
@@ -2777,20 +2778,38 @@
 S.Diag(Attr.getLoc(), diag::err_format_attribute_result_not)
 << (NotNSStringTy ? "string type" : "NSString")
 << IdxExpr->getSourceRange() << getFunctionOrMethodParamRange(D, 0);
-return;
+return true;
   }
 
   // We cannot use the Idx returned from checkFunctionOrMethodParameterIndex
   // because that has corrected for the implicit this parameter, and is zero-
   // based.  The attribute expects what the user wrote explicitly.
-  llvm::APSInt Val;
   IdxExpr->EvaluateAsInt(Val, S.Context);
+  return false;
+}
 
+/// Handle __attribute__((format_arg((idx attribute based on
+/// http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
+static void handleFormatArgAttr(Sema , Decl *D, const AttributeList ) {
+  llvm::APSInt Val;
+  if (checkFormatArgAttr(S, D, Attr, Val))
+return;
   D->addAttr(::new (S.Context)
  

[PATCH] D27917: [OpenCL] Improve diagnostics for double type

yaxunl added inline comments.



Comment at: lib/Sema/SemaType.cpp:1505
+  S.getLangOpts().OpenCLVersion < 120 &&
+  !S.getOpenCLOptions().cl_khr_fp64) {
+S.Diag(DS.getTypeSpecTypeLoc(), diag::err_type_requires_extension)

Please update with clang ToT since OpenCLOptions has interface changes.


https://reviews.llvm.org/D27917



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


[PATCH] D22910: Add support for CXXOperatorCallExpr in Expr::HasSideEffects

aaron.ballman added a comment.

In https://reviews.llvm.org/D22910#601083, @Abpostelnicu wrote:

> Can someone please show me an example on how to write a test for this patch?


You could test this with anything that diagnoses side effects in an unevaluated 
context (look for `warn_side_effects_unevaluated_context` diagnostics), such as 
use as the operand to `sizeof`.


https://reviews.llvm.org/D22910



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


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

aaron.ballman added inline comments.



Comment at: clang-tidy/misc/SuspiciousEnumUsageCheck.cpp:31
+"enum type seems like a bitmask (contains mostly "
+"power-of-2 literals) but some literal(s) are not a power-of-2";
+

Please drop the `(s)` from the diagnostic. The phrase "but some literal are 
not" is incorrect. Alternatively, you could use the `%plural` diagnostic 
modifier (see `note_constexpr_baa_value_insufficient_alignment` in 
DiagnosticASTKinds.td for an example usage).


https://reviews.llvm.org/D22507



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


  1   2   >