Re: [PATCH] D50736: [libc++] Use correct rand.eng.mers all-zeroes seed sequence fallback

2018-08-16 Thread Hubert Tong via cfe-commits
I can commit sometime today; thanks.

-- HT

On Thu, Aug 16, 2018 at 1:24 PM, Marshall Clow via Phabricator <
revi...@reviews.llvm.org> wrote:

> mclow.lists accepted this revision.
> mclow.lists added a comment.
> This revision is now accepted and ready to land.
>
> This LGTM. Do you want me to commit it for you?
>
>
> Repository:
>   rCXX libc++
>
> https://reviews.llvm.org/D50736
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r339969 - [libc++] Use correct rand.eng.mers all-zeroes seed sequence fallback

2018-08-16 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Thu Aug 16 16:56:54 2018
New Revision: 339969

URL: http://llvm.org/viewvc/llvm-project?rev=339969&view=rev
Log:
[libc++] Use correct rand.eng.mers all-zeroes seed sequence fallback

Summary:
When a seed sequence would lead to having no non-zero significant bits
in the initial state of a `mersenne_twister_engine`, the fallback is to
flip the most significant bit of the first value that appears in the
textual representation of the initial state.

rand.eng.mers describes this as setting the value to be 2 to the power
of one less than w; the previous value encoded in the implementation,
namely one less than "2 to the power of w", is replaced by the correct
value in this patch.

Reviewers: mclow.lists, EricWF, jasonliu

Reviewed By: mclow.lists

Subscribers: mclow.lists, jasonliu, EricWF, christof, ldionne, cfe-commits

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

Added:

libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq_all_zero.pass.cpp
Modified:
libcxx/trunk/include/random

Modified: libcxx/trunk/include/random
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/random?rev=339969&r1=339968&r2=339969&view=diff
==
--- libcxx/trunk/include/random (original)
+++ libcxx/trunk/include/random Thu Aug 16 16:56:54 2018
@@ -2337,7 +2337,7 @@ mersenne_twister_engine<_UIntType, __w,
 for (size_t __i = 1; __i < __n; ++__i)
 if (__x_[__i] != 0)
 return;
-__x_[0] = _Max;
+__x_[0] = result_type(1) << (__w - 1);
 }
 }
 
@@ -2363,7 +2363,7 @@ mersenne_twister_engine<_UIntType, __w,
 for (size_t __i = 1; __i < __n; ++__i)
 if (__x_[__i] != 0)
 return;
-__x_[0] = _Max;
+__x_[0] = result_type(1) << (__w - 1);
 }
 }
 

Added: 
libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq_all_zero.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq_all_zero.pass.cpp?rev=339969&view=auto
==
--- 
libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq_all_zero.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq_all_zero.pass.cpp
 Thu Aug 16 16:56:54 2018
@@ -0,0 +1,81 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// template 
+// class mersenne_twister_engine;
+
+// template  explicit mersenne_twister_engine(Sseq &q);
+//
+// [ ... ] Finally, if the most significant $w-r$ bits of $X_{-n}$ are 
zero,
+// and if each of the other resulting $X_i$ is $0$, changes $X_{-n}$ to
+// $ 2^{w-1} $.
+
+#include 
+
+#include 
+#include 
+#include 
+#if TEST_STD_VER >= 11
+#include 
+#endif
+
+struct all_zero_seed_seq {
+  typedef unsigned int result_type;
+
+  all_zero_seed_seq() {}
+
+  template 
+  all_zero_seed_seq(InputIterator, InputIterator) {}
+#if TEST_STD_VER >= 11
+  all_zero_seed_seq(std::initializer_list) {}
+#endif
+
+  template 
+  void generate(RandomAccessIterator rb, RandomAccessIterator re) {
+std::fill(rb, re, 0u);
+  }
+
+  std::size_t size() const { return 0u; }
+  template  void param(OutputIterator) const {}
+};
+
+template 
+void test(void) {
+  const std::size_t state_size = 1u;
+  const std::size_t shift_size = 1u;
+  const std::size_t tempering_l = word_size;
+
+  all_zero_seed_seq q;
+  std::mersenne_twister_engine
+  e(q);
+
+  const result_type Xneg1 = result_type(1) << (word_size - 1);
+  const result_type Y = Xneg1;
+  const result_type X0 = Xneg1 ^ (Y >> 1);
+  assert(e() == X0);
+}
+
+int main() {
+  // Test for k == 1: word_size <= 32.
+  test();
+
+  // Test for k == 2: (32 < word_size <= 64).
+  test();
+}


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


r321778 - Replace cp -a in various Clang tests

2018-01-03 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Wed Jan  3 17:15:52 2018
New Revision: 321778

URL: http://llvm.org/viewvc/llvm-project?rev=321778&view=rev
Log:
Replace cp -a in various Clang tests

Summary:
cp -a is neither part of POSIX nor the LSB. The nearest equivalent under
POSIX is cp -RPp; however, cp -R is sufficient for the intended purpose.

test/Modules/crash-vfs-headermaps.m is not updated since it requires
system-darwin anyway.

Reviewers: bruno

Reviewed By: bruno

Subscribers: bruno, rcraik, cfe-commits

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

Modified:
cfe/trunk/test/Modules/crash-vfs-path-emptydir-entries.m
cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m
cfe/trunk/test/Modules/crash-vfs-path-symlink-topheader.m
cfe/trunk/test/Modules/crash-vfs-umbrella-frameworks.m
cfe/trunk/test/VFS/umbrella-framework-import-skipnonexist.m

Modified: cfe/trunk/test/Modules/crash-vfs-path-emptydir-entries.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-path-emptydir-entries.m?rev=321778&r1=321777&r2=321778&view=diff
==
--- cfe/trunk/test/Modules/crash-vfs-path-emptydir-entries.m (original)
+++ cfe/trunk/test/Modules/crash-vfs-path-emptydir-entries.m Wed Jan  3 
17:15:52 2018
@@ -8,7 +8,7 @@
 
 // RUN: rm -rf %t
 // RUN: mkdir -p %t/i %t/m %t %t/sysroot
-// RUN: cp -a %S/Inputs/crash-recovery/usr %t/i/
+// RUN: cp -R %S/Inputs/crash-recovery/usr %t/i/
 
 // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
 // RUN: %clang -fsyntax-only %s -I %/t/i -isysroot %/t/sysroot/ \

Modified: cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m?rev=321778&r1=321777&r2=321778&view=diff
==
--- cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m (original)
+++ cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m Wed Jan  3 
17:15:52 2018
@@ -8,7 +8,7 @@
 
 // RUN: rm -rf %t
 // RUN: mkdir -p %t/i %t/m %t %t/sysroot
-// RUN: cp -a %S/Inputs/crash-recovery/usr %t/i/
+// RUN: cp -R %S/Inputs/crash-recovery/usr %t/i/
 // RUN: ln -s include/tcl-private %t/i/usr/x
 
 // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \

Modified: cfe/trunk/test/Modules/crash-vfs-path-symlink-topheader.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-path-symlink-topheader.m?rev=321778&r1=321777&r2=321778&view=diff
==
--- cfe/trunk/test/Modules/crash-vfs-path-symlink-topheader.m (original)
+++ cfe/trunk/test/Modules/crash-vfs-path-symlink-topheader.m Wed Jan  3 
17:15:52 2018
@@ -8,7 +8,7 @@
 
 // RUN: rm -rf %t
 // RUN: mkdir -p %t/i %t/m %t %t/sysroot
-// RUN: cp -a %S/Inputs/crash-recovery/usr %t/i/
+// RUN: cp -R %S/Inputs/crash-recovery/usr %t/i/
 // RUN: rm -f %t/i/usr/include/pthread_impl.h
 // RUN: ln -s pthread/pthread_impl.h %t/i/usr/include/pthread_impl.h
 

Modified: cfe/trunk/test/Modules/crash-vfs-umbrella-frameworks.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-umbrella-frameworks.m?rev=321778&r1=321777&r2=321778&view=diff
==
--- cfe/trunk/test/Modules/crash-vfs-umbrella-frameworks.m (original)
+++ cfe/trunk/test/Modules/crash-vfs-umbrella-frameworks.m Wed Jan  3 17:15:52 
2018
@@ -5,7 +5,7 @@
 
 // RUN: rm -rf %t
 // RUN: mkdir -p %t/i %t/m %t
-// RUN: cp -a %S/Inputs/crash-recovery/Frameworks %t/i/
+// RUN: cp -R %S/Inputs/crash-recovery/Frameworks %t/i/
 // RUN: mkdir -p %t/i/Frameworks/A.framework/Frameworks
 // RUN: ln -s ../../B.framework 
%t/i/Frameworks/A.framework/Frameworks/B.framework
 

Modified: cfe/trunk/test/VFS/umbrella-framework-import-skipnonexist.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/umbrella-framework-import-skipnonexist.m?rev=321778&r1=321777&r2=321778&view=diff
==
--- cfe/trunk/test/VFS/umbrella-framework-import-skipnonexist.m (original)
+++ cfe/trunk/test/VFS/umbrella-framework-import-skipnonexist.m Wed Jan  3 
17:15:52 2018
@@ -5,7 +5,7 @@
 
 // RUN: rm -rf %t
 // RUN: mkdir -p %t/vdir %t/outdir %t/cache
-// RUN: cp -a %S/Inputs/Bar.framework %t/outdir/
+// RUN: cp -R %S/Inputs/Bar.framework %t/outdir/
 //
 // RUN: sed -e "s:VDIR:%t/vdir:g" -e "s:OUT_DIR:%t/outdir:g" 
%S/Inputs/bar-headers.yaml > %t/vdir/bar-headers.yaml
 // RUN: rm -f %t/outdir/Bar.framework/Headers/B.h


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


r321828 - Use backslash escape, replacing xargs -0 in test macro-multiline.c

2018-01-04 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Thu Jan  4 14:58:30 2018
New Revision: 321828

URL: http://llvm.org/viewvc/llvm-project?rev=321828&view=rev
Log:
Use backslash escape, replacing xargs -0 in test macro-multiline.c

Summary:
xargs supports escaping of newline characters with backslash.
xargs -0 is neither part of POSIX nor the LSB.

This patch removes the -0 option and adjusts the input to xargs
accordingly; that is, the input is a text file not ending in an
incomplete line, and the newline of interest is preceded by a backslash.

Note: The treatment of escaped newline characters is not as clearly
specified by POSIX as for escaped blank characters; however, the same
can be said for escaped backslashes. It is slightly more clear for the
case where the -I option is used; however, -I is also of limited
portability.

Reviewers: bruno

Reviewed By: bruno

Subscribers: bruno, rcraik, cfe-commits

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

Modified:
cfe/trunk/test/Preprocessor/macro-multiline.c

Modified: cfe/trunk/test/Preprocessor/macro-multiline.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/macro-multiline.c?rev=321828&r1=321827&r2=321828&view=diff
==
--- cfe/trunk/test/Preprocessor/macro-multiline.c (original)
+++ cfe/trunk/test/Preprocessor/macro-multiline.c Thu Jan  4 14:58:30 2018
@@ -1,4 +1,4 @@
-// RUN: printf -- "-DX=A\nTHIS_SHOULD_NOT_EXIST_IN_THE_OUTPUT" | xargs -0 
%clang -E %s | FileCheck -strict-whitespace %s
+// RUN: printf -- "-DX=A\nTHIS_SHOULD_NOT_EXIST_IN_THE_OUTPUT\n" | xargs 
%clang -E %s | FileCheck -strict-whitespace %s
 
 // Per GCC -D semantics, \n and anything that follows is ignored.
 


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


r321830 - Use POSIX argument syntax in test rewrite-includes-messages.c

2018-01-04 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Thu Jan  4 15:03:48 2018
New Revision: 321830

URL: http://llvm.org/viewvc/llvm-project?rev=321830&view=rev
Log:
Use POSIX argument syntax in test rewrite-includes-messages.c

Invoke diff such that options precede operands. Not doing so leads to
unspecified behaviour under the LSB.

Modified:
cfe/trunk/test/Frontend/rewrite-includes-messages.c

Modified: cfe/trunk/test/Frontend/rewrite-includes-messages.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/rewrite-includes-messages.c?rev=321830&r1=321829&r2=321830&view=diff
==
--- cfe/trunk/test/Frontend/rewrite-includes-messages.c (original)
+++ cfe/trunk/test/Frontend/rewrite-includes-messages.c Thu Jan  4 15:03:48 2018
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -E -frewrite-includes %s -I%S/Inputs/ | %clang_cc1 -Wall 
-fsyntax-only -Wunused-macros -x c - 2>&1 > %t.1
 // RUN: %clang_cc1 -I%S/Inputs/ -Wall -Wunused-macros -fsyntax-only %s 2>&1 > 
%t.2
-// RUN: diff %t.1 %t.2 -u
+// RUN: diff -u %t.1 %t.2
 // expected-no-diagnostics
 
 #include "rewrite-includes-messages.h"


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


Re: r351701 - Replace llvm::isPodLike<...> by llvm::is_trivially_copyable<...>

2019-01-22 Thread Hubert Tong via cfe-commits
I am also hitting this. GCC 4.8 is still the minimum at this time.

-- HT

On Tue, Jan 22, 2019 at 8:10 AM Axel Naumann via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Hi,
>
> This broke our clang builds with
>
> $ gcc --version
> gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
>
> on CentOS Linux release 7.6.1810 (Core),
>
> [ 23%] Building CXX object
> tools/clang/lib/Basic/CMakeFiles/clangBasic.dir/Module.cpp.o
>
> In file included from include/llvm/ADT/StringMap.h:20:0,
>  from include/llvm/Support/Host.h:16,
>  from include/llvm/ADT/Hashing.h:48,
>  from include/llvm/ADT/ArrayRef.h:12,
>  from include/llvm/ADT/DenseMapInfo.h:16,
>  from include/llvm/ADT/DenseMap.h:16,
>  from tools/clang/include/clang/Basic/FileManager.h:19,
>  from tools/clang/include/clang/Basic/Module.h:18,
>  from tools/clang/lib/Basic/Module.cpp:14:
> include/llvm/Support/PointerLikeTypeTraits.h: In instantiation of
> ‘struct llvm::PointerLikeTypeTraits’:
> /usr/include/c++/4.8.2/type_traits:1087:41:   required by substitution
> of ‘template static decltype
> (((declval<_Tp1>)()=(declval<_Up1>)(), std::__sfinae_types::__one()))
> std::__is_assignable_helper<_Tp, _Up>::__test(int) [with _Tp1 = _Tp1;
> _Up1 = _Up1; _Tp =
> llvm::detail::trivial_helper bool> >&; _Up = const
> llvm::detail::trivial_helper bool> >&] [with _Tp1 =
> llvm::detail::trivial_helper bool> >&; _Up1 = const
> llvm::detail::trivial_helper bool> >&]’
> /usr/include/c++/4.8.2/type_traits:1094:50:   required from ‘constexpr
> const bool
>
> std::__is_assignable_helper 1u, bool> >&, const
> llvm::detail::trivial_helper bool> >&>::value’
> /usr/include/c++/4.8.2/type_traits:1099:12:   required from ‘struct
>
> std::is_assignable 1u, bool> >&, const
> llvm::detail::trivial_helper bool> >&>’
> /usr/include/c++/4.8.2/type_traits:1112:12:   required from ‘struct
>
> std::__is_copy_assignable_impl 1u, bool> >, false>’
> /usr/include/c++/4.8.2/type_traits:1118:12:   required from ‘struct
>
> std::is_copy_assignable 1u, bool> > >’
> include/llvm/Support/type_traits.h:142:25:   required from ‘constexpr
> const bool
> llvm::is_trivially_copyable bool> >::has_trivial_copy_assign’
> include/llvm/Support/type_traits.h:163:32:   required from ‘constexpr
> const bool
> llvm::is_trivially_copyable bool> >::value’
> include/llvm/ADT/SmallVector.h:321:7:   required from ‘class
> llvm::SmallVectorImpl >’
> include/llvm/ADT/SmallVector.h:845:7:   required from ‘class
> llvm::SmallVector, 2u>’
> tools/clang/include/clang/Basic/Module.h:290:30:   required from here
> include/llvm/Support/PointerLikeTypeTraits.h:59:8: error: invalid
> application of ‘__alignof__’ to incomplete type ‘clang::Module’
>enum { NumLowBitsAvailable = detail::ConstantLog2::value };
> ^
>
> FYI in case you wonder:
>
> $ ls -l /usr/include/c++/
> total 8
> drwxr-xr-x. 12 root root 4096 Dec 11 03:24 4.8.2
> lrwxrwxrwx.  1 root root5 Dec 11 03:24 4.8.5 -> 4.8.2
>
>
> Are we outside the "allowed" range for GCC versions?
>
> Cheers, Axel.
>
> On 1/20/19 10:19 PM, Serge Guelton via cfe-commits wrote:
> > Author: serge_sans_paille
> > Date: Sun Jan 20 13:19:56 2019
> > New Revision: 351701
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=351701&view=rev
> > Log:
> > Replace llvm::isPodLike<...>  by llvm::is_trivially_copyable<...>
> >
> > As noted in https://bugs.llvm.org/show_bug.cgi?id=36651, the
> specialization for
> > isPodLike> did not match the expectation of
> > std::is_trivially_copyable which makes the memcpy optimization invalid.
> >
> > This patch renames the llvm::isPodLike trait into
> llvm::is_trivially_copyable.
> > Unfortunately std::is_trivially_copyable is not portable across compiler
> / STL
> > versions. So a portable version is provided too.
> >
> > Note that the following specialization were invalid:
> >
> > std::pair
> > llvm::Optional
> >
> > Tests have been added to assert that former specialization are respected
> by the
> > standard usage of llvm::is_trivially_copyable, and that when a decent
> version
> > of std::is_trivially_copyable is available, llvm::is_trivially_copyable
> is
> > compared to std::is_trivially_copyable.
> >
> > As of this patch, llvm::Optional is no longer considered trivially
> copyable,
> > even if T is. This is to be fixed in a later patch, as it has impact on a
> > long-running bug (see r347004)
> >
> > Note that GCC warns about this UB, but this got silented by
> https://reviews.llvm.org/D50296.
> >
> > Differential Revision: https://reviews.llvm.org/D54472
> >
> >
> > Modified:
> > cfe/trunk/include/clang/AST/BaseSubobject.h
> > cfe/trunk/include/clang/AST/CharUnits.h
> > cfe/trunk/include/clang/AST/DeclAccessPair.h
> > cfe/trunk/include/clang/AST/DeclarationName.h
> > cfe/trunk/include/clang/AST/ExprObjC.h
> > cfe/trunk/include/clang/AST/GlobalDecl.h
> > cfe/trunk/include/clang/A

r356843 - libclang/CIndexer.cpp: Use loadquery() on AIX for path to library

2019-03-23 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Sat Mar 23 11:10:45 2019
New Revision: 356843

URL: http://llvm.org/viewvc/llvm-project?rev=356843&view=rev
Log:
libclang/CIndexer.cpp: Use loadquery() on AIX for path to library

Summary:
`dladdr` is not available on AIX. Similar functionality is presented
through `loadquery`. This patch replaces a use of `dladdr` with a
version based on `loadquery`.

Reviewers: sfertile, xingxue, jasonliu

Reviewed By: xingxue

Subscribers: jsji, lhames, majnemer, asb, arphaman, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/tools/libclang/CIndexer.cpp

Modified: cfe/trunk/tools/libclang/CIndexer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexer.cpp?rev=356843&r1=356842&r2=356843&view=diff
==
--- cfe/trunk/tools/libclang/CIndexer.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexer.cpp Sat Mar 23 11:10:45 2019
@@ -32,12 +32,69 @@
 
 #ifdef _WIN32
 #include 
+#elif defined(_AIX)
+#include 
+#include 
 #else
 #include 
 #endif
 
 using namespace clang;
 
+#ifdef _AIX
+namespace clang {
+namespace {
+
+template 
+void getClangResourcesPathImplAIX(LibClangPathType &LibClangPath) {
+  int PrevErrno = errno;
+
+  size_t BufSize = 2048u;
+  std::unique_ptr Buf;
+  while (true) {
+Buf = llvm::make_unique(BufSize);
+errno = 0;
+int Ret = loadquery(L_GETXINFO, Buf.get(), (unsigned int)BufSize);
+if (Ret != -1)
+  break; // loadquery() was successful.
+if (errno != ENOMEM)
+  llvm_unreachable("Encountered an unexpected loadquery() failure");
+
+// errno == ENOMEM; try to allocate more memory.
+if ((BufSize & ~((-1u) >> 1u)) != 0u)
+  llvm::report_fatal_error("BufSize needed for loadquery() too large");
+
+Buf.release();
+BufSize <<= 1u;
+  }
+
+  // Extract the function entry point from the function descriptor.
+  uint64_t EntryAddr =
+  reinterpret_cast(clang_createTranslationUnit);
+
+  // Loop to locate the function entry point in the loadquery() results.
+  ld_xinfo *CurInfo = reinterpret_cast(Buf.get());
+  while (true) {
+uint64_t CurTextStart = (uint64_t)CurInfo->ldinfo_textorg;
+uint64_t CurTextEnd = CurTextStart + CurInfo->ldinfo_textsize;
+if (CurTextStart <= EntryAddr && EntryAddr < CurTextEnd)
+  break; // Successfully located.
+
+if (CurInfo->ldinfo_next == 0u)
+  llvm::report_fatal_error("Cannot locate entry point in "
+   "the loadquery() results");
+CurInfo = reinterpret_cast(reinterpret_cast(CurInfo) +
+   CurInfo->ldinfo_next);
+  }
+
+  LibClangPath += reinterpret_cast(CurInfo) + CurInfo->ldinfo_filename;
+  errno = PrevErrno;
+}
+
+} // end anonymous namespace
+} // end namespace clang
+#endif
+
 const std::string &CIndexer::getClangResourcesPath() {
   // Did we already compute the path?
   if (!ResourcesPath.empty())
@@ -64,6 +121,8 @@ const std::string &CIndexer::getClangRes
 #endif
 
   LibClangPath += path;
+#elif defined(_AIX)
+  getClangResourcesPathImplAIX(LibClangPath);
 #else
   // This silly cast below avoids a C++ warning.
   Dl_info info;


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


r357334 - [lit] Set shlibpath_var on AIX

2019-03-29 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Fri Mar 29 16:33:04 2019
New Revision: 357334

URL: http://llvm.org/viewvc/llvm-project?rev=357334&view=rev
Log:
[lit] Set shlibpath_var on AIX

Summary:
When building the `check-all` target on AIX, lit produces
```
warning: unable to inject shared library path on 'AIX'
```

This patch addresses this. `LIBPATH` is the environment variable of
interest on AIX. Newer versions of AIX may consider `LD_LIBRARY_PATH`,
but only when `LIBPATH` is unset.

Reviewers: xingxue, jasonliu, sfertile, serge-sans-paille

Reviewed By: xingxue

Subscribers: jsji, cfe-commits, llvm-commits

Tags: #clang

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

Modified:
cfe/trunk/test/Unit/lit.cfg.py

Modified: cfe/trunk/test/Unit/lit.cfg.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Unit/lit.cfg.py?rev=357334&r1=357333&r2=357334&view=diff
==
--- cfe/trunk/test/Unit/lit.cfg.py (original)
+++ cfe/trunk/test/Unit/lit.cfg.py Fri Mar 29 16:33:04 2019
@@ -42,6 +42,8 @@ def find_shlibpath_var():
 yield 'DYLD_LIBRARY_PATH'
 elif platform.system() == 'Windows':
 yield 'PATH'
+elif platform.system() == 'AIX':
+yield 'LIBPATH'
 
 for shlibpath_var in find_shlibpath_var():
 # in stand-alone builds, shlibdir is clang's build tree


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


r359691 - [analyzer][tests] Use diff_plist, correct order of arguments for missed cases; NFC

2019-05-01 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Wed May  1 08:53:56 2019
New Revision: 359691

URL: http://llvm.org/viewvc/llvm-project?rev=359691&view=rev
Log:
[analyzer][tests] Use diff_plist, correct order of arguments for missed cases; 
NFC

For various files under `clang/test/Analysis`, D52036 applied
`%diff_plist` to replace `diff` invocations with certain options and
D56340 swapped the order of the arguments so that the reference file
comes first. The tests that used `tail` to filter the test output were
not modified accordingly. This patch applies the corresponding update
to those tests.

Modified:
cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp
cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp
cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c
cfe/trunk/test/Analysis/lambda-notes.cpp
cfe/trunk/test/Analysis/malloc-plist.c

Modified: cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp?rev=359691&r1=359690&r2=359691&view=diff
==
--- cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp (original)
+++ cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp Wed May  1 
08:53:56 2019
@@ -1,6 +1,6 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator 
-analyzer-output=text -verify %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator 
-analyzer-output=plist %s -o %t.plist
-// RUN: tail -n +11 %t.plist | diff -u -w -I "/" -I ".:" -I 
"version" - 
%S/copypaste/Inputs/expected-plists/MismatchedDeallocator-path-notes.cpp.plist
+// RUN: tail -n +11 %t.plist | %diff_plist 
%S/copypaste/Inputs/expected-plists/MismatchedDeallocator-path-notes.cpp.plist -
 
 void changePointee(int *p);
 int *allocIntArray(unsigned c) {

Modified: 
cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp?rev=359691&r1=359690&r2=359691&view=diff
==
--- cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp 
(original)
+++ cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp Wed 
May  1 08:53:56 2019
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection 
-analyzer-output=plist-multi-file %s -o %t.plist
-// RUN: tail -n +11 %t.plist | diff -u -w -I "/" -I ".:" -I 
"version" - %S/Inputs/expected-plists/plist-diagnostics-include-check.cpp.plist
+// RUN: tail -n +11 %t.plist | %diff_plist 
%S/Inputs/expected-plists/plist-diagnostics-include-check.cpp.plist -
 
 #include "Inputs/include/plist-diagnostics-include-check-macro.h"
 

Modified: cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c?rev=359691&r1=359690&r2=359691&view=diff
==
--- cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c (original)
+++ cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c Wed May  1 08:53:56 
2019
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=plist-html 
-o %t.plist -verify %s
-// RUN: tail -n +11 %t.plist | diff -u -w -I "/" -I ".:" -I 
"version" --ignore-matching-lines=report - 
%S/Inputs/expected-plists/plist-multi-file.c.plist
+// RUN: tail -n +11 %t.plist | %diff_plist --ignore-matching-lines=report 
%S/Inputs/expected-plists/plist-multi-file.c.plist -
 
 #include "plist-multi-file.h"
 

Modified: cfe/trunk/test/Analysis/lambda-notes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/lambda-notes.cpp?rev=359691&r1=359690&r2=359691&view=diff
==
--- cfe/trunk/test/Analysis/lambda-notes.cpp (original)
+++ cfe/trunk/test/Analysis/lambda-notes.cpp Wed May  1 08:53:56 2019
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core.DivideZero 
-analyzer-config inline-lambdas=true -analyzer-output plist -verify %s -o %t
-// RUN: tail -n +11 %t | diff -u -w -I "/" -I ".:" -I 
"version" - %S/Inputs/expected-plists/lambda-notes.cpp.plist
+// RUN: tail -n +11 %t | %diff_plist 
%S/Inputs/expected-plists/lambda-notes.cpp.plist -
 
 
 // Diagnostic inside a lambda

Modified: cfe/trunk/test/Analysis/malloc-plist.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/malloc-plist.c?rev=359691&r1=359690&r2=359691&view=diff
==
--- cfe/trunk/test/Analysis/malloc-plist.c (original)
+++ cfe/trunk/test/Analysis/malloc-plist.c Wed May  1 08:53:56 2019
@@ -1,6 +1,6 @@
 // RUN: rm -f %t
 // RUN: %cl

r359692 - [analyzer][tests][NFC] Add EOF newlines, normalize reference expected files

2019-05-01 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Wed May  1 08:57:00 2019
New Revision: 359692

URL: http://llvm.org/viewvc/llvm-project?rev=359692&view=rev
Log:
[analyzer][tests][NFC] Add EOF newlines, normalize reference expected files

Reference expected files not ending with a newline are normalized to
have said newlines. Additionally `plist-macros-with-expansion.cpp.plist`
is modified to add a line that is ignored by `%diff_plist`, but not by
the more sensitive pattern proposed by
http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html for
`%normalize_plist`.

Modified:

cfe/trunk/test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist

Modified: 
cfe/trunk/test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist?rev=359692&r1=359691&r2=359692&view=diff
==
--- 
cfe/trunk/test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist
 (original)
+++ 
cfe/trunk/test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist
 Wed May  1 08:57:00 2019
@@ -2,6 +2,7 @@
 http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
 
 
+ clang_version
  diagnostics
  
   

Modified: 
cfe/trunk/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist?rev=359692&r1=359691&r2=359692&view=diff
==
--- cfe/trunk/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist 
(original)
+++ cfe/trunk/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist 
Wed May  1 08:57:00 2019
@@ -26110,4 +26110,4 @@
   
/Volumes/Transcend/code/monorepo/llvm-project/clang/test/Analysis/retain-release.m
  
 
-
\ No newline at end of file
+

Modified: 
cfe/trunk/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist?rev=359692&r1=359691&r2=359692&view=diff
==
--- 
cfe/trunk/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist 
(original)
+++ 
cfe/trunk/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist 
Wed May  1 08:57:00 2019
@@ -26179,4 +26179,4 @@
   
/Volumes/Transcend/code/monorepo/llvm-project/clang/test/Analysis/retain-release.m
  
 
-
\ No newline at end of file
+


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


r353975 - [PowerPC] Stop defining _ARCH_PWR6X on POWER7 and up

2019-02-13 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Wed Feb 13 12:17:13 2019
New Revision: 353975

URL: http://llvm.org/viewvc/llvm-project?rev=353975&view=rev
Log:
[PowerPC] Stop defining _ARCH_PWR6X on POWER7 and up

Summary:
The predefined macro `_ARCH_PWR6X` is associated with GCC's
`-mcpu=power6x` option, which enables generation of P6 "raw mode"
instructions such as `mftgpr`.

Later POWER processors build upon the "architected mode", not the raw
one. `_ARCH_PWR6X` should not be defined for these later processors.

Fixes PR#40236.

Reviewers: echristo, hfinkel, kbarton, nemanjai, wschmidt

Reviewed By: hfinkel

Subscribers: jsji, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/Basic/Targets/PPC.h
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Basic/Targets/PPC.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/PPC.h?rev=353975&r1=353974&r2=353975&view=diff
==
--- cfe/trunk/lib/Basic/Targets/PPC.h (original)
+++ cfe/trunk/lib/Basic/Targets/PPC.h Wed Feb 13 12:17:13 2019
@@ -131,19 +131,18 @@ public:
 ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr |
 ArchDefinePpcsq)
   .Cases("power7", "pwr7",
-ArchDefinePwr7 | ArchDefinePwr6x | ArchDefinePwr6 |
-ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 |
-ArchDefinePpcgr | ArchDefinePpcsq)
+ ArchDefinePwr7 | ArchDefinePwr6 | ArchDefinePwr5x |
+ ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr |
+ ArchDefinePpcsq)
   // powerpc64le automatically defaults to at least power8.
   .Cases("power8", "pwr8", "ppc64le",
-ArchDefinePwr8 | ArchDefinePwr7 | ArchDefinePwr6x |
-ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 |
-ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq)
+ ArchDefinePwr8 | ArchDefinePwr7 | ArchDefinePwr6 |
+ ArchDefinePwr5x | ArchDefinePwr5 | ArchDefinePwr4 |
+ ArchDefinePpcgr | ArchDefinePpcsq)
   .Cases("power9", "pwr9",
-ArchDefinePwr9 | ArchDefinePwr8 | ArchDefinePwr7 |
-ArchDefinePwr6x | ArchDefinePwr6 | ArchDefinePwr5x |
-ArchDefinePwr5 | ArchDefinePwr4 | ArchDefinePpcgr |
-ArchDefinePpcsq)
+ ArchDefinePwr9 | ArchDefinePwr8 | ArchDefinePwr7 |
+ ArchDefinePwr6 | ArchDefinePwr5x | ArchDefinePwr5 |
+ ArchDefinePwr4 | ArchDefinePpcgr | ArchDefinePpcsq)
   .Default(ArchDefineNone);
 }
 return CPUKnown;

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=353975&r1=353974&r2=353975&view=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Wed Feb 13 12:17:13 2019
@@ -5991,7 +5991,7 @@
 // PPC64LE:#define _ARCH_PWR5 1
 // PPC64LE:#define _ARCH_PWR5X 1
 // PPC64LE:#define _ARCH_PWR6 1
-// PPC64LE:#define _ARCH_PWR6X 1
+// PPC64LE-NOT:#define _ARCH_PWR6X 1
 // PPC64LE:#define _ARCH_PWR7 1
 // PPC64LE:#define _CALL_ELF 2
 // PPC64LE:#define _LITTLE_ENDIAN 1
@@ -6331,7 +6331,7 @@
 // PPCPWR7:#define _ARCH_PWR5 1
 // PPCPWR7:#define _ARCH_PWR5X 1
 // PPCPWR7:#define _ARCH_PWR6 1
-// PPCPWR7:#define _ARCH_PWR6X 1
+// PPCPWR7-NOT:#define _ARCH_PWR6X 1
 // PPCPWR7:#define _ARCH_PWR7 1
 //
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none 
-target-cpu power7 -fno-signed-char < /dev/null | FileCheck -match-full-lines 
-check-prefix PPCPOWER7 %s
@@ -6344,7 +6344,7 @@
 // PPCPOWER7:#define _ARCH_PWR5 1
 // PPCPOWER7:#define _ARCH_PWR5X 1
 // PPCPOWER7:#define _ARCH_PWR6 1
