r372492 - NFC: Change ObjCQualified*TypesAreCompatible to take

2019-09-21 Thread James Y Knight via cfe-commits
Author: jyknight
Date: Sat Sep 21 15:31:28 2019
New Revision: 372492

URL: http://llvm.org/viewvc/llvm-project?rev=372492=rev
Log:
NFC: Change ObjCQualified*TypesAreCompatible to take
ObjCObjectPointerType arguments.

All callers already had one, just creating a QualType to pass, after
which the function cast it right back.

Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=372492=372491=372492=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Sat Sep 21 15:31:28 2019
@@ -2583,10 +2583,12 @@ public:
 return T == getObjCSelType();
   }
 
-  bool ObjCQualifiedIdTypesAreCompatible(QualType LHS, QualType RHS,
+  bool ObjCQualifiedIdTypesAreCompatible(const ObjCObjectPointerType *LHS,
+ const ObjCObjectPointerType *RHS,
  bool ForCompare);
 
-  bool ObjCQualifiedClassTypesAreCompatible(QualType LHS, QualType RHS);
+  bool ObjCQualifiedClassTypesAreCompatible(const ObjCObjectPointerType *LHS,
+const ObjCObjectPointerType *RHS);
 
   // Check the safety of assignment from LHS to RHS
   bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT,

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=372492=372491=372492=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sat Sep 21 15:31:28 2019
@@ -7998,15 +7998,11 @@ ASTContext::ProtocolCompatibleWithProtoc
 
 /// ObjCQualifiedClassTypesAreCompatible - compare  Class and
 /// Class.
-bool ASTContext::ObjCQualifiedClassTypesAreCompatible(QualType lhs,
-  QualType rhs) {
-  const auto *lhsQID = lhs->getAs();
-  const auto *rhsOPT = rhs->getAs();
-  assert((lhsQID && rhsOPT) && "ObjCQualifiedClassTypesAreCompatible");
-
-  for (auto *lhsProto : lhsQID->quals()) {
+bool ASTContext::ObjCQualifiedClassTypesAreCompatible(
+const ObjCObjectPointerType *lhs, const ObjCObjectPointerType *rhs) {
+  for (auto *lhsProto : lhs->quals()) {
 bool match = false;
-for (auto *rhsProto : rhsOPT->quals()) {
+for (auto *rhsProto : rhs->quals()) {
   if (ProtocolCompatibleWithProtocol(lhsProto, rhsProto)) {
 match = true;
 break;
@@ -8020,8 +8016,9 @@ bool ASTContext::ObjCQualifiedClassTypes
 
 /// ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an
 /// ObjCQualifiedIDType.
-bool ASTContext::ObjCQualifiedIdTypesAreCompatible(QualType lhs, QualType rhs,
-   bool compare) {
+bool ASTContext::ObjCQualifiedIdTypesAreCompatible(
+const ObjCObjectPointerType *lhs, const ObjCObjectPointerType *rhs,
+bool compare) {
   // Allow id and an 'id' or void* type in all cases.
   if (lhs->isVoidPointerType() ||
   lhs->isObjCIdType() || lhs->isObjCClassType())
@@ -8030,16 +8027,12 @@ bool ASTContext::ObjCQualifiedIdTypesAre
rhs->isObjCIdType() || rhs->isObjCClassType())
 return true;
 
-  if (const ObjCObjectPointerType *lhsQID = lhs->getAsObjCQualifiedIdType()) {
-const auto *rhsOPT = rhs->getAs();
-
-if (!rhsOPT) return false;
-
-if (rhsOPT->qual_empty()) {
+  if (lhs->isObjCQualifiedIdType()) {
+if (rhs->qual_empty()) {
   // If the RHS is a unqualified interface pointer "NSString*",
   // make sure we check the class hierarchy.
-  if (ObjCInterfaceDecl *rhsID = rhsOPT->getInterfaceDecl()) {
-for (auto *I : lhsQID->quals()) {
+  if (ObjCInterfaceDecl *rhsID = rhs->getInterfaceDecl()) {
+for (auto *I : lhs->quals()) {
   // when comparing an id on lhs with a static type on rhs,
   // see if static class implements all of id's protocols, directly or
   // through its super class and categories.
@@ -8051,13 +8044,13 @@ bool ASTContext::ObjCQualifiedIdTypesAre
   return true;
 }
 // Both the right and left sides have qualifiers.
-for (auto *lhsProto : lhsQID->quals()) {
+for (auto *lhsProto : lhs->quals()) {
   bool match = false;
 
   // when comparing an id on lhs with a static type on rhs,
   // see if static class implements all of id's protocols, directly or
   // through its super class and categories.
-  for (auto *rhsProto : rhsOPT->quals()) {
+  for (auto *rhsProto : rhs->quals()) {
 if (ProtocolCompatibleWithProtocol(lhsProto, rhsProto) ||
 (compare && 

[PATCH] D61446: Generalize the pass registration mechanism used by Polly to any third-party tool

2019-09-21 Thread Andrzej Warzynski via Phabricator via cfe-commits
andwar added inline comments.



Comment at: llvm/examples/Bye/Bye.cpp:53
+/* New PM Registration */
+
+llvm::PassPluginLibraryInfo getByePluginInfo() {

[nit] Empty line



Comment at: llvm/examples/Bye/CMakeLists.txt:9
+else()
+  target_link_libraries(Bye
+PUBLIC

Are all these libraries required? I tried building on Darwin and for me 
`LLVMSupport`, `LLVMCore` and `LLVMipo` were sufficient.



Comment at: llvm/examples/Bye/CMakeLists.txt:28
+endif()
+

[nit] Empty line


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61446/new/

https://reviews.llvm.org/D61446



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


[PATCH] D67112: [Sema] Add implicit cast for conversion of function references

2019-09-21 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added a reviewer: riccibruno.
aaronpuchert added a comment.

Perhaps I should mention that this fixes an assertion failure 
.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67112/new/

https://reviews.llvm.org/D67112



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


[PATCH] D55326: [Driver] Fix incorrect GNU triplet for PowerPC on SUSE Linux

2019-09-21 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert updated this revision to Diff 221197.
aaronpuchert added a comment.

Pass correct Clang triple as argument to --target.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55326/new/

https://reviews.llvm.org/D55326

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/test/Driver/Inputs/opensuse_tumbleweed_ppc_tree/usr/lib/crt1.o
  clang/test/Driver/Inputs/opensuse_tumbleweed_ppc_tree/usr/lib/crti.o
  clang/test/Driver/Inputs/opensuse_tumbleweed_ppc_tree/usr/lib/crtn.o
  
clang/test/Driver/Inputs/opensuse_tumbleweed_ppc_tree/usr/lib/gcc/powerpc64-suse-linux/9/crtbegin.o
  
clang/test/Driver/Inputs/opensuse_tumbleweed_ppc_tree/usr/lib/gcc/powerpc64-suse-linux/9/crtend.o
  clang/test/Driver/linux-ld.c


Index: clang/test/Driver/linux-ld.c
===
--- clang/test/Driver/linux-ld.c
+++ clang/test/Driver/linux-ld.c
@@ -879,6 +879,21 @@
 // CHECK-OPENSUSE-TW-RISCV64: 
"{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9{{/|}}crtend.o"
 // CHECK-OPENSUSE-TW-RISCV64: 
"{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9/../../../../lib64{{/|}}crtn.o"
 //
+// Check openSUSE Tumbleweed on ppc
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=powerpc-unknown-linux-gnu -rtlib=platform \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/opensuse_tumbleweed_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-TW-PPC %s
+// CHECK-OPENSUSE-TW-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-OPENSUSE-TW-PPC: 
"{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9/../../..{{/|}}crt1.o"
+// CHECK-OPENSUSE-TW-PPC: 
"{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9/../../..{{/|}}crti.o"
+// CHECK-OPENSUSE-TW-PPC: 
"{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9{{/|}}crtbegin.o"
+// CHECK-OPENSUSE-TW-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/9"
+// CHECK-OPENSUSE-TW-PPC: 
"-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/9/../../.."
+// CHECK-OPENSUSE-TW-PPC: 
"{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9{{/|}}crtend.o"
+// CHECK-OPENSUSE-TW-PPC: 
"{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9/../../..{{/|}}crtn.o"
+//
 // Check dynamic-linker for different archs
 // RUN: %clang %s -### -o %t.o 2>&1 \
 // RUN: --target=arm-linux-gnueabi \
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2004,7 +2004,9 @@
   static const char *const PPCLibDirs[] = {"/lib32", "/lib"};
   static const char *const PPCTriples[] = {
   "powerpc-linux-gnu", "powerpc-unknown-linux-gnu", "powerpc-linux-gnuspe",
-  "powerpc-suse-linux", "powerpc-montavista-linuxspe"};
+  // On 32-bit PowerPC systems running SUSE Linux, gcc is configured as a
+  // 64-bit compiler which defaults to "-m32", hence 
"powerpc64-suse-linux".
+  "powerpc64-suse-linux", "powerpc-montavista-linuxspe"};
   static const char *const PPC64LibDirs[] = {"/lib64", "/lib"};
   static const char *const PPC64Triples[] = {
   "powerpc64-linux-gnu", "powerpc64-unknown-linux-gnu",


Index: clang/test/Driver/linux-ld.c
===
--- clang/test/Driver/linux-ld.c
+++ clang/test/Driver/linux-ld.c
@@ -879,6 +879,21 @@
 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9{{/|}}crtend.o"
 // CHECK-OPENSUSE-TW-RISCV64: "{{.*}}/usr/lib64/gcc/riscv64-suse-linux/9/../../../../lib64{{/|}}crtn.o"
 //
+// Check openSUSE Tumbleweed on ppc
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=powerpc-unknown-linux-gnu -rtlib=platform \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/opensuse_tumbleweed_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-OPENSUSE-TW-PPC %s
+// CHECK-OPENSUSE-TW-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9/../../..{{/|}}crt1.o"
+// CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9/../../..{{/|}}crti.o"
+// CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9{{/|}}crtbegin.o"
+// CHECK-OPENSUSE-TW-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/9"
+// CHECK-OPENSUSE-TW-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/9/../../.."
+// CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9{{/|}}crtend.o"
+// CHECK-OPENSUSE-TW-PPC: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/9/../../..{{/|}}crtn.o"
+//
 // Check dynamic-linker for different archs
 // RUN: %clang %s -### -o %t.o 2>&1 \
 // RUN: --target=arm-linux-gnueabi \
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2004,7 +2004,9 @@
   static const 

[PATCH] D63932: [GlobalDCE] Dead Virtual Function Elimination

2019-09-21 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

> we represent the "post-link" flag in the IR (e.g. as a module flag) in order 
> to keep the IR self-contained.

This makes the IR self-contained, which is good, but it also make the 
interpretation of the IR modal, which isn't great. It means that suddenly the 
rules of interpretation of what is valid to do or not changes according to this 
module flag.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63932/new/

https://reviews.llvm.org/D63932



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


[PATCH] D67627: Clang-format: Add Whitesmiths indentation style

2019-09-21 Thread Tim Wojtulewicz via Phabricator via cfe-commits
timwoj added a comment.

I don't have push access for `master`. Can someone merge this?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67627/new/

https://reviews.llvm.org/D67627



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


[PATCH] D67883: [CLANG][BPF] permit any argument type for __builtin_preserve_access_index()

2019-09-21 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song created this revision.
yonghong-song added a reviewer: ast.
Herald added subscribers: cfe-commits, arphaman.
Herald added a project: clang.

Commit c15aa241f821 
 
("[CLANG][BPF] change __builtin_preserve_access_index()
signature") changed the builtin function signature to

  PointerT __builtin_preserve_access_index(PointerT ptr)

with a pointer type as the argument/return type, where argument and
return types must be the same.

There is really no reason for this constraint. The builtin just
presented a code region so that IR builtins

  __builtin_{array, struct, union}_preserve_access_index

can be applied.

This patch removed the pointer type restriction to permit any
argument type as long as it is permitted by the compiler.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67883

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/builtin-preserve-access-index-nonptr.c
  clang/test/Sema/builtin-preserve-access-index.c

Index: clang/test/Sema/builtin-preserve-access-index.c
===
--- clang/test/Sema/builtin-preserve-access-index.c
+++ clang/test/Sema/builtin-preserve-access-index.c
@@ -4,8 +4,8 @@
   return __builtin_preserve_access_index([1], 1); // expected-error {{too many arguments to function call, expected 1, have 2}}
 }
 
-const void *invalid2(const int *arg) {
-  return __builtin_preserve_access_index(1); // expected-error {{__builtin_preserve_access_index argument must a pointer type instead of 'int'}}
+int valid2(void) {
+  return __builtin_preserve_access_index(1);
 }
 
 void *invalid3(const int *arg) {
@@ -29,3 +29,11 @@
 int valid7(struct s *arg) {
   return *__builtin_preserve_access_index(>b);
 }
+
+int valid8(struct s *arg) {
+  return __builtin_preserve_access_index(arg->a + arg->b);
+}
+
+int valid9(struct s *arg) {
+  return __builtin_preserve_access_index(({arg->a = 2; arg->b = 3; }));
+}
Index: clang/test/CodeGen/builtin-preserve-access-index-nonptr.c
===
--- /dev/null
+++ clang/test/CodeGen/builtin-preserve-access-index-nonptr.c
@@ -0,0 +1,18 @@
+// RUN: %clang -target x86_64 -emit-llvm -S -g %s -o - | FileCheck %s
+
+#define _(x) (__builtin_preserve_access_index(x))
+
+struct s1 {
+  char a;
+  int b[4];
+};
+
+int unit1(struct s1 *arg) {
+  return _(arg->b[2]);
+}
+// CHECK: define dso_local i32 @unit1
+// CHECK: call [4 x i32]* @llvm.preserve.struct.access.index.p0a4i32.p0s_struct.s1s(%struct.s1* %{{[0-9a-z]+}}, i32 1, i32 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[STRUCT_S1:[0-9]+]]
+// CHECK: call i32* @llvm.preserve.array.access.index.p0i32.p0a4i32([4 x i32]* %{{[0-9a-z]+}}, i32 1, i32 2), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[ARRAY:[0-9]+]]
+//
+// CHECK: ![[ARRAY]] = !DICompositeType(tag: DW_TAG_array_type
+// CHECK: ![[STRUCT_S1]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s1"
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -191,22 +191,12 @@
   return false;
 }
 
-/// Check the number of arguments and arg type, and set the result type to
+/// Check the number of arguments and set the result type to
 /// the argument type.
 static bool SemaBuiltinPreserveAI(Sema , CallExpr *TheCall) {
   if (checkArgCount(S, TheCall, 1))
 return true;
 
-  // The argument type must be a pointer
-  ExprResult Arg = TheCall->getArg(0);
-  QualType Ty = Arg.get()->getType();
-  if (!Ty->isPointerType()) {
-S.Diag(Arg.get()->getBeginLoc(),
-   diag::err_builtin_preserve_access_index_invalid_arg)
-<< Ty << Arg.get()->getSourceRange();
-return true;
-  }
-
   TheCall->setType(TheCall->getArg(0)->getType());
   return false;
 }
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -9916,7 +9916,4 @@
   "__builtin_bit_cast %select{source|destination}0 type must be trivially copyable">;
 def err_bit_cast_type_size_mismatch : Error<
   "__builtin_bit_cast source size does not equal destination size (%0 vs %1)">;
-
-def err_builtin_preserve_access_index_invalid_arg : Error<
-  "__builtin_preserve_access_index argument must a pointer type instead of %0">;
 } // end of sema component.
Index: clang/docs/LanguageExtensions.rst
===
--- clang/docs/LanguageExtensions.rst
+++ clang/docs/LanguageExtensions.rst
@@ -2354,13 +2354,13 @@
 under bpf compile-once run-everywhere framework. Debuginfo (typically
 with ``-g``) is needed, otherwise, the compiler 

[PATCH] D67843: DisableFormat also now disables SortIncludes

2019-09-21 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

I assume the intention was that users could have DisableFormat=true and 
SortIncludes=true when they want to sort the includes but not perform any 
additional formatting in the code.

I think by making this change you make it impossible to run clang-format 
through a codebase with the sole intention of just sorting the headers. (which 
I could see as potentially useful isolated functionality)..

If SortIncludes is false by default? (which you are making it not for no style 
so I'm unclear what it would be now if you running without a BasedOnStyle 
setting (uninitialized?)) then you don't need to supply both unless you are 
using LLVM style or one of the other styles that turn it on.

Are you sure this is the right change?




Comment at: clang/lib/Format/Format.cpp:2131
   tooling::Replacements Replaces;
-  if (!Style.SortIncludes)
+  if (!Style.SortIncludes || Style.DisableFormat)
 return Replaces;

this no longer allows DisableFormat=true but SortInclude=true... i.e. running 
ClangFormat to just sort the headers.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67843/new/

https://reviews.llvm.org/D67843



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


[PATCH] D67399: [ARM] Follow AACPS standard for volatile bitfields

2019-09-21 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In D67399#1669920 , @rjmccall wrote:

> In D67399#1669568 , @jfb wrote:
>
> > In D67399#1669038 , @dnsampaio 
> > wrote:
> >
> > > Indeed our main concern is regarding the access widths of loads. As 
> > > mentioned by @rjmccall, most volatile bitfields are used to perform 
> > > memory mapped I/O, and some hardware only support them with a specific 
> > > access width.
> > >  The spurious load I am more than glad to leave it disable behind a 
> > > command flag, so it will only appear if the user requests it. See that 
> > > volatile accesses might have side effects, and for example, an I/O read 
> > > counter holding an odd number could define that the data is still being 
> > > processed.
> >
> >
> > Are the cases being addressed in the PR actually relevant to real MMIO, or 
> > is this patch following the letter of AAPCS which doesn't actually matter?
>
>
> Again, I think AAPCS is well within its rights to say that certain volatile 
> accesses should be performed with loads and stores of certain widths.  If 
> low-level programmers cannot use bit-fields today with memory-mapped I/O 
> because they cannot trust compilers to produce reasonable accesses, that is a 
> legitimate concern for ABI authors and a legitimate bug for compiler 
> maintainers.


I have no objection to the direction in this patch. I agree that it's important 
to have a specification that covers this, and while I still think that this has 
nothing to do with ABI as I believe the term is normally understood, treating 
it as platform-dependent and specifying it in the same place as the platform 
ABI might be the most reasonable option. Clearly the AAPCS is more than a 
Procedure Call Standard, which is fine.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67399/new/

https://reviews.llvm.org/D67399



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


[PATCH] D67638: Improve __builtin_constant_p lowering

2019-09-21 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

OK, this is fine by me if you're confident this doesn't degrade the generated 
code at -O0.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67638/new/

https://reviews.llvm.org/D67638



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


[PATCH] D67877: [analyzer] Conditionnaly include clang Analysis examples with cmake.

2019-09-21 Thread Jean-Bapiste Lepesme via Phabricator via cfe-commits
Jiboo added a comment.

@Szelethus take your time, I'm surprised to be the first with the problem 
(couldn't find reference on google or llvm bug tracker), I wouldn't be 
surprised if I fucked up somewhere and that this patch isn't really necessary.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67877/new/

https://reviews.llvm.org/D67877



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


[PATCH] D67877: [analyzer] Conditionnaly include clang Analysis examples with cmake.

2019-09-21 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

Apologies for the intrusion, but these plugins were added by me, and test an 
important case for our internal plugins. Could you please give me just a day or 
so the check whether the tests work for us correctly?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67877/new/

https://reviews.llvm.org/D67877



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


[PATCH] D67877: Conditionnaly include clang Analysis examples with cmake.

2019-09-21 Thread Jean-Bapiste Lepesme via Phabricator via cfe-commits
Jiboo added inline comments.



Comment at: clang/lib/Analysis/plugins/CMakeLists.txt:1-2
-if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS)
+if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS AND 
CLANG_BUILD_EXAMPLES)
   add_subdirectory(SampleAnalyzer)
   add_subdirectory(CheckerDependencyHandling)

lebedev.ri wrote:
> Sure it isn't just the `SampleAnalyzer` that should be wrapped into 
> `CLANG_BUILD_EXAMPLES`?
Dunno, I though they were all examples, due to their contents:

CheckerDependencyHandling: 
registry.addDependency("example.DependendentChecker", "example.Dependency");
CheckerOptionHandling: registry.addChecker(registerMyChecker, 
shouldRegisterMyChecker, "example.MyChecker", "Example Description",


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67877/new/

https://reviews.llvm.org/D67877



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


[PATCH] D67877: Conditionnaly include clang Analysis examples with cmake.

2019-09-21 Thread Jean-Bapiste Lepesme via Phabricator via cfe-commits
Jiboo updated this revision to Diff 221181.
Jiboo marked 3 inline comments as done.
Jiboo added a comment.

Update to add -U99, although dunno why I don't get more context on 
clang/lib/Analysis/plugins/CMakeLists.txt.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67877/new/

https://reviews.llvm.org/D67877

Files:
  clang/lib/Analysis/plugins/CMakeLists.txt
  clang/test/CMakeLists.txt


Index: clang/test/CMakeLists.txt
===
--- clang/test/CMakeLists.txt
+++ clang/test/CMakeLists.txt
@@ -125,14 +125,12 @@
   endif()
 endif()
 
-if (CLANG_ENABLE_STATIC_ANALYZER)
-  if (LLVM_ENABLE_PLUGINS)
-list(APPEND CLANG_TEST_DEPS
-  SampleAnalyzerPlugin
-  CheckerDependencyHandlingAnalyzerPlugin
-  CheckerOptionHandlingAnalyzerPlugin
-  )
-  endif()
+if (CLANG_ENABLE_STATIC_ANALYZER AND CLANG_BUILD_EXAMPLES AND 
LLVM_ENABLE_PLUGINS)
+  list(APPEND CLANG_TEST_DEPS
+SampleAnalyzerPlugin
+CheckerDependencyHandlingAnalyzerPlugin
+CheckerOptionHandlingAnalyzerPlugin
+)
 endif()
 
 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
Index: clang/lib/Analysis/plugins/CMakeLists.txt
===
--- clang/lib/Analysis/plugins/CMakeLists.txt
+++ clang/lib/Analysis/plugins/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS)
+if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS AND 
CLANG_BUILD_EXAMPLES)
   add_subdirectory(SampleAnalyzer)
   add_subdirectory(CheckerDependencyHandling)
   add_subdirectory(CheckerOptionHandling)


Index: clang/test/CMakeLists.txt
===
--- clang/test/CMakeLists.txt
+++ clang/test/CMakeLists.txt
@@ -125,14 +125,12 @@
   endif()
 endif()
 
-if (CLANG_ENABLE_STATIC_ANALYZER)
-  if (LLVM_ENABLE_PLUGINS)
-list(APPEND CLANG_TEST_DEPS
-  SampleAnalyzerPlugin
-  CheckerDependencyHandlingAnalyzerPlugin
-  CheckerOptionHandlingAnalyzerPlugin
-  )
-  endif()
+if (CLANG_ENABLE_STATIC_ANALYZER AND CLANG_BUILD_EXAMPLES AND LLVM_ENABLE_PLUGINS)
+  list(APPEND CLANG_TEST_DEPS
+SampleAnalyzerPlugin
+CheckerDependencyHandlingAnalyzerPlugin
+CheckerOptionHandlingAnalyzerPlugin
+)
 endif()
 
 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
Index: clang/lib/Analysis/plugins/CMakeLists.txt
===
--- clang/lib/Analysis/plugins/CMakeLists.txt
+++ clang/lib/Analysis/plugins/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS)
+if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS AND CLANG_BUILD_EXAMPLES)
   add_subdirectory(SampleAnalyzer)
   add_subdirectory(CheckerDependencyHandling)
   add_subdirectory(CheckerOptionHandling)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67877: Conditionnaly include clang Analysis examples with cmake.

2019-09-21 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

Please upload all patches with full context (`-U9`)




Comment at: clang/lib/Analysis/plugins/CMakeLists.txt:1-2
-if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS)
+if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS AND 
CLANG_BUILD_EXAMPLES)
   add_subdirectory(SampleAnalyzer)
   add_subdirectory(CheckerDependencyHandling)

Sure it isn't just the `SampleAnalyzer` that should be wrapped into 
`CLANG_BUILD_EXAMPLES`?



Comment at: clang/test/CMakeLists.txt:130
+  list(APPEND CLANG_TEST_DEPS
+SampleAnalyzerPlugin
+CheckerDependencyHandlingAnalyzerPlugin

Likewise


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67877/new/

https://reviews.llvm.org/D67877



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


[PATCH] D67877: Conditionnaly include clang Analysis examples with cmake.

2019-09-21 Thread Jean-Bapiste Lepesme via Phabricator via cfe-commits
Jiboo created this revision.
Jiboo added a reviewer: chandlerc.
Herald added subscribers: cfe-commits, mgorny.
Herald added a project: clang.

Without this patch, the clang Analysis plugin examples (in 
clang/lib/Analysis/plugins) are always built and installed even if 
CLANG_BUILD_EXAMPLES is OFF.

When using llvm-toolchain-bionic in http://apt.llvm.org/bionic/ the package 
llvm-10-dev includes a LLVMExports.cmake which includes thus samples. See 
/data/user/lib/llvm-10/lib/cmake/llvm/LLVMExports.cmake in 
http://apt.llvm.org/bionic/pool/main/l/llvm-toolchain-snapshot/llvm-10-dev_10~svn372305-1~exp1%2b0~20190919071908.1206~1.gbp6f40e3_amd64.deb

When trying to use LLVM-10 from travis (with this config 
https://github.com/Jiboo/wembed/blob/54e9664d615313f39e1a4325c1e7f028ce2b72db/.travis.yml),
 I got the error:

CMake Error at /usr/lib/llvm-10/lib/cmake/llvm/LLVMExports.cmake:1341 (message):

  The imported target "SampleAnalyzerPlugin" references the file
 "/usr/lib/llvm-10/lib/SampleAnalyzerPlugin.so"
  but this file does not exist.  Possible reasons include:
  * The file was deleted, renamed, or moved to another location.
  * An install or uninstall procedure did not complete successfully.
  * The installation package was faulty and contained
 "/usr/lib/llvm-10/lib/cmake/llvm/LLVMExports.cmake"
  but not all the files it references.

I couldn't find SampleAnalyzerPlugin.so in any other packages 
(clang-10-examples only has sources), so I tried to replicate the problem 
locally, CLANG_BUILD_EXAMPLES was OFF, although the sample plugins were built 
and installed. Deleting /usr/local/lib/SampleAnalyzerPlugin.so replicated the 
travis error.

This fix looks ok to me, although I'm no CMake expert, particularly in LLVM 
context, and I might cure a symptom and not the cause, but with this patch if 
CLANG_BUILD_EXAMPLES is ON, they appear in LLVMExports.cmake and vice-versa.


Repository:
  rC Clang

https://reviews.llvm.org/D67877

Files:
  clang/lib/Analysis/plugins/CMakeLists.txt
  clang/test/CMakeLists.txt


Index: clang/test/CMakeLists.txt
===
--- clang/test/CMakeLists.txt
+++ clang/test/CMakeLists.txt
@@ -125,14 +125,12 @@
   endif()
 endif()
 
-if (CLANG_ENABLE_STATIC_ANALYZER)
-  if (LLVM_ENABLE_PLUGINS)
-list(APPEND CLANG_TEST_DEPS
-  SampleAnalyzerPlugin
-  CheckerDependencyHandlingAnalyzerPlugin
-  CheckerOptionHandlingAnalyzerPlugin
-  )
-  endif()
+if (CLANG_ENABLE_STATIC_ANALYZER AND CLANG_BUILD_EXAMPLES AND 
LLVM_ENABLE_PLUGINS)
+  list(APPEND CLANG_TEST_DEPS
+SampleAnalyzerPlugin
+CheckerDependencyHandlingAnalyzerPlugin
+CheckerOptionHandlingAnalyzerPlugin
+)
 endif()
 
 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
Index: clang/lib/Analysis/plugins/CMakeLists.txt
===
--- clang/lib/Analysis/plugins/CMakeLists.txt
+++ clang/lib/Analysis/plugins/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS)
+if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS AND 
CLANG_BUILD_EXAMPLES)
   add_subdirectory(SampleAnalyzer)
   add_subdirectory(CheckerDependencyHandling)
   add_subdirectory(CheckerOptionHandling)


Index: clang/test/CMakeLists.txt
===
--- clang/test/CMakeLists.txt
+++ clang/test/CMakeLists.txt
@@ -125,14 +125,12 @@
   endif()
 endif()
 
-if (CLANG_ENABLE_STATIC_ANALYZER)
-  if (LLVM_ENABLE_PLUGINS)
-list(APPEND CLANG_TEST_DEPS
-  SampleAnalyzerPlugin
-  CheckerDependencyHandlingAnalyzerPlugin
-  CheckerOptionHandlingAnalyzerPlugin
-  )
-  endif()
+if (CLANG_ENABLE_STATIC_ANALYZER AND CLANG_BUILD_EXAMPLES AND LLVM_ENABLE_PLUGINS)
+  list(APPEND CLANG_TEST_DEPS
+SampleAnalyzerPlugin
+CheckerDependencyHandlingAnalyzerPlugin
+CheckerOptionHandlingAnalyzerPlugin
+)
 endif()
 
 add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
Index: clang/lib/Analysis/plugins/CMakeLists.txt
===
--- clang/lib/Analysis/plugins/CMakeLists.txt
+++ clang/lib/Analysis/plugins/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS)
+if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS AND CLANG_BUILD_EXAMPLES)
   add_subdirectory(SampleAnalyzer)
   add_subdirectory(CheckerDependencyHandling)
   add_subdirectory(CheckerOptionHandling)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63640: [clang] Improve Serialization/Imporing of APValues

2019-09-21 Thread Tyker via Phabricator via cfe-commits
Tyker marked 2 inline comments as done.
Tyker added inline comments.



Comment at: clang/lib/AST/APValue.cpp:176
+  (DataSize - sizeof(MemberPointerBase)) / sizeof(CXXRecordDecl *);
+  typedef CXXRecordDecl *PathElem;
   union {

Tyker wrote:
> aaron.ballman wrote:
> > Why is this no longer a pointer to `const`?
> when imporing or deserializing, we reserve the space for elements and then 
> import/deserialize element directly in place. so the buffer storing them is 
> not const. that said i saw that the normal construction cast away the const.
never mind this change wasn't needed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63640/new/

https://reviews.llvm.org/D63640



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


[PATCH] D63640: [clang] Improve Serialization/Imporing of APValues

2019-09-21 Thread Tyker via Phabricator via cfe-commits
Tyker updated this revision to Diff 221169.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63640/new/

https://reviews.llvm.org/D63640

Files:
  clang/include/clang/AST/APValue.h
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/ASTImporter.h
  clang/include/clang/AST/Expr.h
  clang/include/clang/Serialization/ASTReader.h
  clang/lib/AST/APValue.cpp
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Decl.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  clang/test/ASTMerge/APValue/APValue.cpp
  clang/test/PCH/APValue.cpp

Index: clang/test/PCH/APValue.cpp
===
--- /dev/null
+++ clang/test/PCH/APValue.cpp
@@ -0,0 +1,210 @@
+
+// RUN: %clang_cc1 -x c++ -std=gnu++2a -emit-pch %s -o %t.pch
+// RUN: %clang_cc1 -x c++ -std=gnu++2a -include-pch %t.pch -ast-dump-all | FileCheck %s
+
+#ifndef EMIT
+#define EMIT
+
+namespace Integer {
+
+constexpr int Unique_Int = int(6789);
+//CHECK:  VarDecl {{.*}} Unique_Int
+//CHECK-NEXT: ConstantExpr {{.*}} 'int' 6789
+
+constexpr __uint128_t Unique_Int128 = ((__uint128_t)0x75f17d6b3588f843 << 64) | 0xb13dea7c9c324e51;
+//CHECK:  VarDecl {{.*}} Unique_Int128 
+//CHECK-NEXT: ConstantExpr {{.*}} 'unsigned __int128' 156773562844924187900898496343692168785
+
+}
+
+namespace FloatingPoint {
+
+constexpr double Unique_Double = double(567890.67890);
+//CHECK:  VarDecl {{.*}} Unique_Double
+//CHECK-NEXT: ConstantExpr {{.*}} 'double' 5.678907e+05
+
+}
+
+// FIXME: Add test for FixePoint, ComplexInt, ComplexFloat, AddrLabelDiff.
+
+namespace Struct {
+
+struct B {
+  int i;
+  double d;
+};
+
+constexpr B Basic_Struct = B{1, 0.7};
+//CHECK:  VarDecl {{.*}} Basic_Struct
+//CHECK-NEXT: ConstantExpr {{.*}} 'const Struct::B' {1, 7.00e-01}
+
+struct C {
+  int i = 9;
+};
+
+struct A : B {
+  int i;
+  double d;
+  C c;
+};
+
+constexpr A Advanced_Struct = A{Basic_Struct, 1, 79.789, {}};
+//CHECK:  VarDecl {{.*}} Advanced_Struct
+//CHECK-NEXT: ConstantExpr {{.*}} 'const Struct::A' {{[{][{]}}1, 7.00e-01}, 1, 7.978900e+01, {9}}
+
+}
+
+namespace Vector {
+
+using v4si = int __attribute__((__vector_size__(16)));
+
+constexpr v4si Vector_Int = (v4si){8, 2, 3};
+//CHECK:  VarDecl {{.*}} Vector_Int
+//CHECK-NEXT: ConstantExpr {{.*}} 'Vector::v4si':'__attribute__((__vector_size__(4 * sizeof(int int' {8, 2, 3, 0}
+
+}
+
+namespace Array {
+
+constexpr int Array_Int[] = {1, 2, 3, 4, 5, 6};
+//CHECK:  VarDecl {{.*}} Array_Int
+//CHECK-NEXT: ConstantExpr {{.*}} 'const int [6]' {1, 2, 3, 4, 5, 6}
+
+struct A {
+  int i = 789;
+  double d = 67890.09876;
+};
+
+constexpr A Array2_Struct[][3] = {{{}, {-45678, 9.8}, {9}}, {{}}};
+//CHECK:  VarDecl {{.*}} Array2_Struct
+//CHECK-NEXT: ConstantExpr {{.*}} 'Array::A const [2][3]' {{[{][{]}}{789, 6.789010e+04}, {-45678, 9.80e+00}, {9, 6.789010e+04}}, {{[{][{]}}789, 6.789010e+04}, {789, 6.789010e+04}, {789, 6.789010e+04}}}
+
+using v4si = int __attribute__((__vector_size__(16)));
+
+constexpr v4si Array_Vector[] = {{1, 2, 3, 4}, {4, 5, 6, 7}};
+//CHECK:  VarDecl {{.*}} Array_Vector
+//CHECK-NEXT: ConstantExpr {{.*}} 'const Array::v4si [2]' {{[{][{]}}1, 2, 3, 4}, {4, 5, 6, 7}}
+
+}
+
+namespace Union {
+
+struct A {
+  int i = 6789;
+  float f = 987.9876;
+};
+
+union U {
+  int i;
+  A a{567890, 9876.5678f};
+};
+
+constexpr U Unique_Union1 = U{0};
+//CHECK:  VarDecl {{.*}} Unique_Union
+//CHECK-NEXT: ConstantExpr {{.*}} 'const Union::U' {.i = 0}
+
+constexpr U Unique_Union2 = U{};
+//CHECK:  VarDecl {{.*}} Unique_Union
+//CHECK-NEXT: ConstantExpr {{.*}} 'const Union::U' {.a = {567890, 9.876567e+03}}
+
+}
+
+namespace MemberPointer{
+
+struct A {
+  struct B {
+struct C {
+  struct D {
+struct E {
+  struct F {
+struct G {
+  int i;
+};
+  };
+};
+  };
+};
+  };
+};
+
+constexpr auto MemberPointer1 = ::B::C::D::E::F::G::i;
+//CHECK:  VarDecl {{.*}} MemberPointer1
+//CHECK-NEXT: ConstantExpr {{.*}} 'int MemberPointer::A::B::C::D::E::F::G::*' ::i
+
+struct A1 {
+  struct B1 {
+int f() const {
+  return 0;
+}
+  };
+
+};
+
+constexpr auto MemberPointer2 = ::B1::f;
+//CHECK:  VarDecl {{.*}} MemberPointer2
+//CHECK-NEXT: ConstantExpr {{.*}} 'int (MemberPointer::A1::B1::*)() const' ::f
+
+}
+
+namespace std {
+  struct type_info;
+};
+
+namespace LValue {
+
+constexpr int LValueInt = 0;
+constexpr const int& ConstIntRef = LValueInt;
+//CHECK:  VarDecl {{.*}} ConstIntRef
+//CHECK-NEXT: ConstantExpr {{.*}} 'const int' lvalue 
+constexpr const int* IntPtr = 
+//CHECK:  VarDecl {{.*}} IntPtr
+//CHECK-NEXT: ConstantExpr {{.*}} 'const int *' 
+
+constexpr const int* NullPtr = nullptr;
+//CHECK:  VarDecl {{.*}} 

[PATCH] D67638: Improve __builtin_constant_p lowering

2019-09-21 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

Ping.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67638/new/

https://reviews.llvm.org/D67638



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


[PATCH] D63640: [clang] Improve Serialization/Imporing of APValues

2019-09-21 Thread Tyker via Phabricator via cfe-commits
Tyker updated this revision to Diff 221166.
Tyker marked 24 inline comments as done.
Tyker added a comment.

Fixed most changes requested by @aaron.ballman
test are currently no valid anymore see comments for why.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63640/new/

https://reviews.llvm.org/D63640

Files:
  clang/include/clang/AST/APValue.h
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/ASTImporter.h
  clang/include/clang/AST/Expr.h
  clang/include/clang/Serialization/ASTReader.h
  clang/lib/AST/APValue.cpp
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Decl.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  clang/test/ASTMerge/APValue/APValue.cpp
  clang/test/PCH/APValue.cpp

Index: clang/test/PCH/APValue.cpp
===
--- /dev/null
+++ clang/test/PCH/APValue.cpp
@@ -0,0 +1,210 @@
+
+// RUN: %clang_cc1 -x c++ -std=gnu++2a -emit-pch %s -o %t.pch
+// RUN: %clang_cc1 -x c++ -std=gnu++2a -include-pch %t.pch -ast-dump-all | FileCheck %s
+
+#ifndef EMIT
+#define EMIT
+
+namespace Integer {
+
+constexpr int Unique_Int = int(6789);
+//CHECK:  VarDecl {{.*}} Unique_Int
+//CHECK-NEXT: ConstantExpr {{.*}} 'int' 6789
+
+constexpr __uint128_t Unique_Int128 = ((__uint128_t)0x75f17d6b3588f843 << 64) | 0xb13dea7c9c324e51;
+//CHECK:  VarDecl {{.*}} Unique_Int128 
+//CHECK-NEXT: ConstantExpr {{.*}} 'unsigned __int128' 156773562844924187900898496343692168785
+
+}
+
+namespace FloatingPoint {
+
+constexpr double Unique_Double = double(567890.67890);
+//CHECK:  VarDecl {{.*}} Unique_Double
+//CHECK-NEXT: ConstantExpr {{.*}} 'double' 5.678907e+05
+
+}
+
+// FIXME: Add test for FixePoint, ComplexInt, ComplexFloat, AddrLabelDiff.
+
+namespace Struct {
+
+struct B {
+  int i;
+  double d;
+};
+
+constexpr B Basic_Struct = B{1, 0.7};
+//CHECK:  VarDecl {{.*}} Basic_Struct
+//CHECK-NEXT: ConstantExpr {{.*}} 'const Struct::B' {1, 7.00e-01}
+
+struct C {
+  int i = 9;
+};
+
+struct A : B {
+  int i;
+  double d;
+  C c;
+};
+
+constexpr A Advanced_Struct = A{Basic_Struct, 1, 79.789, {}};
+//CHECK:  VarDecl {{.*}} Advanced_Struct
+//CHECK-NEXT: ConstantExpr {{.*}} 'const Struct::A' {{[{][{]}}1, 7.00e-01}, 1, 7.978900e+01, {9}}
+
+}
+
+namespace Vector {
+
+using v4si = int __attribute__((__vector_size__(16)));
+
+constexpr v4si Vector_Int = (v4si){8, 2, 3};
+//CHECK:  VarDecl {{.*}} Vector_Int
+//CHECK-NEXT: ConstantExpr {{.*}} 'Vector::v4si':'__attribute__((__vector_size__(4 * sizeof(int int' {8, 2, 3, 0}
+
+}
+
+namespace Array {
+
+constexpr int Array_Int[] = {1, 2, 3, 4, 5, 6};
+//CHECK:  VarDecl {{.*}} Array_Int
+//CHECK-NEXT: ConstantExpr {{.*}} 'const int [6]' {1, 2, 3, 4, 5, 6}
+
+struct A {
+  int i = 789;
+  double d = 67890.09876;
+};
+
+constexpr A Array2_Struct[][3] = {{{}, {-45678, 9.8}, {9}}, {{}}};
+//CHECK:  VarDecl {{.*}} Array2_Struct
+//CHECK-NEXT: ConstantExpr {{.*}} 'Array::A const [2][3]' {{[{][{]}}{789, 6.789010e+04}, {-45678, 9.80e+00}, {9, 6.789010e+04}}, {{[{][{]}}789, 6.789010e+04}, {789, 6.789010e+04}, {789, 6.789010e+04}}}
+
+using v4si = int __attribute__((__vector_size__(16)));
+
+constexpr v4si Array_Vector[] = {{1, 2, 3, 4}, {4, 5, 6, 7}};
+//CHECK:  VarDecl {{.*}} Array_Vector
+//CHECK-NEXT: ConstantExpr {{.*}} 'const Array::v4si [2]' {{[{][{]}}1, 2, 3, 4}, {4, 5, 6, 7}}
+
+}
+
+namespace Union {
+
+struct A {
+  int i = 6789;
+  float f = 987.9876;
+};
+
+union U {
+  int i;
+  A a{567890, 9876.5678f};
+};
+
+constexpr U Unique_Union1 = U{0};
+//CHECK:  VarDecl {{.*}} Unique_Union
+//CHECK-NEXT: ConstantExpr {{.*}} 'const Union::U' {.i = 0}
+
+constexpr U Unique_Union2 = U{};
+//CHECK:  VarDecl {{.*}} Unique_Union
+//CHECK-NEXT: ConstantExpr {{.*}} 'const Union::U' {.a = {567890, 9.876567e+03}}
+
+}
+
+namespace MemberPointer{
+
+struct A {
+  struct B {
+struct C {
+  struct D {
+struct E {
+  struct F {
+struct G {
+  int i;
+};
+  };
+};
+  };
+};
+  };
+};
+
+constexpr auto MemberPointer1 = ::B::C::D::E::F::G::i;
+//CHECK:  VarDecl {{.*}} MemberPointer1
+//CHECK-NEXT: ConstantExpr {{.*}} 'int MemberPointer::A::B::C::D::E::F::G::*' ::i
+
+struct A1 {
+  struct B1 {
+int f() const {
+  return 0;
+}
+  };
+
+};
+
+constexpr auto MemberPointer2 = ::B1::f;
+//CHECK:  VarDecl {{.*}} MemberPointer2
+//CHECK-NEXT: ConstantExpr {{.*}} 'int (MemberPointer::A1::B1::*)() const' ::f
+
+}
+
+namespace std {
+  struct type_info;
+};
+
+namespace LValue {
+
+constexpr int LValueInt = 0;
+constexpr const int& ConstIntRef = LValueInt;
+//CHECK:  VarDecl {{.*}} ConstIntRef
+//CHECK-NEXT: ConstantExpr {{.*}} 'const int' lvalue 
+constexpr const int* 

[PATCH] D63640: [clang] Improve Serialization/Imporing of APValues

2019-09-21 Thread Tyker via Phabricator via cfe-commits
Tyker added inline comments.



Comment at: clang/include/clang/AST/ASTContext.h:275
-  /// Used to cleanups APValues stored in the AST.
-  mutable llvm::SmallVector APValueCleanups;
-

aaron.ballman wrote:
> Why are you getting rid of this? It seems like we would still want these 
> cleaned up.
when i added APValueCleanups i wasn't aware that there were a generic system to 
handle this. but with this patch APValue a cleaned up using the generic 
ASTContext::addDestruction.



Comment at: clang/include/clang/AST/TextNodeDumper.h:149
 
-  const ASTContext *Context;
+  const ASTContext *Context = nullptr;
 

aaron.ballman wrote:
> Good catch -- this pointed out a bug in the class that I've fixed in r372323, 
> so you'll need to rebase.
i took a look at the revision. there is a big difference is the quality of 
output between APValue::dump and APValue::printPretty. i think it is possible 
to come quite close to printPretty's output even without the ASTContext. this 
would require having a default PrintingPolicy and improving dump

in this patch i was relying on the -ast-dump output for testing. i would need 
to find an other testing strategy or make the improvement to APValue::dump 
first.



Comment at: clang/lib/AST/APValue.cpp:176
+  (DataSize - sizeof(MemberPointerBase)) / sizeof(CXXRecordDecl *);
+  typedef CXXRecordDecl *PathElem;
   union {

aaron.ballman wrote:
> Why is this no longer a pointer to `const`?
when imporing or deserializing, we reserve the space for elements and then 
import/deserialize element directly in place. so the buffer storing them is not 
const. that said i saw that the normal construction cast away the const.



Comment at: clang/lib/AST/APValue.cpp:748
 
+APValue::LValuePathEntry *APValue::getLValuePathPtr() {
+  return ((LV *)(char *)Data.buffer)->getPath();

aaron.ballman wrote:
> Can this function be marked `const`?
this function gives access to non-const internal data. this function is private 
so the impact is quite limited.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63640/new/

https://reviews.llvm.org/D63640



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


[PATCH] D52386: [Lexer] Add udefined_behavior_sanitizer feature

2019-09-21 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added a comment.
Herald added a project: LLVM.

This is needed in the NetBSD kernel, more fine-grained checks would be 
acceptable too, but one global feature detection is what I need.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D52386/new/

https://reviews.llvm.org/D52386



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


[PATCH] D66176: Fix Driver/modules.cpp test to work when build directory name contains '.s'

2019-09-21 Thread Michał Górny via Phabricator via cfe-commits
mgorny added a comment.

Ping. This is a really silly issue, and one that could be fixed trivially, so 
it'd be really nice to actually fix it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66176/new/

https://reviews.llvm.org/D66176



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


r372462 - Attempt to fix a windows buildbot failure

2019-09-21 Thread Kristof Umann via cfe-commits
Author: szelethus
Date: Sat Sep 21 00:56:40 2019
New Revision: 372462

URL: http://llvm.org/viewvc/llvm-project?rev=372462=rev
Log:
Attempt to fix a windows buildbot failure

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=372462=372461=372462=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Sat Sep 21 00:56:40 
2019
@@ -137,8 +137,8 @@ class RefState {
 
   const Stmt *S;
 
-  Kind K : 3;
-  AllocationFamily Family : 3;
+  Kind K;
+  AllocationFamily Family;
 
   RefState(Kind k, const Stmt *s, AllocationFamily family)
   : S(s), K(k), Family(family) {


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


[PATCH] D67719: [clang] [Basic] Enable __has_feature(leak_sanitizer)

2019-09-21 Thread Michał Górny via Phabricator via cfe-commits
mgorny updated this revision to Diff 221155.
mgorny added a comment.

Test added. Thanks for the suggestion!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67719/new/

https://reviews.llvm.org/D67719

Files:
  clang/include/clang/Basic/Features.def
  clang/test/Lexer/has_feature_leak_sanitizer.cpp


Index: clang/test/Lexer/has_feature_leak_sanitizer.cpp
===
--- /dev/null
+++ clang/test/Lexer/has_feature_leak_sanitizer.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -E -fsanitize=leak %s -o - | FileCheck 
--check-prefix=CHECK-LSAN %s
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-LSAN %s
+
+#if __has_feature(leak_sanitizer)
+int LeakSanitizerEnabled();
+#else
+int LeakSanitizerDisabled();
+#endif
+
+// CHECK-LSAN: LeakSanitizerEnabled
+// CHECK-NO-LSAN: LeakSanitizerDisabled
Index: clang/include/clang/Basic/Features.def
===
--- clang/include/clang/Basic/Features.def
+++ clang/include/clang/Basic/Features.def
@@ -39,6 +39,8 @@
 FEATURE(address_sanitizer,
 LangOpts.Sanitize.hasOneOf(SanitizerKind::Address |
SanitizerKind::KernelAddress))
+FEATURE(leak_sanitizer,
+LangOpts.Sanitize.has(SanitizerKind::Leak))
 FEATURE(hwaddress_sanitizer,
 LangOpts.Sanitize.hasOneOf(SanitizerKind::HWAddress |
SanitizerKind::KernelHWAddress))


Index: clang/test/Lexer/has_feature_leak_sanitizer.cpp
===
--- /dev/null
+++ clang/test/Lexer/has_feature_leak_sanitizer.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -E -fsanitize=leak %s -o - | FileCheck --check-prefix=CHECK-LSAN %s
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-LSAN %s
+
+#if __has_feature(leak_sanitizer)
+int LeakSanitizerEnabled();
+#else
+int LeakSanitizerDisabled();
+#endif
+
+// CHECK-LSAN: LeakSanitizerEnabled
+// CHECK-NO-LSAN: LeakSanitizerDisabled
Index: clang/include/clang/Basic/Features.def
===
--- clang/include/clang/Basic/Features.def
+++ clang/include/clang/Basic/Features.def
@@ -39,6 +39,8 @@
 FEATURE(address_sanitizer,
 LangOpts.Sanitize.hasOneOf(SanitizerKind::Address |
SanitizerKind::KernelAddress))
+FEATURE(leak_sanitizer,
+LangOpts.Sanitize.has(SanitizerKind::Leak))
 FEATURE(hwaddress_sanitizer,
 LangOpts.Sanitize.hasOneOf(SanitizerKind::HWAddress |
SanitizerKind::KernelHWAddress))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits