[PATCH] D83992: [ASTImporter] Add Visitor for TypedefNameDecl's

2020-07-25 Thread Vince Bridgers via Phabricator via cfe-commits
vabridgers updated this revision to Diff 280700.
vabridgers added a comment.

Adding negative test case that exposes the original problem.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83992

Files:
  clang/lib/AST/ASTImporterLookupTable.cpp
  clang/test/Analysis/Inputs/ctu-import.c
  clang/test/Analysis/Inputs/ctu-import.c.externalDefMap.ast-dump.txt
  clang/test/Analysis/ctu-implicit.c


Index: clang/test/Analysis/ctu-implicit.c
===
--- /dev/null
+++ clang/test/Analysis/ctu-implicit.c
@@ -0,0 +1,20 @@
+// RUN: rm -rf %t && mkdir %t
+// RUN: mkdir -p %t/ctudir2
+// RUN: %clang_cc1  \
+// RUN:   -emit-pch -o %t/ctudir2/ctu-import.c.ast %S/Inputs/ctu-import.c
+// RUN: cp %S/Inputs/ctu-import.c.externalDefMap.ast-dump.txt 
%t/ctudir2/externalDefMap.txt
+// RUN: %clang_cc1 -analyze \
+// RUN:   -analyzer-checker=core,debug.ExprInspection \
+// RUN:   -analyzer-config experimental-enable-naive-ctu-analysis=true \
+// RUN:   -analyzer-config  display-ctu-progress=true \
+// RUN:   -analyzer-config ctu-dir=%t/ctudir2 \
+// RUN:   -verify %s
+
+void clang_analyzer_eval(int);
+
+int testStaticImplicit(void);
+int func(void) {
+  int ret = testStaticImplicit();
+  clang_analyzer_eval(ret == 4); // expected-warning{{TRUE}}
+  return testStaticImplicit();
+}
Index: clang/test/Analysis/Inputs/ctu-import.c.externalDefMap.ast-dump.txt
===
--- /dev/null
+++ clang/test/Analysis/Inputs/ctu-import.c.externalDefMap.ast-dump.txt
@@ -0,0 +1 @@
+c:@F@testStaticImplicit ctu-import.c.ast
Index: clang/test/Analysis/Inputs/ctu-import.c
===
--- /dev/null
+++ clang/test/Analysis/Inputs/ctu-import.c
@@ -0,0 +1,15 @@
+
+// Use an internal, implicitly defined type, called by
+// a function imported for CTU. This should not crash.
+int foo(void);
+int foobar(int skip) {
+  __NSConstantString str = {.flags = 1};
+
+  if (str.flags >= 0)
+str.flags = 0;
+  return 4;
+}
+
+int testStaticImplicit(void) {
+  return foobar(3);
+}
Index: clang/lib/AST/ASTImporterLookupTable.cpp
===
--- clang/lib/AST/ASTImporterLookupTable.cpp
+++ clang/lib/AST/ASTImporterLookupTable.cpp
@@ -22,6 +22,20 @@
 struct Builder : RecursiveASTVisitor {
   ASTImporterLookupTable 
   Builder(ASTImporterLookupTable ) : LT(LT) {}
+
+  bool VisitTypedefNameDecl(TypedefNameDecl *D) {
+QualType Ty = D->getUnderlyingType();
+Ty = Ty.getCanonicalType();
+if (const auto *RTy = dyn_cast(Ty)) {
+  LT.add(RTy->getAsRecordDecl());
+  // iterate over the field decls, adding them
+  for (auto *it : RTy->getAsRecordDecl()->fields()) {
+LT.add(it);
+  }
+}
+return true;
+  }
+
   bool VisitNamedDecl(NamedDecl *D) {
 LT.add(D);
 return true;


Index: clang/test/Analysis/ctu-implicit.c
===
--- /dev/null
+++ clang/test/Analysis/ctu-implicit.c
@@ -0,0 +1,20 @@
+// RUN: rm -rf %t && mkdir %t
+// RUN: mkdir -p %t/ctudir2
+// RUN: %clang_cc1  \
+// RUN:   -emit-pch -o %t/ctudir2/ctu-import.c.ast %S/Inputs/ctu-import.c
+// RUN: cp %S/Inputs/ctu-import.c.externalDefMap.ast-dump.txt %t/ctudir2/externalDefMap.txt
+// RUN: %clang_cc1 -analyze \
+// RUN:   -analyzer-checker=core,debug.ExprInspection \
+// RUN:   -analyzer-config experimental-enable-naive-ctu-analysis=true \
+// RUN:   -analyzer-config  display-ctu-progress=true \
+// RUN:   -analyzer-config ctu-dir=%t/ctudir2 \
+// RUN:   -verify %s
+
+void clang_analyzer_eval(int);
+
+int testStaticImplicit(void);
+int func(void) {
+  int ret = testStaticImplicit();
+  clang_analyzer_eval(ret == 4); // expected-warning{{TRUE}}
+  return testStaticImplicit();
+}
Index: clang/test/Analysis/Inputs/ctu-import.c.externalDefMap.ast-dump.txt
===
--- /dev/null
+++ clang/test/Analysis/Inputs/ctu-import.c.externalDefMap.ast-dump.txt
@@ -0,0 +1 @@
+c:@F@testStaticImplicit ctu-import.c.ast
Index: clang/test/Analysis/Inputs/ctu-import.c
===
--- /dev/null
+++ clang/test/Analysis/Inputs/ctu-import.c
@@ -0,0 +1,15 @@
+
+// Use an internal, implicitly defined type, called by
+// a function imported for CTU. This should not crash.
+int foo(void);
+int foobar(int skip) {
+  __NSConstantString str = {.flags = 1};
+
+  if (str.flags >= 0)
+str.flags = 0;
+  return 4;
+}
+
+int testStaticImplicit(void) {
+  return foobar(3);
+}
Index: clang/lib/AST/ASTImporterLookupTable.cpp
===
--- clang/lib/AST/ASTImporterLookupTable.cpp
+++ clang/lib/AST/ASTImporterLookupTable.cpp
@@ -22,6 +22,20 @@
 struct Builder : RecursiveASTVisitor 

[PATCH] D84591: [clang-tidy] Replace comment by private method

2020-07-25 Thread Hannes Käufler via Phabricator via cfe-commits
hanneskaeufler updated this revision to Diff 280699.
hanneskaeufler added a comment.

Fix syntax error (add return type)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84591

Files:
  clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp


Index: clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
===
--- clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
+++ clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
@@ -123,12 +123,7 @@
 
 // Emit warnings for headers that are missing guards.
 checkGuardlessHeaders();
-
-// Clear all state.
-Macros.clear();
-Files.clear();
-Ifndefs.clear();
-EndIfs.clear();
+clearAllState();
   }
 
   bool wouldFixEndifComment(StringRef FileName, SourceLocation EndIf,
@@ -255,6 +250,13 @@
   }
 
 private:
+  void clearAllState() {
+Macros.clear();
+Files.clear();
+Ifndefs.clear();
+EndIfs.clear();
+  }
+
   std::vector> Macros;
   llvm::StringMap Files;
   std::map>


Index: clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
===
--- clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
+++ clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
@@ -123,12 +123,7 @@
 
 // Emit warnings for headers that are missing guards.
 checkGuardlessHeaders();
-
-// Clear all state.
-Macros.clear();
-Files.clear();
-Ifndefs.clear();
-EndIfs.clear();
+clearAllState();
   }
 
   bool wouldFixEndifComment(StringRef FileName, SourceLocation EndIf,
@@ -255,6 +250,13 @@
   }
 
 private:
+  void clearAllState() {
+Macros.clear();
+Files.clear();
+Ifndefs.clear();
+EndIfs.clear();
+  }
+
   std::vector> Macros;
   llvm::StringMap Files;
   std::map>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D84591: Replace comment by private method

2020-07-25 Thread Hannes Käufler via Phabricator via cfe-commits
hanneskaeufler created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The comment is better served with a small private
method, helping scannability of the code and
hiding irrelevant details about the private members.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84591

Files:
  clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp


Index: clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
===
--- clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
+++ clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
@@ -123,12 +123,7 @@
 
 // Emit warnings for headers that are missing guards.
 checkGuardlessHeaders();
-
-// Clear all state.
-Macros.clear();
-Files.clear();
-Ifndefs.clear();
-EndIfs.clear();
+clearAllState();
   }
 
   bool wouldFixEndifComment(StringRef FileName, SourceLocation EndIf,
@@ -255,6 +250,13 @@
   }
 
 private:
+  clearAllState() {
+Macros.clear();
+Files.clear();
+Ifndefs.clear();
+EndIfs.clear();
+  }
+
   std::vector> Macros;
   llvm::StringMap Files;
   std::map>


Index: clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
===
--- clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
+++ clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
@@ -123,12 +123,7 @@
 
 // Emit warnings for headers that are missing guards.
 checkGuardlessHeaders();
-
-// Clear all state.
-Macros.clear();
-Files.clear();
-Ifndefs.clear();
-EndIfs.clear();
+clearAllState();
   }
 
   bool wouldFixEndifComment(StringRef FileName, SourceLocation EndIf,
@@ -255,6 +250,13 @@
   }
 
 private:
+  clearAllState() {
+Macros.clear();
+Files.clear();
+Ifndefs.clear();
+EndIfs.clear();
+  }
+
   std::vector> Macros;
   llvm::StringMap Files;
   std::map>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79714: [Diagnostics] Restore -Wdeprecated warning when user-declared copy assignment operator is defined as deleted (PR45634)

2020-07-25 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 updated this revision to Diff 280694.

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

https://reviews.llvm.org/D79714

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/SemaCXX/deprecated-copy-dtor.cpp
  clang/test/SemaCXX/deprecated-copy.cpp
  clang/test/SemaCXX/deprecated-dtor-user-provided.cpp
  clang/test/SemaCXX/deprecated-user-provided.cpp
  clang/test/SemaCXX/deprecated.cpp

Index: clang/test/SemaCXX/deprecated.cpp
===
--- clang/test/SemaCXX/deprecated.cpp
+++ clang/test/SemaCXX/deprecated.cpp
@@ -103,10 +103,10 @@
   void g() { c1 = c2; } // expected-note {{implicit copy assignment operator for 'DeprecatedCopy::Dtor' first required here}}
 
   struct DefaultedDtor {
-~DefaultedDtor() = default;
-  };
-  DefaultedDtor d1, d2(d1);
-  void h() { d1 = d2; }
+~DefaultedDtor() = default; // expected-warning {{definition of implicit copy constructor for 'DefaultedDtor' is deprecated because it has a user-declared destructor}}
+  };// expected-warning@-1 {{definition of implicit copy assignment operator for 'DefaultedDtor' is deprecated because it has a user-declared destructor}}
+  DefaultedDtor d1, d2(d1); // expected-note {{in implicit copy constructor for 'DeprecatedCopy::DefaultedDtor' first required here}}
+  void h() { d1 = d2; } // expected-note {{in implicit copy assignment operator for 'DeprecatedCopy::DefaultedDtor' first required here}}
 }
 #endif
 
Index: clang/test/SemaCXX/deprecated-user-provided.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/deprecated-user-provided.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy-user-provided -verify
+
+struct A {
+  A =(const A &); // expected-warning {{definition of implicit copy constructor for 'A' is deprecated because it has a user-declared copy assignment operator}}
+};
+
+void foo() {
+  A a1, a2(a1); // expected-note {{implicit copy constructor for 'A' first required here}}
+}
Index: clang/test/SemaCXX/deprecated-dtor-user-provided.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/deprecated-dtor-user-provided.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy-dtor-user-provided -verify
+
+struct A {
+  int *ptr;
+  ~A(); // expected-warning {{definition of implicit copy constructor for 'A' is deprecated because it has a user-declared destructor}}
+};
+
+void foo() {
+  A a{};
+  A b = a; // expected-note {{implicit copy constructor for 'A' first required here}}
+}
Index: clang/test/SemaCXX/deprecated-copy.cpp
===
--- clang/test/SemaCXX/deprecated-copy.cpp
+++ clang/test/SemaCXX/deprecated-copy.cpp
@@ -1,23 +1,9 @@
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify
 // RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy -verify
-// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy-dtor -DDEPRECATED_COPY_DTOR -verify
-// RUN: %clang_cc1 -std=c++11 %s -Wextra -verify
 
-#ifdef DEPRECATED_COPY_DTOR
-struct A {
-  int *ptr;
-  ~A() { delete ptr; } // expected-warning {{definition of implicit copy constructor for 'A' is deprecated because it has a user-declared destructor}}
+struct S {
+int i;
+S& operator=(const S&) = delete; // expected-warning {{definition of implicit copy constructor for 'S' is deprecated because it has a user-declared copy assignment operator}}
 };
 
-void foo() {
-  A a{};
-  A b = a; // expected-note {{implicit copy constructor for 'A' first required here}}
-}
-#else
-struct B {
-  B =(const B &); // expected-warning {{definition of implicit copy constructor for 'B' is deprecated because it has a user-declared copy assignment operator}}
-};
-
-void bar() {
-  B b1, b2(b1); // expected-note {{implicit copy constructor for 'B' first required here}}
-}
-#endif
+S test(const S& s) { return S(s); } // expected-note {{implicit copy constructor for 'S' first required here}}
\ No newline at end of file
Index: clang/test/SemaCXX/deprecated-copy-dtor.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/deprecated-copy-dtor.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy-dtor -verify
+
+// definitions for std::move
+namespace std {
+template  struct remove_reference { typedef T type; };
+template  struct remove_reference { typedef T type; };
+template  struct remove_reference { typedef T type; };
+
+template  typename remove_reference::type &(T &);
+} // namespace std
+
+class ITest {
+public:
+  virtual ~ITest() = default; // 

[PATCH] D79714: [Diagnostics] Restore -Wdeprecated warning when user-declared copy assignment operator is defined as deleted (PR45634)

2020-07-25 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 updated this revision to Diff 280693.
xbolva00 added a comment.

More tests


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

https://reviews.llvm.org/D79714

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/SemaCXX/deprecated-copy-dtor.cpp
  clang/test/SemaCXX/deprecated-copy.cpp
  clang/test/SemaCXX/deprecated-dtor-user-provided.cpp
  clang/test/SemaCXX/deprecated-user-provided.cpp
  clang/test/SemaCXX/deprecated.cpp

Index: clang/test/SemaCXX/deprecated.cpp
===
--- clang/test/SemaCXX/deprecated.cpp
+++ clang/test/SemaCXX/deprecated.cpp
@@ -103,10 +103,10 @@
   void g() { c1 = c2; } // expected-note {{implicit copy assignment operator for 'DeprecatedCopy::Dtor' first required here}}
 
   struct DefaultedDtor {
-~DefaultedDtor() = default;
-  };
-  DefaultedDtor d1, d2(d1);
-  void h() { d1 = d2; }
+~DefaultedDtor() = default; // expected-warning {{definition of implicit copy constructor for 'DefaultedDtor' is deprecated because it has a user-declared destructor}}
+  };// expected-warning@-1 {{definition of implicit copy assignment operator for 'DefaultedDtor' is deprecated because it has a user-declared destructor}}
+  DefaultedDtor d1, d2(d1); // expected-note {{in implicit copy constructor for 'DeprecatedCopy::DefaultedDtor' first required here}}
+  void h() { d1 = d2; } // expected-note {{in implicit copy assignment operator for 'DeprecatedCopy::DefaultedDtor' first required here}}
 }
 #endif
 
Index: clang/test/SemaCXX/deprecated-user-provided.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/deprecated-user-provided.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy-user-provided -verify
+
+struct A {
+  A =(const A &); // expected-warning {{definition of implicit copy constructor for 'A' is deprecated because it has a user-declared copy assignment operator}}
+};
+
+void foo() {
+  A a1, a2(a1); // expected-note {{implicit copy constructor for 'A' first required here}}
+}
Index: clang/test/SemaCXX/deprecated-dtor-user-provided.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/deprecated-dtor-user-provided.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy-dtor-user-provided -verify
+
+struct A {
+  int *ptr;
+  ~A(); // expected-warning {{definition of implicit copy constructor for 'A' is deprecated because it has a user-declared destructor}}
+};
+
+void foo() {
+  A a{};
+  A b = a; // expected-note {{implicit copy constructor for 'A' first required here}}
+}
Index: clang/test/SemaCXX/deprecated-copy.cpp
===
--- clang/test/SemaCXX/deprecated-copy.cpp
+++ clang/test/SemaCXX/deprecated-copy.cpp
@@ -1,23 +1,9 @@
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify
 // RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy -verify
-// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy-dtor -DDEPRECATED_COPY_DTOR -verify
-// RUN: %clang_cc1 -std=c++11 %s -Wextra -verify
 