-// PPCPOWER7:#define _ARCH_PWR6X 1
+// PPCPOWER7-NOT:#define _ARCH_PWR6X 1
 // PPCPOWER7:#define _ARCH_PWR7 1
 //
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none 
-target-cpu pwr8 -fno-signed-char < /dev/null | FileCheck -match-full-lines 
-check-prefix PPCPWR8 %s
@@ -6357,7 +6357,7 @@
 // PPCPWR8:#define _ARCH_PWR5 1
 // PPCPWR8:#define _ARCH_PWR5X 1
 // PPCPWR8:#define _ARCH_PWR6 1
-// PPCPWR8:#define _ARCH_PWR6X 1
+// PPCPWR8-NOT:#define _ARCH_PWR6X 1
 // PPCPWR8:#define _ARCH_PWR7 1
 // PPCPWR8:#define _ARCH_PWR8 1
 //
@@ -6374,7 +6374,7 @@
 // PPCPOWER8:#define _ARCH_PWR5 1
 // PPCPOWER8:#define _ARCH_PWR5X 1
 // PPCPOWER8:#define _ARCH_PWR6 1
-// PPCPOWER8:#define _ARCH_PWR6X 1
+// PPCPOWER8-NOT:#define _ARCH_PWR6X 1
 // PPCPOWER8:#define _ARCH_PWR7 1
 // PPCPOWER8:#define _ARCH_PWR8 1
 //
@@ -6388,7 +6388,7 @@
 // PPCPWR9:#define _ARCH_PWR5 1
 // PPCPW

r362876 - [analyzer][NFC][tests] Remove unused expected-plist files

2019-06-08 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Sat Jun  8 06:48:25 2019
New Revision: 362876

URL: http://llvm.org/viewvc/llvm-project?rev=362876&view=rev
Log:
[analyzer][NFC][tests] Remove unused expected-plist files

Removed:
cfe/trunk/test/Analysis/Inputs/expected-plists/cstring-plist.c.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/plist-stats-output.c.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/yaccignore.c.plist

Removed: cfe/trunk/test/Analysis/Inputs/expected-plists/cstring-plist.c.plist
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/Inputs/expected-plists/cstring-plist.c.plist?rev=362875&view=auto
==
--- cfe/trunk/test/Analysis/Inputs/expected-plists/cstring-plist.c.plist 
(original)
+++ cfe/trunk/test/Analysis/Inputs/expected-plists/cstring-plist.c.plist 
(removed)
@@ -1,8 +0,0 @@
-diagnostics
-
-
-
-
-
-
-

Removed: 
cfe/trunk/test/Analysis/Inputs/expected-plists/plist-stats-output.c.plist
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/Inputs/expected-plists/plist-stats-output.c.plist?rev=362875&view=auto
==
--- cfe/trunk/test/Analysis/Inputs/expected-plists/plist-stats-output.c.plist 
(original)
+++ cfe/trunk/test/Analysis/Inputs/expected-plists/plist-stats-output.c.plist 
(removed)
@@ -1,9 +0,0 @@
- diagnostics
- 
- 
-statistics
-{
-}
-
-
-

Removed: cfe/trunk/test/Analysis/Inputs/expected-plists/yaccignore.c.plist
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/Inputs/expected-plists/yaccignore.c.plist?rev=362875&view=auto
==
--- cfe/trunk/test/Analysis/Inputs/expected-plists/yaccignore.c.plist (original)
+++ cfe/trunk/test/Analysis/Inputs/expected-plists/yaccignore.c.plist (removed)
@@ -1,4 +0,0 @@
-diagnostics
-
-
-


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


r362877 - [analyzer][NFC][tests] Pre-normalize expected-plists

2019-06-08 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Sat Jun  8 06:51:37 2019
New Revision: 362877

URL: http://llvm.org/viewvc/llvm-project?rev=362877&view=rev
Log:
[analyzer][NFC][tests] Pre-normalize expected-plists

As suggested in the review for D62949, this patch pre-normalizes the
reference expected output plist files by removing lines containing
fields for which we expect differences that should be ignored.

Modified:

cfe/trunk/test/Analysis/Inputs/expected-plists/NewDelete-path-notes.cpp.plist

cfe/trunk/test/Analysis/Inputs/expected-plists/conditional-path-notes.c.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/cxx-for-range.cpp.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/generics.m.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/inline-plist.c.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/inline-unique-reports.c.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/lambda-notes.cpp.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/malloc-plist.c.plist

cfe/trunk/test/Analysis/Inputs/expected-plists/method-call-path-notes.cpp.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/model-file.cpp.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/null-deref-path-notes.m.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/nullability-notes.m.plist

cfe/trunk/test/Analysis/Inputs/expected-plists/plist-macros-with-expansion.cpp.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/plist-macros.cpp.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist
cfe/trunk/test/Analysis/Inputs/expected-plists/unix-fns.c.plist

cfe/trunk/test/Analysis/copypaste/Inputs/expected-plists/MismatchedDeallocator-path-notes.cpp.plist

cfe/trunk/test/Analysis/copypaste/Inputs/expected-plists/plist-diagnostics-notes-as-events.cpp.plist

cfe/trunk/test/Analysis/copypaste/Inputs/expected-plists/plist-diagnostics.cpp.plist

cfe/trunk/test/Analysis/diagnostics/Inputs/expected-plists/deref-track-symbolic-region.c.plist

cfe/trunk/test/Analysis/diagnostics/Inputs/expected-plists/plist-diagnostics-include-check.cpp.plist

cfe/trunk/test/Analysis/diagnostics/Inputs/expected-plists/plist-multi-file.c.plist

cfe/trunk/test/Analysis/diagnostics/Inputs/expected-plists/report-issues-within-main-file.cpp.plist

cfe/trunk/test/Analysis/diagnostics/Inputs/expected-plists/undef-value-caller.c.plist

cfe/trunk/test/Analysis/diagnostics/Inputs/expected-plists/undef-value-param.c.plist

cfe/trunk/test/Analysis/diagnostics/Inputs/expected-plists/undef-value-param.m.plist

cfe/trunk/test/Analysis/inlining/Inputs/expected-plists/eager-reclamation-path-notes.c.plist

cfe/trunk/test/Analysis/inlining/Inputs/expected-plists/eager-reclamation-path-notes.cpp.plist
cfe/trunk/test/Analysis/inlining/Inputs/expected-plists/path-notes.c.plist
cfe/trunk/test/Analysis/inlining/Inputs/expected-plists/path-notes.cpp.plist

Modified: 
cfe/trunk/test/Analysis/Inputs/expected-plists/NewDelete-path-notes.cpp.plist
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/Inputs/expected-plists/NewDelete-path-notes.cpp.plist?rev=362877&r1=362876&r2=362877&view=diff
==
--- 
cfe/trunk/test/Analysis/Inputs/expected-plists/NewDelete-path-notes.cpp.plist 
(original)
+++ 
cfe/trunk/test/Analysis/Inputs/expected-plists/NewDelete-path-notes.cpp.plist 
Sat Jun  8 06:51:37 2019
@@ -3,7 +3,6 @@
 
 
  clang_version
-clang version 8.0.0 
  diagnostics
  
   
@@ -492,7 +491,6 @@
  
  files
  
-   /clang/test/Analysis/NewDelete-path-notes.cpp
  
 
 

Modified: 
cfe/trunk/test/Analysis/Inputs/expected-plists/conditional-path-notes.c.plist
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/Inputs/expected-plists/conditional-path-notes.c.plist?rev=362877&r1=362876&r2=362877&view=diff
==
--- 
cfe/trunk/test/Analysis/Inputs/expected-plists/conditional-path-notes.c.plist 
(original)
+++ 
cfe/trunk/test/Analysis/Inputs/expected-plists/conditional-path-notes.c.plist 
Sat Jun  8 06:51:37 2019
@@ -3,7 +3,6 @@
 
 
  clang_version
-clang version 8.0.0 
  diagnostics
  
   
@@ -1766,7 +1765,6 @@
  
  files
  
-   /clang/test/Analysis/conditional-path-notes.c
  
 
 

Modified: cfe/trunk/test/Analysis/Inputs/expected-plists/cxx-for-range.cpp.plist
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/Inputs/expected-plists/cxx-for-range.cpp.plist?rev=362877&r1=362876&r2=362877&view=diff
==
--- cfe/trunk/test/Analysis/Inputs/expected-plists/cxx-for-range.cpp.plist 
(original)
+++ cfe/trunk/test/Analysis/Inputs/expected-plists/cxx-for-range.cpp.plist Sat 
Jun  8 06:51:37 2019
@@ -3,7 +3,6 @@
 
 
  clang

r362991 - [CUDA] Fix grep pattern in cuda-types.cu

2019-06-10 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Mon Jun 10 15:28:20 2019
New Revision: 362991

URL: http://llvm.org/viewvc/llvm-project?rev=362991&view=rev
Log:
[CUDA] Fix grep pattern in cuda-types.cu

Summary:
vertical-line is not a BRE special character.

POSIX.1-2017 XBD Section 9.3.2 indicates that the interpretation of `\|`
is undefined. This patch uses EREs instead.

Additionally, the pattern is further fixed so that `SIZEOF` and `WIDTH`
macros are checked.

Reviewers: jlebar, daltenty, xingxue, jasonliu, tra

Reviewed By: tra

Subscribers: jfb, jsji, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/test/Preprocessor/cuda-types.cu

Modified: cfe/trunk/test/Preprocessor/cuda-types.cu
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/cuda-types.cu?rev=362991&r1=362990&r2=362991&view=diff
==
--- cfe/trunk/test/Preprocessor/cuda-types.cu (original)
+++ cfe/trunk/test/Preprocessor/cuda-types.cu Mon Jun 10 15:28:20 2019
@@ -8,41 +8,41 @@
 // RUN: mkdir -p %t
 
 // RUN: %clang --cuda-host-only -nocudainc -target i386-unknown-linux-gnu -x 
cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/i386-host-defines-filtered
 // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target 
i386-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-device-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/i386-device-defines-filtered
 // RUN: diff %t/i386-host-defines-filtered %t/i386-device-defines-filtered
 
 // RUN: %clang --cuda-host-only -nocudainc -target x86_64-unknown-linux-gnu -x 
cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/x86_64-host-defines-filtered
 // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target 
x86_64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-device-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/x86_64-device-defines-filtered
 // RUN: diff %t/x86_64-host-defines-filtered %t/x86_64-device-defines-filtered
 
 // RUN: %clang --cuda-host-only -nocudainc -target powerpc64-unknown-linux-gnu 
-x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/powerpc64-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/powerpc64-host-defines-filtered
 // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target 
powerpc64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > 
%t/powerpc64-device-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > 
%t/powerpc64-device-defines-filtered
 // RUN: diff %t/powerpc64-host-defines-filtered 
%t/powerpc64-device-defines-filtered
 
 // RUN: %clang --cuda-host-only -nocudainc -target i386-windows-msvc -x cuda 
-E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-msvc-host-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > %t/i386-msvc-host-defines-filtered
 // RUN: %clang --cuda-device-only -nocudainc -nocudalib -target 
i386-windows-msvc -x cuda -E -dM -o - /dev/null \
-// RUN:   | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define 
__GCC_ATOMIC' \
-// RUN:   | grep -v '__LDBL\|_LONG_DOUBLE' > 
%t/i386-msvc-device-defines-filtered
+// RUN:   | grep -E 'define __[^ ]*(TYPE|MAX|SIZEOF|WIDTH)|define 
__GCC_ATOMIC' \
+// RUN:   | grep -Ev '__LDBL|_LONG_DOUBLE' > 
%t/i386-msvc-device-defines-filtered
 // RUN: diff %t/i386-msvc-host-defines-filtered 
%t/i386-msvc-devi

r362992 - [PlistSupport] Produce a newline to end plist output files

2019-06-10 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Mon Jun 10 15:30:57 2019
New Revision: 362992

URL: http://llvm.org/viewvc/llvm-project?rev=362992&view=rev
Log:
[PlistSupport] Produce a newline to end plist output files

Summary:
As suggested in the review of D62949, this patch updates the plist
output to have a newline at the end of the file. This makes it so that
the plist output file qualifies as a POSIX text file, which increases
the consumability of the generated plist file in relation to various
tools.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

Reviewed By: NoQ, xingxue

Subscribers: jsji, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/ARCMigrate/PlistReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp

Modified: cfe/trunk/lib/ARCMigrate/PlistReporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/PlistReporter.cpp?rev=362992&r1=362991&r2=362992&view=diff
==
--- cfe/trunk/lib/ARCMigrate/PlistReporter.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/PlistReporter.cpp Mon Jun 10 15:30:57 2019
@@ -120,5 +120,5 @@ void arcmt::writeARCDiagsToPlist(const s
   o << " \n";
 
   // Finish.
-  o << "\n";
+  o << "\n\n";
 }

Modified: cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp?rev=362992&r1=362991&r2=362992&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp Mon Jun 10 15:30:57 
2019
@@ -748,7 +748,7 @@ void PlistDiagnostics::FlushDiagnosticsI
   }
 
   // Finish.
-  o << "\n";
+  o << "\n\n";
 }
 
 
//===--===//


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


r362994 - [analyzer][tests] Add normalize_plist to replace diff_plist

2019-06-10 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Mon Jun 10 15:33:34 2019
New Revision: 362994

URL: http://llvm.org/viewvc/llvm-project?rev=362994&view=rev
Log:
[analyzer][tests] Add normalize_plist to replace diff_plist

Summary:
The `%diff_plist` lit substitution invokes `diff` with a non-portable
`-I` option. The intended effect can be achieved by normalizing the
inputs to `diff` beforehand. Such normalization can be done with
`grep -Ev`, which is also used by other tests.

This patch applies the change (adjusted for review comments) described
in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html to the
specific case shown in the list message. Mechanical changes to the other
affected files will follow in later patches.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, 
Szelethus, donat.nagy, dkrupp, Charusso, jsji, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/test/Analysis/lit.local.cfg
cfe/trunk/test/Analysis/unix-fns.c

Modified: cfe/trunk/test/Analysis/lit.local.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/lit.local.cfg?rev=362994&r1=362993&r2=362994&view=diff
==
--- cfe/trunk/test/Analysis/lit.local.cfg (original)
+++ cfe/trunk/test/Analysis/lit.local.cfg Mon Jun 10 15:33:34 2019
@@ -14,6 +14,14 @@ config.test_format = analyzer_test.Analy
 config.substitutions.append(('%diff_plist',
 'diff -u -w -I "/" -I ".:" -I "version"'))
 
+# Filtering command used by Clang Analyzer tests (when comparing .plist files
+# with reference output)
+config.substitutions.append(('%normalize_plist',
+"grep -Ev '%s|%s|%s'" %
+('^[[:space:]]*.* version .*$',
+ '^[[:space:]]*/.*$',
+ '^[[:space:]]*.:.*$')))
+
 # Diff command for testing SARIF output to reference output.
 config.substitutions.append(('%diff_sarif',
 '''diff -U1 -w -I ".*file:.*%basename_t" -I '"version":' -I 
"2\.0\.0\-csd\.[0-9]*\.beta\."'''))

Modified: cfe/trunk/test/Analysis/unix-fns.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/unix-fns.c?rev=362994&r1=362993&r2=362994&view=diff
==
--- cfe/trunk/test/Analysis/unix-fns.c (original)
+++ cfe/trunk/test/Analysis/unix-fns.c Mon Jun 10 15:33:34 2019
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 
-analyzer-checker=core,unix.API,osx.API,optin.portability %s 
-analyzer-store=region -analyzer-output=plist -analyzer-config faux-bodies=true 
 -fblocks -verify -o %t.plist
-// RUN: cat %t.plist | %diff_plist %S/Inputs/expected-plists/unix-fns.c.plist -
+// RUN: %normalize_plist <%t.plist | diff -u 
%S/Inputs/expected-plists/unix-fns.c.plist -
 // RUN: mkdir -p %t.dir
 // RUN: %clang_analyze_cc1 
-analyzer-checker=core,unix.API,osx.API,optin.portability -analyzer-output=html 
-analyzer-config faux-bodies=true -fblocks -o %t.dir %s
 // RUN: rm -fR %t.dir


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


r362996 - [analyzer][tests] Use normalize_plist in place of diff_plist (`cat` cases)

2019-06-10 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Mon Jun 10 15:37:31 2019
New Revision: 362996

URL: http://llvm.org/viewvc/llvm-project?rev=362996&view=rev
Log:
[analyzer][tests] Use normalize_plist in place of diff_plist (`cat` cases)

Summary:
The `%diff_plist` lit substitution invokes `diff` with a non-portable
`-I` option. The intended effect can be achieved by normalizing the
inputs to `diff` beforehand. Such normalization can be done with
`grep -Ev`, which is also used by other tests.

This patch applies the change (adjusted for review comments) described
in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html
mechanically to the cases where the output file is piped to
`%diff_plist` via `cat`.

The changes were applied via a script, except that
`clang/test/Analysis/NewDelete-path-notes.cpp` and
`clang/test/Analysis/plist-macros-with-expansion.cpp` were each adjusted
for the line-continuation on the relevant `RUN` step.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, 
Szelethus, donat.nagy, dkrupp, Charusso, jsji, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/test/Analysis/NewDelete-path-notes.cpp
cfe/trunk/test/Analysis/conditional-path-notes.c
cfe/trunk/test/Analysis/copypaste/plist-diagnostics-notes-as-events.cpp
cfe/trunk/test/Analysis/copypaste/plist-diagnostics.cpp
cfe/trunk/test/Analysis/cxx-for-range.cpp
cfe/trunk/test/Analysis/diagnostics/deref-track-symbolic-region.c
cfe/trunk/test/Analysis/diagnostics/report-issues-within-main-file.cpp
cfe/trunk/test/Analysis/diagnostics/undef-value-caller.c
cfe/trunk/test/Analysis/diagnostics/undef-value-param.c
cfe/trunk/test/Analysis/diagnostics/undef-value-param.m
cfe/trunk/test/Analysis/edges-new.mm
cfe/trunk/test/Analysis/generics.m
cfe/trunk/test/Analysis/inline-plist.c
cfe/trunk/test/Analysis/inline-unique-reports.c
cfe/trunk/test/Analysis/inlining/eager-reclamation-path-notes.c
cfe/trunk/test/Analysis/inlining/eager-reclamation-path-notes.cpp
cfe/trunk/test/Analysis/inlining/path-notes.c
cfe/trunk/test/Analysis/inlining/path-notes.cpp
cfe/trunk/test/Analysis/inlining/path-notes.m
cfe/trunk/test/Analysis/method-call-path-notes.cpp
cfe/trunk/test/Analysis/model-file.cpp
cfe/trunk/test/Analysis/null-deref-path-notes.m
cfe/trunk/test/Analysis/nullability-notes.m
cfe/trunk/test/Analysis/objc-arc.m
cfe/trunk/test/Analysis/objc-radar17039661.m
cfe/trunk/test/Analysis/plist-macros-with-expansion.cpp
cfe/trunk/test/Analysis/plist-macros.cpp
cfe/trunk/test/Analysis/plist-output-alternate.m
cfe/trunk/test/Analysis/plist-output.m
cfe/trunk/test/Analysis/retain-release-path-notes.m
cfe/trunk/test/Analysis/retain-release.m

Modified: cfe/trunk/test/Analysis/NewDelete-path-notes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/NewDelete-path-notes.cpp?rev=362996&r1=362995&r2=362996&view=diff
==
--- cfe/trunk/test/Analysis/NewDelete-path-notes.cpp (original)
+++ cfe/trunk/test/Analysis/NewDelete-path-notes.cpp Mon Jun 10 15:37:31 2019
@@ -11,7 +11,7 @@
 // RUN:   -analyzer-checker=cplusplus.NewDelete,unix.Malloc \
 // RUN:   -analyzer-config add-pop-up-notes=false \
 // RUN:   -analyzer-output=plist %s -o %t.plist
-// RUN: cat %t.plist | %diff_plist \
+// RUN: %normalize_plist <%t.plist | diff -u \
 // RUN:   %S/Inputs/expected-plists/NewDelete-path-notes.cpp.plist -
 
 void test() {

Modified: cfe/trunk/test/Analysis/conditional-path-notes.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/conditional-path-notes.c?rev=362996&r1=362995&r2=362996&view=diff
==
--- cfe/trunk/test/Analysis/conditional-path-notes.c (original)
+++ cfe/trunk/test/Analysis/conditional-path-notes.c Mon Jun 10 15:37:31 2019
@@ -1,6 +1,6 @@
 // RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference 
-analyzer-output=text -verify
 // RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference 
-analyzer-output=plist -o %t
-// RUN: cat %t | %diff_plist 
%S/Inputs/expected-plists/conditional-path-notes.c.plist -
+// RUN: %normalize_plist <%t | diff -u 
%S/Inputs/expected-plists/conditional-path-notes.c.plist -
 
 void testCondOp(int *p) {
   int *x = p ? p : p;

Modified: 
cfe/trunk/test/Analysis/copypaste/plist-diagnostics-notes-as-events.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/copypaste/plist-diagnostics-notes-as-events.cpp?rev=362996&r1=362995&r2=362996&view=diff
==
--- cfe/trunk/test/Analysis/copypaste/plist-diagnostics-notes-as-events.cpp 
(original)
+++ cfe/trunk/test/Analysis/copypaste/plist-diagnostics-notes-as-event

r362998 - [analyzer][tests] Use normalize_plist in place of diff_plist (`tail` cases)

2019-06-10 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Mon Jun 10 15:40:35 2019
New Revision: 362998

URL: http://llvm.org/viewvc/llvm-project?rev=362998&view=rev
Log:
[analyzer][tests] Use normalize_plist in place of diff_plist (`tail` cases)

Summary:
The `%diff_plist` lit substitution invokes `diff` with a non-portable
`-I` option. The intended effect can be achieved by normalizing the
inputs to `diff` beforehand. Such normalization can be done with
`grep -Ev`, which is also used by other tests.

This patch applies the change (adjusted for review comments) described
in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html
mechanically to the cases where the output file is piped to
`%diff_plist` via `tail`. `%diff_plist` is then, being unused, removed.

The changes were applied via a script.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, 
Szelethus, donat.nagy, dkrupp, Charusso, jsji, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp
cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp
cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c
cfe/trunk/test/Analysis/lambda-notes.cpp
cfe/trunk/test/Analysis/lit.local.cfg
cfe/trunk/test/Analysis/malloc-plist.c

Modified: cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp?rev=362998&r1=362997&r2=362998&view=diff
==
--- cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp (original)
+++ cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp Mon Jun 10 
15:40:35 2019
@@ -1,6 +1,6 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator 
-analyzer-output=text -verify %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator 
-analyzer-output=plist %s -o %t.plist
-// RUN: tail -n +11 %t.plist | %diff_plist 
%S/copypaste/Inputs/expected-plists/MismatchedDeallocator-path-notes.cpp.plist -
+// RUN: tail -n +11 %t.plist | %normalize_plist | diff -u 
%S/copypaste/Inputs/expected-plists/MismatchedDeallocator-path-notes.cpp.plist -
 
 void changePointee(int *p);
 int *allocIntArray(unsigned c) {

Modified: 
cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp?rev=362998&r1=362997&r2=362998&view=diff
==
--- cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp 
(original)
+++ cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp Mon 
Jun 10 15:40:35 2019
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection 
-analyzer-output=plist-multi-file %s -o %t.plist
-// RUN: tail -n +11 %t.plist | %diff_plist 
%S/Inputs/expected-plists/plist-diagnostics-include-check.cpp.plist -
+// RUN: tail -n +11 %t.plist | %normalize_plist | diff -u 
%S/Inputs/expected-plists/plist-diagnostics-include-check.cpp.plist -
 
 #include "Inputs/include/plist-diagnostics-include-check-macro.h"
 

Modified: cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c?rev=362998&r1=362997&r2=362998&view=diff
==
--- cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c (original)
+++ cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c Mon Jun 10 15:40:35 
2019
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core 
-analyzer-output=plist-multi-file -o %t.plist -verify %s
-// RUN: tail -n +11 %t.plist | %diff_plist 
%S/Inputs/expected-plists/plist-multi-file.c.plist -
+// RUN: tail -n +11 %t.plist | %normalize_plist | diff -u 
%S/Inputs/expected-plists/plist-multi-file.c.plist -
 
 #include "plist-multi-file.h"
 

Modified: cfe/trunk/test/Analysis/lambda-notes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/lambda-notes.cpp?rev=362998&r1=362997&r2=362998&view=diff
==
--- cfe/trunk/test/Analysis/lambda-notes.cpp (original)
+++ cfe/trunk/test/Analysis/lambda-notes.cpp Mon Jun 10 15:40:35 2019
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core.DivideZero 
-analyzer-config inline-lambdas=true -analyzer-output plist -verify %s -o %t
-// RUN: tail -n +11 %t | %diff_plist 
%S/Inputs/expected-plists/lambda-notes.cpp.plist -
+// RUN: tail -n +11 %t | %normalize_plist | diff -u 
%S/Inputs/expected-plists/lambda-notes.cpp.plist -
 
 
 // Diagnostic inside a lambda

Modified: cf

r363069 - Reapply r362994 & co "[analyzer][tests] Add normalize_plist to replace diff_plist"

2019-06-11 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Tue Jun 11 07:21:32 2019
New Revision: 363069

URL: http://llvm.org/viewvc/llvm-project?rev=363069&view=rev
Log:
Reapply r362994 & co "[analyzer][tests] Add normalize_plist to replace 
diff_plist"

Following r363007, which reverted r362998, r362996, and r362994,
reapply with adjustments for the CRLF differences encountered with
Windows. Namely, the `-b` option of `diff` is employed, and the `grep`
patterns have `$` replaced with `[[:space:]]*$`.

Modified:
cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp
cfe/trunk/test/Analysis/NewDelete-path-notes.cpp
cfe/trunk/test/Analysis/conditional-path-notes.c
cfe/trunk/test/Analysis/copypaste/plist-diagnostics-notes-as-events.cpp
cfe/trunk/test/Analysis/copypaste/plist-diagnostics.cpp
cfe/trunk/test/Analysis/cxx-for-range.cpp
cfe/trunk/test/Analysis/diagnostics/deref-track-symbolic-region.c
cfe/trunk/test/Analysis/diagnostics/plist-diagnostics-include-check.cpp
cfe/trunk/test/Analysis/diagnostics/plist-multi-file.c
cfe/trunk/test/Analysis/diagnostics/report-issues-within-main-file.cpp
cfe/trunk/test/Analysis/diagnostics/undef-value-caller.c
cfe/trunk/test/Analysis/diagnostics/undef-value-param.c
cfe/trunk/test/Analysis/diagnostics/undef-value-param.m
cfe/trunk/test/Analysis/edges-new.mm
cfe/trunk/test/Analysis/generics.m
cfe/trunk/test/Analysis/inline-plist.c
cfe/trunk/test/Analysis/inline-unique-reports.c
cfe/trunk/test/Analysis/inlining/eager-reclamation-path-notes.c
cfe/trunk/test/Analysis/inlining/eager-reclamation-path-notes.cpp
cfe/trunk/test/Analysis/inlining/path-notes.c
cfe/trunk/test/Analysis/inlining/path-notes.cpp
cfe/trunk/test/Analysis/inlining/path-notes.m
cfe/trunk/test/Analysis/lambda-notes.cpp
cfe/trunk/test/Analysis/lit.local.cfg
cfe/trunk/test/Analysis/malloc-plist.c
cfe/trunk/test/Analysis/method-call-path-notes.cpp
cfe/trunk/test/Analysis/model-file.cpp
cfe/trunk/test/Analysis/null-deref-path-notes.m
cfe/trunk/test/Analysis/nullability-notes.m
cfe/trunk/test/Analysis/objc-arc.m
cfe/trunk/test/Analysis/objc-radar17039661.m
cfe/trunk/test/Analysis/plist-macros-with-expansion.cpp
cfe/trunk/test/Analysis/plist-macros.cpp
cfe/trunk/test/Analysis/plist-output-alternate.m
cfe/trunk/test/Analysis/plist-output.m
cfe/trunk/test/Analysis/retain-release-path-notes.m
cfe/trunk/test/Analysis/retain-release.m
cfe/trunk/test/Analysis/unix-fns.c

Modified: cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp?rev=363069&r1=363068&r2=363069&view=diff
==
--- cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp (original)
+++ cfe/trunk/test/Analysis/MismatchedDeallocator-path-notes.cpp Tue Jun 11 
07:21:32 2019
@@ -1,6 +1,6 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator 
-analyzer-output=text -verify %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.MismatchedDeallocator 
-analyzer-output=plist %s -o %t.plist
-// RUN: tail -n +11 %t.plist | %diff_plist 
%S/copypaste/Inputs/expected-plists/MismatchedDeallocator-path-notes.cpp.plist -
+// RUN: tail -n +11 %t.plist | %normalize_plist | diff -ub 
%S/copypaste/Inputs/expected-plists/MismatchedDeallocator-path-notes.cpp.plist -
 
 void changePointee(int *p);
 int *allocIntArray(unsigned c) {

Modified: cfe/trunk/test/Analysis/NewDelete-path-notes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/NewDelete-path-notes.cpp?rev=363069&r1=363068&r2=363069&view=diff
==
--- cfe/trunk/test/Analysis/NewDelete-path-notes.cpp (original)
+++ cfe/trunk/test/Analysis/NewDelete-path-notes.cpp Tue Jun 11 07:21:32 2019
@@ -11,7 +11,7 @@
 // RUN:   -analyzer-checker=cplusplus.NewDelete,unix.Malloc \
 // RUN:   -analyzer-config add-pop-up-notes=false \
 // RUN:   -analyzer-output=plist %s -o %t.plist
-// RUN: cat %t.plist | %diff_plist \
+// RUN: %normalize_plist <%t.plist | diff -ub \
 // RUN:   %S/Inputs/expected-plists/NewDelete-path-notes.cpp.plist -
 
 void test() {

Modified: cfe/trunk/test/Analysis/conditional-path-notes.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/conditional-path-notes.c?rev=363069&r1=363068&r2=363069&view=diff
==
--- cfe/trunk/test/Analysis/conditional-path-notes.c (original)
+++ cfe/trunk/test/Analysis/conditional-path-notes.c Tue Jun 11 07:21:32 2019
@@ -1,6 +1,6 @@
 // RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference 
-analyzer-output=text -verify
 // RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference 
-analyzer-output=plist -o %t
-// RUN: cat %t | %diff_p

r363070 - [NFC][PowerPC] Header-dependent test requires "native"

2019-06-11 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Tue Jun 11 07:23:55 2019
New Revision: 363070

URL: http://llvm.org/viewvc/llvm-project?rev=363070&view=rev
Log:
[NFC][PowerPC] Header-dependent test requires "native"

Two recently added tests mention complications for cross-compile, but
they do not actually enforce native compilation. This patch makes them
require native compilation to avoid the complications they mention.

Modified:
cfe/trunk/test/CodeGen/ppc-mm-malloc-le.c
cfe/trunk/test/CodeGen/ppc-mm-malloc.c

Modified: cfe/trunk/test/CodeGen/ppc-mm-malloc-le.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ppc-mm-malloc-le.c?rev=363070&r1=363069&r2=363070&view=diff
==
--- cfe/trunk/test/CodeGen/ppc-mm-malloc-le.c (original)
+++ cfe/trunk/test/CodeGen/ppc-mm-malloc-le.c Tue Jun 11 07:23:55 2019
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// REQUIRES: powerpc-registered-target
+// REQUIRES: native, powerpc-registered-target
 // UNSUPPORTED: !powerpc64le-
 // The stdlib.h included in mm_malloc.h references native system header
 // like: bits/libc-header-start.h or features.h, cross-compile it may

Modified: cfe/trunk/test/CodeGen/ppc-mm-malloc.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ppc-mm-malloc.c?rev=363070&r1=363069&r2=363070&view=diff
==
--- cfe/trunk/test/CodeGen/ppc-mm-malloc.c (original)
+++ cfe/trunk/test/CodeGen/ppc-mm-malloc.c Tue Jun 11 07:23:55 2019
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// REQUIRES: powerpc-registered-target
+// REQUIRES: native, powerpc-registered-target
 // UNSUPPORTED: !powerpc64-
 // The stdlib.h included in mm_malloc.h references native system header
 // like: bits/libc-header-start.h or features.h, cross-compile it may


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


r363788 - [analyzer][NFC][tests] Pre-normalize expected-sarif files

2019-06-19 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Wed Jun 19 04:19:51 2019
New Revision: 363788

URL: http://llvm.org/viewvc/llvm-project?rev=363788&view=rev
Log:
[analyzer][NFC][tests] Pre-normalize expected-sarif files

As discussed in the review for D62952, this patch pre-normalizes the
reference expected output sarif files by removing lines containing
fields for which we expect differences that should be ignored.

Modified:

cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif

cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif

Modified: 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif?rev=363788&r1=363787&r2=363788&view=diff
==
--- 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
 (original)
+++ 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
 Wed Jun 19 04:19:51 2019
@@ -5,7 +5,6 @@
   "files": [
 {
   "fileLocation": {
-"uri": "file:sarif-diagnostics-taint-test.c"
   },
   "length": 415,
   "mimeType": "text/plain",
@@ -43,7 +42,6 @@
 "physicalLocation": {
   "fileLocation": {
 "fileIndex": 0,
-"uri": "file:sarif-diagnostics-taint-test.c"
   },
   "region": {
 "endColumn": 5,
@@ -63,7 +61,6 @@
 "physicalLocation": {
   "fileLocation": {
 "fileIndex": 0,
-"uri": "file:sarif-diagnostics-taint-test.c"
   },
   "region": {
 "endColumn": 17,
@@ -84,7 +81,6 @@
   "physicalLocation": {
 "fileLocation": {
   "fileIndex": 0,
-  "uri": "file:sarif-diagnostics-taint-test.c"
 },
 "region": {
   "endColumn": 17,
@@ -106,9 +102,7 @@
 "fullName": "clang static analyzer",
 "language": "en-US",
 "name": "clang",
-"version": "clang version 8.0.0"
   }
 }
   ],
-  "version": "2.0.0-csd.2.beta.2018-11-28"
 }

Modified: 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif?rev=363788&r1=363787&r2=363788&view=diff
==
--- 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif
 (original)
+++ 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif
 Wed Jun 19 04:19:51 2019
@@ -5,7 +5,6 @@
   "files": [  
 {
   "fileLocation": {
-"uri": "file:sarif-multi-diagnostic-test.c"
   },
   "length": 667,
   "mimeType": "text/plain",
@@ -63,7 +62,6 @@
 "physicalLocation": {
   "fileLocation": {
 "fileIndex": 0,
-"uri": "file:sarif-multi-diagnostic-test.c"
   },
   "region": {
 "endColumn": 5,
@@ -83,7 +81,6 @@
 "physicalLocation": {
   "fileLocation": {
 "fileIndex": 0,
-"uri": "file:sarif-multi-diagnostic-test.c"
   },
   "region": {
 "endColumn": 17,
@@ -104,7 +101,6 @@
   "physicalLocation": {
 "fileLocation": {
   "fileIndex": 0,
-  "uri": "file:sarif-multi-diagnostic-test.c"
 },
 "region": {
   "endColumn": 17,
@@ -136,7 +132,6 @@
 "physicalLocation": {
   "fileLocation": {
 "fileIndex": 0,
-"uri": "file:sarif-multi-diagnostic-test.c"
   },
   "region": {
 "endColumn": 5,
@@ -156,7 +151,6 @@
 "physicalLocation": {
   "fileLocation": {
 "fileIndex": 0,
-"uri": "file:sarif-multi-diagnostic-test.c"
   },

r363822 - [analyzer] SARIF: Add EOF newline; replace diff_sarif

2019-06-19 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Wed Jun 19 08:27:35 2019
New Revision: 363822

URL: http://llvm.org/viewvc/llvm-project?rev=363822&view=rev
Log:
[analyzer] SARIF: Add EOF newline; replace diff_sarif

Summary:
This patch applies a change similar to rC363069, but for SARIF files.

The `%diff_sarif` lit substitution invokes `diff` with a non-portable
`-I` option. The intended effect can be achieved by normalizing the
inputs to `diff` beforehand. Such normalization can be done with
`grep -Ev`, which is also used by other tests.

Additionally, this patch updates the SARIF output to have a newline at
the end of the file. This makes it so that the SARIF file qualifies as a
POSIX text file, which increases the consumability of the generated file
in relation to various tools.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, 
Szelethus, donat.nagy, dkrupp, Charusso, jsji, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp

cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif

cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif
cfe/trunk/test/Analysis/diagnostics/sarif-diagnostics-taint-test.c
cfe/trunk/test/Analysis/diagnostics/sarif-multi-diagnostic-test.c
cfe/trunk/test/Analysis/lit.local.cfg

Modified: cfe/trunk/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp?rev=363822&r1=363821&r2=363822&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp Wed Jun 19 08:27:35 
2019
@@ -345,5 +345,5 @@ void SarifDiagnostics::FlushDiagnosticsI
"http://json.schemastore.org/sarif-2.0.0-csd.2.beta.2018-11-28"},
   {"version", "2.0.0-csd.2.beta.2018-11-28"},
   {"runs", json::Array{createRun(Diags)}}};
-  OS << llvm::formatv("{0:2}", json::Value(std::move(Sarif)));
+  OS << llvm::formatv("{0:2}\n", json::Value(std::move(Sarif)));
 }

Modified: 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif?rev=363822&r1=363821&r2=363822&view=diff
==
--- 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
 (original)
+++ 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
 Wed Jun 19 08:27:35 2019
@@ -6,7 +6,7 @@
 {
   "fileLocation": {
   },
-  "length": 415,
+  "length": 434,
   "mimeType": "text/plain",
   "roles": [
 "resultFile"

Modified: 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif?rev=363822&r1=363821&r2=363822&view=diff
==
--- 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif
 (original)
+++ 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif
 Wed Jun 19 08:27:35 2019
@@ -6,7 +6,7 @@
 {
   "fileLocation": {
   },
-  "length": 667,
+  "length": 686,
   "mimeType": "text/plain",
   "roles": [
 "resultFile"

Modified: cfe/trunk/test/Analysis/diagnostics/sarif-diagnostics-taint-test.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/sarif-diagnostics-taint-test.c?rev=363822&r1=363821&r2=363822&view=diff
==
--- cfe/trunk/test/Analysis/diagnostics/sarif-diagnostics-taint-test.c 
(original)
+++ cfe/trunk/test/Analysis/diagnostics/sarif-diagnostics-taint-test.c Wed Jun 
19 08:27:35 2019
@@ -1,4 +1,4 @@
-// RUN: %clang_analyze_cc1 
-analyzer-checker=alpha.security.taint,debug.TaintTest %s -verify 
-analyzer-output=sarif -o - | %diff_sarif 
%S/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif -
+// RUN: %clang_analyze_cc1 
-analyzer-checker=alpha.security.taint,debug.TaintTest %s -verify 
-analyzer-output=sarif -o - | %normalize_sarif | diff -U1 -b 
%S/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif -
 #include "../Inputs/system-header-simulator.h"
 
 int atoi(const char *nptr);

Modified: cfe/trunk/test/An

r363826 - [NFC][codeview] Avoid undefined grep in debug-info-codeview-display-name.cpp

2019-06-19 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Wed Jun 19 08:48:12 2019
New Revision: 363826

URL: http://llvm.org/viewvc/llvm-project?rev=363826&view=rev
Log:
[NFC][codeview] Avoid undefined grep in debug-info-codeview-display-name.cpp

vertical-line is not a BRE special character.

POSIX.1-2017 XBD Section 9.3.2 indicates that the interpretation of `\|`
is undefined. This patch uses an ERE instead.

Modified:
cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp

Modified: cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp?rev=363826&r1=363825&r2=363826&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-codeview-display-name.cpp Wed Jun 19 
08:48:12 2019
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -std=c++98 | \
-// RUN:grep 'DISubprogram\|DICompositeType' | sed -e 's/.*name: 
"\([^"]*\)".*/"\1"/' | \
+// RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: 
"\([^"]*\)".*/"\1"/' | \
 // RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
 // RUN: %clang_cc1 -fblocks -debug-info-kind=line-tables-only -gcodeview 
-emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -std=c++98 | \


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


r366544 - [sanitizers] Use covering ObjectFormatType switches

2019-07-19 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Fri Jul 19 01:46:18 2019
New Revision: 366544

URL: http://llvm.org/viewvc/llvm-project?rev=366544&view=rev
Log:
[sanitizers] Use covering ObjectFormatType switches

Summary:
This patch removes the `default` case from some switches on
`llvm::Triple::ObjectFormatType`, and cases for the missing enumerators
(`UnknownObjectFormat`, `Wasm`, and `XCOFF`) are then added.

For `UnknownObjectFormat`, the effect of the action for the `default`
case is maintained; otherwise, where `llvm_unreachable` is called,
`report_fatal_error` is used instead.

Where the `default` case returns a default value, `report_fatal_error`
is used for XCOFF as a placeholder. For `Wasm`, the effect of the action
for the `default` case in maintained.

The code is structured to avoid strongly implying that the `Wasm` case
is present for any reason other than to make the switch cover all
`ObjectFormatType` enumerator values.

Reviewers: sfertile, jasonliu, daltenty

Reviewed By: sfertile

Subscribers: hiraditya, aheejin, sunfish, llvm-commits, cfe-commits

Tags: #clang, #llvm

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

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

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=366544&r1=366543&r2=366544&view=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Jul 19 01:46:18 2019
@@ -231,9 +231,13 @@ static bool asanUseGlobalsGC(const Tripl
 return true;
   case Triple::ELF:
 return CGOpts.DataSections && !CGOpts.DisableIntegratedAS;
-  default:
-return false;
+  case Triple::XCOFF:
+llvm::report_fatal_error("ASan not implemented for XCOFF.");
+  case Triple::Wasm:
+  case Triple::UnknownObjectFormat:
+break;
   }
+  return false;
 }
 
 static void addAddressSanitizerPasses(const PassManagerBuilder &Builder,


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


r367147 - Partially revert rC365414; `ln -n` is not portable

2019-07-26 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Fri Jul 26 13:09:37 2019
New Revision: 367147

URL: http://llvm.org/viewvc/llvm-project?rev=367147&view=rev
Log:
Partially revert rC365414; `ln -n` is not portable

This restores the use of `rm` instead of the non-portable `ln -n`. Such
use being the status quo for the 12-month period between rC334972 and
rC365414.

Modified:
cfe/trunk/test/Driver/no-canonical-prefixes.c

Modified: cfe/trunk/test/Driver/no-canonical-prefixes.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/no-canonical-prefixes.c?rev=367147&r1=367146&r2=367147&view=diff
==
--- cfe/trunk/test/Driver/no-canonical-prefixes.c (original)
+++ cfe/trunk/test/Driver/no-canonical-prefixes.c Fri Jul 26 13:09:37 2019
@@ -4,10 +4,11 @@
 // RUN: cd %t.real
 // RUN: ln -sf %clang test-clang
 // RUN: cd ..
-// If %.fake already is a symlink to %t.real when `ln -sf %t.real %t.fake`
-// runs, then that would symlink %t.real to itself, forming a cycle.
-// The `-n` flag prevents this.
-// RUN: ln -sfn %t.real %t.fake
+// Important to remove %t.fake: If it already is a symlink to %t.real when
+// `ln -sf %t.real %t.fake` runs, then that would symlink %t.real to itself,
+// forming a cycle.
+// RUN: rm -f %t.fake
+// RUN: ln -sf %t.real %t.fake
 // RUN: cd %t.fake
 // RUN: ./test-clang -v -S %s 2>&1 | FileCheck --check-prefix=CANONICAL %s
 // RUN: ./test-clang -v -S %s -no-canonical-prefixes 2>&1 | FileCheck 
--check-prefix=NON-CANONICAL %s


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


r367709 - [Driver][test] Avoid undefined grep in darwin-ld.c

2019-08-02 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Fri Aug  2 12:26:05 2019
New Revision: 367709

URL: http://llvm.org/viewvc/llvm-project?rev=367709&view=rev
Log:
[Driver][test] Avoid undefined grep in darwin-ld.c

Summary:
question-mark is not a BRE special character.

POSIX.1-2017 XBD Section 9.3.2 indicates that the interpretation of `\?`
as used by rC366282 is undefined. This patch uses an ERE instead.

Reviewers: rnk, daltenty, xingxue, jasonliu

Reviewed By: rnk

Subscribers: cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/test/Driver/darwin-ld.c

Modified: cfe/trunk/test/Driver/darwin-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-ld.c?rev=367709&r1=367708&r2=367709&view=diff
==
--- cfe/trunk/test/Driver/darwin-ld.c (original)
+++ cfe/trunk/test/Driver/darwin-ld.c Fri Aug  2 12:26:05 2019
@@ -5,9 +5,9 @@
 
 // Make sure we run dsymutil on source input files.
 // RUN: %clang -target i386-apple-darwin9 -### -g %s -o BAR 2> %t.log
-// RUN: grep '".*dsymutil\(.exe\)\?" "-o" "BAR.dSYM" "BAR"' %t.log
+// RUN: grep -E '".*dsymutil(\.exe)?" "-o" "BAR.dSYM" "BAR"' %t.log
 // RUN: %clang -target i386-apple-darwin9 -### -g -filelist FOO %s -o BAR 2> 
%t.log
-// RUN: grep '".*dsymutil\(.exe\)\?" "-o" "BAR.dSYM" "BAR"' %t.log
+// RUN: grep -E '".*dsymutil(\.exe)?" "-o" "BAR.dSYM" "BAR"' %t.log
 
 // Check linker changes that came with new linkedit format.
 // RUN: touch %t.o


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


r368690 - [AIX][test/Index] Set/propagate AIXTHREAD_STK for AIX

2019-08-13 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Tue Aug 13 06:38:15 2019
New Revision: 368690

URL: http://llvm.org/viewvc/llvm-project?rev=368690&view=rev
Log:
[AIX][test/Index] Set/propagate AIXTHREAD_STK for AIX

Summary:
Some tests perform deep recursion, which requires a larger pthread stack
size than the relatively low default of 192 KiB for 64-bit processes on
AIX. The `AIXTHREAD_STK` environment variable provides a non-intrusive
way to request a larger pthread stack size for the tests. The required
pthread stack size depends on the build configuration.

A 4 MiB default is generous compared to the 512 KiB of macOS; however,
it is known that some compilers on AIX produce code that uses
comparatively more stack space.

Reviewers: xingxue, daltenty, jasonliu

Reviewed By: daltenty

Subscribers: arphaman, jfb, cfe-commits

Tags: #clang

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

Added:
cfe/trunk/test/Index/lit.local.cfg

Added: cfe/trunk/test/Index/lit.local.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/lit.local.cfg?rev=368690&view=auto
==
--- cfe/trunk/test/Index/lit.local.cfg (added)
+++ cfe/trunk/test/Index/lit.local.cfg Tue Aug 13 06:38:15 2019
@@ -0,0 +1,12 @@
+import platform
+
+# Some tests perform deep recursion, which requires a larger pthread stack size
+# than the relatively low default of 192 KiB for 64-bit processes on AIX. The
+# `AIXTHREAD_STK` environment variable provides a non-intrusive way to request
+# a larger pthread stack size for the tests. Various applications and runtime
+# libraries on AIX use a default pthread stack size of 4 MiB, so we will use
+# that as a default value here.
+if 'AIXTHREAD_STK' in os.environ:
+config.environment['AIXTHREAD_STK'] = os.environ['AIXTHREAD_STK']
+elif platform.system() == 'AIX':
+config.environment['AIXTHREAD_STK'] = '4194304'


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


Re: r363429 - PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type

2019-06-28 Thread Hubert Tong via cfe-commits
I don't see how the resolution of Core Issue 2140 changes the status of
nullptr_t lvalue-to-rvalue conversion for constexpr evaluation. PR42440 has
been opened concerning the change to constexpr evaluation.

-- HT

On Fri, Jun 14, 2019 at 1:43 PM Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rsmith
> Date: Fri Jun 14 10:46:38 2019
> New Revision: 363429
>
> URL: http://llvm.org/viewvc/llvm-project?rev=363429&view=rev
> Log:
> PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type
> nullptr_t does not access memory.
>
> We now reuse CK_NullToPointer to represent a conversion from a glvalue
> of type nullptr_t to a prvalue of nullptr_t where necessary.
>
> This reinstates r363337, reverted in r363352.
>
> Modified:
> cfe/trunk/lib/AST/Expr.cpp
> cfe/trunk/lib/CodeGen/CGExprAgg.cpp
> cfe/trunk/lib/CodeGen/CGExprScalar.cpp
> cfe/trunk/lib/Sema/SemaExpr.cpp
> cfe/trunk/lib/Sema/SemaInit.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp
> cfe/trunk/test/Analysis/nullptr.cpp
> cfe/trunk/test/CXX/drs/dr21xx.cpp
> cfe/trunk/test/CodeGenCXX/nullptr.cpp
> cfe/trunk/www/cxx_dr_status.html
>
> Modified: cfe/trunk/lib/AST/Expr.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=363429&r1=363428&r2=363429&view=diff
>
> ==
> --- cfe/trunk/lib/AST/Expr.cpp (original)
> +++ cfe/trunk/lib/AST/Expr.cpp Fri Jun 14 10:46:38 2019
> @@ -1885,6 +1885,11 @@ ImplicitCastExpr *ImplicitCastExpr::Crea
> ExprValueKind VK) {
>unsigned PathSize = (BasePath ? BasePath->size() : 0);
>void *Buffer = C.Allocate(totalSizeToAlloc *>(PathSize));
> +  // Per C++ [conv.lval]p3, lvalue-to-rvalue conversions on class and
> +  // std::nullptr_t have special semantics not captured by
> CK_LValueToRValue.
> +  assert((Kind != CK_LValueToRValue ||
> +  !(T->isNullPtrType() || T->getAsCXXRecordDecl())) &&
> + "invalid type for lvalue-to-rvalue conversion");
>ImplicitCastExpr *E =
>  new (Buffer) ImplicitCastExpr(T, Kind, Operand, PathSize, VK);
>if (PathSize)
>
> Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=363429&r1=363428&r2=363429&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Fri Jun 14 10:46:38 2019
> @@ -1352,7 +1352,8 @@ static bool isSimpleZero(const Expr *E,
>// (int*)0 - Null pointer expressions.
>if (const CastExpr *ICE = dyn_cast(E))
>  return ICE->getCastKind() == CK_NullToPointer &&
> -CGF.getTypes().isPointerZeroInitializable(E->getType());
> +   CGF.getTypes().isPointerZeroInitializable(E->getType()) &&
> +   !E->HasSideEffects(CGF.getContext());
>// '\0'
>if (const CharacterLiteral *CL = dyn_cast(E))
>  return CL->getValue() == 0;
>
> Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=363429&r1=363428&r2=363429&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Fri Jun 14 10:46:38 2019
> @@ -2148,14 +2148,14 @@ Value *ScalarExprEmitter::VisitCastExpr(
>
>case CK_NullToPointer:
>  if (MustVisitNullValue(E))
> -  (void) Visit(E);
> +  CGF.EmitIgnoredExpr(E);
>
>  return
> CGF.CGM.getNullPointer(cast(ConvertType(DestTy)),
>DestTy);
>
>case CK_NullToMemberPointer: {
>  if (MustVisitNullValue(E))
> -  (void) Visit(E);
> +  CGF.EmitIgnoredExpr(E);
>
>  const MemberPointerType *MPT =
> CE->getType()->getAs();
>  return CGF.CGM.getCXXABI().EmitNullMemberPointer(MPT);
>
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=363429&r1=363428&r2=363429&view=diff
>
> ==
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Jun 14 10:46:38 2019
> @@ -635,8 +635,10 @@ ExprResult Sema::DefaultLvalueConversion
>if (E->getType().getObjCLifetime() == Qualifiers::OCL_Weak)
>  Cleanup.setExprNeedsCleanups(true);
>
> -  Res = ImplicitCastExpr::Create(Context, T, CK_LValueToRValue, E,
> nullptr,
> - VK_RValue);
> +  // C++ [conv.lval]p3:
> +  //   If T is cv std::nullptr_t, the result is a null pointer constant.
> +  CastKind CK = T->isNullPtrType() ? CK_NullToPointer : CK_LValueToRValue;
> +  Res = ImplicitCastExpr::Create(Context, T, CK, E, nullptr, VK_RValue);
>
>// C11 6.3.2.1p2:
>//   ...

r365160 - [NFC] Make some ObjectFormatType switches covering

2019-07-04 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Thu Jul  4 14:40:28 2019
New Revision: 365160

URL: http://llvm.org/viewvc/llvm-project?rev=365160&view=rev
Log:
[NFC] Make some ObjectFormatType switches covering

Summary:
This patch removes the `default` case from some switches on
`llvm::Triple::ObjectFormatType`, and cases for the missing enumerators
are then added.

For `UnknownObjectFormat`, the action (`llvm_unreachable`) for the
`default` case is kept.

For the other unhandled cases, `report_fatal_error` is used instead.

Reviewers: sfertile, jasonliu, daltenty

Reviewed By: sfertile

Subscribers: wuzish, aheejin, jsji, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=365160&r1=365159&r2=365160&view=diff
==
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Thu Jul  4 14:40:28 2019
@@ -4921,7 +4921,7 @@ llvm::Value *CGObjCMac::EmitIvarOffset(C
 std::string CGObjCCommonMac::GetSectionName(StringRef Section,
 StringRef MachOAttributes) {
   switch (CGM.getTriple().getObjectFormat()) {
-  default:
+  case llvm::Triple::UnknownObjectFormat:
 llvm_unreachable("unexpected object file format");
   case llvm::Triple::MachO: {
 if (MachOAttributes.empty())
@@ -4936,6 +4936,10 @@ std::string CGObjCCommonMac::GetSectionN
 assert(Section.substr(0, 2) == "__" &&
"expected the name to begin with __");
 return ("." + Section.substr(2) + "$B").str();
+  case llvm::Triple::Wasm:
+  case llvm::Triple::XCOFF:
+llvm::report_fatal_error(
+"Objective-C support is unimplemented for object file format.");
   }
 }
 


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


r348938 - [ExprConstant] Improve memchr/memcmp for type mismatch and multibyte element types

2018-12-12 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Wed Dec 12 08:53:43 2018
New Revision: 348938

URL: http://llvm.org/viewvc/llvm-project?rev=348938&view=rev
Log:
[ExprConstant] Improve memchr/memcmp for type mismatch and multibyte element 
types

Summary:
`memchr` and `memcmp` operate upon the character units of the object
representation; that is, the `size_t` parameter expresses the number of
character units. The constant folding implementation is updated in this
patch to account for multibyte element types in the arrays passed to
`memchr`/`memcmp` and, in the case of `memcmp`, to account for the
possibility that the arrays may have differing element types (even when
they are byte-sized).

Actual inspection of the object representation is not implemented.
Comparisons are done only between elements with the same object size;
that is, `memchr` will fail when inspecting at least one character unit
of a multibyte element. The integer types are assumed to have two's
complement representation with 0 for `false`, 1 for `true`, and no
padding bits.

`memcmp` on multibyte elements will only be able to fold in cases where
enough elements are equal for the answer to be 0.

Various tests are added to guard against incorrect folding for cases
that miscompile on some system or other prior to this patch. At the same
time, the unsigned 32-bit `wchar_t` testing in
`test/SemaCXX/constexpr-string.cpp` is restored.

Reviewers: rsmith, aaron.ballman, hfinkel

Reviewed By: rsmith

Subscribers: cfe-commits

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

Modified:
cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/test/SemaCXX/constexpr-string.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td?rev=348938&r1=348937&r2=348938&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td Wed Dec 12 08:53:43 2018
@@ -121,6 +121,8 @@ def note_constexpr_ltor_non_const_int :
   "read of non-const variable %0 is not allowed in a constant expression">;
 def note_constexpr_ltor_non_constexpr : Note<
   "read of non-constexpr variable %0 is not allowed in a constant expression">;
+def note_constexpr_ltor_incomplete_type : Note<
+  "read of incomplete type %0 is not allowed in a constant expression">;
 def note_constexpr_access_null : Note<
   "%select{read of|assignment to|increment of|decrement of}0 "
   "dereferenced null pointer is not allowed in a constant expression">;

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=348938&r1=348937&r2=348938&view=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Dec 12 08:53:43 2018
@@ -1290,6 +1290,14 @@ void EvalInfo::addCallStack(unsigned Lim
   }
 }
 
+/// Kinds of access we can perform on an object, for diagnostics.
+enum AccessKinds {
+  AK_Read,
+  AK_Assign,
+  AK_Increment,
+  AK_Decrement
+};
+
 namespace {
   struct ComplexValue {
   private:
@@ -1395,21 +1403,36 @@ namespace {
   set(B, true);
 }
 
+  private:
 // Check that this LValue is not based on a null pointer. If it is, produce
 // a diagnostic and mark the designator as invalid.
-bool checkNullPointer(EvalInfo &Info, const Expr *E,
-  CheckSubobjectKind CSK) {
+template 
+bool checkNullPointerDiagnosingWith(const GenDiagType &GenDiag) {
   if (Designator.Invalid)
 return false;
   if (IsNullPtr) {
-Info.CCEDiag(E, diag::note_constexpr_null_subobject)
-  << CSK;
+GenDiag();
 Designator.setInvalid();
 return false;
   }
   return true;
 }
 
+  public:
+bool checkNullPointer(EvalInfo &Info, const Expr *E,
+  CheckSubobjectKind CSK) {
+  return checkNullPointerDiagnosingWith([&Info, E, CSK] {
+Info.CCEDiag(E, diag::note_constexpr_null_subobject) << CSK;
+  });
+}
+
+bool checkNullPointerForFoldAccess(EvalInfo &Info, const Expr *E,
+   AccessKinds AK) {
+  return checkNullPointerDiagnosingWith([&Info, E, AK] {
+Info.FFDiag(E, diag::note_constexpr_access_null) << AK;
+  });
+}
+
 // Check this LValue refers to an object. If not, set the designator to be
 // invalid and emit a diagnostic.
 bool checkSubobject(EvalInfo &Info, const Expr *E, CheckSubobjectKind CSK) 
{
@@ -2746,14 +2769,6 @@ static bool diagnoseUnreadableFields(Eva
   return false;
 }
 
-/// Kinds of access we can perform on an object, for diagnostics.
-enum AccessKinds {
-  AK_Read,
-  AK_Assign,
-  AK_Increment,
-  AK_Decrem

[clang] c15d5d1 - [Driver] NFC: Use Twine temp to replace std::string local

2020-05-31 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-05-31T16:38:10-04:00
New Revision: c15d5d12c625df52bf82828a6af5ef2dfb6b4533

URL: 
https://github.com/llvm/llvm-project/commit/c15d5d12c625df52bf82828a6af5ef2dfb6b4533
DIFF: 
https://github.com/llvm/llvm-project/commit/c15d5d12c625df52bf82828a6af5ef2dfb6b4533.diff

LOG: [Driver] NFC: Use Twine temp to replace std::string local

This patch replaces a `std::string` local used for a concatentation with
a `Twine` where the string was being passed into call.

Added: 


Modified: 
clang/lib/Driver/ToolChains/Gnu.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 9a340142a242..ac9eb46dacb5 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -449,10 +449,9 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
   CmdArgs.push_back("-export-dynamic");
 
 if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE) {
-  const std::string Loader =
-  D.DyldPrefix + ToolChain.getDynamicLinker(Args);
   CmdArgs.push_back("-dynamic-linker");
-  CmdArgs.push_back(Args.MakeArgString(Loader));
+  CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) +
+   ToolChain.getDynamicLinker(Args)));
 }
   }
 



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


[clang] 021a333 - [www] Turn 'Clang 10' boxes green in C++ status pages to reflect release

2020-04-14 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-04-14T18:38:35-04:00
New Revision: 021a333bfca363ecb672d22dcff6295d4ecee3b7

URL: 
https://github.com/llvm/llvm-project/commit/021a333bfca363ecb672d22dcff6295d4ecee3b7
DIFF: 
https://github.com/llvm/llvm-project/commit/021a333bfca363ecb672d22dcff6295d4ecee3b7.diff

LOG: [www] Turn 'Clang 10' boxes green in C++ status pages to reflect release

Summary:
The 'Clang 10' boxes should be green since Clang 10 has been released.

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

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

Added: 


Modified: 
clang/www/cxx_dr_status.html
clang/www/cxx_status.html

Removed: 




diff  --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 3e9210f861ab..2e1683c9989f 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -9421,7 +9421,7 @@ C++ defect report implementation 
status
 https://wg21.link/cwg1601";>1601
 C++14
 Promotion of enumeration with fixed underlying type
-Clang 10
+Clang 10
   
   
 https://wg21.link/cwg1602";>1602
@@ -13927,7 +13927,7 @@ C++ defect report implementation 
status
 https://wg21.link/cwg2352";>2352
 DR
 Similar types and reference binding
-Clang 10
+Clang 10
   
   
 https://wg21.link/cwg2353";>2353

diff  --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index 39ada7f26a18..e0c2cefcaa3f 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -864,7 +864,7 @@ C++20 implementation status
 
   Designated initializers
   https://wg21.link/p0329r4";>P0329R4
-  Clang 10
+  Clang 10
 
 
   template-parameter-list for generic lambdas
@@ -874,7 +874,7 @@ C++20 implementation status
 
   Concepts
   https://wg21.link/p0734r0";>P0734R0
-  Clang 10
+  Clang 10
 

 https://wg21.link/p0857r0";>P0857R0
@@ -891,7 +891,7 @@ C++20 implementation status
   
   
 https://wg21.link/p1616r1";>P1616R1
-Clang 10
+Clang 10
   
   
 https://wg21.link/p1452r2";>P1452R2
@@ -932,7 +932,7 @@ C++20 implementation status
 
   Consistent comparison (operator<=>)
   https://wg21.link/p0515r3";>P0515R3
-  Clang 10
+  Clang 10
 

 https://wg21.link/p0905r1";>P0905R1
@@ -1031,7 +1031,7 @@ C++20 implementation status
   

 https://wg21.link/p1331r2";>P1331R2
-Clang 10
+Clang 10
   
   
 https://wg21.link/p1668r1";>P1668R1
@@ -1160,7 +1160,7 @@ C++20 implementation status
 
   Deprecate some problematic uses of volatile
   https://wg21.link/p1152r4";>P1152R4
-  Clang 10
+  Clang 10
 
 
   [[nodiscard("with reason")]]
@@ -1193,7 +1193,7 @@ C++20 implementation status
 
   constinit
   https://wg21.link/p1143r2";>P1143R2
-  Clang 10
+  Clang 10
 
 
 
@@ -1273,7 +1273,7 @@ Technical specifications and standing 
documents
   
 
 
-  
+  
 Clang 10 (https://wg21.link/p1902r1";>P1902R1)
   
 



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


[clang] a73a81d - [www] Update make_cxx_dr_status for v10; regenerate cxx_dr_status.html

2020-04-15 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-04-15T10:45:00-04:00
New Revision: a73a81dce5bcae4f14004c09ee1844d7572d4f1e

URL: 
https://github.com/llvm/llvm-project/commit/a73a81dce5bcae4f14004c09ee1844d7572d4f1e
DIFF: 
https://github.com/llvm/llvm-project/commit/a73a81dce5bcae4f14004c09ee1844d7572d4f1e.diff

LOG: [www] Update make_cxx_dr_status for v10; regenerate cxx_dr_status.html

Summary: Update `latest_release` to reflect the release of Clang 10.

Reviewed By: rsmith

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

Added: 


Modified: 
clang/www/cxx_dr_status.html
clang/www/make_cxx_dr_status

Removed: 




diff  --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 2e1683c9989f..3f0102889c67 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -2645,7 +2645,7 @@ C++ defect report implementation 
status
 https://wg21.link/cwg434";>434
 NAD
 Unclear suppression of standard conversions while binding reference to 
lvalue
-Superseded by 2352
+Superseded by 2352
   
   
 https://wg21.link/cwg435";>435
@@ -3527,7 +3527,7 @@ C++ defect report implementation 
status
   
   
 https://wg21.link/cwg581";>581
-DR
+DRWP
 Can a templated constructor be explicitly instantiated or 
specialized?
 Unknown
   
@@ -4133,7 +4133,7 @@ C++ defect report implementation 
status
   
   
 https://wg21.link/cwg682";>682
-tentatively ready
+DRWP
 Missing description of lookup of template aliases
 Unknown
   
@@ -9537,11 +9537,11 @@ C++ defect report implementation 
status
 User-defined literals and extended integer types
 Not resolved
   
-  
+  
 https://wg21.link/cwg1621";>1621
-drafting
+DRWP
 Member initializers in anonymous unions
-Not resolved
+Unknown
   
   
 https://wg21.link/cwg1622";>1622
@@ -11243,7 +11243,7 @@ C++ defect report implementation 
status
   
   
 https://wg21.link/cwg1905";>1905
-MAD
+NAD
 Dependent types and injected-class-names
 Unknown
   
@@ -11435,13 +11435,13 @@ C++ defect report implementation 
status
   
   
 https://wg21.link/cwg1937";>1937
-DR
+DRWP
 Incomplete specification of function pointer from lambda
 Unknown
   
   
 https://wg21.link/cwg1938";>1938
-DR
+DRWP
 Should hosted/freestanding be implementation-defined?
 Unknown
   
@@ -11933,7 +11933,7 @@ C++ defect report implementation 
status
   
   
 https://wg21.link/cwg2020";>2020
-DR
+DRWP
 Inadequate description of odr-use of implicitly-invoked functions
 Unknown
   
@@ -12119,7 +12119,7 @@ C++ defect report implementation 
status
   
   
 https://wg21.link/cwg2051";>2051
-DR
+DRWP
 Simplifying alias rules
 Unknown
   
@@ -12129,11 +12129,11 @@ C++ defect report implementation 
status
 Template argument deduction vs overloaded operators
 Unknown
   
-  
+  
 https://wg21.link/cwg2053";>2053
-drafting
+DR
 auto in non-generic lambdas
-Not resolved
+Unknown
   
   
 https://wg21.link/cwg2054";>2054
@@ -12311,7 +12311,7 @@ C++ defect report implementation 
status
   
   
 https://wg21.link/cwg2083";>2083
-DR
+DRWP
 Incorrect cases of odr-use
 Partial
   
@@ -12431,7 +12431,7 @@ C++ defect report implementation 
status
   
   
 https://wg21.link/cwg2103";>2103
-DR
+DRWP
 Lvalue-to-rvalue conversion is irrelevant in odr-use of a 
reference
 Yes
   
@@ -12567,11 +12567,11 @@ C++ defect report implementation 
status
 Copy elision and comma operator
 Extension
   
-  
+  
 https://wg21.link/cwg2126";>2126
-drafting
+DRWP
 Lifetime-extended temporaries in constant expressions
-Not resolved
+Unknown
   
   
 https://wg21.link/cwg2127";>2127
@@ -12833,7 +12833,7 @@ C++ defect report implementation 
status
   
   
 https://wg21.link/cwg2170";>2170
-DR
+DRWP
 Unclear definition of odr-use for arrays
 Clang 9
   
@@ -13055,7 +13055,7 @@ C++ defect report implementation 
status
   
   
 https://wg21.link/cwg2207";>2207
-tentatively ready
+DRWP
 Alignment of allocation function return value
 Unknown
   
@@ -13349,13 +13349,13 @@ C++ defect report implementation 
status
   
   
 https://wg21.link/cwg2256";>2256
-DR
+DRWP
 Lifetime of trivially-destructible objects
 Unknown
   
   
 https://wg21.link/cwg2257";>2257
-DR
+DRWP
 Lifetime extension of references vs exceptions
 Unknown
   
@@ -13409,13 +13409,13 @@ C++ defect report implementation 
status
   
   
 https://wg21.link/cwg2266";>2266
-DR
+DRWP
 Has dependent type vs is type-dependent
 Unknown
   
   
 https://wg21.link/cwg2267";>2267
-DR
+DRWP
 Copy-initialization of temporary in reference 
direct-initialization
 Unknown
   
@@ -13481,

Re: [clang] b129c9d - Author: Shuhong Liu

2020-08-10 Thread Hubert Tong via cfe-commits
@shuhong@ibm.com: I'm not sure what process you followed to commit
this, but the commit message does not seem right. It might make sense to
revert this and commit again with the proper message to make annotations
from `git blame` work better.

-- HT

On Mon, Aug 10, 2020 at 10:33 AM Shuhong Liu via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
> Author: Shuhong Liu
> Date: 2020-08-10T10:27:04-04:00
> New Revision: b129c9d81aff8ece71eb29df1e5f31136a48c040
>
> URL:
> https://github.com/llvm/llvm-project/commit/b129c9d81aff8ece71eb29df1e5f31136a48c040
> DIFF:
> https://github.com/llvm/llvm-project/commit/b129c9d81aff8ece71eb29df1e5f31136a48c040.diff
>
> LOG: Author: Shuhong Liu 
> Date:   Mon Aug 10 10:31:50 2020 +0300
>
> [AIX][Clang][Driver] Generate reference to the C++ library on the link
> step
>
> Have the linker find libc++ on its search path by adding -lc++.
>
> Reviewed by: daltenty, hubert.reinterpretcast, stevewan
>
> Differential Revision: https://reviews.llvm.org/D85315
>
> Added:
>
>
> Modified:
> clang/lib/Driver/ToolChains/AIX.cpp
> clang/lib/Driver/ToolChains/AIX.h
> clang/test/Driver/aix-ld.c
>
> Removed:
>
>
>
>
> 
> diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp
> b/clang/lib/Driver/ToolChains/AIX.cpp
> index f9d8e18d6fd0..bc130a5557e9 100644
> --- a/clang/lib/Driver/ToolChains/AIX.cpp
> +++ b/clang/lib/Driver/ToolChains/AIX.cpp
> @@ -141,6 +141,9 @@ void aix::Linker::ConstructJob(Compilation &C, const
> JobAction &JA,
>Args.AddAllArgs(CmdArgs, options::OPT_L);
>ToolChain.AddFilePathLibArgs(Args, CmdArgs);
>
> +  if (getToolChain().ShouldLinkCXXStdlib(Args))
> +getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
> +
>if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
>  // Support POSIX threads if "-pthreads" or "-pthread" is present.
>  if (Args.hasArg(options::OPT_pthreads, options::OPT_pthread))
> @@ -197,6 +200,23 @@ void AIX::AddClangSystemIncludeArgs(const ArgList
> &DriverArgs,
>addSystemInclude(DriverArgs, CC1Args, UP.str());
>  }
>
> +void AIX::AddCXXStdlibLibArgs(const llvm::opt::ArgList &DriverArgs,
> +  llvm::opt::ArgStringList &CC1Args) const {
> +  switch (GetCXXStdlibType(DriverArgs)) {
> +  case ToolChain::CST_Libcxx:
> +CC1Args.push_back("-lc++");
> +return;
> +  case ToolChain::CST_Libstdcxx:
> +llvm::report_fatal_error("linking libstdc++ unimplemented on AIX");
> +  }
> +
> +  llvm_unreachable("Unexpected C++ library type; only libc++ is
> supported.");
> +}
> +
> +ToolChain::CXXStdlibType AIX::GetDefaultCXXStdlibType() const {
> +  return ToolChain::CST_Libcxx;
> +}
> +
>  auto AIX::buildAssembler() const -> Tool * { return new
> aix::Assembler(*this); }
>
>  auto AIX::buildLinker() const -> Tool * { return new aix::Linker(*this); }
>
> diff  --git a/clang/lib/Driver/ToolChains/AIX.h
> b/clang/lib/Driver/ToolChains/AIX.h
> index 942bb3cceb8a..f63b20da969e 100644
> --- a/clang/lib/Driver/ToolChains/AIX.h
> +++ b/clang/lib/Driver/ToolChains/AIX.h
> @@ -67,6 +67,11 @@ class LLVM_LIBRARY_VISIBILITY AIX : public ToolChain {
>AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
>  llvm::opt::ArgStringList &CC1Args) const
> override;
>
> +  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
> +   llvm::opt::ArgStringList &CmdArgs) const
> override;
> +
> +  CXXStdlibType GetDefaultCXXStdlibType() const override;
> +
>  protected:
>Tool *buildAssembler() const override;
>Tool *buildLinker() const override;
>
> diff  --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
> index 59e35248af30..7b3710ca21ef 100644
> --- a/clang/test/Driver/aix-ld.c
> +++ b/clang/test/Driver/aix-ld.c
> @@ -15,6 +15,7 @@
>  // CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000"
>  // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
>  // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
> +// CHECK-LD32-NOT: "-lc++"
>  // CHECK-LD32: "-lc"
>
>  // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
> @@ -31,6 +32,7 @@
>  // CHECK-LD64: "-bpT:0x1" "-bpD:0x11000"
>  // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
>  // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
> +// CHECK-LD64-NOT: "-lc++"
>  // CHECK-LD64: "-lc"
>
>  // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
> @@ -48,6 +50,7 @@
>  // CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000"
>  // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
>  // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
> +// CHECK-LD32-PTHREAD-NOT: "-lc++"
>  // CHECK-LD32-PTHREAD: "-lpthreads"
>  // CHECK-LD32-PTHREAD: "-lc"
>
> @@ -66,6 +69,7 @@
>  // CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000"
>  // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
>  // CHECK-LD64-PTHREAD:

[clang] dedaf78 - [SystemZ][z/OS] enable trigraphs by default on z/OS

2020-08-13 Thread Hubert Tong via cfe-commits

Author: Abhina Sreeskantharajan
Date: 2020-08-13T16:02:07-04:00
New Revision: dedaf78fa71433d3c9da2e3d2f3dad3e9cd3bdd2

URL: 
https://github.com/llvm/llvm-project/commit/dedaf78fa71433d3c9da2e3d2f3dad3e9cd3bdd2
DIFF: 
https://github.com/llvm/llvm-project/commit/dedaf78fa71433d3c9da2e3d2f3dad3e9cd3bdd2.diff

LOG: [SystemZ][z/OS] enable trigraphs by default on z/OS

This patch enables trigraphs on z/OS.

Reviewed By: hubert.reinterpretcast, fanbo-meng

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

Added: 


Modified: 
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Frontend/trigraphs.cpp
clang/test/Lexer/cxx1z-trigraphs.cpp

Removed: 




diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index c3c8f3b9c6a9..17c43ec55c79 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2787,7 +2787,9 @@ static void ParseLangArgs(LangOptions &Opts, ArgList 
&Args, InputKind IK,
   // Mimicking gcc's behavior, trigraphs are only enabled if -trigraphs
   // is specified, or -std is set to a conforming mode.
   // Trigraphs are disabled by default in c++1z onwards.
-  Opts.Trigraphs = !Opts.GNUMode && !Opts.MSVCCompat && !Opts.CPlusPlus17;
+  // For z/OS, trigraphs are enabled by default (without regard to the above).
+  Opts.Trigraphs =
+  (!Opts.GNUMode && !Opts.MSVCCompat && !Opts.CPlusPlus17) || T.isOSzOS();
   Opts.Trigraphs =
   Args.hasFlag(OPT_ftrigraphs, OPT_fno_trigraphs, Opts.Trigraphs);
 

diff  --git a/clang/test/Frontend/trigraphs.cpp 
b/clang/test/Frontend/trigraphs.cpp
index 552078951aee..f65ad10b8eb7 100644
--- a/clang/test/Frontend/trigraphs.cpp
+++ b/clang/test/Frontend/trigraphs.cpp
@@ -4,12 +4,14 @@
 // RUN: %clang_cc1 -DSTDCPP17 -std=c++1z -verify -fsyntax-only %s
 // RUN: %clang_cc1 -DSTDCPP17TRI -ftrigraphs -std=c++1z -verify -fsyntax-only 
%s
 // RUN: %clang_cc1 -DMSCOMPAT -fms-compatibility -std=c++11 -verify 
-fsyntax-only %s
+// RUN: %clang_cc1 -DNOTRI -fno-trigraphs -verify -fsyntax-only %s
 
 void foo() {
 #if defined(NOFLAGS) || defined(STDCPP11) || defined(STDGNU11TRI) || \
-defined(STDCPP17TRI)
+defined(STDCPP17TRI) || (defined(__MVS__) && !defined(NOTRI))
   const char c[] = "??/n"; // expected-warning{{trigraph converted to '\' 
character}}
-#elif defined(STDGNU11) || defined(STDCPP17) || defined(MSCOMPAT)
+#elif defined(STDGNU11) || defined(STDCPP17) || defined(MSCOMPAT) || \
+defined(NOTRI)
   const char c[] = "??/n"; // expected-warning{{trigraph ignored}}
 #else
 #error Not handled.

diff  --git a/clang/test/Lexer/cxx1z-trigraphs.cpp 
b/clang/test/Lexer/cxx1z-trigraphs.cpp
index 08c45e51f833..d6069e77f897 100644
--- a/clang/test/Lexer/cxx1z-trigraphs.cpp
+++ b/clang/test/Lexer/cxx1z-trigraphs.cpp
@@ -1,14 +1,31 @@
 // RUN: %clang_cc1 -std=c++1z %s -verify
-// RUN: %clang_cc1 -std=c++1z %s -ftrigraphs -fsyntax-only 2>&1 | FileCheck 
--check-prefix=TRIGRAPHS %s
+// RUN: %clang_cc1 -std=c++1z %s -verify -ftrigraphs -DENABLED_TRIGRAPHS=1
+// RUN: %clang_cc1 -std=c++1z %s -verify -fno-trigraphs -DENABLED_TRIGRAPHS=0
 
-??= define foo ; // expected-error {{}} expected-warning {{trigraph ignored}}
+#ifdef __MVS__
+#ifndef ENABLED_TRIGRAPHS
+#define ENABLED_TRIGRAPHS 1
+#endif
+#endif
 
-static_assert("??="[0] == '#', ""); // expected-error {{failed}} 
expected-warning {{trigraph ignored}}
+??= define foo ;
+
+static_assert("??="[0] == '#', "");
 
 // ??/
-error here; // expected-error {{}}
+error here;
 
-// Note, there is intentionally trailing whitespace two lines below.
-// TRIGRAPHS: :[[@LINE+1]]:{{.*}} backslash and newline separated by space
+// Note, there is intentionally trailing whitespace one line below.
 // ??/  
-error here; // expected-error {{}}
+error here;
+
+#if !ENABLED_TRIGRAPHS
+// expected-error@11 {{}} expected-warning@11 {{trigraph ignored}}
+// expected-error@13 {{failed}} expected-warning@13 {{trigraph ignored}}
+// expected-error@16 {{}}
+// expected-error@20 {{}}
+#else
+// expected-warning@11 {{trigraph converted}}
+// expected-warning@13 {{trigraph converted}}
+// expected-warning@19 {{backslash and newline separated by space}}
+#endif



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


[clang] b116ded - [AIX] Avoid structor alias; die before bad alias codegen

2020-05-08 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-05-08T16:51:34-04:00
New Revision: b116ded57da3530e661f871f4191c59cd9e091cd

URL: 
https://github.com/llvm/llvm-project/commit/b116ded57da3530e661f871f4191c59cd9e091cd
DIFF: 
https://github.com/llvm/llvm-project/commit/b116ded57da3530e661f871f4191c59cd9e091cd.diff

LOG: [AIX] Avoid structor alias; die before bad alias codegen

Summary:
`AsmPrinter::emitGlobalIndirectSymbol` is dependent on
`MCStreamer::emitAssignment` to produce `.set` directives for alias
symbols; however, the `.set` pseudo-op on AIX is documented as not
usable with external relocatable terms or expressions, which limits its
applicability in generating alias symbols.

Disable generating aliases on AIX until a different implementation
strategy is available.

Reviewers: cebowleratibm, jasonliu, sfertile, daltenty, DiggerLin

Reviewed By: jasonliu

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

Added: 
clang/test/Driver/aix-constructor-alias.c
llvm/test/CodeGen/PowerPC/aix-alias.ll

Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3fc1ef49d1f7..04c05a8f53e3 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4675,8 +4675,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
 
   // Enable -mconstructor-aliases except on darwin, where we have to work 
around
   // a linker bug (see ), and CUDA device code, where
-  // aliases aren't supported.
-  if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX())
+  // aliases aren't supported. Similarly, aliases aren't yet supported for AIX.
+  if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX() && !RawTriple.isOSAIX())
 CmdArgs.push_back("-mconstructor-aliases");
 
   // Darwin's kernel doesn't support guard variables; just die if we

diff  --git a/clang/test/Driver/aix-constructor-alias.c 
b/clang/test/Driver/aix-constructor-alias.c
new file mode 100644
index ..18c5f5b5b877
--- /dev/null
+++ b/clang/test/Driver/aix-constructor-alias.c
@@ -0,0 +1,7 @@
+// Check that we don't pass -mconstructor-aliases when compiling for AIX.
+
+// RUN: %clang -### -target powerpc-ibm-aix7.1.0.0 %s -c -o %t.o 2>&1 \
+// RUN:   | FileCheck %s
+// RUN: %clang -### -target powerpc64-ibm-aix7.1.0.0 %s -c -o %t.o 2>&1 \
+// RUN:   | FileCheck %s
+// CHECK-NOT: "-mconstructor-aliases"

diff  --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp 
b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 2651b683bd0d..241a19d48027 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -155,6 +155,14 @@ class PPCAIXAsmPrinter : public PPCAsmPrinter {
 
   StringRef getPassName() const override { return "AIX PPC Assembly Printer"; }
 
+  bool doInitialization(Module &M) override {
+if (M.alias_size() > 0u)
+  report_fatal_error(
+  "module has aliases, which LLVM does not yet support for AIX");
+
+return PPCAsmPrinter::doInitialization(M);
+  }
+
   void SetupMachineFunction(MachineFunction &MF) override;
 
   void emitGlobalVariable(const GlobalVariable *GV) override;

diff  --git a/llvm/test/CodeGen/PowerPC/aix-alias.ll 
b/llvm/test/CodeGen/PowerPC/aix-alias.ll
new file mode 100644
index ..2183c2e8c557
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/aix-alias.ll
@@ -0,0 +1,10 @@
+; RUN: not --crash llc < %s -mtriple powerpc-ibm-aix-xcoff 2>&1 | FileCheck %s
+; RUN: not --crash llc < %s -mtriple powerpc64-ibm-aix-xcoff 2>&1 | FileCheck 
%s
+
+; Check that, while generation of aliases on AIX remains unimplemented, llc 
dies
+; with an appropriate message instead of generating incorrect output when an
+; alias is encountered.
+
+define i32 @a() { ret i32 0 }
+; CHECK: ERROR: module has aliases
+@b = internal alias i32 (), i32 ()* @a



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


[clang] 15f0f82 - [tests][Driver] Set `--sysroot=""` to allow `DEFAULT_SYSROOT` build

2020-05-15 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-05-15T17:34:00-04:00
New Revision: 15f0f824b36ea06fcb17bc56ecd181520b4bfbcf

URL: 
https://github.com/llvm/llvm-project/commit/15f0f824b36ea06fcb17bc56ecd181520b4bfbcf
DIFF: 
https://github.com/llvm/llvm-project/commit/15f0f824b36ea06fcb17bc56ecd181520b4bfbcf.diff

LOG: [tests][Driver] Set `--sysroot=""` to allow `DEFAULT_SYSROOT` build

Summary:
If `DEFAULT_SYSROOT` is configured to some path, some tests would fail.
This patch overrides `sysroot` to be the empty string in the style of
D66834 so that the tests will pass even when the build is configured
with a `DEFAULT_SYSROOT`.

Reviewed By: mstorsjo

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

Added: 


Modified: 
clang/test/Driver/darwin-header-search-libcxx.cpp
clang/test/Driver/darwin-header-search-system.cpp
clang/test/Driver/mingw-sysroot.cpp

Removed: 




diff  --git a/clang/test/Driver/darwin-header-search-libcxx.cpp 
b/clang/test/Driver/darwin-header-search-libcxx.cpp
index a54d8adfbda8..6bdbbd11908a 100644
--- a/clang/test/Driver/darwin-header-search-libcxx.cpp
+++ b/clang/test/Driver/darwin-header-search-libcxx.cpp
@@ -20,6 +20,7 @@
 // RUN: -target x86_64-apple-darwin \
 // RUN: -stdlib=libc++ \
 // RUN: -ccc-install-dir %S/Inputs/basic_darwin_toolchain/usr/bin \
+// RUN: --sysroot="" \
 // RUN:   | FileCheck -DTOOLCHAIN=%S/Inputs/basic_darwin_toolchain 
--check-prefix=CHECK-LIBCXX-TOOLCHAIN-1 %s
 // CHECK-LIBCXX-TOOLCHAIN-1: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
 // CHECK-LIBCXX-TOOLCHAIN-1: "-internal-isystem" 
"[[TOOLCHAIN]]/usr/bin/../include/c++/v1"

diff  --git a/clang/test/Driver/darwin-header-search-system.cpp 
b/clang/test/Driver/darwin-header-search-system.cpp
index a8cd48755179..272d778c2a24 100644
--- a/clang/test/Driver/darwin-header-search-system.cpp
+++ b/clang/test/Driver/darwin-header-search-system.cpp
@@ -95,6 +95,7 @@
 // RUN: -target x86_64-apple-darwin \
 // RUN: -ccc-install-dir 
%S/Inputs/basic_darwin_toolchain_no_libcxx/usr/bin \
 // RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: --sysroot="" \
 // RUN:   | FileCheck -DRESOURCE=%S/Inputs/resource_dir \
 // RUN:   --check-prefix=CHECK-NOSYSROOT %s
 // CHECK-NOSYSROOT: "{{[^"]*}}clang{{[^"]*}}" "-cc1"

diff  --git a/clang/test/Driver/mingw-sysroot.cpp 
b/clang/test/Driver/mingw-sysroot.cpp
index eb62b6fe5d0c..63f970fb1e10 100644
--- a/clang/test/Driver/mingw-sysroot.cpp
+++ b/clang/test/Driver/mingw-sysroot.cpp
@@ -17,7 +17,7 @@
 // If we find a gcc in the path with the right triplet prefix, pick that as
 // sysroot:
 
-// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" %clang -target 
x86_64-w64-mingw32 -rtlib=platform -stdlib=libstdc++ -c -### %s 2>&1 | 
FileCheck -check-prefix=CHECK_TESTROOT_GCC %s
+// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" %clang -target 
x86_64-w64-mingw32 -rtlib=platform -stdlib=libstdc++ --sysroot="" -c -### %s 
2>&1 | FileCheck -check-prefix=CHECK_TESTROOT_GCC %s
 // CHECK_TESTROOT_GCC: 
"{{.*}}/testroot-gcc{{/|}}lib{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.3-posix{{/|}}include{{/|}}c++"
 // CHECK_TESTROOT_GCC: 
"{{.*}}/testroot-gcc{{/|}}lib{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.3-posix{{/|}}include{{/|}}c++{{/|}}x86_64-w64-mingw32"
 // CHECK_TESTROOT_GCC: 
"{{.*}}/testroot-gcc{{/|}}lib{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.3-posix{{/|}}include{{/|}}c++{{/|}}backward"
@@ -27,7 +27,7 @@
 // If there's a matching sysroot next to the clang binary itself, prefer that
 // over a gcc in the path:
 
-// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" 
%T/testroot-clang/bin/x86_64-w64-mingw32-clang -target x86_64-w64-mingw32 
-rtlib=compiler-rt -stdlib=libstdc++ -c -### %s 2>&1 | FileCheck 
-check-prefix=CHECK_TESTROOT_CLANG %s
+// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" 
%T/testroot-clang/bin/x86_64-w64-mingw32-clang -target x86_64-w64-mingw32 
-rtlib=compiler-rt -stdlib=libstdc++ --sysroot="" -c -### %s 2>&1 | FileCheck 
-check-prefix=CHECK_TESTROOT_CLANG %s
 // CHECK_TESTROOT_CLANG: 
"{{.*}}/testroot-clang{{/|}}x86_64-w64-mingw32{{/|}}include"
 
 
@@ -35,4 +35,4 @@
 // happens to be in the same directory as gcc, make sure we still can pick up
 // the libgcc directory:
 
-// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" 
%T/testroot-gcc/bin/x86_64-w64-mingw32-clang -target x86_64-w64-mingw32 
-rtlib=platform -stdlib=libstdc++ -c -### %s 2>&1 | FileCheck 
-check-prefix=CHECK_TESTROOT_GCC %s
+// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" 
%T/testroot-gcc/bin/x86_64-w64-mingw32-clang -target x86_64-w64-mingw32 
-rtlib=platform -stdlib=libstdc++ --sysroot="" -c -### %s 2>&1 | FileCheck 
-check-prefix=CHECK_TESTROOT_GCC %s



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

[clang] 3f5fc73 - [test][ARM][CMSE] Use clang_cc1 in arm_cmse.h tests

2020-05-15 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-05-15T17:34:00-04:00
New Revision: 3f5fc73a9d52fc7f128dc4e53ccc63b88fc44fb6

URL: 
https://github.com/llvm/llvm-project/commit/3f5fc73a9d52fc7f128dc4e53ccc63b88fc44fb6
DIFF: 
https://github.com/llvm/llvm-project/commit/3f5fc73a9d52fc7f128dc4e53ccc63b88fc44fb6.diff

LOG: [test][ARM][CMSE] Use clang_cc1 in arm_cmse.h tests

Summary:
The `arm_cmse.h` header includes standard headers, but some tests that
include this header explicitly specify a target. The standard headers
found via the standard include paths need not be compatible with the
explicitly-specified target from the tests. In order to avoid test
failures caused by such incompatibility, this patch uses `%clang_cc1`,
which doesn't pick up the host system headers.

Reviewed By: chill

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

Added: 


Modified: 
clang/test/CodeGen/arm-cmse-nonsecure.c
clang/test/CodeGen/arm-cmse-secure.c

Removed: 




diff  --git a/clang/test/CodeGen/arm-cmse-nonsecure.c 
b/clang/test/CodeGen/arm-cmse-nonsecure.c
index 2a483a71f593..c0b33f50ee88 100644
--- a/clang/test/CodeGen/arm-cmse-nonsecure.c
+++ b/clang/test/CodeGen/arm-cmse-nonsecure.c
@@ -1,5 +1,5 @@
-// RUN: %clang  -mlittle-endian -target thumbv8m.base-eabi  -emit-llvm -S -o - 
%s | FileCheck %s
-// RUN: %clang  -mbig-endian-target thumbv8m.base-eabi  -emit-llvm -S -o - 
%s | FileCheck %s
+// RUN: %clang_cc1 -triple thumbv8m.base-unknown-unknown-eabi   -emit-llvm 
-mrelocation-model static -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple thumbebv8m.base-unknown-unknown-eabi -emit-llvm 
-mrelocation-model static -o - %s | FileCheck %s
 
 #include 
 

diff  --git a/clang/test/CodeGen/arm-cmse-secure.c 
b/clang/test/CodeGen/arm-cmse-secure.c
index 716887254e57..da60f2ed9294 100644
--- a/clang/test/CodeGen/arm-cmse-secure.c
+++ b/clang/test/CodeGen/arm-cmse-secure.c
@@ -1,5 +1,5 @@
-// RUN: %clang -mlittle-endian -mcmse -target thumbv8m.base-eabi -emit-llvm -S 
-o - %s | FileCheck %s
-// RUN: %clang -mbig-endian-mcmse -target thumbv8m.base-eabi -emit-llvm -S 
-o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple thumbv8m.base-unknown-unknown-eabi   -emit-llvm 
-mrelocation-model static -mcmse -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple thumbebv8m.base-unknown-unknown-eabi -emit-llvm 
-mrelocation-model static -mcmse -o - %s | FileCheck %s
 
 #include 
 



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


[PATCH] D25480: __builtin_fpclassify missing one int parameter

2016-10-11 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added a comment.

A test should probably be added as well.


https://reviews.llvm.org/D25480



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


[PATCH] D25480: __builtin_fpclassify missing one int parameter

2016-10-11 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added a comment.

In https://reviews.llvm.org/D25480#567552, @ahatanak wrote:

> __builtin_fpclassify takes five int arguments followed by one last argument 
> that is of floating point type. Do you know if there is a way to specify the 
> last one argument is a floating point rather than using '.'?


There is already code in `clang/lib/Sema/SemaChecking.cpp` to generate 
`diag::err_typecheck_call_invalid_unary_fp`.


https://reviews.llvm.org/D25480



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


[PATCH] D25674: [Concepts] Class template associated constraints

2016-10-17 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: rsmith, faisalv, aaron.ballman.
hubert.reinterpretcast added subscribers: nwilson, cfe-commits.

This adds associated constraints as a property of class templates.
An error is produced if redeclarations are not similarly constrained.


https://reviews.llvm.org/D25674

Files:
  include/clang/AST/DeclTemplate.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/AST/DeclTemplate.cpp
  lib/Sema/SemaTemplate.cpp
  test/CXX/concepts-ts/temp/
  test/CXX/concepts-ts/temp/temp.constr/
  test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/
  test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp

Index: test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
===
--- /dev/null
+++ test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s
+
+namespace nodiag {
+
+using MyBool = bool;
+
+template  requires !!sizeof(bool)
+struct A;
+template  requires !!sizeof(MyBool)
+struct A;
+
+} // end namespace nodiag
+
+namespace diag {
+
+template  requires true // expected-note{{previous template declaration is here}}
+struct A;
+template  struct A; // expected-error{{associated constraints differ in template redeclaration}}
+
+template  struct B; // expected-note{{previous template declaration is here}}
+template  requires true // expected-error{{associated constraints differ in template redeclaration}}
+struct B;
+
+template  requires true // expected-note{{previous template declaration is here}}
+struct C;
+template  requires !0 // expected-error{{associated constraints differ in template redeclaration}}
+struct C;
+
+} // end namespace diag
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -45,6 +45,26 @@
   return SourceRange(Ps[0]->getTemplateLoc(), Ps[N-1]->getRAngleLoc());
 }
 
+namespace clang {
+/// \brief [temp.constr.decl]p2: A template's associated constraints are
+/// defined as a single constraint-expression derived from the introduced
+/// constraint-expressions [ ... ].
+///
+/// \param Params The template parameter list and optional requires-clause.
+///
+/// \param FD The underlying templated function declaration for a function
+/// template.
+static Expr *formAssociatedConstraints(TemplateParameterList *Params,
+   FunctionDecl *FD);
+}
+
+static Expr *clang::formAssociatedConstraints(TemplateParameterList *Params,
+  FunctionDecl *FD) {
+  // FIXME: Concepts: collect additional introduced constraint-expressions
+  assert(!FD && "Cannot collect constraints from function declaration yet.");
+  return Params->getRequiresClause();
+}
+
 /// \brief Determine whether the declaration found is acceptable as the name
 /// of a template and, if so, return that template declaration. Otherwise,
 /// returns NULL.
@@ -1117,6 +1137,9 @@
 }
   }
 
+  // TODO Memory management; associated constraints are not always stored.
+  Expr *const CurAC = formAssociatedConstraints(TemplateParams, nullptr);
+
   if (PrevClassTemplate) {
 // Ensure that the template parameter lists are compatible. Skip this check
 // for a friend in a dependent context: the template parameter list itself
@@ -1128,6 +1151,26 @@
 TPL_TemplateMatch))
   return true;
 
+// Check for matching associated constraints on redeclarations.
+do {
+  const Expr *const PrevAC = PrevClassTemplate->getAssociatedConstraints();
+  if (!(CurAC || PrevAC))
+continue; // nothing to check
+  if (CurAC && PrevAC) {
+llvm::FoldingSetNodeID CurACInfo, PrevACInfo;
+CurAC->Profile(CurACInfo, Context, /*Canonical=*/true);
+PrevAC->Profile(PrevACInfo, Context, /*Canonical=*/true);
+if (CurACInfo == PrevACInfo)
+  continue; // all good
+  }
+
+  Diag(CurAC ? CurAC->getLocStart() : NameLoc,
+   diag::err_template_different_associated_constraints);
+  Diag(PrevAC ? PrevAC->getLocStart() : PrevClassTemplate->getLocation(),
+   diag::note_template_prev_declaration) << /*declaration*/0;
+  return true;
+} while (0);
+
 // C++ [temp.class]p4:
 //   In a redeclaration, partial specialization, explicit
 //   specialization or explicit instantiation of a class template,
@@ -1225,7 +1268,8 @@
   ClassTemplateDecl *NewTemplate
 = ClassTemplateDecl::Create(Context, SemanticContext, NameLoc,
 DeclarationName(Name), TemplateParams,
-NewClass, PrevClassTemplate);
+NewClass, PrevClassTemplate,
+PrevClassTemplate

r319992 - Remove old concepts parsing code

2017-12-06 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Wed Dec  6 16:34:20 2017
New Revision: 319992

URL: http://llvm.org/viewvc/llvm-project?rev=319992&view=rev
Log:
Remove old concepts parsing code

Summary:
This is so we can implement concepts per P0734R0. Relevant failing test
cases are disabled.

Reviewers: hubert.reinterpretcast, rsmith, saar.raz, nwilson

Reviewed By: saar.raz

Subscribers: cfe-commits

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

Patch by Changyu Li!

Added:
cfe/trunk/test/CXX/concepts-ts/dcl.dcl/lit.cfg.py
Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/Parser/cxx-concept-declaration.cpp

Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=319992&r1=319991&r2=319992&view=diff
==
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Wed Dec  6 16:34:20 2017
@@ -405,7 +405,7 @@ protected:
   TemplateDecl(ConstrainedTemplateDeclInfo *CTDI, Kind DK, DeclContext *DC,
SourceLocation L, DeclarationName Name,
TemplateParameterList *Params)
-  : NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr, false),
+  : NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr),
 TemplateParams(CTDI) {
 this->setTemplateParameters(Params);
   }
@@ -418,7 +418,7 @@ protected:
   TemplateDecl(ConstrainedTemplateDeclInfo *CTDI, Kind DK, DeclContext *DC,
SourceLocation L, DeclarationName Name,
TemplateParameterList *Params, NamedDecl *Decl)
-  : NamedDecl(DK, DC, L, Name), TemplatedDecl(Decl, false),
+  : NamedDecl(DK, DC, L, Name), TemplatedDecl(Decl),
 TemplateParams(CTDI) {
 this->setTemplateParameters(Params);
   }
@@ -450,7 +450,7 @@ public:
   }
 
   /// Get the underlying, templated declaration.
-  NamedDecl *getTemplatedDecl() const { return TemplatedDecl.getPointer(); }
+  NamedDecl *getTemplatedDecl() const { return TemplatedDecl; }
 
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
@@ -461,21 +461,11 @@ public:
 
   SourceRange getSourceRange() const override LLVM_READONLY {
 return SourceRange(getTemplateParameters()->getTemplateLoc(),
-   TemplatedDecl.getPointer()->getSourceRange().getEnd());
+   TemplatedDecl->getSourceRange().getEnd());
   }
 
-  /// Whether this is a (C++ Concepts TS) function or variable concept.
-  bool isConcept() const { return TemplatedDecl.getInt(); }
-  void setConcept() { TemplatedDecl.setInt(true); }
-
 protected:
-  /// \brief The named declaration from which this template was instantiated.
-  /// (or null).
-  ///
-  /// The boolean value will be true to indicate that this template
-  /// (function or variable) is a concept.
-  llvm::PointerIntPair TemplatedDecl;
-
+  NamedDecl *TemplatedDecl;
   /// \brief The template parameter list and optional requires-clause
   /// associated with this declaration; alternatively, a
   /// \c ConstrainedTemplateDeclInfo if the associated constraints of the
@@ -504,9 +494,9 @@ public:
   /// \brief Initialize the underlying templated declaration and
   /// template parameters.
   void init(NamedDecl *templatedDecl, TemplateParameterList* templateParams) {
-assert(!TemplatedDecl.getPointer() && "TemplatedDecl already set!");
+assert(!TemplatedDecl && "TemplatedDecl already set!");
 assert(!TemplateParams && "TemplateParams already set!");
-TemplatedDecl.setPointer(templatedDecl);
+TemplatedDecl = templatedDecl;
 TemplateParams = templateParams;
   }
 };
@@ -1028,7 +1018,7 @@ public:
 
   /// Get the underlying function declaration of the template.
   FunctionDecl *getTemplatedDecl() const {
-return static_cast(TemplatedDecl.getPointer());
+return static_cast(TemplatedDecl);
   }
 
   /// Returns whether this template declaration defines the primary
@@ -2120,7 +2110,7 @@ public:
 
   /// \brief Get the underlying class declarations of the template.
   CXXRecordDecl *getTemplatedDecl() const {
-return static_cast(TemplatedDecl.getPointer());
+return static_cast(TemplatedDecl);
   }
 
   /// \brief Returns whether this template declaration defines the primary
@@ -2367,7 +2357,7 @@ public:
 
   /// Get the underlying function declaration of the template.
   TypeAliasDecl *getTemplatedDecl() const {
-return static_cast(TemplatedDecl.getPointer());
+return static_cast(TemplatedDecl);
   }
 
 
@@ -2934,7 +2924,7 @@ public:
 
   /// \brief Get the underlying variable declarati

[llvm] [clang] [AIX][TOC] Add -mtocdata/-mno-tocdata options on AIX (PR #67999)

2023-11-29 Thread Hubert Tong via cfe-commits

hubert-reinterpretcast wrote:

> The manual change says "the TOC data transformation will be applied to [...] 
> block-scope static variables". But later, you mention "internal linkage", 
> which is a bit confusing when you're dealing with C++. Block-scope static 
> variables don't have "linkage" in the sense defined in the C++ standard. 
> Maybe worth trying to be more explicit here.

The later mention of "internal linkage" is with respect to not being able to 
apply the transformation to variables with internal linkage. This is consistent 
with block-scope static variables not having "linkage" as defined by the C++ 
standard. @efriedma-quic

Nevertheless, the other mention of "internal linkage" (which states that the 
explicit naming forms ignore such variables) may also require the addition of 
"block-scope static variables". @syzaara

My understanding is that trying to name the `x` below using 
`-mtocdata=_ZZ3foovE1x` is not effective:
```cpp
inline int foo [[gnu::used]]() {
  static int x = 0;
  return ++x;
}
```

https://github.com/llvm/llvm-project/pull/67999
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6bd53df - [clang][NFC][tests] dr208.c optional signext handling

2022-06-30 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2022-07-01T00:03:58-04:00
New Revision: 6bd53df9b6e9fffb440ee2f9020f15b61f8b39e7

URL: 
https://github.com/llvm/llvm-project/commit/6bd53df9b6e9fffb440ee2f9020f15b61f8b39e7
DIFF: 
https://github.com/llvm/llvm-project/commit/6bd53df9b6e9fffb440ee2f9020f15b61f8b39e7.diff

LOG: [clang][NFC][tests] dr208.c optional signext handling

Fixes llvm/llvm-project#56325.

Added: 


Modified: 
clang/test/C/drs/dr208.c

Removed: 




diff  --git a/clang/test/C/drs/dr208.c b/clang/test/C/drs/dr208.c
index aac27e7c1ad31..67c6bc1a5b4e4 100644
--- a/clang/test/C/drs/dr208.c
+++ b/clang/test/C/drs/dr208.c
@@ -15,10 +15,10 @@ void dr208(void) {
 [0] = dr208_init(2) /* expected-warning {{initializer overrides prior 
initialization of this subobject}} */
   };
 
-  /* CHECK-NOT: call i32 @dr208_init(i32 noundef 0)
- CHECK-DAG: call i32 @dr208_init(i32 noundef 1)
- CHECK-DAG: call i32 @dr208_init(i32 noundef 2)
- CHECK-NOT: call i32 @dr208_init(i32 noundef 0)
+  /* CHECK-NOT: call {{signext i32|i32}} @dr208_init(i32 noundef {{(signext 
)?}}0)
+ CHECK-DAG: call {{signext i32|i32}} @dr208_init(i32 noundef {{(signext 
)?}}1)
+ CHECK-DAG: call {{signext i32|i32}} @dr208_init(i32 noundef {{(signext 
)?}}2)
+ CHECK-NOT: call {{signext i32|i32}} @dr208_init(i32 noundef {{(signext 
)?}}0)
*/
 }
 



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


[clang] bd8b55e - [AIX][clang/test] Set/propagate AIXTHREAD_STK for AIX

2022-07-08 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2022-07-08T18:33:16-04:00
New Revision: bd8b55e609c825f1063a28ef94502a6bfed7a0fd

URL: 
https://github.com/llvm/llvm-project/commit/bd8b55e609c825f1063a28ef94502a6bfed7a0fd
DIFF: 
https://github.com/llvm/llvm-project/commit/bd8b55e609c825f1063a28ef94502a6bfed7a0fd.diff

LOG: [AIX][clang/test] Set/propagate AIXTHREAD_STK for AIX

Some tests perform deep recursion, which requires a larger pthread stack
size than the relatively low default of 192 KiB for 64-bit processes on
AIX. The `AIXTHREAD_STK` environment variable provides a non-intrusive
way to request a larger pthread stack size for the tests. The required
pthread stack size depends on the build configuration.

A 4 MiB default is generous compared to the 512 KiB of macOS; however,
it is known that some compilers on AIX produce code that uses
comparatively more stack space.

This patch expands the solution from D65688 to apply to all Clang LIT
tests.

This also reverts commit c3c75d805c2174388417080f762230961b3433d6,
"[clang][test] Mark test arm-float-abi-lto.c unsupported on AIX".

The problem was caused by the test running up against the per-thread
stack limit on AIX. This is resolved by having the tests run with
`AIXTHREAD_STK` set for 4 MiB.

Reviewed By: xingxue

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

Added: 


Modified: 
clang/test/Driver/arm-float-abi-lto.c
clang/test/lit.cfg.py

Removed: 
clang/test/Index/lit.local.cfg



diff  --git a/clang/test/Driver/arm-float-abi-lto.c 
b/clang/test/Driver/arm-float-abi-lto.c
index bde61ce16441b..8b6d8ff6b5d7a 100644
--- a/clang/test/Driver/arm-float-abi-lto.c
+++ b/clang/test/Driver/arm-float-abi-lto.c
@@ -1,5 +1,3 @@
-// FIXME: Produces a segmentation fault on AIX after the introduction of 
opaque pointers (D125847). 
-// UNSUPPORTED: system-aix
 // REQUIRES: arm-registered-target
 
 // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m33 -mfloat-abi=hard -O1 %s 
-S -o - -emit-llvm -DCALL_LIB -DDEFINE_LIB | FileCheck %s

diff  --git a/clang/test/Index/lit.local.cfg b/clang/test/Index/lit.local.cfg
deleted file mode 100644
index fb7d197d82388..0
--- a/clang/test/Index/lit.local.cfg
+++ /dev/null
@@ -1,12 +0,0 @@
-import platform
-
-# Some tests perform deep recursion, which requires a larger pthread stack size
-# than the relatively low default of 192 KiB for 64-bit processes on AIX. The
-# `AIXTHREAD_STK` environment variable provides a non-intrusive way to request
-# a larger pthread stack size for the tests. Various applications and runtime
-# libraries on AIX use a default pthread stack size of 4 MiB, so we will use
-# that as a default value here.
-if 'AIXTHREAD_STK' in os.environ:
-config.environment['AIXTHREAD_STK'] = os.environ['AIXTHREAD_STK']
-elif platform.system() == 'AIX':
-config.environment['AIXTHREAD_STK'] = '4194304'

diff  --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index fd86353c8cc36..d95ea5d2da198 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -264,3 +264,13 @@ def exclude_unsupported_files_for_aix(dirname):
   '/ASTMerge/anonymous-fields', 
'/ASTMerge/injected-class-name-decl'):
 exclude_unsupported_files_for_aix(config.test_source_root + directory)
 
+# Some tests perform deep recursion, which requires a larger pthread stack size
+# than the relatively low default of 192 KiB for 64-bit processes on AIX. The
+# `AIXTHREAD_STK` environment variable provides a non-intrusive way to request
+# a larger pthread stack size for the tests. Various applications and runtime
+# libraries on AIX use a default pthread stack size of 4 MiB, so we will use
+# that as a default value here.
+if 'AIXTHREAD_STK' in os.environ:
+config.environment['AIXTHREAD_STK'] = os.environ['AIXTHREAD_STK']
+elif platform.system() == 'AIX':
+config.environment['AIXTHREAD_STK'] = '4194304'



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


[clang] ce21c92 - [Clang] Work with multiple pragmas weak before definition

2022-03-24 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2022-03-24T20:17:49-04:00
New Revision: ce21c926f8efe969717e21e3ae6c5a3246b3d455

URL: 
https://github.com/llvm/llvm-project/commit/ce21c926f8efe969717e21e3ae6c5a3246b3d455
DIFF: 
https://github.com/llvm/llvm-project/commit/ce21c926f8efe969717e21e3ae6c5a3246b3d455.diff

LOG: [Clang] Work with multiple pragmas weak before definition

Update `WeakUndeclaredIdentifiers` to hold a collection of weak
aliases per identifier instead of only one.

This also allows the "used" state to be removed from `WeakInfo`
because it is really only there as an alternative to removing
processed map entries, and we can represent that using an empty set
now. The serialization code is updated for the removal of the field.
Additionally, a PCH test is added for the new functionality.

The records are grouped by the "target" identifier, which was already
being used as a key for lookup purposes. We also store only one record
per alias name; combined, this means that diagnostics are grouped by
the "target" and limited to one per alias (which should be acceptable).

Fixes PR28611.
Fixes llvm/llvm-project#28985.

Reviewed By: aaron.ballman, cebowleratibm

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

Co-authored-by: Rachel Craik 
Co-authored-by: Jamie Schmeiser 

Added: 
clang/test/PCH/pragma-weak-functional.c
clang/test/PCH/pragma-weak-functional.h

Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Sema/Sema.h
clang/include/clang/Sema/Weak.h
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/test/CodeGen/pragma-weak.c

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 7dd43cb01a8ea..b268d0f8c20d8 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -78,6 +78,10 @@ Bug Fixes
 - No longer crash when specifying a variably-modified parameter type in a
   function with the ``naked`` attribute. This fixes
   `Issue 50541 `_.
+- Allow multiple ``#pragma weak`` directives to name the same undeclared (if an
+  alias, target) identifier instead of only processing one such ``#pragma 
weak``
+  per identifier.
+  Fixes `Issue 28985 `_.
 
 Improvements to Clang's diagnostics
 ^^^

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index f95308275688e..4c44ee3cc9313 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -1072,10 +1072,20 @@ class Sema final {
 }
   };
 
-  /// WeakUndeclaredIdentifiers - Identifiers contained in
-  /// \#pragma weak before declared. rare. may alias another
-  /// identifier, declared or undeclared
-  llvm::MapVector WeakUndeclaredIdentifiers;
+  /// WeakUndeclaredIdentifiers - Identifiers contained in \#pragma weak before
+  /// declared. Rare. May alias another identifier, declared or undeclared.
+  ///
+  /// For aliases, the target identifier is used as a key for eventual
+  /// processing when the target is declared. For the single-identifier form,
+  /// the sole identifier is used as the key. Each entry is a `SetVector`
+  /// (ordered by parse order) of aliases (identified by the alias name) in 
case
+  /// of multiple aliases to the same undeclared identifier.
+  llvm::MapVector<
+  IdentifierInfo *,
+  llvm::SetVector<
+  WeakInfo, llvm::SmallVector,
+  llvm::SmallDenseSet>>
+  WeakUndeclaredIdentifiers;
 
   /// ExtnameUndeclaredIdentifiers - Identifiers contained in
   /// \#pragma redefine_extname before declared.  Used in Solaris system 
headers
@@ -10175,7 +10185,7 @@ class Sema final {
 
   NamedDecl *DeclClonePragmaWeak(NamedDecl *ND, const IdentifierInfo *II,
  SourceLocation Loc);
-  void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W);
+  void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, const WeakInfo &W);
 
   /// ActOnPragmaWeakID - Called on well formed \#pragma weak ident.
   void ActOnPragmaWeakID(IdentifierInfo* WeakName,

diff  --git a/clang/include/clang/Sema/Weak.h b/clang/include/clang/Sema/Weak.h
index 434393677d42d..877b47d2474ea 100644
--- a/clang/include/clang/Sema/Weak.h
+++ b/clang/include/clang/Sema/Weak.h
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_SEMA_WEAK_H
 
 #include "clang/Basic/SourceLocation.h"
+#include "llvm/ADT/DenseMapInfo.h"
 
 namespace clang {
 
@@ -22,22 +23,32 @@ class IdentifierInfo;
 
 /// Captures information about a \#pragma weak directive.
 class WeakInfo {
-  IdentifierInfo *alias;  // alias (optional)
-  SourceLocation loc; // for diagnostics
-  bool used;  // identifier later declared?
+  const IdentifierInfo *alias = nullptr; // al

[clang] 7d669e6 - [AIX] Generate large code model relocations when mcmodel=medium on AIX

2021-07-22 Thread Hubert Tong via cfe-commits

Author: Anjan Kumar Guttahalli Krishna
Date: 2021-07-22T15:47:22-04:00
New Revision: 7d669ec1d67c1b4aecd90687013636d8037c

URL: 
https://github.com/llvm/llvm-project/commit/7d669ec1d67c1b4aecd90687013636d8037c
DIFF: 
https://github.com/llvm/llvm-project/commit/7d669ec1d67c1b4aecd90687013636d8037c.diff

LOG: [AIX] Generate large code model relocations when mcmodel=medium on AIX

This patch makes the changes in the driver that converts the medium code
model to large.

Reviewed By: hubert.reinterpretcast

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/mcmodel.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 75bc32916371..0ebbad7e8877 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5136,11 +5136,15 @@ void Clang::ConstructJob(Compilation &C, const 
JobAction &JA,
   if (Arg *A = Args.getLastArg(options::OPT_mcmodel_EQ)) {
 StringRef CM = A->getValue();
 if (CM == "small" || CM == "kernel" || CM == "medium" || CM == "large" ||
-CM == "tiny")
-  A->render(Args, CmdArgs);
-else
+CM == "tiny") {
+  if (Triple.isOSAIX() && CM == "medium")
+CmdArgs.push_back("-mcmodel=large");
+  else
+A->render(Args, CmdArgs);
+} else {
   D.Diag(diag::err_drv_invalid_argument_to_option)
   << CM << A->getOption().getName();
+}
   }
 
   if (Arg *A = Args.getLastArg(options::OPT_mtls_size_EQ)) {

diff  --git a/clang/test/Driver/mcmodel.c b/clang/test/Driver/mcmodel.c
index 8df5c6a7e38b..2c74c966744a 100644
--- a/clang/test/Driver/mcmodel.c
+++ b/clang/test/Driver/mcmodel.c
@@ -3,6 +3,8 @@
 // RUN: %clang -target x86_64 -### -S -mcmodel=kernel %s 2>&1 | FileCheck 
--check-prefix=KERNEL %s
 // RUN: %clang -target x86_64 -### -c -mcmodel=medium %s 2>&1 | FileCheck 
--check-prefix=MEDIUM %s
 // RUN: %clang -target x86_64 -### -S -mcmodel=large %s 2>&1 | FileCheck 
--check-prefix=LARGE %s
+// RUN: %clang -target powerpc-unknown-aix -### -S -mcmodel=medium %s 2> %t.log
+// RUN: FileCheck --check-prefix=AIX-MCMEDIUM-OVERRIDE %s < %t.log
 // RUN: not %clang -c -mcmodel=lager %s 2>&1 | FileCheck 
--check-prefix=INVALID %s
 
 // TINY: "-mcmodel=tiny"
@@ -10,5 +12,6 @@
 // KERNEL: "-mcmodel=kernel"
 // MEDIUM: "-mcmodel=medium"
 // LARGE: "-mcmodel=large"
+// AIX-MCMEDIUM-OVERRIDE: "-mcmodel=large"
 
 // INVALID: error: invalid argument 'lager' to -mcmodel=



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


[clang] da167a5 - [Clang][NFC] Some `const` for `IdentifierInfo *`s feeding `DeclarationName`

2022-03-23 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2022-03-23T11:07:56-04:00
New Revision: da167a53c87f53ce582de6cc122d5e090f341b42

URL: 
https://github.com/llvm/llvm-project/commit/da167a53c87f53ce582de6cc122d5e090f341b42
DIFF: 
https://github.com/llvm/llvm-project/commit/da167a53c87f53ce582de6cc122d5e090f341b42.diff

LOG: [Clang][NFC] Some `const` for `IdentifierInfo *`s feeding `DeclarationName`

`DeclarationName` already takes `const IdentifierInfo *`. Propagate the
`const` outward to various APIs.

Reviewed By: aaron.ballman

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

Added: 


Modified: 
clang/include/clang/AST/Decl.h
clang/include/clang/Sema/Sema.h
clang/lib/AST/Decl.cpp
clang/lib/Sema/SemaDeclAttr.cpp

Removed: 




diff  --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 926426b5470d2..1246287ee2e62 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -1041,7 +1041,7 @@ class VarDecl : public DeclaratorDecl, public 
Redeclarable {
   };
 
   VarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
-  SourceLocation IdLoc, IdentifierInfo *Id, QualType T,
+  SourceLocation IdLoc, const IdentifierInfo *Id, QualType T,
   TypeSourceInfo *TInfo, StorageClass SC);
 
   using redeclarable_base = Redeclarable;
@@ -1071,8 +1071,8 @@ class VarDecl : public DeclaratorDecl, public 
Redeclarable {
 
   static VarDecl *Create(ASTContext &C, DeclContext *DC,
  SourceLocation StartLoc, SourceLocation IdLoc,
- IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo,
- StorageClass S);
+ const IdentifierInfo *Id, QualType T,
+ TypeSourceInfo *TInfo, StorageClass S);
 
   static VarDecl *CreateDeserialized(ASTContext &C, unsigned ID);
 

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 25cd747cbec96..296b367424283 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -10175,7 +10175,7 @@ class Sema final {
   void ActOnPragmaVisibility(const IdentifierInfo* VisType,
  SourceLocation PragmaLoc);
 
-  NamedDecl *DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II,
+  NamedDecl *DeclClonePragmaWeak(NamedDecl *ND, const IdentifierInfo *II,
  SourceLocation Loc);
   void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W);
 

diff  --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 82c4412296dbc..cc5eca86abb19 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -2020,7 +2020,7 @@ const char 
*VarDecl::getStorageClassSpecifierString(StorageClass SC) {
 
 VarDecl::VarDecl(Kind DK, ASTContext &C, DeclContext *DC,
  SourceLocation StartLoc, SourceLocation IdLoc,
- IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo,
+ const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo,
  StorageClass SC)
 : DeclaratorDecl(DK, DC, IdLoc, Id, T, TInfo, StartLoc),
   redeclarable_base(C) {
@@ -2035,10 +2035,9 @@ VarDecl::VarDecl(Kind DK, ASTContext &C, DeclContext *DC,
   // Everything else is implicitly initialized to false.
 }
 
-VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC,
- SourceLocation StartL, SourceLocation IdL,
- IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo,
- StorageClass S) {
+VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation StartL,
+ SourceLocation IdL, const IdentifierInfo *Id,
+ QualType T, TypeSourceInfo *TInfo, StorageClass S) {
   return new (C, DC) VarDecl(Var, C, DC, StartL, IdL, Id, T, TInfo, S);
 }
 

diff  --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 70d6721a8b1c0..4ac45145e6e8a 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -9016,8 +9016,8 @@ void Sema::checkUnusedDeclAttributes(Declarator &D) {
 
 /// DeclClonePragmaWeak - clone existing decl (maybe definition),
 /// \#pragma weak needs a non-definition decl and source may not have one.
-NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II,
-  SourceLocation Loc) {
+NamedDecl *Sema::DeclClonePragmaWeak(NamedDecl *ND, const IdentifierInfo *II,
+ SourceLocation Loc) {
   assert(isa(ND) || isa(ND));
   NamedDecl *NewD = nullptr;
   if (auto *FD = dyn_cast(ND)) {



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


[clang] 52ce95a - [NFC] Prevent shadowing a variable declared in `if`

2022-04-28 Thread Hubert Tong via cfe-commits

Author: Ken Matsui
Date: 2022-04-28T22:22:27-04:00
New Revision: 52ce95a1a55424256f0d56e32392396896ed7f76

URL: 
https://github.com/llvm/llvm-project/commit/52ce95a1a55424256f0d56e32392396896ed7f76
DIFF: 
https://github.com/llvm/llvm-project/commit/52ce95a1a55424256f0d56e32392396896ed7f76.diff

LOG: [NFC] Prevent shadowing a variable declared in `if`

Prevents confusion over which `S` is referenced in the final `else`
branch if such use is added.

Reviewed By: hubert.reinterpretcast

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

Added: 


Modified: 
clang/lib/Basic/Diagnostic.cpp

Removed: 




diff  --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp
index 3315012685d69..d14134f99ee95 100644
--- a/clang/lib/Basic/Diagnostic.cpp
+++ b/clang/lib/Basic/Diagnostic.cpp
@@ -983,13 +983,13 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd,
   if (const char *S = tok::getPunctuatorSpelling(Kind))
 // Quoted token spelling for punctuators.
 Out << '\'' << S << '\'';
-  else if (const char *S = tok::getKeywordSpelling(Kind))
+  else if ((S = tok::getKeywordSpelling(Kind)))
 // Unquoted token spelling for keywords.
 Out << S;
-  else if (const char *S = getTokenDescForDiagnostic(Kind))
+  else if ((S = getTokenDescForDiagnostic(Kind)))
 // Unquoted translatable token name.
 Out << S;
-  else if (const char *S = tok::getTokenName(Kind))
+  else if ((S = tok::getTokenName(Kind)))
 // Debug name, shouldn't appear in user-facing diagnostics.
 Out << '<' << S << '>';
   else



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


[clang] [Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (PR #76361)

2024-03-18 Thread Hubert Tong via cfe-commits


@@ -6375,12 +6383,16 @@ ExprResult Sema::BuildCXXDefaultInitExpr(SourceLocation 
Loc, FieldDecl *Field) {
   ImmediateCallVisitor V(getASTContext());
   if (!NestedDefaultChecking)
 V.TraverseDecl(Field);
-  if (V.HasImmediateCalls) {
+  if (V.HasImmediateCalls || InLifetimeExtendingContext) {
 ExprEvalContexts.back().DelayedDefaultInitializationContext = {Loc, Field,
CurContext};
 ExprEvalContexts.back().IsCurrentlyCheckingDefaultArgumentOrInitializer =
 NestedDefaultChecking;
 
+// Pass down lifetime extending flag, and collect temporaries in
+// CreateMaterializeTemporaryExpr when we rewrite the call argument.
+keepInLifetimeExtendingContext();
+keepInMaterializeTemporaryObjectContext();

hubert-reinterpretcast wrote:

> @hubert-reinterpretcast Could you please give me an example where 
> `CXXDefaultInitExpr` has to be lifetime-extended?

https://github.com/llvm/llvm-project/issues/85613

https://github.com/llvm/llvm-project/pull/76361
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AIX][clang][driver] fix no-pthread option (PR #69363)

2023-10-18 Thread Hubert Tong via cfe-commits

hubert-reinterpretcast wrote:

@daltenty, can we also have a check that the driver does not pass `-pthread` to 
the frontend when `-no-pthread` is used?

As a complication, I think the code responsible is common cross-platform code 
in 
[clang/Driver/ToolChains/Clang.cpp](https://github.com/llvm/llvm-project/blob/df3478e480b3b2e9fe125697b7931dc48b09e450/clang/lib/Driver/ToolChains/Clang.cpp#L6537).

To exacerbate things, the ineffectiveness of `-no-pthread` in terms of the 
linker invocation occurs on multiple other platforms (and I am not sure that 
fixing just the frontend invocation leaves us in a better state for those 
platforms).

https://github.com/llvm/llvm-project/pull/69363
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 97ccf93 - [SystemZ][z/OS] Add z/OS Target and define macros

2020-08-25 Thread Hubert Tong via cfe-commits

Author: Abhina Sreeskantharajan
Date: 2020-08-25T15:51:59-04:00
New Revision: 97ccf93b3615ff4c0d5fe116e6a7c7b616d8ec0c

URL: 
https://github.com/llvm/llvm-project/commit/97ccf93b3615ff4c0d5fe116e6a7c7b616d8ec0c
DIFF: 
https://github.com/llvm/llvm-project/commit/97ccf93b3615ff4c0d5fe116e6a7c7b616d8ec0c.diff

LOG: [SystemZ][z/OS] Add z/OS Target and define macros

This patch adds the z/OS target and defines macros as a stepping stone
towards enabling a native build on z/OS.

Reviewed By: hubert.reinterpretcast

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

Added: 
clang/test/Preprocessor/init-zos.c

Modified: 
clang/lib/Basic/Targets.cpp
clang/lib/Basic/Targets/OSTargets.h

Removed: 




diff  --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 38a388afa534..933b7b342891 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -452,6 +452,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
 switch (os) {
 case llvm::Triple::Linux:
   return new LinuxTargetInfo(Triple, Opts);
+case llvm::Triple::ZOS:
+  return new ZOSTargetInfo(Triple, Opts);
 default:
   return new SystemZTargetInfo(Triple, Opts);
 }

diff  --git a/clang/lib/Basic/Targets/OSTargets.h 
b/clang/lib/Basic/Targets/OSTargets.h
index a2c0fd42f26d..9c206fc7e6a4 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -728,6 +728,55 @@ class AIXTargetInfo : public OSTargetInfo {
   bool defaultsToAIXPowerAlignment() const override { return true; }
 };
 
+// z/OS target
+template 
+class LLVM_LIBRARY_VISIBILITY ZOSTargetInfo : public OSTargetInfo {
+protected:
+  void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
+MacroBuilder &Builder) const override {
+// FIXME: _LONG_LONG should not be defined under -std=c89.
+Builder.defineMacro("_LONG_LONG");
+Builder.defineMacro("_OPEN_DEFAULT");
+// _UNIX03_WITHDRAWN is required to build libcxx.
+Builder.defineMacro("_UNIX03_WITHDRAWN");
+Builder.defineMacro("__370__");
+Builder.defineMacro("__BFP__");
+// FIXME: __BOOL__ should not be defined under -std=c89.
+Builder.defineMacro("__BOOL__");
+Builder.defineMacro("__LONGNAME__");
+Builder.defineMacro("__MVS__");
+Builder.defineMacro("__THW_370__");
+Builder.defineMacro("__THW_BIG_ENDIAN__");
+Builder.defineMacro("__TOS_390__");
+Builder.defineMacro("__TOS_MVS__");
+Builder.defineMacro("__XPLINK__");
+
+if (this->PointerWidth == 64)
+  Builder.defineMacro("__64BIT__");
+
+if (Opts.CPlusPlus) {
+  Builder.defineMacro("__DLL__");
+  // _XOPEN_SOURCE=600 is required to build libcxx.
+  Builder.defineMacro("_XOPEN_SOURCE", "600");
+}
+
+if (Opts.GNUMode) {
+  Builder.defineMacro("_MI_BUILTIN");
+  Builder.defineMacro("_EXT");
+}
+
+if (Opts.CPlusPlus && Opts.WChar) {
+  // Macro __wchar_t is defined so that the wchar_t data
+  // type is not declared as a typedef in system headers.
+  Builder.defineMacro("__wchar_t");
+}
+  }
+
+public:
+  ZOSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
+  : OSTargetInfo(Triple, Opts) {}
+};
+
 void addWindowsDefines(const llvm::Triple &Triple, const LangOptions &Opts,
MacroBuilder &Builder);
 

diff  --git a/clang/test/Preprocessor/init-zos.c 
b/clang/test/Preprocessor/init-zos.c
new file mode 100644
index ..50c4ed9e539e
--- /dev/null
+++ b/clang/test/Preprocessor/init-zos.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=s390x-none-zos 
-fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix 
S390X-ZOS %s
+// RUN: %clang_cc1 -x c++ -std=gnu++14 -E -dM -ffreestanding 
-triple=s390x-none-zos -fno-signed-char < /dev/null | FileCheck 
-match-full-lines -check-prefix S390X-ZOS -check-prefix S390X-ZOS-GNUXX %s
+
+// S390X-ZOS-GNUXX:#define _EXT 1
+// S390X-ZOS:#define _LONG_LONG 1
+// S390X-ZOS-GNUXX:#define _MI_BUILTIN 1
+// S390X-ZOS:#define _OPEN_DEFAULT 1
+// S390X-ZOS:#define _UNIX03_WITHDRAWN 1
+// S390X-ZOS-GNUXX:#define _XOPEN_SOURCE 600
+// S390X-ZOS:#define __370__ 1
+// S390X-ZOS:#define __64BIT__ 1
+// S390X-ZOS:#define __BFP__ 1
+// S390X-ZOS:#define __BOOL__ 1
+// S390X-ZOS-GNUXX:#define __DLL__ 1
+// S390X-ZOS:#define __LONGNAME__ 1
+// S390X-ZOS:#define __MVS__ 1
+// S390X-ZOS:#define __THW_370__ 1
+// S390X-ZOS:#define __THW_BIG_ENDIAN__ 1
+// S390X-ZOS:#define __TOS_390__ 1
+// S390X-ZOS:#define __TOS_MVS__ 1
+// S390X-ZOS:#define __XPLINK__ 1
+// S390X-ZOS-GNUXX:#define __wchar_t 1



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


[clang] d563d7a - [analyzer][NFC] Add `override` keyword missing from D86027

2020-08-31 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-08-31T17:57:22-04:00
New Revision: d563d7a7313cf47dcb24c6370a035bd803965b4e

URL: 
https://github.com/llvm/llvm-project/commit/d563d7a7313cf47dcb24c6370a035bd803965b4e
DIFF: 
https://github.com/llvm/llvm-project/commit/d563d7a7313cf47dcb24c6370a035bd803965b4e.diff

LOG: [analyzer][NFC] Add `override` keyword missing from D86027

Speculative fix for `-Werror,-Wsuggest-override` build failures on
the ppc64le-lld-multistage-test bot.

Added: 


Modified: 
clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp

Removed: 




diff  --git a/clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp 
b/clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
index f1ca28ba339d..1ca53590e06c 100644
--- a/clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
@@ -54,7 +54,7 @@ class SmartPtrModeling
  ArrayRef Regions,
  const LocationContext *LCtx, const CallEvent *Call) const;
   void printState(raw_ostream &Out, ProgramStateRef State, const char *NL,
-  const char *Sep) const;
+  const char *Sep) const override;
   void checkLiveSymbols(ProgramStateRef State, SymbolReaper &SR) const;
 
 private:



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


[clang] 09fc779 - [NFC][tests] Replace use of GNUisms in usage of diff

2020-11-08 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-11-08T12:07:51-05:00
New Revision: 09fc7796e57417071523c82bdac8b3bf050648a0

URL: 
https://github.com/llvm/llvm-project/commit/09fc7796e57417071523c82bdac8b3bf050648a0
DIFF: 
https://github.com/llvm/llvm-project/commit/09fc7796e57417071523c82bdac8b3bf050648a0.diff

LOG: [NFC][tests] Replace use of GNUisms in usage of diff

... the POSIX options suffice.

This maintains compatibility with the system `diff` on platforms
like AIX.

Added: 


Modified: 
clang/test/APINotes/yaml-roundtrip-2.test
clang/test/APINotes/yaml-roundtrip.test

Removed: 




diff  --git a/clang/test/APINotes/yaml-roundtrip-2.test 
b/clang/test/APINotes/yaml-roundtrip-2.test
index 02455302fec1..b0b777b59506 100644
--- a/clang/test/APINotes/yaml-roundtrip-2.test
+++ b/clang/test/APINotes/yaml-roundtrip-2.test
@@ -1,8 +1,8 @@
 RUN: apinotes-test 
%S/Inputs/Frameworks/SimpleKit.framework/Headers/SimpleKit.apinotes > %t.result
-RUN: not 
diff  --strip-trailing-cr --ed %t.result 
%S/Inputs/Frameworks/SimpleKit.framework/Headers/SimpleKit.apinotes | FileCheck 
%s
+RUN: not 
diff  -b -e %t.result 
%S/Inputs/Frameworks/SimpleKit.framework/Headers/SimpleKit.apinotes | FileCheck 
%s
 
-The `--ed` parameter to `
diff ` is not implemented in the builtin 
diff , assume
-that we have a GNU compatible 
diff  when we have a shell.
+The `-e` option of `
diff ` is not implemented in the builtin 
diff , assume
+that we have a POSIX compatible 
diff  when we have a shell.
 REQUIRES: shell
 
 We expect only the document markers to be emitted

diff  --git a/clang/test/APINotes/yaml-roundtrip.test 
b/clang/test/APINotes/yaml-roundtrip.test
index bd4c89d2cdd9..bcf84afda8df 100644
--- a/clang/test/APINotes/yaml-roundtrip.test
+++ b/clang/test/APINotes/yaml-roundtrip.test
@@ -1,5 +1,5 @@
 RUN: apinotes-test 
%S/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes > %t.result
-RUN: not 
diff  --strip-trailing-cr 
%S/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes %t.result | 
FileCheck %s
+RUN: not 
diff  -b %S/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes 
%t.result | FileCheck %s
 
 Avoid Windows as the 
diff  output 
diff ers due to line-endings and 
diff erent 
diff 
 implementations.



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


[clang] ae4c400 - [NFC] Fix spacing in clang/test/Driver/aix-ld.c

2020-09-30 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-09-30T17:01:32-04:00
New Revision: ae4c400e02fc3f7cff11cc332e6b107353b3e6a2

URL: 
https://github.com/llvm/llvm-project/commit/ae4c400e02fc3f7cff11cc332e6b107353b3e6a2
DIFF: 
https://github.com/llvm/llvm-project/commit/ae4c400e02fc3f7cff11cc332e6b107353b3e6a2.diff

LOG: [NFC] Fix spacing in clang/test/Driver/aix-ld.c

Fix one line with mismatch in indentation after afc277b0ed0d.

Added: 


Modified: 
clang/test/Driver/aix-ld.c

Removed: 




diff  --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 7ccbeff3b8b6..89959d851b93 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -403,7 +403,7 @@
 // CHECK-LD32-NOSTDLIBXX-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOSTDLIBXX-LCXX-NOT: "-lc++"
 // CHECK-LD32-NOSTDLIBXX-LCXX: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
-// CHECK-LD32-NOSTDLIBXX-LCXX:"-lm"
+// CHECK-LD32-NOSTDLIBXX-LCXX: "-lm"
 // CHECK-LD32-NOSTDLIBXX-LCXX: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nostdlib++.



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


[clang] 35ecc7f - [clang][Sema] Fix PR47676: Handle dependent AltiVec C-style cast

2020-10-01 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-10-01T15:57:01-04:00
New Revision: 35ecc7fe49ba881a77e8146b51870a60a52b211f

URL: 
https://github.com/llvm/llvm-project/commit/35ecc7fe49ba881a77e8146b51870a60a52b211f
DIFF: 
https://github.com/llvm/llvm-project/commit/35ecc7fe49ba881a77e8146b51870a60a52b211f.diff

LOG: [clang][Sema] Fix PR47676: Handle dependent AltiVec C-style cast

Fix premature decision in the presence of type-dependent expression
operands on whether AltiVec vector initializations from single
expressions are "splat" operations.

Verify that the instantiation is able to determine the correct cast
semantics for both the scalar type and the vector type case.

Note that, because the change only affects the single-expression
case (and the target type is an AltiVec-style vector type), the
replacement of a parenthesized list with a parenthesized expression
does not change the semantics of the program in a program-observable
manner.

Reviewed By: aaron.ballman

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

Added: 
clang/test/SemaTemplate/pr47676.cpp

Modified: 
clang/lib/Sema/SemaExpr.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 22840dd3dfe3..e51b27626184 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -7408,7 +7408,7 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
 }
 if (PE || PLE->getNumExprs() == 1) {
   Expr *E = (PE ? PE->getSubExpr() : PLE->getExpr(0));
-  if (!E->getType()->isVectorType())
+  if (!E->isTypeDependent() && !E->getType()->isVectorType())
 isVectorLiteral = true;
 }
 else

diff  --git a/clang/test/SemaTemplate/pr47676.cpp 
b/clang/test/SemaTemplate/pr47676.cpp
new file mode 100644
index ..428607097c96
--- /dev/null
+++ b/clang/test/SemaTemplate/pr47676.cpp
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu \
+// RUN:-target-feature +altivec -fsyntax-only -ast-dump \
+// RUN:-xc++ < %s 2>&1 \
+// RUN:   | FileCheck %s
+
+// Ensures that casts to AltiVec type with a dependent expression operand does
+// not hit the assertion failure reported in PR47676. Further checks that casts
+// to AltiVec type with a dependent expression operand is, on instantiation,
+// able to correctly 
diff erentiate between a splat case and a bitcast case.
+template  void f(T *tp) {
+  extern void g(int, ...);
+  g(0, (__vector int)(*tp));
+  g(0, (__vector int)*tp);
+}
+
+void g(void) {
+  f<__vector float>(nullptr);
+//  CHECK: | |-FunctionDecl {{.*}} f 'void (__vector float *)'
+
+//  CHECK: |   | `-CStyleCastExpr {{.*}} '__vector int' 
+// CHECK-NEXT: |   |   `-ImplicitCastExpr {{.*}} '__vector int' 
+// CHECK-NEXT: |   | `-ImplicitCastExpr {{.*}}'__vector float' 

+
+//  CHECK: | `-CStyleCastExpr {{.*}} '__vector int' 
+// CHECK-NEXT: |   `-ImplicitCastExpr {{.*}} '__vector int' 
+// CHECK-NEXT: | `-ImplicitCastExpr {{.*}}'__vector float' 

+
+  f(nullptr);
+//  CHECK: | `-FunctionDecl {{.*}} f 'void (double *)'
+
+//  CHECK: | | `-CStyleCastExpr {{.*}} '__vector int' 
+// CHECK-NEXT: | |   `-ImplicitCastExpr {{.*}} 'int' 
+// CHECK-NEXT: | | `-ImplicitCastExpr {{.*}}'double' 
+
+//  CHECK: |   `-CStyleCastExpr {{.*}} '__vector int' 
+// CHECK-NEXT: | `-ImplicitCastExpr {{.*}} 'int' 
+// CHECK-NEXT: |   `-ImplicitCastExpr {{.*}}:'double' 
+}



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


Re: [clang] 849c605 - PR47792: Include the type of a pointer or reference non-type template

2020-10-11 Thread Hubert Tong via cfe-commits
The bots don't seem happy building with a Clang that incorporates this
change:
```
/b/sanitizer-x86_64-linux-bootstrap/build/llvm-project/clang/lib/ASTMatchers/ASTMatchersInternal.cpp:943:5:
error: redefinition of 'hasAnyName' with a different type: 'const
VariadicFunction<...>' vs 'const VariadicFunction<...>'
hasAnyName = {};
^
/b/sanitizer-x86_64-linux-bootstrap/build/llvm-project/clang/include/clang/ASTMatchers/ASTMatchers.h:2771:5:
note: previous declaration is here
hasAnyName;
^
```
(from
http://lab.llvm.org:8011/#/builders/99/builds/49/steps/2/logs/build_clang_asan
)

On Sun, Oct 11, 2020 at 7:00 PM Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
> Author: Richard Smith
> Date: 2020-10-11T15:59:49-07:00
> New Revision: 849c60541b630ddf8cabf9179fa771b3f4207ec8
>
> URL:
> https://github.com/llvm/llvm-project/commit/849c60541b630ddf8cabf9179fa771b3f4207ec8
> DIFF:
> https://github.com/llvm/llvm-project/commit/849c60541b630ddf8cabf9179fa771b3f4207ec8.diff
>
> LOG: PR47792: Include the type of a pointer or reference non-type template
> parameter in its notion of template argument identity.
>
> We already did this for all the other kinds of non-type template
> argument. We're still missing the type from the mangling, so we continue
> to be able to see collisions at link time; that's an open ABI issue.
>
> Added:
>
>
> Modified:
> clang/lib/AST/ASTContext.cpp
> clang/lib/AST/TemplateBase.cpp
> clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
>
> Removed:
>
>
>
>
> 
> diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
> index a82d95461bb9..7c96038629fb 100644
> --- a/clang/lib/AST/ASTContext.cpp
> +++ b/clang/lib/AST/ASTContext.cpp
> @@ -5890,7 +5890,7 @@ ASTContext::getCanonicalTemplateArgument(const
> TemplateArgument &Arg) const {
>
>  case TemplateArgument::Declaration: {
>auto *D = cast(Arg.getAsDecl()->getCanonicalDecl());
> -  return TemplateArgument(D, Arg.getParamTypeForDecl());
> +  return TemplateArgument(D,
> getCanonicalType(Arg.getParamTypeForDecl()));
>  }
>
>  case TemplateArgument::NullPtr:
>
> diff  --git a/clang/lib/AST/TemplateBase.cpp
> b/clang/lib/AST/TemplateBase.cpp
> index a9113720fd45..e4303fdb7731 100644
> --- a/clang/lib/AST/TemplateBase.cpp
> +++ b/clang/lib/AST/TemplateBase.cpp
> @@ -244,7 +244,8 @@ void TemplateArgument::Profile(llvm::FoldingSetNodeID
> &ID,
>  break;
>
>case Declaration:
> -ID.AddPointer(getAsDecl()? getAsDecl()->getCanonicalDecl() : nullptr);
> +ID.AddPointer(getAsDecl() ? getAsDecl()->getCanonicalDecl() :
> nullptr);
> +getParamTypeForDecl().Profile(ID);
>  break;
>
>case Template:
> @@ -294,7 +295,8 @@ bool TemplateArgument::structurallyEquals(const
> TemplateArgument &Other) const {
>  return TypeOrValue.V == Other.TypeOrValue.V;
>
>case Declaration:
> -return getAsDecl() == Other.getAsDecl();
> +return getAsDecl() == Other.getAsDecl() &&
> +   getParamTypeForDecl() == Other.getParamTypeForDecl();
>
>case Integral:
>  return getIntegralType() == Other.getIntegralType() &&
>
> diff  --git a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
> b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
> index 7538de330902..6949a2eaad48 100644
> --- a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
> +++ b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
> @@ -459,3 +459,23 @@ namespace PR46637 {
>X y;
>int n = y.call(); // expected-error {{cannot initialize a variable of
> type 'int' with an rvalue of type 'void *'}}
>  }
> +
> +namespace PR47792 {
> +  using I = int;
> +
> +  template int a;
> +  const int n = 0;
> +  const I n2 = 0;
> +  static_assert(&a == &a<0>, "both should have type 'int'");
> +  static_assert(&a == &a<0>, "both should have type 'int'");
> +
> +  // FIXME: We will need to mangle these cases
> diff erently too!
> +  int m;
> +  const int &r1 = m;
> +  int &r2 = m;
> +  static_assert(&a != &a, "should have
> diff erent types");
> +
> +  const I &r3 = m;
> +  static_assert(&a == &a, "should have
> diff erent types");
>
I think the text of the static_assert string here is a copy-paste error.


> +  static_assert(&a != &a, "should have
> diff erent types");
> +}
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] 702529d - [clang] Fix returning the underlying VarDecl as top-level decl for VarTemplateDecl.

2020-10-12 Thread Hubert Tong via cfe-commits
ParsedASTTest.TopLevelDecls has not recovered on clang-ppc64le-rhel since
this went in (even when including f1bf41e433e196ecffcc4fb7cd04c58d48445425,
which is purported to fix buildbot failures from this commit).

http://lab.llvm.org:8011/#/builders/57/builds/81

On Mon, Oct 12, 2020 at 5:06 AM Haojian Wu via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
> Author: Haojian Wu
> Date: 2020-10-12T10:46:18+02:00
> New Revision: 702529d899c87e9268bb33d836dbc91b6bce0b16
>
> URL:
> https://github.com/llvm/llvm-project/commit/702529d899c87e9268bb33d836dbc91b6bce0b16
> DIFF:
> https://github.com/llvm/llvm-project/commit/702529d899c87e9268bb33d836dbc91b6bce0b16.diff
>
> LOG: [clang] Fix returning the underlying VarDecl as top-level decl for
> VarTemplateDecl.
>
> Given the following VarTemplateDecl AST,
>
> ```
> VarTemplateDecl col:26 X
> |-TemplateTypeParmDecl typename depth 0 index 0
> `-VarDecl X 'bool' cinit
>   `-CXXBoolLiteralExpr 'bool' true
> ```
>
> previously, we returned the VarDecl as the top-level decl, which was not
> correct, the top-level decl should be VarTemplateDecl.
>
> Differential Revision: https://reviews.llvm.org/D89098
>
> Added:
>
>
> Modified:
> clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
> clang/lib/Parse/ParseDecl.cpp
>
> Removed:
>
>
>
>
> 
> diff  --git a/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
> b/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
> index 65d9cffeedc7..db23438766d2 100644
> --- a/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
> +++ b/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
> @@ -57,6 +57,12 @@ MATCHER_P(DeclNamed, Name, "") {
>return false;
>  }
>
> +MATCHER_P(DeclKind, Kind, "") {
> +  if (NamedDecl *ND = dyn_cast(arg))
> +return ND->getDeclKindName() == Kind;
> +  return false;
> +}
> +
>  // Matches if the Decl has template args equal to ArgName. If the decl is
> a
>  // NamedDecl and ArgName is an empty string it also matches.
>  MATCHER_P(WithTemplateArgs, ArgName, "") {
> @@ -99,9 +105,15 @@ TEST(ParsedASTTest, TopLevelDecls) {
>  int header1();
>  int header2;
>)";
> -  TU.Code = "int main();";
> +  TU.Code = R"cpp(
> +int main();
> +template  bool X = true;
> +  )cpp";
>auto AST = TU.build();
> -  EXPECT_THAT(AST.getLocalTopLevelDecls(),
> ElementsAre(DeclNamed("main")));
> +  EXPECT_THAT(
> +  AST.getLocalTopLevelDecls(),
> +  ElementsAreArray({AllOf(DeclNamed("main"), DeclKind("Function")),
> +AllOf(DeclNamed("X"), DeclKind("VarTemplate"))}));
>  }
>
>  TEST(ParsedASTTest, DoesNotGetIncludedTopDecls) {
>
> diff  --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
> index 3f314c59ade6..01a16575c239 100644
> --- a/clang/lib/Parse/ParseDecl.cpp
> +++ b/clang/lib/Parse/ParseDecl.cpp
> @@ -2195,6 +2195,7 @@ Decl
> *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
>
>// Inform the current actions module that we just parsed this
> declarator.
>Decl *ThisDecl = nullptr;
> +  Decl *OuterDecl = nullptr;
>switch (TemplateInfo.Kind) {
>case ParsedTemplateInfo::NonTemplate:
>  ThisDecl = Actions.ActOnDeclarator(getCurScope(), D);
> @@ -2205,10 +2206,12 @@ Decl
> *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
>  ThisDecl = Actions.ActOnTemplateDeclarator(getCurScope(),
>
> *TemplateInfo.TemplateParams,
> D);
> -if (VarTemplateDecl *VT = dyn_cast_or_null(ThisDecl))
> +if (VarTemplateDecl *VT =
> dyn_cast_or_null(ThisDecl)) {
>// Re-direct this decl to refer to the templated decl so that we can
>// initialize it.
>ThisDecl = VT->getTemplatedDecl();
> +  OuterDecl = VT;
> +}
>  break;
>}
>case ParsedTemplateInfo::ExplicitInstantiation: {
> @@ -2385,8 +2388,7 @@ Decl
> *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
>}
>
>Actions.FinalizeDeclaration(ThisDecl);
> -
> -  return ThisDecl;
> +  return OuterDecl ? OuterDecl : ThisDecl;
>  }
>
>  /// ParseSpecifierQualifierList
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] 702529d - [clang] Fix returning the underlying VarDecl as top-level decl for VarTemplateDecl.

2020-10-12 Thread Hubert Tong via cfe-commits
On Mon, Oct 12, 2020 at 9:43 AM Haojian Wu  wrote:

> sorry, I'm looking at it.
>
No problem, thanks!


> On Mon, 12 Oct 2020 at 15:35, Hubert Tong <
> hubert.reinterpretc...@gmail.com> wrote:
>
>> ParsedASTTest.TopLevelDecls has not recovered on clang-ppc64le-rhel since
>> this went in (even when including f1bf41e433e196ecffcc4fb7cd04c58d48445425,
>> which is purported to fix buildbot failures from this commit).
>>
>> http://lab.llvm.org:8011/#/builders/57/builds/81
>>
>> On Mon, Oct 12, 2020 at 5:06 AM Haojian Wu via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>>
>>> Author: Haojian Wu
>>> Date: 2020-10-12T10:46:18+02:00
>>> New Revision: 702529d899c87e9268bb33d836dbc91b6bce0b16
>>>
>>> URL:
>>> https://github.com/llvm/llvm-project/commit/702529d899c87e9268bb33d836dbc91b6bce0b16
>>> DIFF:
>>> https://github.com/llvm/llvm-project/commit/702529d899c87e9268bb33d836dbc91b6bce0b16.diff
>>>
>>> LOG: [clang] Fix returning the underlying VarDecl as top-level decl for
>>> VarTemplateDecl.
>>>
>>> Given the following VarTemplateDecl AST,
>>>
>>> ```
>>> VarTemplateDecl col:26 X
>>> |-TemplateTypeParmDecl typename depth 0 index 0
>>> `-VarDecl X 'bool' cinit
>>>   `-CXXBoolLiteralExpr 'bool' true
>>> ```
>>>
>>> previously, we returned the VarDecl as the top-level decl, which was not
>>> correct, the top-level decl should be VarTemplateDecl.
>>>
>>> Differential Revision: https://reviews.llvm.org/D89098
>>>
>>> Added:
>>>
>>>
>>> Modified:
>>> clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
>>> clang/lib/Parse/ParseDecl.cpp
>>>
>>> Removed:
>>>
>>>
>>>
>>>
>>> 
>>> diff  --git a/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
>>> b/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
>>> index 65d9cffeedc7..db23438766d2 100644
>>> --- a/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
>>> +++ b/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp
>>> @@ -57,6 +57,12 @@ MATCHER_P(DeclNamed, Name, "") {
>>>return false;
>>>  }
>>>
>>> +MATCHER_P(DeclKind, Kind, "") {
>>> +  if (NamedDecl *ND = dyn_cast(arg))
>>> +return ND->getDeclKindName() == Kind;
>>> +  return false;
>>> +}
>>> +
>>>  // Matches if the Decl has template args equal to ArgName. If the decl
>>> is a
>>>  // NamedDecl and ArgName is an empty string it also matches.
>>>  MATCHER_P(WithTemplateArgs, ArgName, "") {
>>> @@ -99,9 +105,15 @@ TEST(ParsedASTTest, TopLevelDecls) {
>>>  int header1();
>>>  int header2;
>>>)";
>>> -  TU.Code = "int main();";
>>> +  TU.Code = R"cpp(
>>> +int main();
>>> +template  bool X = true;
>>> +  )cpp";
>>>auto AST = TU.build();
>>> -  EXPECT_THAT(AST.getLocalTopLevelDecls(),
>>> ElementsAre(DeclNamed("main")));
>>> +  EXPECT_THAT(
>>> +  AST.getLocalTopLevelDecls(),
>>> +  ElementsAreArray({AllOf(DeclNamed("main"), DeclKind("Function")),
>>> +AllOf(DeclNamed("X"),
>>> DeclKind("VarTemplate"))}));
>>>  }
>>>
>>>  TEST(ParsedASTTest, DoesNotGetIncludedTopDecls) {
>>>
>>> diff  --git a/clang/lib/Parse/ParseDecl.cpp
>>> b/clang/lib/Parse/ParseDecl.cpp
>>> index 3f314c59ade6..01a16575c239 100644
>>> --- a/clang/lib/Parse/ParseDecl.cpp
>>> +++ b/clang/lib/Parse/ParseDecl.cpp
>>> @@ -2195,6 +2195,7 @@ Decl
>>> *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
>>>
>>>// Inform the current actions module that we just parsed this
>>> declarator.
>>>Decl *ThisDecl = nullptr;
>>> +  Decl *OuterDecl = nullptr;
>>>switch (TemplateInfo.Kind) {
>>>case ParsedTemplateInfo::NonTemplate:
>>>  ThisDecl = Actions.ActOnDeclarator(getCurScope(), D);
>>> @@ -2205,10 +2206,12 @@ Decl
>>> *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
>>>  ThisDecl = Actions.ActOnTemplateDeclarator(getCurScope(),
>>>
>>> *TemplateInfo.TemplateParams,
>>> D);
>>> -if (VarTemplateDecl *VT =
>>> dyn_cast_or_null(ThisDecl))
>>> +if (VarTemplateDecl *VT =
>>> dyn_cast_or_null(ThisDecl)) {
>>>// Re-direct this decl to refer to the templated decl so that we
>>> can
>>>// initialize it.
>>>ThisDecl = VT->getTemplatedDecl();
>>> +  OuterDecl = VT;
>>> +}
>>>  break;
>>>}
>>>case ParsedTemplateInfo::ExplicitInstantiation: {
>>> @@ -2385,8 +2388,7 @@ Decl
>>> *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
>>>}
>>>
>>>Actions.FinalizeDeclaration(ThisDecl);
>>> -
>>> -  return ThisDecl;
>>> +  return OuterDecl ? OuterDecl : ThisDecl;
>>>  }
>>>
>>>  /// ParseSpecifierQualifierList
>>>
>>>
>>>
>>> ___
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 44174b3 - [NFC][tests] Replace non-portable grep with FileCheck

2020-11-24 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-11-24T12:15:07-05:00
New Revision: 44174b3d518ed70482ff5df2879523a4e26f92cc

URL: 
https://github.com/llvm/llvm-project/commit/44174b3d518ed70482ff5df2879523a4e26f92cc
DIFF: 
https://github.com/llvm/llvm-project/commit/44174b3d518ed70482ff5df2879523a4e26f92cc.diff

LOG: [NFC][tests] Replace non-portable grep with FileCheck

After commit 2482648a795afbe12774168bbbf70dc14c031267, a GNU grep option
is just passed unconditionally to `grep` in general. This patch fixes
the test for platforms where `grep` is not GNU grep.

Added: 


Modified: 
clang/test/CodeGen/thinlto_embed_bitcode.ll

Removed: 




diff  --git a/clang/test/CodeGen/thinlto_embed_bitcode.ll 
b/clang/test/CodeGen/thinlto_embed_bitcode.ll
index 971d4005435d..590cadbfd418 100644
--- a/clang/test/CodeGen/thinlto_embed_bitcode.ll
+++ b/clang/test/CodeGen/thinlto_embed_bitcode.ll
@@ -18,7 +18,7 @@
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t.o -x ir %t1.bc -c 
-fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt
 ; RUN: llvm-readelf -S %t.o | FileCheck %s 
--check-prefixes=CHECK-ELF,CHECK-ELF-CMD
 ; RUN: llvm-objcopy --dump-section=.llvmcmd=%t-embedded.cmd %t.o /dev/null
-; RUN: grep --text x86_64-unknown-linux-gnu %t-embedded.cmd | count 1
+; RUN: FileCheck %s --check-prefixes=CHECK-EMBEDDED-CMD <%t-embedded.cmd
 ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null
 ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-NOOPT
 ; We should only need the index and the post-thinlto merged module to generate 
@@ -43,3 +43,6 @@
 ; CHECK-NOOPT-NEXT: call void @bar()
 ; CHECK-NOOPT: define available_externally void @bar()
 ; CHECK-NOOPT-NEXT: ret void
+
+; CHECK-EMBEDDED-CMD: x86_64-unknown-linux-gnu{{.*$}}
+; CHECK-EMBEDDED-CMD-NOT: x86_64-unknown-linux-gnu



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


[clang] 1260944 - [PowerPC][AIX] Make `__vector [un]signed long` an error

2020-10-18 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-10-18T12:39:16-04:00
New Revision: 126094485ab99dac3e6df9c201124d48a1d798ce

URL: 
https://github.com/llvm/llvm-project/commit/126094485ab99dac3e6df9c201124d48a1d798ce
DIFF: 
https://github.com/llvm/llvm-project/commit/126094485ab99dac3e6df9c201124d48a1d798ce.diff

LOG: [PowerPC][AIX] Make `__vector [un]signed long` an error

The semantics associated with `__vector [un]signed long` are neither
consistently specified nor consistently implemented.

The IBM XL compilers on AIX traditionally treated these as deprecated
aliases for the corresponding `__vector int` type in both 32-bit and
64-bit modes. The newer, Clang-based, IBM XL compilers on AIX make usage
of the previously deprecated types an error. This is also consistent
with IBM XL C/C++ for Linux on Power (on little endian distributions).

In line with the above, this patch upgrades (on AIX) the deprecation of
`__vector long` to become removal.

Reviewed By: ZarkoCA

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

Added: 


Modified: 
clang/lib/Sema/DeclSpec.cpp
clang/test/Parser/altivec.c
clang/test/Parser/cxx-altivec.cpp

Removed: 




diff  --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp
index a3f770bb00ad..dc37474db9fd 100644
--- a/clang/lib/Sema/DeclSpec.cpp
+++ b/clang/lib/Sema/DeclSpec.cpp
@@ -1196,7 +1196,13 @@ void DeclSpec::Finish(Sema &S, const PrintingPolicy 
&Policy) {
 S.Diag(TSTLoc, diag::err_invalid_vector_float_decl_spec);
 } else if (TypeSpecWidth == TSW_long) {
   // vector long is unsupported for ZVector and deprecated for AltiVec.
-  if (S.getLangOpts().ZVector)
+  // It has also been historically deprecated on AIX (as an alias for
+  // "vector int" in both 32-bit and 64-bit modes). It was then made
+  // unsupported in the Clang-based XL compiler since the deprecated type
+  // has a number of conflicting semantics and continuing to support it
+  // is a disservice to users.
+  if (S.getLangOpts().ZVector ||
+  S.Context.getTargetInfo().getTriple().isOSAIX())
 S.Diag(TSWRange.getBegin(), diag::err_invalid_vector_long_decl_spec);
   else
 S.Diag(TSWRange.getBegin(),

diff  --git a/clang/test/Parser/altivec.c b/clang/test/Parser/altivec.c
index 769b4dec98fc..e966679be54a 100644
--- a/clang/test/Parser/altivec.c
+++ b/clang/test/Parser/altivec.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec 
-fsyntax-only -verify %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature 
+altivec -fsyntax-only -verify %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature 
+altivec -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec 
-fsyntax-only -verify=expected,nonaix %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature 
+altivec -fsyntax-only -verify=expected,nonaix %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature 
+altivec -fsyntax-only -verify=expected,nonaix %s
+// RUN: %clang_cc1 -triple=powerpc-ibm-aix -target-feature +altivec 
-fsyntax-only -verify=expected,aix %s
+// RUN: %clang_cc1 -triple=powerpc64-ibm-aix -target-feature +altivec 
-fsyntax-only -verify=expected,aix %s
 
 __vector char vv_c;
 __vector signed char vv_sc;
@@ -54,19 +56,33 @@ void f_a2(int b, vector int a);
 
 vector int v = (vector int)(-1);
 
+// These should have errors on AIX and warnings otherwise.
+__vector long vv_l; // nonaix-warning {{Use of 'long' with 
'__vector' is deprecated}}
+// aix-error@-1 {{cannot use 'long' with 
'__vector'}}
+__vector signed long vv_sl; // nonaix-warning {{Use of 'long' with 
'__vector' is deprecated}}
+// aix-error@-1 {{cannot use 'long' with 
'__vector'}}
+__vector unsigned long vv_ul;   // nonaix-warning {{Use of 'long' with 
'__vector' is deprecated}}
+// aix-error@-1 {{cannot use 'long' with 
'__vector'}}
+__vector long int vv_li;// nonaix-warning {{Use of 'long' with 
'__vector' is deprecated}}
+// aix-error@-1 {{cannot use 'long' with 
'__vector'}}
+__vector signed long int vv_sli;// nonaix-warning {{Use of 'long' with 
'__vector' is deprecated}}
+// aix-error@-1 {{cannot use 'long' with 
'__vector'}}
+__vector unsigned long int vv_uli;  // nonaix-warning {{Use of 'long' with 
'__vector' is deprecated}}
+// aix-error@-1 {{cannot use 'long' with 
'__vector'}}
+vector long v_l;// nonaix-warning {{Use of 'long' with 
'__vector' is deprecated}}
+// aix-error@-1 {{cannot use 'long' with 
'__vector'}}
+vector signed long v