-#ifdef DEPRECATED_COPY_DTOR
-struct A {
-  int *ptr;
-  ~A() { delete ptr; } // expected-warning {{definition of implicit copy constructor for 'A' is deprecated because it has a user-declared destructor}}
+struct S {
+int i;
+S& operator=(const S&) = delete; // expected-warning {{definition of implicit copy constructor for 'S' is deprecated because it has a user-declared copy assignment operator}}
 };
 
-void foo() {
-  A a{};
-  A b = a; // expected-note {{implicit copy constructor for 'A' first required here}}
-}
-#else
-struct B {
-  B =(const B &); // expected-warning {{definition of implicit copy constructor for 'B' is deprecated because it has a user-declared copy assignment operator}}
-};
-
-void bar() {
-  B b1, b2(b1); // expected-note {{implicit copy constructor for 'B' first required here}}
-}
-#endif
+S test(const S& s) { return S(s); } // expected-note {{implicit copy constructor for 'S' first required here}}
\ No newline at end of file
Index: clang/test/SemaCXX/deprecated-copy-dtor.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/deprecated-copy-dtor.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy -verify
+
+struct S {
+int i;
+~A() = delete; // expected-warning {{definition of implicit copy constructor for 'S' is deprecated because it has a user-declared copy assignment operator}}
+};
+
+S test(const S& s) { return S(s); } // expected-note {{implicit copy constructor for 'S' first required here}}
\ No 

[PATCH] D79714: [Diagnostics] Restore -Wdeprecated warning when user-declared copy assignment operator is defined as deleted (PR45634)

2020-07-25 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 updated this revision to Diff 280692.
xbolva00 added a comment.

Updated. Thanks for review.


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

https://reviews.llvm.org/D79714

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/SemaCXX/deprecated-dtor-user-provided.cpp
  clang/test/SemaCXX/deprecated-user-provided.cpp
  clang/test/SemaCXX/deprecated.cpp

Index: clang/test/SemaCXX/deprecated.cpp
===
--- clang/test/SemaCXX/deprecated.cpp
+++ clang/test/SemaCXX/deprecated.cpp
@@ -103,10 +103,10 @@
   void g() { c1 = c2; } // expected-note {{implicit copy assignment operator for 'DeprecatedCopy::Dtor' first required here}}
 
   struct DefaultedDtor {
-~DefaultedDtor() = default;
-  };
-  DefaultedDtor d1, d2(d1);
-  void h() { d1 = d2; }
+~DefaultedDtor() = default; // expected-warning {{definition of implicit copy constructor for 'DefaultedDtor' is deprecated because it has a user-declared destructor}}
+  };// expected-warning@-1 {{definition of implicit copy assignment operator for 'DefaultedDtor' is deprecated because it has a user-declared destructor}}
+  DefaultedDtor d1, d2(d1); // expected-note {{in implicit copy constructor for 'DeprecatedCopy::DefaultedDtor' first required here}}
+  void h() { d1 = d2; } // expected-note {{in implicit copy assignment operator for 'DeprecatedCopy::DefaultedDtor' first required here}}
 }
 #endif
 
Index: clang/test/SemaCXX/deprecated-user-provided.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/deprecated-user-provided.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy-user-provided -verify
+
+struct A {
+  A =(const A &); // expected-warning {{definition of implicit copy constructor for 'A' is deprecated because it has a user-declared copy assignment operator}}
+};
+
+void foo() {
+  A a1, a2(a1); // expected-note {{implicit copy constructor for 'A' first required here}}
+}
Index: clang/test/SemaCXX/deprecated-dtor-user-provided.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/deprecated-dtor-user-provided.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify
+// RUN: %clang_cc1 -std=c++11 %s -Wdeprecated-copy-dtor-user-provided -verify
+
+struct A {
+  int *ptr;
+  ~A(); // expected-warning {{definition of implicit copy constructor for 'A' is deprecated because it has a user-declared destructor}}
+};
+
+void foo() {
+  A a{};
+  A b = a; // expected-note {{implicit copy constructor for 'A' first required here}}
+}
Index: clang/lib/Sema/SemaDeclCXX.cpp
===
--- clang/lib/Sema/SemaDeclCXX.cpp
+++ clang/lib/Sema/SemaDeclCXX.cpp
@@ -13932,12 +13932,20 @@
 assert(UserDeclaredOperation);
   }
 
-  if (UserDeclaredOperation && UserDeclaredOperation->isUserProvided()) {
-S.Diag(UserDeclaredOperation->getLocation(),
-   isa(UserDeclaredOperation)
-   ? diag::warn_deprecated_copy_dtor_operation
-   : diag::warn_deprecated_copy_operation)
-<< RD << /*copy assignment*/ !isa(CopyOp);
+  if (UserDeclaredOperation) {
+bool UDOIsUserProvided = UserDeclaredOperation->isUserProvided();
+bool UDOIsDestructor = isa(UserDeclaredOperation);
+bool IsCopyAssignment = !isa(CopyOp);
+unsigned DiagID =
+(UDOIsUserProvided && UDOIsDestructor)
+? diag::warn_deprecated_copy_dtor_operation_user_provided
+: (UDOIsUserProvided && !UDOIsDestructor)
+? diag::warn_deprecated_copy_operation_user_provided
+: (!UDOIsUserProvided && UDOIsDestructor)
+? diag::warn_deprecated_copy_dtor_operation
+: diag::warn_deprecated_copy_operation;
+S.Diag(UserDeclaredOperation->getLocation(), DiagID)
+<< RD << /*copy assignment*/ IsCopyAssignment;
   }
 }
 
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -564,6 +564,12 @@
   "definition of implicit copy %select{constructor|assignment operator}1 "
   "for %0 is deprecated because it has a user-declared destructor">,
   InGroup, DefaultIgnore;
+def warn_deprecated_copy_operation_user_provided : Warning<
+  warn_deprecated_copy_operation.Text>,
+  InGroup, DefaultIgnore;
+def warn_deprecated_copy_dtor_operation_user_provided : Warning<
+  warn_deprecated_copy_dtor_operation.Text>,
+  InGroup, DefaultIgnore;
 def warn_cxx17_compat_exception_spec_in_signature : Warning<
   "mangled name of %0 will change in C++17 due to non-throwing 

[clang] 6a75496 - [Driver] Define LinkOption and fix forwarded options to GCC for linking

2020-07-25 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-07-25T12:33:18-07:00
New Revision: 6a75496836ea14bcfd2f4b59d35a1cad4ac58cee

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

LOG: [Driver] Define LinkOption and fix forwarded options to GCC for linking

Many driver options are neither 'DriverOption' nor 'LinkerInput'. When gcc is
used for linking, these options get forwarded even if they don't have anything
to do with linking. Among these options, clang-specific ones can cause gcc to
error.

Just use 'OPT_Link_Group' and a new flag 'LinkOption' for options which already
have a group.

gfortran support apparently bit rots (which does not seem to make much sense). 
XFAIL the test.

Added: 