[clang] 134ffa8 - NFC: Fix -Wsign-compare warnings on 32-bit builds

2020-10-20 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-10-20T20:52:10-04:00
New Revision: 134ffa8138c31444685013e10f592cd7c88d675b

URL: 
https://github.com/llvm/llvm-project/commit/134ffa8138c31444685013e10f592cd7c88d675b
DIFF: 
https://github.com/llvm/llvm-project/commit/134ffa8138c31444685013e10f592cd7c88d675b.diff

LOG: NFC: Fix -Wsign-compare warnings on 32-bit builds

Comparing 32-bit `ptrdiff_t` against 32-bit `unsigned` results in
`-Wsign-compare` warnings for both GCC and Clang.

The warning for the cases in question appear to identify an issue
where the `ptrdiff_t` value would be mutated via conversion to an
unsigned type.

The warning is resolved by using the usual arithmetic conversions to
safely preserve the value of the `unsigned` operand while trying to
convert to a signed type. Host platforms where `unsigned` has the same
width as `unsigned long long` will need to make a different change, but
using an explicit cast has disadvantages that can be avoided for now.

Reviewed By: dantrushin

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

Added: 


Modified: 
clang/lib/Serialization/ASTReaderStmt.cpp
llvm/lib/CodeGen/StackMaps.cpp

Removed: 




diff  --git a/clang/lib/Serialization/ASTReaderStmt.cpp 
b/clang/lib/Serialization/ASTReaderStmt.cpp
index c154c146727e..363527f884b3 100644
--- a/clang/lib/Serialization/ASTReaderStmt.cpp
+++ b/clang/lib/Serialization/ASTReaderStmt.cpp
@@ -2186,9 +2186,9 @@ void ASTStmtReader::VisitRecoveryExpr(RecoveryExpr *E) {
   unsigned NumArgs = Record.readInt();
   E->BeginLoc = readSourceLocation();
   E->EndLoc = readSourceLocation();
-  assert(
-  (NumArgs == std::distance(E->children().begin(), E->children().end())) &&
-  "Wrong NumArgs!");
+  assert((NumArgs + 0LL ==
+  std::distance(E->children().begin(), E->children().end())) &&
+ "Wrong NumArgs!");
   (void)NumArgs;
   for (Stmt *&Child : E->children())
 Child = Record.readSubStmt();

diff  --git a/llvm/lib/CodeGen/StackMaps.cpp b/llvm/lib/CodeGen/StackMaps.cpp
index f7fb2e824bb9..ee1a4a47b4cc 100644
--- a/llvm/lib/CodeGen/StackMaps.cpp
+++ b/llvm/lib/CodeGen/StackMaps.cpp
@@ -401,7 +401,7 @@ void StackMaps::parseStatepointOpers(const MachineInstr &MI,
 SmallVector GCPtrIndices;
 unsigned GCPtrIdx = (unsigned)SO.getFirstGCPtrIdx();
 assert((int)GCPtrIdx != -1);
-assert(MOI - MI.operands_begin() == GCPtrIdx);
+assert(MOI - MI.operands_begin() == GCPtrIdx + 0LL);
 while (NumGCPointers--) {
   GCPtrIndices.push_back(GCPtrIdx);
   GCPtrIdx = StackMaps::getNextMetaArgIdx(&MI, GCPtrIdx);



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


[clang] 9ae529d - [AIX][clang-repl][test] Mark unsupported pending XCOFF64 integrated-as

2021-05-15 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2021-05-15T22:41:45-04:00
New Revision: 9ae529d0db2d6841b3b2e49525e03b33e8445636

URL: 
https://github.com/llvm/llvm-project/commit/9ae529d0db2d6841b3b2e49525e03b33e8445636
DIFF: 
https://github.com/llvm/llvm-project/commit/9ae529d0db2d6841b3b2e49525e03b33e8445636.diff

LOG: [AIX][clang-repl][test] Mark unsupported pending XCOFF64 integrated-as

This patch replaces the `powerpc64` token with the `system-aix` one in
the UNSUPPORTED line of a test. The `powerpc64` token was originally
added temporarily in 71a0609a2b53.

If AIX uses integrated-as by default and it works both for 32-bit and
64-bit objects, then the issues encountered so far (see comments in
D96033) would be mostly solved.

As it is, marking the test as expected-to-fail (as opposed to
unsupported) on AIX might cause more trouble in the form of 32-bit
versus 64-bit differences. I am not aware of other situations where LIT
tests are dependent on whether the LLVM build is 64-bit or 32-bit.

Reviewed By: jsji

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

Added: 


Modified: 
clang/test/Interpreter/execute.cpp

Removed: 




diff  --git a/clang/test/Interpreter/execute.cpp 
b/clang/test/Interpreter/execute.cpp
index a9beed5714d0b..108b79b23a59d 100644
--- a/clang/test/Interpreter/execute.cpp
+++ b/clang/test/Interpreter/execute.cpp
@@ -1,6 +1,6 @@
 // RUN: cat %s | clang-repl | FileCheck %s
 // REQUIRES: host-supports-jit
-// UNSUPPORTED: powerpc64
+// UNSUPPORTED: system-aix
 
 extern "C" int printf(const char *, ...);
 int i = 42;



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


[clang] 603818b - [test] Fix pre-ra-sched.c to check for error message from stderr

2021-05-20 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2021-05-20T09:51:21-04:00
New Revision: 603818b97c795114f66a6fc13e8a5f0e54b49a13

URL: 
https://github.com/llvm/llvm-project/commit/603818b97c795114f66a6fc13e8a5f0e54b49a13
DIFF: 
https://github.com/llvm/llvm-project/commit/603818b97c795114f66a6fc13e8a5f0e54b49a13.diff

LOG: [test] Fix pre-ra-sched.c to check for error message from stderr

The test previous accidentally passed because it was looking for a lack
of specific input from the binary(!) output being sent to stdout.

Added: 


Modified: 
clang/test/CodeGen/pre-ra-sched.c

Removed: 




diff  --git a/clang/test/CodeGen/pre-ra-sched.c 
b/clang/test/CodeGen/pre-ra-sched.c
index 3bd7594a5db9..376e5641b63b 100644
--- a/clang/test/CodeGen/pre-ra-sched.c
+++ b/clang/test/CodeGen/pre-ra-sched.c
@@ -1,4 +1,4 @@
-// RUN: %clang %s -mllvm -pre-RA-sched=fast -c -o - | FileCheck %s
-// RUN: %clang %s -mllvm -pre-RA-sched=linearize -c -o - | FileCheck %s
+// RUN: %clang %s -mllvm -pre-RA-sched=fast -c -o %t-fast.o 2>&1 | FileCheck 
--allow-empty %s
+// RUN: %clang %s -mllvm -pre-RA-sched=linearize -c -o %t-linearize.o 2>&1 | 
FileCheck --allow-empty %s
 
 // CHECK-NOT: clang (LLVM option parsing): for the --pre-RA-sched option: 
Cannot find option named



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


Re: [llvm-dev] Phabricator Creator Pulling the Plug

2021-09-30 Thread Hubert Tong via cfe-commits
On Thu, Sep 30, 2021 at 6:56 PM Mehdi AMINI via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> We talked about this with the IWG (Infrastructure Working Group) just
> last week coincidentally.
> Two major blocking tracks that were identified at the roundtable
> during the LLVM Dev Meeting exactly 2 years ago are still an issue
> today:
>
> 1) Replacement for Herald rules. This is what allows us to subscribe
> and track new revisions or commits based on paths in the repo or other
> criteria. We could build a replacement based on GitHub action or any
> other kind of service, but this is a bit tricky (how do you store
> emails privately? etc.). I have looked around online but I didn't find
> another OSS project (or external company) providing a similar service
> for GitHub unfortunately, does anyone know of any?
>
> 2) Support for stacked commits. I can see how to structure this
> somehow assuming we would push pull-request branches in the main repo
> (with one new commit per branch and cascading the pull-requests from
> one branch to the other), otherwise this will be a major regression
> compared to the current workflow.
>
> What remains unknown to me is the current state of GitHub management
> of comments across `git commit --amend` and force push to update a
> branch.
>

Force pushing to a PR branch does make it harder for reviewers to see how
review comments were addressed or what was done since they last looked at
the PR. Are your use cases addressed if the workflow consists of pushing
additional commits to address comments or pushing a merge commit to refresh
the PR branch? When the PR is approved, the "squash and merge" option can
be used to commit the patch as a single commit.


>
> Others may have other items to add!
>

I find the code review experience in GitHub to be a productivity drain
compared to Phabricator.

Older inline comments are much harder to find in GitHub.
Much more clicking needed in GitHub to actually load everything (blocks of
comments folded away, comments collapsed not because you want them
collapsed but because someone else or maybe just GitHub thought it should
be collapsed, source files not loaded).
GitHub does not allow inline comments further away than a few lines from a
change.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang] e6629be - [AIX] Define __STDC_NO_ATOMICS__ and __STDC_NO_THREADS__ predefined macros