Modified: 
clang/include/clang/Driver/Options.h
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Gnu.cpp
clang/test/Driver/gcc_forward.c
clang/test/Driver/gfortran.f90

Removed: 




diff  --git a/clang/include/clang/Driver/Options.h 
b/clang/include/clang/Driver/Options.h
index 7c5cddd9e896..9831efda4e58 100644
--- a/clang/include/clang/Driver/Options.h
+++ b/clang/include/clang/Driver/Options.h
@@ -33,7 +33,8 @@ enum ClangFlags {
   CC1Option = (1 << 10),
   CC1AsOption = (1 << 11),
   NoDriverOption = (1 << 12),
-  Ignored = (1 << 13)
+  LinkOption = (1 << 13),
+  Ignored = (1 << 14),
 };
 
 enum ID {

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 700a5c4578f6..b6e31700c0a6 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -52,6 +52,10 @@ def CC1AsOption : OptionFlag;
 // NoDriverOption - This option should not be accepted by the driver.
 def NoDriverOption : OptionFlag;
 
+// If an option affects linking, but has a primary group (so Link_Group cannot
+// be used), add this flag.
+def LinkOption : OptionFlag;
+
 // A short name to show in documentation. The name will be interpreted as rST.
 class DocName { string DocName = name; }
 
@@ -573,7 +577,7 @@ def config_system_dir_EQ : Joined<["--"], 
"config-system-dir=">, Flags<[DriverOp
   HelpText<"System directory for configuration files">;
 def config_user_dir_EQ : Joined<["--"], "config-user-dir=">, 
Flags<[DriverOption, HelpHidden]>,
   HelpText<"User directory for configuration files">;
-def coverage : Flag<["-", "--"], "coverage">, Flags<[CoreOption]>;
+def coverage : Flag<["-", "--"], "coverage">, Group, 
Flags<[CoreOption]>;
 def cpp_precomp : Flag<["-"], "cpp-precomp">, Group;
 def current__version : JoinedOrSeparate<["-"], "current_version">;
 def cxx_isystem : JoinedOrSeparate<["-"], "cxx-isystem">, Group,
@@ -1747,7 +1751,7 @@ def fpass_plugin_EQ : Joined<["-"], "fpass-plugin=">,
   HelpText<"Load pass plugin from a dynamic shared object file (only with new 
pass manager).">;
 defm preserve_as_comments : OptOutFFlag<"preserve-as-comments", "",
   "Do not preserve comments in inline assembly">;
-def fprofile_arcs : Flag<["-"], "fprofile-arcs">, Group;
+def fprofile_arcs : Flag<["-"], "fprofile-arcs">, Group, 
Flags<[LinkOption]>;
 def fno_profile_arcs : Flag<["-"], "fno-profile-arcs">, Group;
 def framework : Separate<["-"], "framework">, Flags<[LinkerInput]>;
 def frandom_seed_EQ : Joined<["-"], "frandom-seed=">, 
Group;
@@ -2724,7 +2728,7 @@ def nostdinc : Flag<["-"], "nostdinc">, 
Flags<[CoreOption]>;
 def nostdlibinc : Flag<["-"], "nostdlibinc">;
 def nostdincxx : Flag<["-"], "nostdinc++">, Flags<[CC1Option]>,
   HelpText<"Disable standard #include directories for the C++ standard 
library">;
-def nostdlib : Flag<["-"], "nostdlib">;
+def nostdlib : Flag<["-"], "nostdlib">, Group;
 def nostdlibxx : Flag<["-"], "nostdlib++">;
 def object : Flag<["-"], "object">;
 def o : JoinedOrSeparate<["-"], "o">, Flags<[DriverOption, RenderAsInput, 
CC1Option, CC1AsOption]>,
@@ -2768,15 +2772,15 @@ def pthread : Flag<["-"], "pthread">, 
Flags<[CC1Option]>,
   HelpText<"Support POSIX threads in generated code">;
 def no_pthread : Flag<["-"], "no-pthread">, Flags<[CC1Option]>;
 def p : Flag<["-"], "p">;
-def pie : Flag<["-"], "pie">;
-def static_pie : Flag<["-"], "static-pie">;
+def pie : Flag<["-"], "pie">, Group;
+def static_pie : Flag<["-"], "static-pie">, Group;
 def read__only__relocs : Separate<["-"], "read_only_relocs">;
 def remap : Flag<["-"], "remap">;
 def rewrite_objc : Flag<["-"], "rewrite-objc">, 
Flags<[DriverOption,CC1Option]>,
   HelpText<"Rewrite Objective-C source to C++">, Group;
 def rewrite_legacy_objc : Flag<["-"], "rewrite-legacy-objc">, 
Flags<[DriverOption]>,
   HelpText<"Rewrite Legacy Objective-C source to C++">;
-def rdynamic : Flag<["-"], "rdynamic">;
+def rdynamic : Flag<["-"], "rdynamic">, Group;
 def resource_dir : Separate<["-"], "resource-dir">,
   Flags<[DriverOption, CC1Option, CoreOption, 

[PATCH] D81678: Introduce noundef attribute at call sites for stricter poison analysis

2020-07-25 Thread Gui Andrade via Phabricator via cfe-commits
guiand updated this revision to Diff 280622.
guiand added a comment.

Added an across-the-board test with several different interesting cases. 
@rsmith, I'm not sure how to test things like VTables/VTTs, since afaik the way 
they would be exposed to function attributes would be if a struct is being 
passed by value. But in that case, we currently never emit noundef.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81678

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/attr-noundef.cpp
  clang/test/CodeGen/indirect-noundef.cpp

Index: clang/test/CodeGen/indirect-noundef.cpp
===
--- /dev/null
+++ clang/test/CodeGen/indirect-noundef.cpp
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -O0 -emit-llvm -o - %s | FileCheck %s
+
+union u1 {
+  int val;
+};
+
+// CHECK: @indirect_callee_int_ptr = global i32 (i32)*
+int (*indirect_callee_int_ptr)(int);
+// CHECK: @indirect_callee_union_ptr = global i32 (i32)*
+union u1 (*indirect_callee_union_ptr)(union u1);
+
+// CHECK-LABEL: define noundef i32 @{{.*}}indirect_callee_int{{.*}}(i32 noundef %
+int indirect_callee_int(int a) { return a; }
+// CHECK-LABEL: define i32 @{{.*}}indirect_callee_union{{.*}}(i32 %
+union u1 indirect_callee_union(union u1 a) {
+  return a;
+}
+
+int main() {
+  // CHECK: call noundef i32 @{{.*}}indirect_callee_int{{.*}}(i32 noundef 0)
+  indirect_callee_int(0);
+  // CHECK: call i32 @{{.*}}indirect_callee_union{{.*}}(i32 %
+  indirect_callee_union((union u1){0});
+
+  indirect_callee_int_ptr = indirect_callee_int;
+  indirect_callee_union_ptr = indirect_callee_union;
+
+  // CHECK: call noundef i32 %{{.*}}(i32 noundef 0)
+  indirect_callee_int_ptr(0);
+  // CHECK: call i32 %{{.*}}(i32 %
+  indirect_callee_union_ptr((union u1){});
+
+  return 0;
+}
Index: clang/test/CodeGen/attr-noundef.cpp
===
--- /dev/null
+++ clang/test/CodeGen/attr-noundef.cpp
@@ -0,0 +1,152 @@
+// RUN: %clang_cc1 -x c++ -S -emit-llvm %s -o - | FileCheck %s
+
+// Passing structs by value
+// TODO: No structs may currently be marked noundef
+
+namespace check_structs {
+struct Trivial {
+  int a;
+};
+Trivial ret_trivial() { return {}; }
+void pass_trivial(Trivial e) {}
+// CHECK: define i32 @{{.*}}ret_trivial
+// CHECK: define void @{{.*}}pass_trivial{{.*}}(i32 %
+
+struct NoCopy {
+  int a;
+  NoCopy(NoCopy &) = delete;
+};
+NoCopy ret_nocopy() { return {}; }
+void pass_nocopy(NoCopy e) {}
+// CHECK: define void @{{.*}}ret_nocopy{{.*}}(%"struct.check_structs::NoCopy"* noalias sret align 4 %
+// CHECK: define void @{{.*}}pass_nocopy{{.*}}(%"struct.check_structs::NoCopy"* noundef %
+
+struct Huge {
+  int a[1024];
+};
+Huge ret_huge() { return {}; }
+void pass_huge(Huge h) {}
+// CHECK: define void @{{.*}}ret_huge{{.*}}(%"struct.check_structs::Huge"* noalias sret align 4 %
+// CHECK: define void @{{.*}}pass_huge{{.*}}(%"struct.check_structs::Huge"* noundef byval
+} // namespace check_structs
+
+// Passing unions by value
+// No unions may be marked noundef
+
+namespace check_unions {
+union Trivial {
+  int a;
+};
+Trivial ret_trivial() { return {}; }
+void pass_trivial(Trivial e) {}
+// CHECK: define i32 @{{.*}}ret_trivial
+// CHECK: define void @{{.*}}pass_trivial{{.*}}(i32 %
+
+union NoCopy {
+  int a;
+  NoCopy(NoCopy &) = delete;
+};
+NoCopy ret_nocopy() { return {}; }
+void pass_nocopy(NoCopy e) {}
+// CHECK: define void @{{.*}}ret_nocopy{{.*}}(%"union.check_unions::NoCopy"* noalias sret align 4 %
+// CHECK: define void @{{.*}}pass_nocopy{{.*}}(%"union.check_unions::NoCopy"* noundef %
+} // namespace check_unions
+
+// Passing `this` pointers
+// `this` pointer must always be defined
+
+namespace check_this {
+struct Object {
+  int data[];
+
+  Object() {
+this->data[0] = 0;
+  }
+  int getData() {
+return this->data[0];
+  }
+  Object *getThis() {
+return this;
+  }
+};
+
+void use_object() {
+  Object obj;
+  obj.getData();
+  obj.getThis();
+}
+// CHECK: define linkonce_odr void @{{.*}}Object{{.*}}(%"struct.check_this::Object"* noundef %
+// CHECK: define linkonce_odr noundef i32 @{{.*}}Object{{.*}}getData{{.*}}(%"struct.check_this::Object"* noundef %
+// CHECK: define linkonce_odr noundef %"struct.check_this::Object"* @{{.*}}Object{{.*}}getThis{{.*}}(%"struct.check_this::Object"* noundef %
+} // namespace check_this
+
+// Passing vector types
+
+namespace check_vecs {
+typedef int __attribute__((vector_size(12))) i32x3;
+i32x3 ret_vec() {
+  return {};
+}
+void pass_vec(i32x3 v) {
+}
+
+// CHECK: define noundef <3 x i32> @{{.*}}ret_vec{{.*}}()
+// CHECK: define void @{{.*}}pass_vec{{.*}}(<3 x i32> noundef %
+} // namespace 

[PATCH] D82317: [Clang/Test]: Update tests where `noundef` attribute is necessary

2020-07-25 Thread Gui Andrade via Phabricator via cfe-commits
guiand updated this revision to Diff 280588.
guiand added a comment.

Update tests to reflect more strict noundef rules


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82317

Files:
  clang/test/ARCMT/objcmt-instancetype.m
  clang/test/ARCMT/objcmt-instancetype.m.result
  clang/test/ARCMT/objcmt-numeric-literals.m
  clang/test/ARCMT/objcmt-numeric-literals.m.result
  clang/test/CXX/except/except.spec/p14-ir.cpp
  clang/test/CXX/expr/expr.prim/expr.prim.lambda/blocks-irgen.mm
  clang/test/CXX/modules-ts/codegen-basics.cppm
  clang/test/CXX/special/class.copy/p3.cpp
  clang/test/CodeGen/2004-02-13-Memset.c
  clang/test/CodeGen/2004-06-17-UnorderedCompares.c
  clang/test/CodeGen/2006-05-19-SingleEltReturn.c
  clang/test/CodeGen/2007-06-18-SextAttrAggregate.c
  clang/test/CodeGen/2009-02-13-zerosize-union-field.c
  clang/test/CodeGen/2009-05-04-EnumInreg.c
  clang/test/CodeGen/64bit-swiftcall.c
  clang/test/CodeGen/aapcs-align.cpp
  clang/test/CodeGen/aapcs-bitfield.c
  clang/test/CodeGen/aapcs64-align.cpp
  clang/test/CodeGen/aarch64-args.cpp
  clang/test/CodeGen/aarch64-bf16-getset-intrinsics.c
  clang/test/CodeGen/aarch64-byval-temp.c
  clang/test/CodeGen/aarch64-neon-3v.c
  clang/test/CodeGen/aarch64-neon-across.c
  clang/test/CodeGen/aarch64-neon-dot-product.c
  clang/test/CodeGen/aarch64-neon-extract.c
  clang/test/CodeGen/aarch64-neon-fcvt-intrinsics.c
  clang/test/CodeGen/aarch64-neon-fma.c
  clang/test/CodeGen/aarch64-neon-fp16fml.c
  clang/test/CodeGen/aarch64-neon-ldst-one.c
  clang/test/CodeGen/aarch64-neon-scalar-copy.c
  clang/test/CodeGen/aarch64-neon-scalar-x-indexed-elem.c
  clang/test/CodeGen/aarch64-neon-tbl.c
  clang/test/CodeGen/aarch64-neon-vcombine.c
  clang/test/CodeGen/aarch64-neon-vget-hilo.c
  clang/test/CodeGen/aarch64-neon-vget.c
  clang/test/CodeGen/aarch64-poly128.c
  clang/test/CodeGen/aarch64-poly64.c
  clang/test/CodeGen/aarch64-varargs.c
  clang/test/CodeGen/address-space-avr.c
  clang/test/CodeGen/address-space-field1.c
  clang/test/CodeGen/address-space.c
  clang/test/CodeGen/aggregate-assign-call.c
  clang/test/CodeGen/aix-return.c
  clang/test/CodeGen/aix-struct-arg.c
  clang/test/CodeGen/aix-vaargs.c
  clang/test/CodeGen/alias.c
  clang/test/CodeGen/align_value.cpp
  clang/test/CodeGen/alloc-align-attr.c
  clang/test/CodeGen/arc/arguments.c
  clang/test/CodeGen/arm-aapcs-vfp.c
  clang/test/CodeGen/arm-abi-vector.c
  clang/test/CodeGen/arm-arguments.c
  clang/test/CodeGen/arm-bf16-params-returns.c
  clang/test/CodeGen/arm-byval-align.c
  clang/test/CodeGen/arm-cmse-attr.c
  clang/test/CodeGen/arm-cmse-call.c
  clang/test/CodeGen/arm-float-helpers.c
  clang/test/CodeGen/arm-fp16-arguments.c
  clang/test/CodeGen/arm-homogenous.c
  clang/test/CodeGen/arm-mangle-bf16.cpp
  clang/test/CodeGen/arm-mve-intrinsics/vld24.c
  clang/test/CodeGen/arm-neon-directed-rounding.c
  clang/test/CodeGen/arm-neon-dot-product.c
  clang/test/CodeGen/arm-neon-fma.c
  clang/test/CodeGen/arm-neon-numeric-maxmin.c
  clang/test/CodeGen/arm-neon-vcvtX.c
  clang/test/CodeGen/arm-swiftcall.c
  clang/test/CodeGen/arm-varargs.c
  clang/test/CodeGen/arm-vector-arguments.c
  clang/test/CodeGen/arm-vfp16-arguments.c
  clang/test/CodeGen/arm-vfp16-arguments2.cpp
  clang/test/CodeGen/arm64-aapcs-arguments.c
  clang/test/CodeGen/arm64-abi-vector.c
  clang/test/CodeGen/arm64-arguments.c
  clang/test/CodeGen/arm64-microsoft-arguments.cpp
  clang/test/CodeGen/arm64-microsoft-intrinsics.c
  clang/test/CodeGen/arm64_32-vaarg.c
  clang/test/CodeGen/arm64_32.c
  clang/test/CodeGen/arm64_vcopy.c
  clang/test/CodeGen/arm64_vdupq_n_f64.c
  clang/test/CodeGen/arm_neon_intrinsics.c
  clang/test/CodeGen/armv7k-abi.c
  clang/test/CodeGen/asm-label.c
  clang/test/CodeGen/assume-aligned-and-alloc-align-attributes.c
  clang/test/CodeGen/atomic-arm64.c
  clang/test/CodeGen/atomic-ops-libcall.c
  clang/test/CodeGen/atomic-ops.c
  clang/test/CodeGen/atomic_ops.c
  clang/test/CodeGen/atomics-inlining.c
  clang/test/CodeGen/attr-func-def.c
  clang/test/CodeGen/attr-naked.c
  clang/test/CodeGen/attr-no-tail.c
  clang/test/CodeGen/attr-nomerge.cpp
  clang/test/CodeGen/attr-optnone.c
  clang/test/CodeGen/attr-target-mv-func-ptrs.c
  clang/test/CodeGen/attr-target-mv-va-args.c
  clang/test/CodeGen/attr-target-mv.c
  clang/test/CodeGen/attr-x86-interrupt.c
  clang/test/CodeGen/attributes.c
  clang/test/CodeGen/available-externally-hidden.cpp
  clang/test/CodeGen/available-externally-suppress.c
  clang/test/CodeGen/avx2-builtins.c
  clang/test/CodeGen/avx512-reduceMinMaxIntrin.c
  clang/test/CodeGen/big-atomic-ops.c
  clang/test/CodeGen/bittest-intrin.c
  clang/test/CodeGen/blocks.c
  clang/test/CodeGen/bool-convert.c
  clang/test/CodeGen/builtin-align-array.c
  clang/test/CodeGen/builtin-align.c
  clang/test/CodeGen/builtin-assume-aligned.c
  clang/test/CodeGen/builtin-attributes.c
  clang/test/CodeGen/builtin-memfns.c
  

Re: [PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-07-25 Thread Vedant Kumar via cfe-commits
Thanks, that addressed the issue.

> On Jul 24, 2020, at 1:41 PM, Petr Hosek  wrote:
> 
> Thanks for the heads up, this should be addressed by 
> c86f56e32e724c6018e579bb2bc11e667c96fc96, let me know if there are other 
> issues.
> 
> On Fri, Jul 24, 2020 at 12:33 PM Vedant Kumar via Phabricator 
> mailto:revi...@reviews.llvm.org>> wrote:
> vsk added a comment.
> 
> @phosek I suspect this is causing a cmake error on the lldb standalone bot, 
> would you mind taking a look?
> 
> http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake-standalone/1858/ 
> 
> 
>   CMake Error at 
> /Users/buildslave/jenkins/workspace/lldb-cmake-standalone/clang-build/lib/cmake/llvm/AddLLVM.cmake:823
>  (add_executable):
> Target "lit-cpuid" links to target "ZLIB::ZLIB" but the target was not
> found.  Perhaps a find_package() call is missing for an IMPORTED target, 
> or
> an ALIAS target is missing?
>   Call Stack (most recent call first):
> cmake/modules/AddLLDB.cmake:165 (add_llvm_executable)
> utils/lit-cpuid/CMakeLists.txt:1 (add_lldb_executable)
> 
> 
> Repository:
>   rG LLVM Github Monorepo
> 
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D79219/new/ 
> 
> https://reviews.llvm.org/D79219 
> 
> 
> 

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


[PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-07-25 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added a comment.

@phosek I suspect this is causing a cmake error on the lldb standalone bot, 
would you mind taking a look?

http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake-standalone/1858/

  CMake Error at 
/Users/buildslave/jenkins/workspace/lldb-cmake-standalone/clang-build/lib/cmake/llvm/AddLLVM.cmake:823
 (add_executable):
Target "lit-cpuid" links to target "ZLIB::ZLIB" but the target was not
found.  Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
  Call Stack (most recent call first):
cmake/modules/AddLLDB.cmake:165 (add_llvm_executable)
utils/lit-cpuid/CMakeLists.txt:1 (add_lldb_executable)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79219



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


Re: [PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-07-25 Thread Petr Hosek via cfe-commits
Thanks for the heads up, this should be addressed
by c86f56e32e724c6018e579bb2bc11e667c96fc96, let me know if there are other
issues.

On Fri, Jul 24, 2020 at 12:33 PM Vedant Kumar via Phabricator <
revi...@reviews.llvm.org> wrote:

> vsk added a comment.
>
> @phosek I suspect this is causing a cmake error on the lldb standalone
> bot, would you mind taking a look?
>
> http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake-standalone/1858/
>
>   CMake Error at
> /Users/buildslave/jenkins/workspace/lldb-cmake-standalone/clang-build/lib/cmake/llvm/AddLLVM.cmake:823
> (add_executable):
> Target "lit-cpuid" links to target "ZLIB::ZLIB" but the target was not
> found.  Perhaps a find_package() call is missing for an IMPORTED
> target, or
> an ALIAS target is missing?
>   Call Stack (most recent call first):
> cmake/modules/AddLLDB.cmake:165 (add_llvm_executable)
> utils/lit-cpuid/CMakeLists.txt:1 (add_lldb_executable)
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D79219/new/
>
> https://reviews.llvm.org/D79219
>
>
>
>


smime.p7s
Description: S/MIME Cryptographic Signature
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D84499: [clangd] Add more logs and attach tracers to remote index server routines

2020-07-25 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments.



Comment at: clang-tools-extra/clangd/index/remote/server/Server.cpp:96
+} Counter(Request->DebugString());
+return std::forward(Call)(
+*Index, ClangdRequest, [&](const StreamType ) {

kbobyrev wrote:
> sammccall wrote:
> > I don't think you need forward here... just take the param by const 
> > reference?
> How do I do that? The problem is that some functions return `bool` and one 
> `void`, so I can't really assign the result to variable and then return it.
Currently you have 
```
template (IndexCall&& Call) {
  forward(Call);
}
```
but I think this would work fine here:
```
template (const IndexCall& Call) {
  IndexCall(Call);
}
```
(nothing particularly wrong with this use of forward, but "more template goop" 
feels particularly expensive here.



Comment at: clang-tools-extra/clangd/index/remote/server/Server.cpp:49
+llvm::cl::desc("Pretty-print JSON output"),
+llvm::cl::init(true),
+};

kbobyrev wrote:
> sammccall wrote:
> > kadircet wrote:
> > > this sounds like a debug feature, do we really want it to be true by 
> > > default?
> > This option is not worth having at all, IMO.
> Why not? It's relatively hard to read trace files otherwise. Do you think 
> they should be pretty-printed by default?
FWIW, I've never had to read them except when initially developing/debugging 
the trace feature.
(The most I have to do is fix up a broken end-of-file, and events are 
one-per-line in non-pretty anyway...)

I think either always-on or always-off is better than having a flag.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84499



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


[PATCH] D84499: [clangd] Add more logs and attach tracers to remote index server routines

2020-07-25 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added inline comments.



Comment at: clang-tools-extra/clangd/index/remote/server/Server.cpp:96
+} Counter(Request->DebugString());
+return std::forward(Call)(
+*Index, ClangdRequest, [&](const StreamType ) {

sammccall wrote:
> I don't think you need forward here... just take the param by const reference?
How do I do that? The problem is that some functions return `bool` and one 
`void`, so I can't really assign the result to variable and then return it.



Comment at: clang-tools-extra/clangd/index/remote/server/Server.cpp:49
+llvm::cl::desc("Pretty-print JSON output"),
+llvm::cl::init(true),
+};

sammccall wrote:
> kadircet wrote:
> > this sounds like a debug feature, do we really want it to be true by 
> > default?
> This option is not worth having at all, IMO.
Why not? It's relatively hard to read trace files otherwise. Do you think they 
should be pretty-printed by default?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84499



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