2021-06-08 Thread Hubert Tong via cfe-commits
On Tue, Jun 8, 2021 at 11:43 AM Joerg Sonnenberger via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Mon, Jun 07, 2021 at 07:04:36PM -0700, via cfe-commits wrote:
> >
> > Author: =Jake Egan
> > Date: 2021-06-07T22:04:18-04:00
> > New Revision: e6629be31e67190f0a524f009752d73410894560
> >
> > URL:
> https://github.com/llvm/llvm-project/commit/e6629be31e67190f0a524f009752d73410894560
> > DIFF:
> https://github.com/llvm/llvm-project/commit/e6629be31e67190f0a524f009752d73410894560.diff
> >
> > LOG: [AIX] Define __STDC_NO_ATOMICS__ and __STDC_NO_THREADS__ predefined
> macros
>
> I find the justification for this a bit strange. Neither one has to be
> implemented in libc. compiler-rt implements the former with the mixing
> caveats applied and there are portable implementations of the latter
> based on pthread. I would expect them to work well enough on AIX, too.
> So this seems to do more harm than good?
>

Thanks for the feedback. The compiler-rt pointer is a good hint. Note that
the status quo of compiler-rt is that the implementation you mention is
guarded under
if(APPLE)
in the CMake. Thus setting the macro reflects the status quo at this time.

For the latter, I think the vanilla LLVM source is meant to reflect what
could be considered a vanilla deployment. The portable implementations you
mention would be an extra component.


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


Re: [clang] 9ca905b - XFAIL a test on ppc64

2021-07-30 Thread Hubert Tong via cfe-commits
On Fri, Jul 30, 2021 at 12:05 PM Paul Robinson via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
> Author: Paul Robinson
> Date: 2021-07-30T09:05:14-07:00
> New Revision: 9ca905b52d53c46aceb4d28e44dfbf4a815d0c68
>
> URL:
> https://github.com/llvm/llvm-project/commit/9ca905b52d53c46aceb4d28e44dfbf4a815d0c68
> DIFF:
> https://github.com/llvm/llvm-project/commit/9ca905b52d53c46aceb4d28e44dfbf4a815d0c68.diff
>
> LOG: XFAIL a test on ppc64
>
> Buildbot failure:
> https://lab.llvm.org/buildbot/#/builders/105/builds/13141
> which provides no details about why it failed,


Which would be because the test is set up to display warnings but won't
display errors.

/usr/bin/as: unrecognized option '--32'

I also tried `x86_64-pc-linux-gnu`:

/usr/bin/as: unrecognized option '--64'

It probably makes sense that these options aren't supported if the system
is 64-bit only.


> but the only failure
> reports are for ppc64 bots.
>
> Added:
>
>
> Modified:
> clang/test/Driver/as-no-warnings.c
>
> Removed:
>
>
>
>
> 
> diff  --git a/clang/test/Driver/as-no-warnings.c
> b/clang/test/Driver/as-no-warnings.c
> index 9c2b3f096872..77971389ee65 100644
> --- a/clang/test/Driver/as-no-warnings.c
> +++ b/clang/test/Driver/as-no-warnings.c
> @@ -14,6 +14,7 @@
>  // REQUIRES: clang-driver
>  // REQUIRES: x86-registered-target
>  // REQUIRES: system-linux
> +// XFAIL: ppc64
>
>  // CHECK: "-cc1" {{.*}} "-massembler-no-warn"
>  // CHECK-NOIAS: "--no-warn"
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang] 9ca905b - XFAIL a test on ppc64

2021-07-30 Thread Hubert Tong via cfe-commits
On Fri, Jul 30, 2021 at 12:59 PM  wrote:

> Do you have a suggestion for how to fix it?  This isn’t actually my test,
> I tripped over it and it seemed like it would be easy to get it to work.
> ☹
>

I think removing all of the `-target` options might help. Alternatively, I
don't see why the test should actually call out to the assembler (could
just check the driver would invoke it with the options of interest).

If the test is also meant to check that an error from the native assembler
produces an error return code from the driver, then that could be tested
using an ersatz assembler picked up using `-B` (but I would hope that
there's a different test to cover that already).

Thanks,
>
> --paulr
>
>
>
> *From:* Hubert Tong 
> *Sent:* Friday, July 30, 2021 12:43 PM
> *To:* Robinson, Paul ; Paul Robinson <
> llvmlist...@llvm.org>
> *Cc:* cfe-commits 
> *Subject:* Re: [clang] 9ca905b - XFAIL a test on ppc64
>
>
>
> On Fri, Jul 30, 2021 at 12:05 PM Paul Robinson via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>
> Author: Paul Robinson
> Date: 2021-07-30T09:05:14-07:00
> New Revision: 9ca905b52d53c46aceb4d28e44dfbf4a815d0c68
>
> URL:
> https://github.com/llvm/llvm-project/commit/9ca905b52d53c46aceb4d28e44dfbf4a815d0c68
> 
> DIFF:
> https://github.com/llvm/llvm-project/commit/9ca905b52d53c46aceb4d28e44dfbf4a815d0c68.diff
> 
>
> LOG: XFAIL a test on ppc64
>
> Buildbot failure:
> https://lab.llvm.org/buildbot/#/builders/105/builds/13141
> 
> which provides no details about why it failed,
>
>
>
> Which would be because the test is set up to display warnings but won't
> display errors.
>
>
>
> /usr/bin/as: unrecognized option '--32'
>
>
>
> I also tried `x86_64-pc-linux-gnu`:
>
>
>
> /usr/bin/as: unrecognized option '--64'
>
>
>
> It probably makes sense that these options aren't supported if the system
> is 64-bit only.
>
>
>
> but the only failure
> reports are for ppc64 bots.
>
> Added:
>
>
> Modified:
> clang/test/Driver/as-no-warnings.c
>
> Removed:
>
>
>
>
> 
> diff  --git a/clang/test/Driver/as-no-warnings.c
> b/clang/test/Driver/as-no-warnings.c
> index 9c2b3f096872..77971389ee65 100644
> --- a/clang/test/Driver/as-no-warnings.c
> +++ b/clang/test/Driver/as-no-warnings.c
> @@ -14,6 +14,7 @@
>  // REQUIRES: clang-driver
>  // REQUIRES: x86-registered-target
>  // REQUIRES: system-linux
> +// XFAIL: ppc64
>
>  // CHECK: "-cc1" {{.*}} "-massembler-no-warn"
>  // CHECK-NOIAS: "--no-warn"
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> 
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6ace52e - [Driver][AIX] Change UNSUPPORTED to XFAIL system-aix

2022-11-04 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2022-11-04T12:26:53-04:00
New Revision: 6ace52e5e49cff6664fc301fa4985fc28c88f26f

URL: 
https://github.com/llvm/llvm-project/commit/6ace52e5e49cff6664fc301fa4985fc28c88f26f
DIFF: 
https://github.com/llvm/llvm-project/commit/6ace52e5e49cff6664fc301fa4985fc28c88f26f.diff

LOG: [Driver][AIX] Change UNSUPPORTED to XFAIL system-aix

Update https://reviews.llvm.org/rGc14df228ff3c to check the host versus
the target thereby allowing XFAIL to be used in case the issue is
resolved in the future.

Added: 


Modified: 
clang/test/Driver/response-file-errs.c

Removed: 




diff  --git a/clang/test/Driver/response-file-errs.c 
b/clang/test/Driver/response-file-errs.c
index 64eb3208a836..0fd03ed08c04 100644
--- a/clang/test/Driver/response-file-errs.c
+++ b/clang/test/Driver/response-file-errs.c
@@ -1,5 +1,5 @@
 // AIX reacts on opening directory 
diff erently than other systems.
-// UNSUPPORTED: aix
+// XFAIL: system-aix
 
 // If response file does not exist, '@file; directive remains unexpanded in
 // command line.



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


[clang] 0f5099c - Opting out of Clang 16 ABI Changes for AIX and z/OS

2023-01-23 Thread Hubert Tong via cfe-commits

Author: Nicole Rabjohn
Date: 2023-01-24T01:14:05-05:00
New Revision: 0f5099cd94226479fe30b4fc2d6a9743ebe2b12b

URL: 
https://github.com/llvm/llvm-project/commit/0f5099cd94226479fe30b4fc2d6a9743ebe2b12b
DIFF: 
https://github.com/llvm/llvm-project/commit/0f5099cd94226479fe30b4fc2d6a9743ebe2b12b.diff

LOG: Opting out of Clang 16 ABI Changes for AIX and z/OS

There is already a GCC compatibility gap on AIX, & GCC compatibility is
not a concern on z/OS. GCC compatibility is not sufficient motivation
for breaking ABI on AIX and z/OS. This opts out of changes introduced in
https://reviews.llvm.org/D119051. For AIX only, also opt out of D117616
(which z/OS had picked up at the time ABI stabilization occurred).

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

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/lib/AST/RecordLayoutBuilder.cpp
clang/lib/Basic/Targets/OSTargets.h
clang/test/SemaCXX/class-layout.cpp

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index f7a68a64df325..7d356e53547bf 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -838,13 +838,14 @@ ABI Changes in Clang
 
 - GCC doesn't pack non-POD members in packed structs unless the packed
   attribute is also specified on the member. Clang historically did perform
-  such packing. Clang now matches the gcc behavior (except on Darwin and PS4).
+  such packing. Clang now matches the gcc behavior
+  (except on Darwin, PS4 and AIX).
   You can switch back to the old ABI behavior with the flag:
   ``-fclang-abi-compat=15.0``.
 - GCC allows POD types to have defaulted special members. Clang historically
   classified such types as non-POD (for the purposes of Itanium ABI). Clang now
-  matches the gcc behavior (except on Darwin and PS4). You can switch back to
-  the old ABI behavior with the flag: ``-fclang-abi-compat=15.0``.
+  matches the gcc behavior (except on Darwin, PS4, AIX and z/OS). You can 
switch
+  back to the old ABI behavior with the flag: ``-fclang-abi-compat=15.0``.
 
 OpenMP Support in Clang
 ---

diff  --git a/clang/lib/AST/RecordLayoutBuilder.cpp 
b/clang/lib/AST/RecordLayoutBuilder.cpp
index da27f73ea94e2..2f546398338c4 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -1968,7 +1968,8 @@ void ItaniumRecordLayoutBuilder::LayoutField(const 
FieldDecl *D,
  FieldClass->hasAttr() ||
  Context.getLangOpts().getClangABICompat() <=
  LangOptions::ClangABI::Ver15 ||
- Target.isPS() || Target.isOSDarwin())) ||
+ Target.isPS() || Target.isOSDarwin() ||
+ Target.isOSAIX())) ||
  D->hasAttr();
 
   // When used as part of a typedef, or together with a 'packed' attribute, the

diff  --git a/clang/lib/Basic/Targets/OSTargets.h 
b/clang/lib/Basic/Targets/OSTargets.h
index a1b1f917931b2..fd372cb12df2b 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -773,6 +773,10 @@ class AIXTargetInfo : public OSTargetInfo {
   }
 
   bool defaultsToAIXPowerAlignment() const override { return true; }
+
+  bool areDefaultedSMFStillPOD(const LangOptions &) const override {
+return false;
+  }
 };
 
 // z/OS target
@@ -831,6 +835,10 @@ class LLVM_LIBRARY_VISIBILITY ZOSTargetInfo : public 
OSTargetInfo {
 this->UseLeadingZeroLengthBitfield = false;
 this->ZeroLengthBitfieldBoundary = 32;
   }
+
+  bool areDefaultedSMFStillPOD(const LangOptions &) const override {
+return false;
+  }
 };
 
 void addWindowsDefines(const llvm::Triple &Triple, const LangOptions &Opts,

diff  --git a/clang/test/SemaCXX/class-layout.cpp 
b/clang/test/SemaCXX/class-layout.cpp
index 3d710dc5a5200..3ccd0ad25d7e7 100644
--- a/clang/test/SemaCXX/class-layout.cpp
+++ b/clang/test/SemaCXX/class-layout.cpp
@@ -7,8 +7,17 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -fclang-abi-compat=14 -DCLANG_ABI_COMPAT=14
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -fclang-abi-compat=15 -DCLANG_ABI_COMPAT=15
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -fclang-abi-compat=16 -DCLANG_ABI_COMPAT=16
+// RUN: %clang_cc1 -triple powerpc-ibm-aix7.3.0.0 %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -DCLANG_ABI_COMPAT=15
+// RUN: %clang_cc1 -triple powerpc-ibm-aix7.3.0.0 %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -fclang-abi-compat=15 -DCLANG_ABI_COMPAT=15
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix7.3.0.0 %s -fsyntax-only -verify 
-std=c++11 -Wno-inaccessible-base -DCLANG_

[clang] [PowerPC] Support local-dynamic TLS relocation on AIX (PR #66316)

2023-10-03 Thread Hubert Tong via cfe-commits


@@ -660,14 +671,16 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
  "GETtls[ld]ADDR[32] must read GPR3");
 
   if (Subtarget->isAIXABI()) {
-// On AIX, the variable offset should already be in R4 and the region 
handle
-// should already be in R3.
-// For TLSGD, which currently is the only supported access model, we only
-// need to generate an absolute branch to .__tls_get_addr.
+// For TLSGD, the variable offset should already be in R4 and the region
+// handle should already be in R3. We generate an absolute branch to
+// .__tls_get_addr. For TLSLD, the module handle should already be in R3.
+// We generate an absolute branch to .__tls_get_mod.
 Register VarOffsetReg = Subtarget->isPPC64() ? PPC::X4 : PPC::R4;
 (void)VarOffsetReg;
-assert(MI->getOperand(2).isReg() &&
-   MI->getOperand(2).getReg() == VarOffsetReg &&
+assert((MI->getOpcode() == PPC::GETtlsMOD32AIX ||
+MI->getOpcode() == PPC::GETtlsMOD64AIX ||
+(MI->getOperand(2).isReg() &&
+ MI->getOperand(2).getReg() == VarOffsetReg)) &&
"GETtls[ld]ADDR[32] must read GPR4");
 EmitAIXTlsCallHelper(MI);

hubert-reinterpretcast wrote:

The helper functions have special calling convention properties. For example, 
they do not use the FP registers. The IBM XL compiler was able to take 
advantage of that.

For:
```c
__attribute__((tls_model("local-dynamic"))) __thread int x;
double g(int, double);
void f() {
  double gg = g(0, 1.);
  g(x, gg);
}
```

The IBM XL compilers were able to make use of the returned `double` staying in 
the register:
```
  28: 48 00 00 03   bla 0
0028:  R_RBA(idx: 36) .__tls_get_mod[PR]
  2c: 7c 66 18 2e   lwzx 3, 6, 3
  30: 4b ff ff d1   bl 0x0 <.f>
0030:  R_RBR(idx: 34) .g[PR]
```

Clang/LLVM loads the value from the stack:
```
  24: 48 00 00 03   bla 0
0024:  R_RBA(idx: 3) .__tls_get_mod[PR]
  28: e8 82 00 08   ld 4, 8(2)
002a:  R_TOC(idx: 17) x[TC]
  2c: 7c 63 22 aa   lwax 3, 3, 4
  30: 4b ff ff d1   bl 0x0 <.f>
0030:  R_RBR(idx: 1) .g[PR]
```

https://github.com/llvm/llvm-project/pull/66316
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] cead149 - Add new option -fkeep-persistent-storage-variables to Clang release notes

2023-07-24 Thread Hubert Tong via cfe-commits

Author: Zheng Qian
Date: 2023-07-24T22:56:18-04:00
New Revision: cead1497ae0c1d57ee6883500c7c205f83798440

URL: 
https://github.com/llvm/llvm-project/commit/cead1497ae0c1d57ee6883500c7c205f83798440
DIFF: 
https://github.com/llvm/llvm-project/commit/cead1497ae0c1d57ee6883500c7c205f83798440.diff

LOG: Add new option -fkeep-persistent-storage-variables to Clang release notes

This patch updates the Clang release notes with the new option
-fkeep-persistent-storage-variables added in bb6ab91b1dcd.

Reviewed By: hubert.reinterpretcast

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

Added: 


Modified: 
clang/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index b69e1c7e60e177..89707a658f46bd 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -274,6 +274,11 @@ New Compiler Flags
 - ``-fcaret-diagnostics-max-lines=`` has been added as a driver options, which
   lets users control the maximum number of source lines printed for a
   caret diagnostic.
+- ``-fkeep-persistent-storage-variables`` has been implemented to keep all
+  variables that have a persistent storage duration—including global, static
+  and thread-local variables—to guarantee that they can be directly addressed.
+  Since this inhibits the merging of the affected variables, the number of
+  individual relocations in the program will generally increase.
 
 Deprecated Compiler Flags
 -



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


[clang] [AIX] recognize vsr in inline asm for AIX (PR #68476)

2023-10-07 Thread Hubert Tong via cfe-commits


@@ -807,6 +807,7 @@ ArrayRef 
PPCTargetInfo::getGCCRegAliases() const {
 // PPC ELFABIv2 DWARF Definitoin "Table 2.26. Mappings of Common Registers".
 // vs0 ~ vs31 is mapping to 32 - 63,
 // vs32 ~ vs63 is mapping to 77 - 108.
+// And this mapping applies to all OSes which runs on powerpc.

hubert-reinterpretcast wrote:

While likely true (e.g., GCC for big-endian Linux accepts these: 
https://godbolt.org/z/sGK7znYGx), this patch does not implement things that way.

For info, GCC will recognize these clobber names even with `-mcpu=power4`.

https://github.com/llvm/llvm-project/pull/68476
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AIX] recognize vsr in inline asm for AIX (PR #68476)

2023-10-07 Thread Hubert Tong via cfe-commits


@@ -2,6 +2,10 @@
 
 // RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -target-feature +vsx \
 // RUN:   -target-cpu pwr9 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -target-feature +vsx \
+// RUN:   -target-cpu pwr9 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -target-feature +vsx \
+// RUN:   -target-cpu pwr9 -emit-llvm %s -o - | FileCheck %s
 
 // This case is to test VSX register support in the clobbers list for inline 
asm.
 void testVSX (void) {

hubert-reinterpretcast wrote:

The `%vs32` syntax is not accepted by the AIX system assembler. It seems to me 
that, as a front-end patch, this is not responsible for the recognition of the 
`%vs32` syntax in the assembly string, so perhaps (to have a more portable C 
test source) we should use plain `32` instead?

[aside: The IBM XL compilers accepted (without the percent sign and without 
usage checking; probably not in a documented manner) things like `r0`, etc. as 
alternatives to literal `0`, etc. in the assembly string.]

https://github.com/llvm/llvm-project/pull/68476
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AIX] recognize vsr in inline asm for AIX (PR #68476)

2023-10-07 Thread Hubert Tong via cfe-commits

https://github.com/hubert-reinterpretcast edited 
https://github.com/llvm/llvm-project/pull/68476
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AIX] recognize vsr in inline asm for AIX (PR #68476)

2023-10-09 Thread Hubert Tong via cfe-commits


@@ -807,7 +807,7 @@ ArrayRef 
PPCTargetInfo::getGCCRegAliases() const {
 // PPC ELFABIv2 DWARF Definitoin "Table 2.26. Mappings of Common Registers".
 // vs0 ~ vs31 is mapping to 32 - 63,
 // vs32 ~ vs63 is mapping to 77 - 108.

hubert-reinterpretcast wrote:

I am not sure it helps to appeal to the ELFABIv2 DWARF definition if we are no 
longer restraining this data to be used only under ELFABIv2. Instead, the usage 
here can be explained as the index numbers for the related FPRs and VRs in 
`GCCRegNames` above.

https://github.com/llvm/llvm-project/pull/68476
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AIX] recognize vsr in inline asm for AIX (PR #68476)

2023-10-10 Thread Hubert Tong via cfe-commits


@@ -807,7 +807,7 @@ ArrayRef 
PPCTargetInfo::getGCCRegAliases() const {
 // PPC ELFABIv2 DWARF Definitoin "Table 2.26. Mappings of Common Registers".
 // vs0 ~ vs31 is mapping to 32 - 63,
 // vs32 ~ vs63 is mapping to 77 - 108.

hubert-reinterpretcast wrote:

> To me, the DWARF number should be architecture specific, i.e., although the 
> ABIs are different, all these ABIs on same architecture should use same DWARF 
> register mapping, because the hardware registers are bound to architecture?

While that makes sense, I am not seeing elsewhere in the code comments that the 
DWARF numbers are being used. The code _does_ support (in 
`getNormalizedGCCRegisterName`) that these numbers are used to index into the 
`GCCRegNames` array.

https://github.com/llvm/llvm-project/pull/68476
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AIX] recognize vsr in inline asm for AIX (PR #68476)

2023-10-10 Thread Hubert Tong via cfe-commits


@@ -828,10 +829,7 @@ const TargetInfo::AddlRegName GCCAddlRegNames[] = {
 };
 
 ArrayRef PPCTargetInfo::getGCCAddlRegNames() const {
-  if (ABI == "elfv2")
-return llvm::ArrayRef(GCCAddlRegNames);
-  else
-return TargetInfo::getGCCAddlRegNames();
+  return llvm::ArrayRef(GCCAddlRegNames);

hubert-reinterpretcast wrote:

@stefanp-ibm, GCC does accept these register names for ELFv1: 
https://github.com/llvm/llvm-project/pull/68476#discussion_r1349529109

For the compiler, I think the main responsibility would be to understand that 
these registers may overlay non-volatile FP and VMX registers.

https://github.com/llvm/llvm-project/pull/68476
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AIX] recognize vsr in inline asm for AIX (PR #68476)

2023-10-10 Thread Hubert Tong via cfe-commits


@@ -807,7 +807,7 @@ ArrayRef 
PPCTargetInfo::getGCCRegAliases() const {
 // PPC ELFABIv2 DWARF Definitoin "Table 2.26. Mappings of Common Registers".
 // vs0 ~ vs31 is mapping to 32 - 63,
 // vs32 ~ vs63 is mapping to 77 - 108.

hubert-reinterpretcast wrote:

> I prefer to solve this in another patch with solution: for targets that have 
> no canonical name for physically overlapping registers, `ReturnCanonical` 
> should always be false.
> 
> What do you think?

I think the usage of `ReturnCanonical` is at least partially intended (and 
applies to the situation with vs0 -> f0). In particular, it is intended to 
diagnose (as GCC does):
```
void f(void) {
  register float f __asm__("fr1");
  __asm__ __volatile__ (
"fmul %0,%0,%0"
:
: "f"(f)
: "vs1"
  );
}
```

That diagnostic does not seem to operate for Clang (at least for PPC) even with 
a simpler case where the clobber is `fr1` though.

I think we can leave that for later. For now, with the current patch, I think a 
comment to say that these numbers are used for indexing into the `GCCRegNames` 
array would be correct. If you believe that is a problem, then an additional 
FIXME comment can be added.

https://github.com/llvm/llvm-project/pull/68476
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AIX] recognize vsr in inline asm for AIX (PR #68476)

2023-10-11 Thread Hubert Tong via cfe-commits

https://github.com/hubert-reinterpretcast approved this pull request.

LGTM, but I am not sure if @stefanp-ibm continues to be concerned about 
enabling this for ABIs that have not been updated to specify a treatment of the 
VSX registers.

https://github.com/llvm/llvm-project/pull/68476
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AIX] recognize vsr in inline asm for AIX (PR #68476)

2023-10-11 Thread Hubert Tong via cfe-commits

hubert-reinterpretcast wrote:

The code formatting check failure seems to be a infrastructure problem: 
https://discourse.llvm.org/t/clang-format-github-action-cannot-find-merge-base/73894

https://github.com/llvm/llvm-project/pull/68476
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [PowerPC] Support local-dynamic TLS relocation on AIX (PR #66316)

2023-10-13 Thread Hubert Tong via cfe-commits

https://github.com/hubert-reinterpretcast edited 
https://github.com/llvm/llvm-project/pull/66316
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [PowerPC] Support local-dynamic TLS relocation on AIX (PR #66316)

2023-10-13 Thread Hubert Tong via cfe-commits


@@ -660,14 +671,16 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
  "GETtls[ld]ADDR[32] must read GPR3");
 
   if (Subtarget->isAIXABI()) {
-// On AIX, the variable offset should already be in R4 and the region 
handle
-// should already be in R3.
-// For TLSGD, which currently is the only supported access model, we only
-// need to generate an absolute branch to .__tls_get_addr.
+// For TLSGD, the variable offset should already be in R4 and the region
+// handle should already be in R3. We generate an absolute branch to
+// .__tls_get_addr. For TLSLD, the module handle should already be in R3.
+// We generate an absolute branch to .__tls_get_mod.
 Register VarOffsetReg = Subtarget->isPPC64() ? PPC::X4 : PPC::R4;
 (void)VarOffsetReg;
-assert(MI->getOperand(2).isReg() &&
-   MI->getOperand(2).getReg() == VarOffsetReg &&
+assert((MI->getOpcode() == PPC::GETtlsMOD32AIX ||
+MI->getOpcode() == PPC::GETtlsMOD64AIX ||
+(MI->getOperand(2).isReg() &&
+ MI->getOperand(2).getReg() == VarOffsetReg)) &&
"GETtls[ld]ADDR[32] must read GPR4");
 EmitAIXTlsCallHelper(MI);

hubert-reinterpretcast wrote:

Thanks @orcguru. I misread the assembly 🤦‍♂️ (the extra instruction is not an 
`lfd`).

https://github.com/llvm/llvm-project/pull/66316
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [PowerPC] Support local-dynamic TLS relocation on AIX (PR #66316)

2023-10-13 Thread Hubert Tong via cfe-commits

https://github.com/hubert-reinterpretcast edited 
https://github.com/llvm/llvm-project/pull/66316
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] bb6ab91 - Add option -fkeep-persistent-storage-variables to emit all variables that have a persistent storage duration

2023-07-15 Thread Hubert Tong via cfe-commits

Author: Zheng Qian
Date: 2023-07-15T16:13:48-04:00
New Revision: bb6ab91b1dcd2fadfddffcd020439978af184862

URL: 
https://github.com/llvm/llvm-project/commit/bb6ab91b1dcd2fadfddffcd020439978af184862
DIFF: 
https://github.com/llvm/llvm-project/commit/bb6ab91b1dcd2fadfddffcd020439978af184862.diff

LOG: Add option -fkeep-persistent-storage-variables to emit all variables that 
have a persistent storage duration

This patch adds a new option -fkeep-persistent-storage-variables to emit
all variables that have a persistent storage duration, including global,
static and thread-local variables. This could be useful in cases where
the presence of all these variables as symbols in the object file are
required, so that they can be directly addressed.

Reviewed By: hubert.reinterpretcast

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

Added: 
clang/test/CodeGen/keep-persistent-storage-variables.cpp
clang/test/Driver/fkeep-persistent-storage-variables.c

Modified: 
clang/include/clang/Basic/CodeGenOptions.def
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CGDecl.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/Driver/ToolChains/Clang.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/CodeGenOptions.def 
b/clang/include/clang/Basic/CodeGenOptions.def
index a03447ca2931e2..f9903b18603b58 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -477,6 +477,10 @@ CODEGENOPT(Addrsig, 1, 0)
 /// Whether to emit unused static constants.
 CODEGENOPT(KeepStaticConsts, 1, 0)
 
+/// Whether to emit all variables that have a persistent storage duration,
+/// including global, static and thread local variables.
+CODEGENOPT(KeepPersistentStorageVariables, 1, 0)
+
 /// Whether to follow the AAPCS enforcing at least one read before storing to 
a volatile bitfield
 CODEGENOPT(ForceAAPCSBitfieldLoad, 1, 0)
 

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 8d061e0ca191ea..d4e3e168b4cd01 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1757,6 +1757,10 @@ defm keep_static_consts : 
BoolFOption<"keep-static-consts",
   CodeGenOpts<"KeepStaticConsts">, DefaultFalse,
   PosFlag, NegFlag,
   BothFlags<[NoXarchOption], " static const variables even if unused">>;
+defm keep_persistent_storage_variables : 
BoolFOption<"keep-persistent-storage-variables",
+  CodeGenOpts<"KeepPersistentStorageVariables">, DefaultFalse,
+  PosFlag, NegFlag,
+  BothFlags<[NoXarchOption], " keeping all variables that have a persistent 
storage duration, including global, static and thread-local variables, to 
guarantee that they can be directly addressed">>;
 defm fixed_point : BoolFOption<"fixed-point",
   LangOpts<"FixedPoint">, DefaultFalse,
   PosFlag, NegFlag,

diff  --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index f0953eed6acde9..b0d6eb05acc22e 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -470,6 +470,9 @@ void CodeGenFunction::EmitStaticVarDecl(const VarDecl &D,
   else if (D.hasAttr())
 CGM.addUsedOrCompilerUsedGlobal(var);
 
+  if (CGM.getCodeGenOpts().KeepPersistentStorageVariables)
+CGM.addUsedOrCompilerUsedGlobal(var);
+
   // We may have to cast the constant because of the initializer
   // mismatch above.
   //

diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index d8a45e4dcb3064..1a9cfc21ba71db 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -2426,12 +2426,14 @@ void CodeGenModule::SetCommonAttributes(GlobalDecl GD, 
llvm::GlobalValue *GV) {
   if (D && D->hasAttr())
 addUsedOrCompilerUsedGlobal(GV);
 
-  if (CodeGenOpts.KeepStaticConsts && D && isa(D)) {
-const auto *VD = cast(D);
-if (VD->getType().isConstQualified() &&
-VD->getStorageDuration() == SD_Static)
-  addUsedOrCompilerUsedGlobal(GV);
-  }
+  if (const auto *VD = dyn_cast_if_present(D);
+  VD &&
+  ((CodeGenOpts.KeepPersistentStorageVariables &&
+(VD->getStorageDuration() == SD_Static ||
+ VD->getStorageDuration() == SD_Thread)) ||
+   (CodeGenOpts.KeepStaticConsts && VD->getStorageDuration() == SD_Static 
&&
+VD->getType().isConstQualified(
+addUsedOrCompilerUsedGlobal(GV);
 }
 
 bool CodeGenModule::GetCPUAndFeaturesAttributes(GlobalDecl GD,
@@ -3312,12 +3314,14 @@ bool CodeGenModule::MustBeEmitted(const ValueDecl 
*Global) {
   if (LangOpts.EmitAllDecls)
 return true;
 
-  if (CodeGenOpts.KeepStaticConsts) {
-const auto *VD = dyn_cast(Global);
-if (VD && VD->getType().isConstQualified() &&
-VD->getStorageDuration() == SD_Static)
-  return true;
-  }
+  const auto *VD = dyn_cast(Global);
+  if (VD &&
+  ((CodeGenOpts.KeepPersistentStorageVariables &&
+  

Re: [clang] 499b2a8 - PR45294: Fix handling of assumed template names looked up in the lexical

2020-03-30 Thread Hubert Tong via cfe-commits
I have not found which of the few commits on Friday having to do with
template-ids is responsible, but this now produces a crash (trace is below):
struct A;
struct B : A {};

Richard, would you take a look?

Thanks,


Hubert Tong

:2:12: error: unknown template name 'A'
struct B : A {};
   ^
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.  Program arguments: /build/bin/clang++ -cc1 -xc++ -
1.  :2:19: current parser token '{'
2.  :2:1: parsing struct/union/class body 'B'
 #0 0x3fffb2016418 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/build/bin/../lib/libLLVMSupport.so.11git+0x206418)
 #1 0x3fffb2016540 PrintStackTraceSignalHandler(void*)
(/build/bin/../lib/libLLVMSupport.so.11git+0x206540)
 #2 0x3fffb2013b38 llvm::sys::RunSignalHandlers()
(/build/bin/../lib/libLLVMSupport.so.11git+0x203b38)
 #3 0x3fffb2013d2c SignalHandler(int)
(/build/bin/../lib/libLLVMSupport.so.11git+0x203d2c)
 #4 0x3fffb4570478  0x478 clang::Sema::ActOnBaseSpecifier(clang::Decl*,
clang::SourceRange, clang::ParsedAttributes&, bool, clang::AccessSpecifier,
clang::OpaquePtr, clang::SourceLocation,
clang::SourceLocation)
 #5 0x3fffb4570478
 #6 0x3fffb4570478 clang::Parser::ParseBaseSpecifier(clang::Decl*)
(+0x478)
 #7 0x001c0017
 #8 0x3fffad949354 clang::Parser::ParseBaseClause(clang::Decl*)
(/build/bin/../lib/../lib/libclangSema.so.11git+0x469354)
 #9 0x3fffae1b3368
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned
int, clang::Decl*) (/build/bin/../lib/../lib/libclangParse.so.11git+0x73368)
#10 0x3fffae1b3668
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/build/bin/../lib/../lib/libclangParse.so.11git+0x73668)
#11 0x3fffae1b884c
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/build/bin/../lib/../lib/libclangParse.so.11git+0x7884c)
#12 0x3fffae1ba2ac
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/build/bin/../lib/../lib/libclangParse.so.11git+0x7a2ac)
#13 0x3fffae19b4f0
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.221)
(/build/bin/../lib/../lib/libclangParse.so.11git+0x5b4f0)
#14 0x3fffae248894
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/build/bin/../lib/../lib/libclangParse.so.11git+0x108894)
#15 0x3fffae249174
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&,
bool) (/build/bin/../lib/../lib/libclangParse.so.11git+0x109174)
#16 0x3fffae24d880 clang::ParseAST(clang::Sema&, bool, bool)
(/build/bin/../lib/../lib/libclangParse.so.11git+0x10d880)
#17 0x3fffae24f00c clang::ASTFrontendAction::ExecuteAction()
(/build/bin/../lib/../lib/libclangParse.so.11git+0x10f00c)
#18 0x3fffae1743a8 clang::FrontendAction::Execute()
(/build/bin/../lib/../lib/libclangParse.so.11git+0x343a8)
#19 0x3fffb07bc5c0
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/build/bin/../lib/libclangFrontend.so.11git+0x11c5c0)
#20 0x3fffb07c100c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/build/bin/../lib/libclangFrontend.so.11git+0x12100c)
#21 0x3fffb076d900 cc1_main(llvm::ArrayRef, char const*,
void*) (/build/bin/../lib/libclangFrontend.so.11git+0xcd900)
#22 0x3fffb06749dc ExecuteCC1Tool(llvm::SmallVectorImpl&)
(/build/bin/../lib/libclangFrontendTool.so.11git+0x49dc)
#23 0x1001635c main (/build/bin/clang+++0x1001635c)
#24 0x1000f6b8 generic_start_main.isra.0
(/build/bin/clang+++0x1000f6b8)
#25 0x1000cdcc __libc_start_main (/build/bin/clang+++0x1000cdcc)
/build/bin/../lib/libLLVMSupport.so.11git(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x38)[0x3fffb2016418]
/build/bin/../lib/libLLVMSupport.so.11git(+0x206540)[0x3fffb2016540]
/build/bin/../lib/libLLVMSupport.so.11git(_ZN4llvm3sys17RunSignalHandlersEv+0x78)[0x3fffb2013b38]
/build/bin/../lib/libLLVMSupport.so.11git(+0x203d2c)[0x3fffb2013d2c]
[0x3fffb4570478]
[0x1c0017]
/build/bin/../lib/../lib/libclangSema.so.11git(_ZN5clang4Sema18ActOnBaseSpecifierEPNS_4DeclENS_11SourceRangeERNS_16ParsedAttributesEbNS_15AccessSpecifierENS_9OpaquePtrINS_8QualTypeEEENS_14SourceLocationESA_+0x234)[0x3fffad949354]
/build/bin/../lib/../lib/libclangParse.so.11git(_ZN5clang6Parser18ParseBaseSpecifierEPNS_4DeclE+0x1b8)[0x3fffae1b3368]
/build/bin/../lib/../lib/libclangParse.so.11

Re: [clang] d052a57 - [c++2a] Allow comparison functions to be explicitly defaulted.

2020-03-07 Thread Hubert Tong via cfe-commits
Following this commit, the error recovery for invalid cases that explicitly
define (out-of-line) a member function template as deleted and attempts to
instantiate said function appears broken.

:4:35: error: deleted definition must be first declaration
template  void A::f() = delete;
  ^
:2:35: note: previous declaration is here
  template  static void f();
  ^
clang:
/src_d052a578de58cbbb638cbe2dba05242d1ff443b9/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4288:
void clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl *, bool, bool, bool): Assertion `(Pattern ||
PatternDecl->isDefaulted() || PatternDecl->hasSkippedBody()) && "unexpected
kind of function template definition"' failed.
Stack dump:
0.  Program arguments:
/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/clang -cc1 -std=c++11
-xc++ -
1.  :5:26: current parser token ';'
 #0 0x3fff7fe6a024 PrintStackTraceSignalHandler(void*)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/libLLVMSupport.so.10svn+0x1ea024)
 #1 0x3fff7fe670c8 llvm::sys::RunSignalHandlers()
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/libLLVMSupport.so.10svn+0x1e70c8)
 #2 0x3fff7fe6a49c SignalHandler(int)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/libLLVMSupport.so.10svn+0x1ea49c)
 #3 0x3fff82030478  0x478 abort
 #4 0x3fff82030478
 #5 0x3fff82030478 __assert_fail_base (+0x478)
 #6 0x3fff7e0a1f94 __assert_fail (/lib64/libc.so.6+0x41f94)
 #7 0x3fff7e0955d4
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool) (/lib64/libc.so.6+0x355d4)
 #8 0x3fff7e0956c4
clang::Sema::ActOnExplicitInstantiation(clang::Scope*,
clang::SourceLocation, clang::SourceLocation, clang::Declarator&)
(/lib64/libc.so.6+0x356c4)
 #9 0x3fff7c28d604
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangSema.so.10svn+0x8ad604)
#10 0x3fff7c15c2b0
clang::Parser::ParseDeclarationAfterDeclarator(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangSema.so.10svn+0x77c2b0)
#11 0x3fff7c4cc8f8
clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangParse.so.10svn+0x4c8f8)
#12 0x3fff7c4cdf48
clang::Parser::ParseExplicitInstantiation(clang::DeclaratorContext,
clang::SourceLocation, clang::SourceLocation, clang::SourceLocation&,
clang::ParsedAttributes&, clang::AccessSpecifier)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangParse.so.10svn+0x4df48)
#13 0x3fff7c57c1f0
clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangParse.so.10svn+0xfc1f0)
#14 0x3fff7c57a6c0
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
clang::SourceLocation*)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangParse.so.10svn+0xfa6c0)
#15 0x3fff7c57a4f8
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangParse.so.10svn+0xfa4f8)
#16 0x3fff7c4c5db0
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&,
bool)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangParse.so.10svn+0x45db0)
#17 0x3fff7c58fffc clang::ParseAST(clang::Sema&, bool, bool)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangParse.so.10svn+0x10fffc)
#18 0x3fff7c58def4 clang::ASTFrontendAction::ExecuteAction()
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangParse.so.10svn+0x10def4)
#19 0x3fff7c4b01e0 clang::FrontendAction::Execute()
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangParse.so.10svn+0x301e0)
#20 0x3fff7e93d57c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/libclangFrontend.so.10svn+0x10d57c)
#21 0x3fff7e93cbf0
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/libclangFrontend.so.10svn+0x10cbf0)
#22 0x3fff7e8d5bd4 cc1_main(llvm::ArrayRef, char const*,
void*)
(/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/libclangFrontend.s

[clang] f4076ad - [www] cxx_status: Update title to mention C++20

2020-03-09 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-03-09T14:51:11-04:00
New Revision: f4076ad6407594c0abedb4ff61f73abecce394f7

URL: 
https://github.com/llvm/llvm-project/commit/f4076ad6407594c0abedb4ff61f73abecce394f7
DIFF: 
https://github.com/llvm/llvm-project/commit/f4076ad6407594c0abedb4ff61f73abecce394f7.diff

LOG: [www] cxx_status: Update title to mention C++20

Summary:
The document covers the Clang implementation status of the "upcoming
C++20 standard". Update the title to match.

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/www/cxx_status.html

Removed: 




diff  --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index 9e8322aaf281..4f479792264c 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -2,7 +2,7 @@
 
 
   
-  Clang - C++17, C++14, C++11 and C++98 Status
+  Clang - C++20, C++17, C++14, C++11 and C++98 Status
   
   
   

[clang] dfaafba - [www] cxx_status: Update Reflection TS to Cologne draft

2020-03-09 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-03-09T14:51:11-04:00
New Revision: dfaafbab4687676f8ad616a79d3d924267831cbd

URL: 
https://github.com/llvm/llvm-project/commit/dfaafbab4687676f8ad616a79d3d924267831cbd
DIFF: 
https://github.com/llvm/llvm-project/commit/dfaafbab4687676f8ad616a79d3d924267831cbd.diff

LOG: [www] cxx_status: Update Reflection TS to Cologne draft

Summary:
As of the 2019 Cologne meeting, according to its minutes (N4826), N4818
is the draft of the Reflection TS.

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

Added: 


Modified: 
clang/www/cxx_status.html

Removed: 




diff  --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index 4f479792264c..39ada7f26a18 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -1321,7 +1321,7 @@ Technical specifications and standing 
documents
 
 
   [DRAFT TS] Reflection
-  https://wg21.link/n4746";>N4746
+  https://wg21.link/n4818";>N4818
   
   No
 



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


Re: [clang] d052a57 - [c++2a] Allow comparison functions to be explicitly defaulted.

2020-03-10 Thread Hubert Tong via cfe-commits
On Tue, Mar 10, 2020 at 7:35 PM Richard Smith  wrote:

> Should be fixed in llvmorg-11-init-5426-g4cba668ac13.
>
Thanks. We're also seeing a failure on valid code where a template class
explicitly deletes a function that is an override of an explicitly deleted
virtual function in a (non-templated) base class.

:7:16: error: non-deleted function 'f' cannot override a deleted
function
  virtual void f() = delete;
   ^
:10:8: note: in instantiation of template class 'B' requested
here
B b() { return {}; }
   ^
:2:16: note: overridden virtual function is here
  virtual void f() = delete;
   ^
1 error generated.


>
> On Sat, 7 Mar 2020 at 08:05, Hubert Tong via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Following this commit, the error recovery for invalid cases that
>> explicitly define (out-of-line) a member function template as deleted and
>> attempts to instantiate said function appears broken.
>>
>> :4:35: error: deleted definition must be first declaration
>> template  void A::f() = delete;
>>   ^
>> :2:35: note: previous declaration is here
>>   template  static void f();
>>   ^
>> clang:
>> /src_d052a578de58cbbb638cbe2dba05242d1ff443b9/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:4288:
>> void clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
>> clang::FunctionDecl *, bool, bool, bool): Assertion `(Pattern ||
>> PatternDecl->isDefaulted() || PatternDecl->hasSkippedBody()) && "unexpected
>> kind of function template definition"' failed.
>> Stack dump:
>> 0.  Program arguments:
>> /build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/clang -cc1 -std=c++11
>> -xc++ -
>> 1.  :5:26: current parser token ';'
>>  #0 0x3fff7fe6a024 PrintStackTraceSignalHandler(void*)
>> (/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/libLLVMSupport.so.10svn+0x1ea024)
>>  #1 0x3fff7fe670c8 llvm::sys::RunSignalHandlers()
>> (/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/libLLVMSupport.so.10svn+0x1e70c8)
>>  #2 0x3fff7fe6a49c SignalHandler(int)
>> (/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/libLLVMSupport.so.10svn+0x1ea49c)
>>  #3 0x3fff82030478  0x478 abort
>>  #4 0x3fff82030478
>>  #5 0x3fff82030478 __assert_fail_base (+0x478)
>>  #6 0x3fff7e0a1f94 __assert_fail (/lib64/libc.so.6+0x41f94)
>>  #7 0x3fff7e0955d4
>> clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
>> clang::FunctionDecl*, bool, bool, bool) (/lib64/libc.so.6+0x355d4)
>>  #8 0x3fff7e0956c4
>> clang::Sema::ActOnExplicitInstantiation(clang::Scope*,
>> clang::SourceLocation, clang::SourceLocation, clang::Declarator&)
>> (/lib64/libc.so.6+0x356c4)
>>  #9 0x3fff7c28d604
>> clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
>> clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
>> (/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangSema.so.10svn+0x8ad604)
>> #10 0x3fff7c15c2b0
>> clang::Parser::ParseDeclarationAfterDeclarator(clang::Declarator&,
>> clang::Parser::ParsedTemplateInfo const&)
>> (/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangSema.so.10svn+0x77c2b0)
>> #11 0x3fff7c4cc8f8
>> clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext,
>> clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
>> clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
>> (/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangParse.so.10svn+0x4c8f8)
>> #12 0x3fff7c4cdf48
>> clang::Parser::ParseExplicitInstantiation(clang::DeclaratorContext,
>> clang::SourceLocation, clang::SourceLocation, clang::SourceLocation&,
>> clang::ParsedAttributes&, clang::AccessSpecifier)
>> (/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangParse.so.10svn+0x4df48)
>> #13 0x3fff7c57c1f0
>> clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext,
>> clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
>> (/build_d052a578de58cbbb638cbe2dba05242d1ff443b9/bin/../lib/../lib/libclangParse.so.10svn+0xfc1f0)
>> #14 0x3fff7c57a6c0
>> clang::Parser::ParseDeclaration(clang::DeclaratorContext,
>> clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
>> clang::SourceLocation*)
>> (/build_d052a578de58

[clang-tools-extra] 48121a5 - [cmake] Link libclangDaemonTweaks with clangFormat

2020-03-10 Thread Hubert Tong via cfe-commits

Author: Hubert Tong
Date: 2020-03-10T21:31:10-04:00
New Revision: 48121a5743b684def33d158391c5424626de28e2

URL: 
https://github.com/llvm/llvm-project/commit/48121a5743b684def33d158391c5424626de28e2
DIFF: 
https://github.com/llvm/llvm-project/commit/48121a5743b684def33d158391c5424626de28e2.diff

LOG: [cmake] Link libclangDaemonTweaks with clangFormat

Speculative fix for buildbot failure in
http://lab.llvm.org:8011/builders/clang-ppc64le-rhel/builds/1881/steps/build%20stage%201/logs/stdio

Cause appears to be D75716.

Added: 


Modified: 
clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt 
b/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt
index 6f6ef4a2ace2..5817830b7ea3 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt
+++ b/clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt
@@ -29,6 +29,7 @@ add_clang_library(clangDaemonTweaks OBJECT
   clangAST
   clangBasic
   clangDaemon
+  clangFormat
   clangLex
   clangToolingCore
   clangToolingRefactoring



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


Re: patch via mailing list: Use getLocation() in too few/many arguments diagnostic

2020-02-07 Thread Hubert Tong via cfe-commits
I think this looks okay. I think Richard or Aaron might be able to provide
a more informed opinion.

-- HT

On Fri, Feb 7, 2020 at 10:06 AM John Marshall via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Ping. I am a newcomer to Clang so don't know who might be appropriate
> reviewers to CC, so I've CCed a couple of general people from
> clang/CODE_OWNERS.TXT who may be able to forward as appropriate.
>
> Thanks,
>
> John
>
>
> On 20 Jan 2020, at 16:09, John Marshall wrote:
> >
> > This small patch improves the diagnostics when calling a function with
> the wrong number of arguments. For example, given
> >
> >   int
> >   foo(int a, int b);
> >
> >   int bar() { return foo(1); }
> >
> > The existing compiler shows the error message and a note for "foo
> declared here" showing only the "int" line. Ideally it would show the line
> containing the word "foo" instead, which it does after this patch. Also if
> the function declaration starts with some incidental macro, a trace of
> macro expansion is shown which is likely irrelevant. See for example
> https://github.com/samtools/htslib/issues/1013 and PR#23564.
> >
> > I have not contributed to LLVM before and I am unfamiliar with the
> difference between getBeginLoc() and getLocation() and the implications of
> using each. However this patch does fix PR#23564 and perhaps this fix would
> be mostly a no-brainer for those who are familiar with the code and these
> two location functions in particular?
>
> commit e8e73a04dd4274441541cc5fdc553cc4b26c00c3
> Author: John Marshall 
> Date:   Mon Jan 20 14:58:14 2020 +
>
> Use getLocation() in too few/many arguments diagnostic
>
> Use the more accurate location when emitting the location of the
> function being called's prototype in diagnostics emitted when calling
> a function with an incorrect number of arguments.
>
> In particular, avoids showing a trace of irrelevant macro expansions
> for "MY_EXPORT static int AwesomeFunction(int, int);". Fixes PR#23564.
>
> diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
> index ffe72c98356..b9d7024f083 100644
> --- a/clang/lib/Sema/SemaExpr.cpp
> +++ b/clang/lib/Sema/SemaExpr.cpp
> @@ -5194,7 +5194,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr
> *Fn,
>
>// Emit the location of the prototype.
>if (!TC && FDecl && !FDecl->getBuiltinID() && !IsExecConfig)
> -Diag(FDecl->getBeginLoc(), diag::note_callee_decl) << FDecl;
> +Diag(FDecl->getLocation(), diag::note_callee_decl) << FDecl;
>
>return true;
>  }
> @@ -5239,7 +5239,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr
> *Fn,
>
>// Emit the location of the prototype.
>if (!TC && FDecl && !FDecl->getBuiltinID() && !IsExecConfig)
> -Diag(FDecl->getBeginLoc(), diag::note_callee_decl) << FDecl;
> +Diag(FDecl->getLocation(), diag::note_callee_decl) << FDecl;
>
>// This deletes the extra arguments.
>Call->shrinkNumArgs(NumParams);
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r306905 - Fix PR 33189: Clang assertion on template destructor declaration

2017-06-30 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Fri Jun 30 15:43:54 2017
New Revision: 306905

URL: http://llvm.org/viewvc/llvm-project?rev=306905&view=rev
Log:
Fix PR 33189: Clang assertion on template destructor declaration

Summary:
This patch aims to fix the bug reported at
https://bugs.llvm.org/show_bug.cgi?id=33189. Clang hits an assertion
when a template destructor declaration is present. This is caused by
later processing that does not expect to encounter a template when
looking at a destructor. The resolution is to treat the destructor as
being not declared when later processing is interested in the properties
of the destructor of a class.

Reviewers: rcraik, hubert.reinterpretcast, aaron.ballman, rsmith

Reviewed By: rsmith

Subscribers: rsmith, cfe-commits

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

Patch by Kuang He!

Modified:
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/test/SemaTemplate/destructor-template.cpp

Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=306905&r1=306904&r2=306905&view=diff
==
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Fri Jun 30 15:43:54 2017
@@ -1417,11 +1417,8 @@ CXXDestructorDecl *CXXRecordDecl::getDes
   Context.getCanonicalType(ClassType));
 
   DeclContext::lookup_result R = lookup(Name);
-  if (R.empty())
-return nullptr;
 
-  CXXDestructorDecl *Dtor = cast(R.front());
-  return Dtor;
+  return R.empty() ? nullptr : dyn_cast(R.front());
 }
 
 bool CXXRecordDecl::isAnyDestructorNoReturn() const {

Modified: cfe/trunk/test/SemaTemplate/destructor-template.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/destructor-template.cpp?rev=306905&r1=306904&r2=306905&view=diff
==
--- cfe/trunk/test/SemaTemplate/destructor-template.cpp (original)
+++ cfe/trunk/test/SemaTemplate/destructor-template.cpp Fri Jun 30 15:43:54 2017
@@ -86,3 +86,9 @@ namespace PR16852 {
   template decltype(S().~S()) f(); // expected-note {{candidate 
template ignored: couldn't infer template argument 'T'}}
   void g() { f(); } // expected-error {{no matching function for call to 'f'}}
 }
+
+class PR33189
+{
+  template 
+  ~PR33189() { } // expected-error{{destructor cannot be declared as a 
template}}
+};


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


r294697 - [Concepts] Class template associated constraints

2017-02-09 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Thu Feb  9 20:46:19 2017
New Revision: 294697

URL: http://llvm.org/viewvc/llvm-project?rev=294697&view=rev
Log:
[Concepts] Class template associated constraints

Summary:
This adds associated constraints as a property of class templates.
An error is produced if redeclarations are not similarly constrained.

Reviewers: rsmith, faisalv, aaron.ballman

Reviewed By: rsmith

Subscribers: cfe-commits, nwilson

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

Added:
cfe/trunk/test/CXX/concepts-ts/temp/
cfe/trunk/test/CXX/concepts-ts/temp/temp.constr/
cfe/trunk/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/

cfe/trunk/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
Modified:
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/AST/DeclTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp

Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=294697&r1=294696&r2=294697&view=diff
==
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Thu Feb  9 20:46:19 2017
@@ -344,6 +344,32 @@ public:
 // Kinds of Templates
 
//===--===//
 
+/// \brief Stores the template parameter list and associated constraints for
+/// \c TemplateDecl objects that track associated constraints.
+class ConstrainedTemplateDeclInfo {
+  friend TemplateDecl;
+
+public:
+  ConstrainedTemplateDeclInfo() : TemplateParams(), AssociatedConstraints() {}
+
+  TemplateParameterList *getTemplateParameters() const {
+return TemplateParams;
+  }
+
+  Expr *getAssociatedConstraints() const { return AssociatedConstraints; }
+
+protected:
+  void setTemplateParameters(TemplateParameterList *TParams) {
+TemplateParams = TParams;
+  }
+
+  void setAssociatedConstraints(Expr *AC) { AssociatedConstraints = AC; }
+
+  TemplateParameterList *TemplateParams;
+  Expr *AssociatedConstraints;
+};
+
+
 /// \brief The base class of all kinds of template declarations (e.g.,
 /// class, function, etc.).
 ///
@@ -352,33 +378,53 @@ public:
 class TemplateDecl : public NamedDecl {
   void anchor() override;
 protected:
-  // This is probably never used.
-  TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName 
Name)
+  // Construct a template decl with the given name and parameters.
+  // Used when there is no templated element (e.g., for tt-params).
+  TemplateDecl(ConstrainedTemplateDeclInfo *CTDI, Kind DK, DeclContext *DC,
+   SourceLocation L, DeclarationName Name,
+   TemplateParameterList *Params)
   : NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr, false),
-TemplateParams(nullptr) {}
+TemplateParams(CTDI) {
+this->setTemplateParameters(Params);
+  }
 
-  // Construct a template decl with the given name and parameters.
-  // Used when there is not templated element (tt-params).
   TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName 
Name,
TemplateParameterList *Params)
-  : NamedDecl(DK, DC, L, Name), TemplatedDecl(nullptr, false),
-TemplateParams(Params) {}
+  : TemplateDecl(nullptr, DK, DC, L, Name, Params) {}
 
   // Construct a template decl with name, parameters, and templated element.
-  TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName 
Name,
+  TemplateDecl(ConstrainedTemplateDeclInfo *CTDI, Kind DK, DeclContext *DC,
+   SourceLocation L, DeclarationName Name,
TemplateParameterList *Params, NamedDecl *Decl)
   : NamedDecl(DK, DC, L, Name), TemplatedDecl(Decl, false),
-TemplateParams(Params) {}
+TemplateParams(CTDI) {
+this->setTemplateParameters(Params);
+  }
+
+  TemplateDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName 
Name,
+   TemplateParameterList *Params, NamedDecl *Decl)
+  : TemplateDecl(nullptr, DK, DC, L, Name, Params, Decl) {}
 
 public:
   /// Get the list of template parameters
   TemplateParameterList *getTemplateParameters() const {
-return TemplateParams;
+const auto *const CTDI =
+TemplateParams.dyn_cast();
+return CTDI ? CTDI->getTemplateParameters()
+: TemplateParams.get();
   }
 
   /// Get the constraint-expression from the associated requires-clause (if 
any)
   const Expr *getRequiresClause() const {
-return TemplateParams ? TemplateParams->getRequiresClause() : nullptr;
+const TemplateParameterList *const TP = getTemplateParameters();
+return TP ? TP->getRequiresClause() : nullptr;
+  }
+
+  Expr *getAssociatedConstraints() const {
+const TemplateDecl *const C = c

[PATCH] D26882: Refactor how FunctionDecl handles constexpr:

2016-11-20 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: include/clang/AST/Decl.h:1915
+IsConstexprSpecified = IC;
+IsConstexpr = IC;
+  }

How is the `inline` property transmitted here? Why does the 
`setImplicitlyConstexpr` function need to call `setImplicitlyInline`?



Comment at: include/clang/AST/Decl.h:1919
+  /// Flag that this function as implicitly constexpr
+  /// C++11 [dcl.constexpr]p2: constexpr functions and constexpr constructors
+  /// are implicitly inline functions (7.1.2).

The quote does not seem to be pertinent here. Maybe have it a few lines down?



Comment at: include/clang/AST/Decl.h:1923
+IsConstexpr = IC;
+setImplicitlyInline();
+  }

I am quite sure this is not the right thing to do when `IC` is `false`.



Comment at: lib/Sema/SemaDecl.cpp:8085
   // C++ Concepts TS [dcl.spec.concept]p2: Every concept definition is
   // implicity defined to be a constexpr declaration (implicitly inline)
+  NewFD->setImplicitlyConstexpr(true);

The parenthetical here seems to be no longer needed.



Comment at: lib/Sema/SemaDecl.cpp:9107
   << FixItHint::CreateRemoval(DS.getConstexprSpecLoc());
-FD->setConstexpr(false);
+FD->setImplicitlyConstexpr(false);
   }

This reads wrong to me. I get that the idea is that the function should not be 
semantically considered `constexpr`, but the choice of `setImplicitlyConstexpr` 
seems odd.



Comment at: test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p2.cpp:21
+static_assert(FCSizeOfU4(), "");
+static_assert(FCSizeOfU4(), "size of argument not equal to expected 
(4)"); // expected-error {{static_assert failed "size of argument not equal to 
expected (4)"}}
+

This does not strike me as being very portable (I may be mistaken about how 
`clang -cc1` works though). I think it would be much safer to use `char [8]` 
here (and in general for the size matching).



https://reviews.llvm.org/D26882



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


r303472 - Fix valid-for-expr ellipses eaten as invalid decl

2017-05-19 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Fri May 19 19:21:55 2017
New Revision: 303472

URL: http://llvm.org/viewvc/llvm-project?rev=303472&view=rev
Log:
Fix valid-for-expr ellipses eaten as invalid decl

Summary:
The trial parse for declarative syntax accepts an invalid pack
declaration syntax, which is ambiguous with valid pack expansions of
expressions. This commit removes the invalid pack declaration syntax to
avoid mistaking valid pack expansions as invalid declarator components.

Additionally, the trial parse of a //template-argument-list// then needs
to handle the optional ellipsis that is part of that grammar, as opposed
to relying on the trial parse for declarators accepting stray ellipses.

Reviewers: rsmith, rcraik, aaron.ballman

Reviewed By: rsmith

Subscribers: cfe-commits

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

Modified:
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/test/Parser/cxx0x-ambig.cpp

Modified: cfe/trunk/lib/Parse/ParseTentative.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=303472&r1=303471&r2=303472&view=diff
==
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Fri May 19 19:21:55 2017
@@ -481,10 +481,10 @@ Parser::isCXXConditionDeclarationOrInitS
   /// the corresponding ')'. If the context is
   /// TypeIdAsTemplateArgument, we've already parsed the '<' or ','
   /// before this template argument, and will cease lookahead when we
-  /// hit a '>', '>>' (in C++0x), or ','. Returns true for a type-id
-  /// and false for an expression.  If during the disambiguation
-  /// process a parsing error is encountered, the function returns
-  /// true to let the declaration parsing code handle it.
+  /// hit a '>', '>>' (in C++0x), or ','; or, in C++0x, an ellipsis immediately
+  /// preceding such. Returns true for a type-id and false for an expression.
+  /// If during the disambiguation process a parsing error is encountered,
+  /// the function returns true to let the declaration parsing code handle it.
   ///
   /// type-id:
   ///   type-specifier-seq abstract-declarator[opt]
@@ -533,10 +533,15 @@ bool Parser::isCXXTypeId(TentativeCXXTyp
 
 // We are supposed to be inside a template argument, so if after
 // the abstract declarator we encounter a '>', '>>' (in C++0x), or
-// ',', this is a type-id. Otherwise, it's an expression.
+// ','; or, in C++0x, an ellipsis immediately preceding such, this
+// is a type-id. Otherwise, it's an expression.
 } else if (Context == TypeIdAsTemplateArgument &&
(Tok.isOneOf(tok::greater, tok::comma) ||
-(getLangOpts().CPlusPlus11 && Tok.is(tok::greatergreater {
+(getLangOpts().CPlusPlus11 &&
+ (Tok.is(tok::greatergreater) ||
+  (Tok.is(tok::ellipsis) &&
+   NextToken().isOneOf(tok::greater, tok::greatergreater,
+   tok::comma)) {
   TPR = TPResult::True;
   isAmbiguous = true;
 
@@ -829,14 +834,14 @@ Parser::TPResult Parser::TryParseOperato
 /// abstract-declarator:
 ///   ptr-operator abstract-declarator[opt]
 ///   direct-abstract-declarator
-///   ...
 ///
 /// direct-abstract-declarator:
 ///   direct-abstract-declarator[opt]
-///   '(' parameter-declaration-clause ')' cv-qualifier-seq[opt]
+/// '(' parameter-declaration-clause ')' cv-qualifier-seq[opt]
 /// exception-specification[opt]
 ///   direct-abstract-declarator[opt] '[' constant-expression[opt] ']'
 ///   '(' abstract-declarator ')'
+/// [C++0x]   ...
 ///
 /// ptr-operator:
 ///   '*' cv-qualifier-seq[opt]
@@ -928,10 +933,6 @@ Parser::TPResult Parser::TryParseDeclara
   while (1) {
 TPResult TPR(TPResult::Ambiguous);
 
-// abstract-declarator: ...
-if (Tok.is(tok::ellipsis))
-  ConsumeToken();
-
 if (Tok.is(tok::l_paren)) {
   // Check whether we have a function declarator or a possible ctor-style
   // initializer that follows the declarator. Note that ctor-style

Modified: cfe/trunk/test/Parser/cxx0x-ambig.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-ambig.cpp?rev=303472&r1=303471&r2=303472&view=diff
==
--- cfe/trunk/test/Parser/cxx0x-ambig.cpp (original)
+++ cfe/trunk/test/Parser/cxx0x-ambig.cpp Fri May 19 19:21:55 2017
@@ -132,6 +132,32 @@ namespace ellipsis {
 void l(int(*...)(T)); // expected-warning {{ISO C++11 requires a 
parenthesized pack declaration to have a name}}
 void l(int(S::*...)(T)); // expected-warning {{ISO C++11 requires a 
parenthesized pack declaration to have a name}}
   };
+
+  struct CtorSink {
+template  constexpr CtorSink(T &&...t) { }
+co

[PATCH] D25674: [Concepts] Class template associated constraints

2016-10-22 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: 
test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp:12
+
+} // end namespace nodiag
+

I should probably add some template-dependent cases.


https://reviews.llvm.org/D25674



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


[PATCH] D25674: [Concepts] Class template associated constraints

2016-10-24 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added a comment.

Friendly ping...


https://reviews.llvm.org/D25674



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


Re: [PATCH] D10018: C11 _Bool bitfield diagnostic

2015-09-09 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added inline comments.


Comment at: lib/Sema/SemaDecl.cpp:12613
@@ +12612,3 @@
+FieldTy->isBooleanType() &&
+Value.getZExtValue() > 1) {
+  if (FieldName)

rsmith wrote:
> This will assert if the specified bitfield width doesn't fit in 64 bits. You 
> can use `Value.ugt(1)` instead.
> 
> The check above for `TypeSize` has the same bug. This testcase causes an 
> assertion to fire:
> 
>   struct X { int n : 0x * (__int128)0x * 0x; };
I think this is PR 23505.


http://reviews.llvm.org/D10018



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


Re: [PATCH] D10018: C11 _Bool bitfield diagnostic

2015-09-09 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added inline comments.


Comment at: lib/Sema/SemaDecl.cpp:12586
@@ -12585,3 +12585,3 @@
   if (!FieldTy->isDependentType()) {
 uint64_t TypeSize = Context.getTypeSize(FieldTy);
 if (Value.getZExtValue() > TypeSize) {

rsmith wrote:
> I think the right way to fix this is to call `getIntWidth` here instead of 
> `getTypeSize`, and finesse our error message to clarify that we're talking 
> about the width of the type (the number of value bits) rather than the size 
> of the type (the number of storage bits).
The implementation of `getIntWidth` currently makes this consideration moot at 
this time, but should this extend to C89 (aside from the `_Bool` extension)?


http://reviews.llvm.org/D10018



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


  1   2   3   4   5   >