[PATCH] D12110: [SemaExpr] Re-enable missing assertion

2015-08-18 Thread Davide Italiano via cfe-commits
davide created this revision.
davide added a reviewer: rsmith.
davide added a subscriber: cfe-commits.

This has been disabled for a long time, but:
1) Initializers work (and apparently they're re reason why this was disabled).
2) various tests happen to hit this code path and the invariant seems to be 
always verified.

I propose to add this back, it may be useful to catch mistakes.

http://reviews.llvm.org/D12110

Files:
  lib/Sema/SemaExpr.cpp

Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -5085,8 +5085,7 @@
 Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty,
SourceLocation RParenLoc, Expr *InitExpr) {
   assert(Ty  ActOnCompoundLiteral(): missing type);
-  // FIXME: put back this assert when initializers are worked out.
-  //assert((InitExpr != 0)  ActOnCompoundLiteral(): missing expression);
+  assert((InitExpr != 0)  ActOnCompoundLiteral(): missing expression);
 
   TypeSourceInfo *TInfo;
   QualType literalType = GetTypeFromParser(Ty, TInfo);


Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -5085,8 +5085,7 @@
 Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty,
SourceLocation RParenLoc, Expr *InitExpr) {
   assert(Ty  ActOnCompoundLiteral(): missing type);
-  // FIXME: put back this assert when initializers are worked out.
-  //assert((InitExpr != 0)  ActOnCompoundLiteral(): missing expression);
+  assert((InitExpr != 0)  ActOnCompoundLiteral(): missing expression);
 
   TypeSourceInfo *TInfo;
   QualType literalType = GetTypeFromParser(Ty, TInfo);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r245404 - [SemaExpr] Re-enable missing assertion.

2015-08-18 Thread Davide Italiano via cfe-commits
Author: davide
Date: Tue Aug 18 21:21:12 2015
New Revision: 245404

URL: http://llvm.org/viewvc/llvm-project?rev=245404view=rev
Log:
[SemaExpr] Re-enable missing assertion.

This has been disabled for a long time, but:
1) Initializers work (and apparently they're re reason why this was disabled).
2) various tests happen to hit this code path and the invariant seems to be
always verified.

Differential Revision:  http://reviews.llvm.org/D12110
Reviewed by:rsmith

Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=245404r1=245403r2=245404view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Aug 18 21:21:12 2015
@@ -5085,8 +5085,7 @@ ExprResult
 Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty,
SourceLocation RParenLoc, Expr *InitExpr) {
   assert(Ty  ActOnCompoundLiteral(): missing type);
-  // FIXME: put back this assert when initializers are worked out.
-  //assert((InitExpr != 0)  ActOnCompoundLiteral(): missing expression);
+  assert(InitExpr  ActOnCompoundLiteral(): missing expression);
 
   TypeSourceInfo *TInfo;
   QualType literalType = GetTypeFromParser(Ty, TInfo);


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


r245051 - [Sema] main can't be declared as global variable, in C++.

2015-08-14 Thread Davide Italiano via cfe-commits
Author: davide
Date: Fri Aug 14 09:13:29 2015
New Revision: 245051

URL: http://llvm.org/viewvc/llvm-project?rev=245051view=rev
Log:
[Sema] main can't be declared as global variable, in C++.

So, we now reject that. We also warn for any external-linkage global
variable named main in C, because it results in undefined behavior.

PR:   24309
Differential Revision:  http://reviews.llvm.org/D11658
Reviewed by:rsmith

Added:
cfe/trunk/test/CXX/basic/basic.start/basic.start.main/p3.cpp
cfe/trunk/test/Sema/warn-extern-main.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=245051r1=245050r2=245051view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Aug 14 09:13:29 
2015
@@ -510,6 +510,10 @@ def warn_main_one_arg : Warningonly on
 def err_main_arg_wrong : Error%select{first|second|third|fourth}0 
 parameter of 'main' (%select{argument count|argument array|environment|
 platform-specific data}0) must be of type %1;
+def err_main_global_variable :
+Errormain cannot be declared as global variable;
+def warn_main_redefined : Warningvariable named 'main' with external linkage 

+has undefined behavior, InGroupMain;
 def ext_main_used : Extension
   ISO C++ does not allow 'main' to be used by a program, InGroupMain;
 

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=245051r1=245050r2=245051view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Aug 14 09:13:29 2015
@@ -6111,6 +6111,22 @@ Sema::ActOnVariableDeclarator(Scope *S,
 }
   }
 
+  // Special handling of variable named 'main'.
+  if (Name.isIdentifier()  Name.getAsIdentifierInfo()-isStr(main) 
+  NewVD-getDeclContext()-getRedeclContext()-isTranslationUnit() 
+  !getLangOpts().Freestanding  !NewVD-getDescribedVarTemplate()) {
+
+// C++ [basic.start.main]p3
+// A program that declares a variable main at global scope is ill-formed.
+if (getLangOpts().CPlusPlus)
+  Diag(D.getLocStart(), diag::err_main_global_variable);
+
+// In C, and external-linkage variable named main results in undefined
+// behavior.
+else if (NewVD-hasExternalFormalLinkage())
+  Diag(D.getLocStart(), diag::warn_main_redefined);
+  }
+
   if (D.isRedeclaration()  !Previous.empty()) {
 checkDLLAttributeRedeclaration(
 *this, dyn_castNamedDecl(Previous.getRepresentativeDecl()), NewVD,

Added: cfe/trunk/test/CXX/basic/basic.start/basic.start.main/p3.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/basic/basic.start/basic.start.main/p3.cpp?rev=245051view=auto
==
--- cfe/trunk/test/CXX/basic/basic.start/basic.start.main/p3.cpp (added)
+++ cfe/trunk/test/CXX/basic/basic.start/basic.start.main/p3.cpp Fri Aug 14 
09:13:29 2015
@@ -0,0 +1,66 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST1
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST2
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST3
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST4
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14 -DTEST5
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14 -DTEST6
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST7
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST8
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST9
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST10 -ffreestanding
+
+#if TEST1
+int main; // expected-error{{main cannot be declared as global variable}}
+
+#elif TEST2
+// expected-no-diagnostics
+int f () {
+  int main;
+  return main;
+}
+
+#elif TEST3
+// expected-no-diagnostics
+void x(int main) {};
+int y(int main);
+
+#elif TEST4
+// expected-no-diagnostics
+class A {
+  static int main;
+};
+
+#elif TEST5
+// expected-no-diagnostics
+templateclass T constexpr T main;
+
+#elif TEST6
+extern templateclass T constexpr T main; //expected-error{{expected 
unqualified-id}}
+
+#elif TEST7
+// expected-no-diagnostics
+namespace foo {
+  int main;
+}
+
+#elif TEST8
+void z(void)
+{
+  extern int main;  // expected-error{{main cannot be declared as global 
variable}}
+}
+
+#elif TEST9
+// expected-no-diagnostics
+int q(void)
+{
+  static int main;
+  return main;
+}
+
+#elif TEST10
+// expected-no-diagnostics
+int main;
+
+#else
+#error Unknown Test
+#endif

Added: cfe/trunk/test/Sema/warn-extern-main.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-extern-main.c?rev=245051view=auto

r245162 - [Sema] Be consistent about diagnostic wording: always use cannot.

2015-08-15 Thread Davide Italiano via cfe-commits
Author: davide
Date: Sat Aug 15 10:23:14 2015
New Revision: 245162

URL: http://llvm.org/viewvc/llvm-project?rev=245162view=rev
Log:
[Sema] Be consistent about diagnostic wording: always use cannot.

Discussed with Richard Smith.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/CXX/expr/expr.unary/expr.unary.op/p4.cpp
cfe/trunk/test/CXX/over/over.over/p2-resolve-single-template-id.cpp
cfe/trunk/test/Sema/ext_vector_casts.c
cfe/trunk/test/Sema/zvector.c
cfe/trunk/test/SemaCXX/default-assignment-operator.cpp
cfe/trunk/test/SemaCXX/vector-casts.cpp
cfe/trunk/test/SemaCXX/vector-no-lax.cpp
cfe/trunk/test/SemaObjC/arc.m
cfe/trunk/test/SemaObjCXX/exceptions.mm
cfe/trunk/test/SemaOpenCL/cond.cl
cfe/trunk/test/SemaTemplate/deduction.cpp
cfe/trunk/test/SemaTemplate/derived.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=245162r1=245161r2=245162view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sat Aug 15 10:23:14 
2015
@@ -2083,9 +2083,9 @@ def err_attribute_invalid_size : Error
 def err_attribute_zero_size : Errorzero vector size;
 def err_attribute_size_too_large : Errorvector size too large;
 def err_typecheck_vector_not_convertable : Error
-  can't convert between vector values of different size (%0 and %1);
+  cannot convert between vector values of different size (%0 and %1);
 def err_typecheck_vector_not_convertable_non_scalar : Error
-  can't convert between vector and non-scalar values (%0 and %1);
+  cannot convert between vector and non-scalar values (%0 and %1);
 def err_typecheck_vector_lengths_not_equal : Error
   vector operands do not have the same number of elements (%0 and %1);
 def err_ext_vector_component_exceeds_length : Error
@@ -2888,7 +2888,7 @@ def err_param_default_argument_on_parame
   parameter pack cannot have a default argument;
 def err_uninitialized_member_for_assign : Error
   cannot define the implicit copy assignment operator for %0, because 
-  non-static %select{reference|const}1 member %2 can't use copy 
+  non-static %select{reference|const}1 member %2 cannot use copy 
   assignment operator;
 def err_uninitialized_member_in_ctor : Error
   %select{|implicit default |inheriting }0constructor for %1 must explicitly 
@@ -2972,7 +2972,7 @@ def note_ovl_candidate_instantiation_dep
 candidate template ignored: substitution exceeded maximum template 
 instantiation depth;
 def note_ovl_candidate_underqualified : Note
-candidate template ignored: can't deduce a type for %0 that would 
+candidate template ignored: cannot deduce a type for %0 that would 
 make %2 equal %1;
 def note_ovl_candidate_substitution_failure : Note
 candidate template ignored: substitution failure%0%1;
@@ -3262,7 +3262,7 @@ def err_addr_ovl_ambiguous : Error
 def err_addr_ovl_not_func_ptrref : Error
   address of overloaded function %0 cannot be converted to type %1;
 def err_addr_ovl_no_qualifier : Error
-  can't form member pointer of type %0 without '' and class name;
+  cannot form member pointer of type %0 without '' and class name;
 
 // C++11 Literal Operators
 def err_ovl_no_viable_literal_operator : Error
@@ -4556,7 +4556,7 @@ def err_typecheck_arc_assign_self : Erro
 def err_typecheck_arc_assign_self_class_method : Error
   cannot assign to 'self' in a class method;
 def err_typecheck_arr_assign_enumeration : Error
-  fast enumeration variables can't be modified in ARC by default; 
+  fast enumeration variables cannot be modified in ARC by default; 
   declare the variable __strong to allow this;
 def warn_arc_retained_assign : Warning
   assigning retained object to %select{weak|unsafe_unretained}0 
@@ -5370,7 +5370,7 @@ def warn_objc_pointer_cxx_catch_fragile
   cannot catch an exception thrown with @throw in C++ in the non-unified 
   exception model, InGroupObjCNonUnifiedException;
 def err_objc_object_catch : Error
-  can't catch an Objective-C object by value;
+  cannot catch an Objective-C object by value;
 def err_incomplete_type_objc_at_encode : Error
   '@encode' of incomplete type %0;
 def warn_objc_circular_container : Warning

Modified: cfe/trunk/test/CXX/expr/expr.unary/expr.unary.op/p4.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.unary/expr.unary.op/p4.cpp?rev=245162r1=245161r2=245162view=diff
==
--- cfe/trunk/test/CXX/expr/expr.unary/expr.unary.op/p4.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.unary/expr.unary.op/p4.cpp Sat Aug 15 10:23:14 
2015
@@ -7,7 +7,7 @@ namespace test0 {
 templatetypename T void g(T);
 
 void test() {
-  foo(gint); // expected-error-re {{can't form member 

Re: [PATCH] D11658: [Sema] main can't be declared as global variable

2015-08-12 Thread Davide Italiano via cfe-commits
davide updated this revision to Diff 31932.
davide added a comment.

- Refactored check
- Added test for -ffreestanding in C
- Changed the diagnostic emitted

Also, thanks for your time and guidance.


http://reviews.llvm.org/D11658

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDecl.cpp
  test/CXX/basic/basic.start/basic.start.main/p3.cpp
  test/Sema/warn-extern-main.c

Index: test/Sema/warn-extern-main.c
===
--- test/Sema/warn-extern-main.c
+++ test/Sema/warn-extern-main.c
@@ -0,0 +1,56 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST1
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST2
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST3
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST4
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST5
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST6
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST7
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST8
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST9 -ffreestanding
+
+#if TEST1
+int main; // expected-warning{{external-linkage variable named 'main' has undefined behavior}}
+
+#elif TEST2
+extern int main; // expected-warning{{external-linkage variable named 'main' has undefined behavior}}
+
+#elif TEST3
+// expected-no-diagnostics
+void x() {
+  static int main;
+}
+
+#elif TEST4
+void x() {
+  extern int main; // expected-warning{{external-linkage variable named 'main' has undefined behavior}}
+}
+
+#elif TEST5
+// expected-no-diagnostics
+void x() {
+  int main;
+}
+
+#elif TEST6
+// expected-no-diagnostics
+static int main;
+
+#elif TEST7
+// expected-no-diagnostics
+void x() {
+  auto int main;
+}
+
+#elif TEST8
+// expected-no-diagnostics
+void x() {
+  register int main;
+}
+
+#elif TEST9
+// expected-no-diagnostics
+int main;
+
+#else
+#error Unknown Test
+#endif
Index: test/CXX/basic/basic.start/basic.start.main/p3.cpp
===
--- test/CXX/basic/basic.start/basic.start.main/p3.cpp
+++ test/CXX/basic/basic.start/basic.start.main/p3.cpp
@@ -0,0 +1,66 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST1
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST2
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST3
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST4
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14 -DTEST5
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14 -DTEST6
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST7
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST8
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST9
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST10 -ffreestanding
+
+#if TEST1
+int main; // expected-error{{main can't be declared as global variable}}
+
+#elif TEST2
+// expected-no-diagnostics
+int f () {
+  int main;
+  return main;
+}
+
+#elif TEST3
+// expected-no-diagnostics
+void x(int main) {};
+int y(int main);
+
+#elif TEST4
+// expected-no-diagnostics
+class A {
+  static int main;
+};
+
+#elif TEST5
+// expected-no-diagnostics
+templateclass T constexpr T main;
+
+#elif TEST6
+extern templateclass T constexpr T main; //expected-error{{expected unqualified-id}}
+
+#elif TEST7
+// expected-no-diagnostics
+namespace foo {
+  int main;
+}
+
+#elif TEST8
+void z(void)
+{
+  extern int main;  // expected-error{{main can't be declared as global variable}}
+}
+
+#elif TEST9
+// expected-no-diagnostics
+int q(void)
+{
+  static int main;
+  return main;
+}
+
+#elif TEST10
+// expected-no-diagnostics
+int main;
+
+#else
+#error Unknown Test
+#endif
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -6111,6 +6111,22 @@
 }
   }
 
+  // Special handling of variable named 'main'.
+  if (Name.isIdentifier()  Name.getAsIdentifierInfo()-isStr(main) 
+  NewVD-getDeclContext()-getRedeclContext()-isTranslationUnit() 
+  !getLangOpts().Freestanding  !NewVD-getDescribedVarTemplate()) {
+
+// C++ [basic.start.main]p3
+// A program that declares a variable main at global scope is ill-formed.
+if (getLangOpts().CPlusPlus)
+  Diag(D.getLocStart(), diag::err_main_global_variable);
+
+// In C, and external-linkage variable named main results in undefined
+// behavior.
+else if (NewVD-hasExternalFormalLinkage())
+  Diag(D.getLocStart(), diag::warn_main_redefined);
+  }
+
   if (D.isRedeclaration()  !Previous.empty()) {
 checkDLLAttributeRedeclaration(
 *this, dyn_castNamedDecl(Previous.getRepresentativeDecl()), NewVD,
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -510,6 +510,9 @@
 def err_main_arg_wrong : Error%select{first|second|third|fourth}0 
 parameter of 'main' (%select{argument count|argument 

Re: [PATCH] D13854: Template class: emit better diagnostic in case of missing template argument list

2015-11-09 Thread Davide Italiano via cfe-commits
davide added a comment.

Gentle Monday morning ping :)


Repository:
  rL LLVM

http://reviews.llvm.org/D13854



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


r252793 - [SemaDeclCXX] Use isTemplateParamScope() rather than accessing raw bits.

2015-11-11 Thread Davide Italiano via cfe-commits
Author: davide
Date: Wed Nov 11 14:06:35 2015
New Revision: 252793

URL: http://llvm.org/viewvc/llvm-project?rev=252793=rev
Log:
[SemaDeclCXX] Use isTemplateParamScope() rather than accessing raw bits.

Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=252793=252792=252793=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Nov 11 14:06:35 2015
@@ -7572,7 +7572,7 @@ Decl *Sema::ActOnUsingDirective(Scope *S
   assert(IdentLoc.isValid() && "Invalid NamespceName location.");
 
   // This can only happen along a recovery path.
-  while (S->getFlags() & Scope::TemplateParamScope)
+  while (S->isTemplateParamScope())
 S = S->getParent();
   assert(S->getFlags() & Scope::DeclScope && "Invalid Scope.");
 
@@ -8531,7 +8531,7 @@ Decl *Sema::ActOnAliasDeclaration(Scope
   TypeResult Type,
   Decl *DeclFromDeclSpec) {
   // Skip up to the relevant declaration scope.
-  while (S->getFlags() & Scope::TemplateParamScope)
+  while (S->isTemplateParamScope())
 S = S->getParent();
   assert((S->getFlags() & Scope::DeclScope) &&
  "got alias-declaration outside of declaration scope");


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


Re: [PATCH] D13854: Template class: emit better diagnostic in case of missing template argument list

2015-11-01 Thread Davide Italiano via cfe-commits
davide added a comment.

Gentle ping.


Repository:
  rL LLVM

http://reviews.llvm.org/D13854



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


[PATCH] D13854: Template class: emit better diagnostic in case of missing template argument list

2015-10-18 Thread Davide Italiano via cfe-commits
davide created this revision.
davide added a reviewer: rsmith.
davide added a subscriber: cfe-commits.
davide set the repository for this revision to rL LLVM.

Richard, this implements what you proposed in 
https://llvm.org/bugs/show_bug.cgi?id=25223 , hopefully in the correct way.
This is what we emit now:

template.cpp:7:3: error: missing template argument list for class template 'X'
T X::foo(void)
  ^
  X
template.cpp:2:7: note: 'X' declared here
class X {
  ^
1 error generated.


I will tackle the case where we emit a terrible diagnostic for ambigous lookup 
separately.



Repository:
  rL LLVM

http://reviews.llvm.org/D13854

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaCXXScopeSpec.cpp
  test/SemaTemplate/temp_arg_lookup.cpp

Index: test/SemaTemplate/temp_arg_lookup.cpp
===
--- test/SemaTemplate/temp_arg_lookup.cpp
+++ test/SemaTemplate/temp_arg_lookup.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template
+class X { // expected-note{{declared here}}
+  T foo(void);
+};
+
+template
+T X::foo(void)  // expected-error{{missing template argument list for class 
template}}}
+{
+  return 0;
+}
Index: lib/Sema/SemaCXXScopeSpec.cpp
===
--- lib/Sema/SemaCXXScopeSpec.cpp
+++ lib/Sema/SemaCXXScopeSpec.cpp
@@ -771,9 +771,29 @@
   }
 
   if (!Found.empty()) {
-if (TypeDecl *TD = Found.getAsSingle())
+if (ClassTemplateDecl *CTD = Found.getAsSingle()) {
+  TemplateParameterList *TPL = CTD->getTemplateParameters();
+  assert(TPL && "NULL template parameter list");
+  std::string FixString = Identifier.getName();
+  FixString += "<";
+  bool FirstArg = true;
+  for (NamedDecl *TemplArg : *TPL) {
+if (FirstArg)
+  FirstArg = false;
+else
+  FixString += ", ";
+FixString += TemplArg->getName();
+  }
+  FixString += ">";
+  Diag(IdentifierLoc, diag::err_missing_argument_list) << 
+  << FixItHint::CreateReplacement(IdentifierLoc, FixString);
+  if (NamedDecl *ND = Found.getAsSingle())
+Diag(ND->getLocation(), diag::note_entity_declared_at) << 
+}
+else if (TypeDecl *TD = Found.getAsSingle()) {
   Diag(IdentifierLoc, diag::err_expected_class_or_namespace)
   << QualType(TD->getTypeForDecl(), 0) << getLangOpts().CPlusPlus;
+}
 else {
   Diag(IdentifierLoc, diag::err_expected_class_or_namespace)
   <<  << getLangOpts().CPlusPlus;
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -5831,6 +5831,8 @@
   
 def err_expected_class_or_namespace : Error<"%0 is not a class"
   "%select{ or namespace|, namespace, or enumeration}1">;
+def err_missing_argument_list : Error<"missing template argument list for "
+  "class template %0">;
 def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
   "because namespace %1 does not enclose namespace %2">;
 def err_invalid_declarator_global_scope : Error<


Index: test/SemaTemplate/temp_arg_lookup.cpp
===
--- test/SemaTemplate/temp_arg_lookup.cpp
+++ test/SemaTemplate/temp_arg_lookup.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template
+class X { // expected-note{{declared here}}
+  T foo(void);
+};
+
+template
+T X::foo(void)  // expected-error{{missing template argument list for class template}}}
+{
+  return 0;
+}
Index: lib/Sema/SemaCXXScopeSpec.cpp
===
--- lib/Sema/SemaCXXScopeSpec.cpp
+++ lib/Sema/SemaCXXScopeSpec.cpp
@@ -771,9 +771,29 @@
   }
 
   if (!Found.empty()) {
-if (TypeDecl *TD = Found.getAsSingle())
+if (ClassTemplateDecl *CTD = Found.getAsSingle()) {
+  TemplateParameterList *TPL = CTD->getTemplateParameters();
+  assert(TPL && "NULL template parameter list");
+  std::string FixString = Identifier.getName();
+  FixString += "<";
+  bool FirstArg = true;
+  for (NamedDecl *TemplArg : *TPL) {
+if (FirstArg)
+  FirstArg = false;
+else
+  FixString += ", ";
+FixString += TemplArg->getName();
+  }
+  FixString += ">";
+  Diag(IdentifierLoc, diag::err_missing_argument_list) << 
+  << FixItHint::CreateReplacement(IdentifierLoc, FixString);
+  if (NamedDecl *ND = Found.getAsSingle())
+Diag(ND->getLocation(), diag::note_entity_declared_at) << 
+}
+else if (TypeDecl *TD = Found.getAsSingle()) {
   Diag(IdentifierLoc, diag::err_expected_class_or_namespace)
   << QualType(TD->getTypeForDecl(), 0) << getLangOpts().CPlusPlus;
+}
 else {
   Diag(IdentifierLoc, diag::err_expected_class_or_namespace)
   

r250605 - [Frontend] Name variable correctly.

2015-10-17 Thread Davide Italiano via cfe-commits
Author: davide
Date: Sat Oct 17 01:46:39 2015
New Revision: 250605

URL: http://llvm.org/viewvc/llvm-project?rev=250605=rev
Log:
[Frontend] Name variable correctly.

Reported by: Kim Grasman!

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

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=250605=250604=250605=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sat Oct 17 01:46:39 2015
@@ -1986,8 +1986,8 @@ void ModuleSignature::flush() {
 }
 
 void ModuleSignature::add(StringRef Value) {
-  for (auto  : Value)
-add(S, 8);
+  for (auto  : Value)
+add(c, 8);
 }
 
 llvm::APInt ModuleSignature::getAsInteger() const {


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


Re: [PATCH] D15899: Add -fno-movt frontend option, to disable movt/movw on ARM

2016-01-05 Thread Davide Italiano via cfe-commits
davide added a comment.

In http://reviews.llvm.org/D15899#319918, @dim wrote:

> In http://reviews.llvm.org/D15899#319902, @davide wrote:
>
> > I'm not opposed to this but ... this will likely it only 11 (and maybe 10.3 
> > if backported) -- what about people running <= 10.2 ? Isn't this a problem 
> > for them?
>
>
> People running ports-provided or hand-built clang 3.8.0 or higher on older 
> FreeBSD's can use `-fno-movt`.  For clang versions 3.7.x and earlier, they 
> can still use the old style `-mllvm -arm-use-movt=0`.
>
> We'll fix the FreeBSD build system so it uses the right options for older and 
> newer clang versions.


Sounds like a plan.


http://reviews.llvm.org/D15899



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


Re: [PATCH] D15899: Add -fno-movt frontend option, to disable movt/movw on ARM

2016-01-05 Thread Davide Italiano via cfe-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

Hmm, probably they can use the new frontend options so it's fine. LGTM.


http://reviews.llvm.org/D15899



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


Re: [PATCH] D15899: Add -fno-movt frontend option, to disable movt/movw on ARM

2016-01-05 Thread Davide Italiano via cfe-commits
davide added a comment.

I'm not opposed to this but ... this will likely it only 11 (and maybe 10.3 if 
backported) -- what about people running <= 10.2 ? Isn't this a problem for 
them?


http://reviews.llvm.org/D15899



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


Re: [PATCH] D15166: Fix C++ support on recent DragonFly BSD releases

2015-12-22 Thread Davide Italiano via cfe-commits
davide added a subscriber: davide.
davide accepted this revision.
davide added a reviewer: davide.
davide added a comment.
This revision is now accepted and ready to land.

The patch looks good, and the changes are localized to the DflyBSD driver so if 
you tested and works, I'm fine with it. I'll comit that unless objections rise.


http://reviews.llvm.org/D15166



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


r256641 - Disable generating movt on FreeBSD.

2015-12-30 Thread Davide Italiano via cfe-commits
Author: davide
Date: Wed Dec 30 07:53:25 2015
New Revision: 256641

URL: http://llvm.org/viewvc/llvm-project?rev=256641=rev
Log:
Disable generating movt on FreeBSD.

It's sort of an hack, but we have no choice.
The linker in the base system doesn't handle that correctly (yet).
Once FreeBSD will import lld, this can be backed out.

Patch by: Andrew Turner!

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/arm-no-movt.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=256641=256640=256641=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Dec 30 07:53:25 2015
@@ -938,8 +938,8 @@ static void getARMTargetFeatures(const T
   if (Args.hasArg(options::OPT_ffixed_r9))
 Features.push_back("+reserve-r9");
 
-  // The kext linker doesn't know how to deal with movw/movt.
-  if (KernelOrKext)
+  // The kext and FreeBSD linkers don't know how to deal with movw/movt.
+  if (KernelOrKext || Triple.isOSFreeBSD())
 Features.push_back("+no-movt");
 }
 

Modified: cfe/trunk/test/Driver/arm-no-movt.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-no-movt.c?rev=256641=256640=256641=diff
==
--- cfe/trunk/test/Driver/arm-no-movt.c (original)
+++ cfe/trunk/test/Driver/arm-no-movt.c Wed Dec 30 07:53:25 2015
@@ -4,6 +4,11 @@
 // RUN: %clang -target armv7-apple-darwin -mkernel -### %s 2>&1 \
 // RUN:| FileCheck %s -check-prefix CHECK-KERNEL
 
+// RUN: %clang -target armv7-gnueabi-freebsd11 -### %s 2>&1 \
+// RUN:| FileCheck %s -check-prefix CHECK-FREEBSD
+
 // CHECK-DEFAULT-NOT: "-target-feature" "+no-movt"
 
 // CHECK-KERNEL: "-target-feature" "+no-movt"
+
+// CHECK-FREEBSD: "-target-feature" "+no-movt"


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


Re: [PATCH] D15791: Disable generating movt on FreeBSD

2015-12-29 Thread Davide Italiano via cfe-commits
davide accepted this revision.
davide added a reviewer: davide.
davide added a comment.
This revision is now accepted and ready to land.

LGTM



Comment at: lib/Driver/Tools.cpp:941
@@ -940,3 +940,3 @@
 
-  // The kext linker doesn't know how to deal with movw/movt.
-  if (KernelOrKext)
+  // The kext and FreeBSD linkers don't know how to deal with movw/movt.
+  if (KernelOrKext || Triple.isOSFreeBSD())

I'd add a FIXME I expect this to be fixed in the foreseeable future.


Repository:
  rL LLVM

http://reviews.llvm.org/D15791



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


Re: [PATCH] D15791: Disable generating movt on FreeBSD

2015-12-29 Thread Davide Italiano via cfe-commits
davide added a comment.

In http://reviews.llvm.org/D15791#317172, @dim wrote:

> @davide, any idea whether lld will be able to handle movt correctly?  If so, 
> we might want to make this dependent on `-fuse-ld=bfd` or `-fuse-ld=lld` ?


lld/AArch64 can't still handle that properly, so I'd rather recommend to make 
it dependent on fuse-ld=bfd.

Thanks,

-

Davide


Repository:
  rL LLVM

http://reviews.llvm.org/D15791



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


Re: [PATCH] D15791: Disable generating movt on FreeBSD

2016-01-11 Thread Davide Italiano via cfe-commits
davide closed this revision.
davide added a comment.

Close, this went in a while ago.


Repository:
  rL LLVM

http://reviews.llvm.org/D15791



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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Davide Italiano via cfe-commits
davide added a comment.

In http://reviews.llvm.org/D21006#449365, @mehdi_amini wrote:

> I'm not sure it is consistent with how we handle -flto, for instance -c means 
> usually to output an object file, but adding -flto indicates to dump bitcode 
> instead.


I see two alternative approaches:

1. Force all the downstream consumers to pass -fno-lto (as I'm doing right now) 
together with -S. I don't like this option.
2. Make -flto and -S incompatible (and add a warning or an error) and have 
people that really want to emit llvm to use -emit-llvm instead?


http://reviews.llvm.org/D21006



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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Davide Italiano via cfe-commits
davide updated this revision to Diff 59679.
davide added a comment.

Add a test, fix a typo.


http://reviews.llvm.org/D21006

Files:
  lib/Driver/Driver.cpp
  test/CodeGen/2009-10-20-GlobalDebug.c
  test/CodeGen/emit-asm.c
  test/CodeGenCXX/cxx-apple-kext.cpp
  test/Driver/darwin-iphone-defaults.m
  test/Driver/darwin-objc-gc.m

Index: test/Driver/darwin-objc-gc.m
===
--- test/Driver/darwin-objc-gc.m
+++ test/Driver/darwin-objc-gc.m
@@ -1,6 +1,6 @@
 // Check that we warn, but accept, -fobjc-gc for iPhone OS.
 
-// RUN: %clang -target i386-apple-darwin9 -miphoneos-version-min=3.0 -stdlib=platform -fobjc-gc -flto -S -o %t %s 2> %t.err
+// RUN: %clang -target i386-apple-darwin9 -miphoneos-version-min=3.0 -stdlib=platform -fobjc-gc -flto -S -emit-llvm -o %t %s 2> %t.err
 // RUN: FileCheck --check-prefix=IPHONE_OBJC_GC_LL %s < %t 
 // RUN: FileCheck --check-prefix=IPHONE_OBJC_GC_STDERR %s < %t.err
 
Index: test/Driver/darwin-iphone-defaults.m
===
--- test/Driver/darwin-iphone-defaults.m
+++ test/Driver/darwin-iphone-defaults.m
@@ -1,4 +1,4 @@
-// RUN: %clang -target i386-apple-darwin9 -miphoneos-version-min=3.0 -arch armv7 -stdlib=platform -flto -S -o - %s | FileCheck %s
+// RUN: %clang -target i386-apple-darwin9 -miphoneos-version-min=3.0 -arch armv7 -stdlib=platform -flto -S -emit-llvm -o - %s | FileCheck %s
 
 // CHECK: @f0() [[F0:#[0-9]+]]
 // CHECK: @__f0_block_invoke
Index: test/CodeGenCXX/cxx-apple-kext.cpp
===
--- test/CodeGenCXX/cxx-apple-kext.cpp
+++ test/CodeGenCXX/cxx-apple-kext.cpp
@@ -1,7 +1,7 @@
-// RUN: %clangxx -target x86_64-apple-darwin10 %s -flto -S -o - |\
+// RUN: %clangxx -target x86_64-apple-darwin10 %s -flto -S -emit-llvm -o - |\
 // RUN:   FileCheck --check-prefix=CHECK-NO-KEXT %s
-// RUN: %clangxx -target x86_64-apple-darwin10 %s -fapple-kext -flto -S -o - |\
-// RUN:   FileCheck --check-prefix=CHECK-KEXT %s
+// RUN: %clangxx -target x86_64-apple-darwin10 %s -fapple-kext -flto -S \
+// RUN:   -emit-llvm -o - | FileCheck --check-prefix=CHECK-KEXT %s
 
 // CHECK-NO-KEXT-NOT: _GLOBAL__D_a
 // CHECK-NO-KEXT: @is_hosted = global
Index: test/CodeGen/emit-asm.c
===
--- test/CodeGen/emit-asm.c
+++ test/CodeGen/emit-asm.c
@@ -0,0 +1,15 @@
+// Make sure ASM is emitted instead of LLVM IR.
+// RUN: %clang_cc1 %s -S -flto -o - | FileCheck %s
+
+int foo(int goo) { return goo + 42; }
+
+// CHECK:   .section  __TEXT,__text,regular,pure_instructions
+// CHECK:   .macosx_version_min 10, 11
+// CHECK:   .globl  _foo
+// CHECK:   .p2align  4, 0x90
+// CHECK: _foo:
+// CHECK:   movl  %edi, -4(%rsp)
+// CHECK:   movl  -4(%rsp), %edi
+// CHECK:   addl  $42, %edi
+// CHECK:   movl  %edi, %eax
+// CHECK:   retq
Index: test/CodeGen/2009-10-20-GlobalDebug.c
===
--- test/CodeGen/2009-10-20-GlobalDebug.c
+++ test/CodeGen/2009-10-20-GlobalDebug.c
@@ -1,16 +1,17 @@
 // REQUIRES: x86-registered-target
-// RUN: %clang -target i386-apple-darwin10 -flto -S -g %s -o - | FileCheck %s
+// RUN: %clang -target i386-apple-darwin10 -flto -emit-llvm -S -g %s -o - |\
+// RUN:FileCheck %s
 int global;
 int main() { 
   static int localstatic;
   return 0;
 }
 
 // CHECK: !DIGlobalVariable(name: "localstatic"
 // CHECK-NOT:   linkageName:
-// CHECK-SAME:  line: 5,
+// CHECK-SAME:  line: 6,
 // CHECK-SAME:  variable: i32* @main.localstatic
 // CHECK: !DIGlobalVariable(name: "global"
 // CHECK-NOT:   linkageName:
-// CHECK-SAME:  line: 3,
+// CHECK-SAME:  line: 4,
 // CHECK-SAME:  variable: i32* @global
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1746,8 +1746,15 @@
   }
   case phases::Backend: {
 if (isUsingLTO()) {
-  types::ID Output =
-  Args.hasArg(options::OPT_S) ? types::TY_LTO_IR : types::TY_LTO_BC;
+  // -flto in conjunction with -S will still produce
+  // assembler, unless -emit-llvm is also specified.
+  // In that case, LLVM IR is produced instead.
+  types::ID Output;
+  if (Args.hasArg(options::OPT_S))
+Output = (Args.hasArg(options::OPT_emit_llvm)) ? types::TY_LLVM_IR :
+types::TY_PP_Asm;
+  else
+Output = types::TY_LTO_BC;
   return C.MakeAction(Input, Output);
 }
 if (Args.hasArg(options::OPT_emit_llvm)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Davide Italiano via cfe-commits
davide added a comment.

In http://reviews.llvm.org/D21006#449409, @dexonsmith wrote:

> I agree with Mehdi.  I expect `-S -flto` to give equivalent output to `-c 
> -flto`.
>
> In effect, with this change, `-flto -S` would silently ignore the `-flto` 
> flag.  That doesn't make sense to me.


I guess there's enough disagreement to hold on on this change.
My $0.02: When I ask for -S I really expect asm to be produced, but maybe it's 
just me =)
Lots of build systems have invocations of clang like:

  CFLAGS= -S
  ${CC} ${CFLAGS} blah.c -o blah.s
  sed -e ...

When CFLAGS is changed, as in:

  CFLAGS += -flto

this is generally passed globally. So, not emitting ASM in this case makes LTO 
non transparent for the build system, i.e. Makefiles need to pass `-fno-lto`, 
which might not be terrible overall, just not what I expect.


http://reviews.llvm.org/D21006



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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Davide Italiano via cfe-commits
davide added a comment.

In http://reviews.llvm.org/D21006#449380, @rafael wrote:

> Can you check what GCC does?


Sure.

  $ gcc flto.c -o flto.o -flto -S && cat flto.o |head -n 15
.file   "flto.c"
.section.gnu.lto_.inline.513e7babbe55b1f8,"e",@progbits
.string "x\234ca\200"
.string "\021\006\004`d``af``b\371\240\307\300\302\300\004\026\003"
.ascii  "\020b\001K"
.text
.section.gnu.lto_foo.513e7babbe55b1f8,"e",@progbits
.string 
"x\234eP\275J\003A\020\236o\346\210Q8\365\001R\244\t!\026>C\360\021|\005A\033\341\032\373\254\\\"QA,\242\210X\004LH\341O\022[\213\004\004\021\301\"\202\235EPQ\320&\207\212\225\2363I#8\260;3\314\3673\273\036\215b\016D\276\346\2245\036\201I\017Do\201\216\bT`A\001\237\374\315\350\025[\007\362\301%!x\332F7\373\217\223\326\002im_j[{\3105\234F\277^Inl\243$L1\023\216\221\302\021\314\002'\310)\264z\365v\351\313\004H\353\316m\271\346e\353Fs\347y7\256$\234B\376\362L\007Md\r\376\320\376\331\361\023EC\247M\\5[H\350\252\320a\377\375\372\"\2319t\256\354\334W\267\n\267\236\377\277\203B\333\3104\347\273.\216C\347\356\322\360"
.ascii  "\223\347\241\021\rL\224\"\326$\317\bw\327\356\305,B\341P\314"
.ascii  "\244\321\253lN\331\263\03138\033JF\254?\235&\247\325\253~"
.ascii  "\341\210aJ\003\326\355\264\032[\\^\tf\027H\226\202\340\027\253"
.ascii  "\277d'"
.text
.section.gnu.lto_.symbol_nodes.513e7babbe55b1f8,"e",@progbits
.string 
"x\234ca``\020\006b\006&\206z\006\206\t\347\030@\324\252FE\240\b"


http://reviews.llvm.org/D21006



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


Re: [PATCH] D20748: Handle recursion in LLVMIRGeneration Timer

2016-06-08 Thread Davide Italiano via cfe-commits
I agree with Rafael. I ran with -ftime-report for a couple of weeks on
a lot of tests and never hit this problem.
It actually seems weird we have to handle the timer recursively here
as well (I'd like to avoid it at all), but let's see what Richard has
to say when he gets to this review.

On Wed, Jun 8, 2016 at 10:27 PM, Rafael EspĂ­ndola
 wrote:
> Since we found only one user, I think my preference is to handle it there.
>
> Cheers,
> Rafael
>
>
> On 8 June 2016 at 13:49, Vedant Kumar  wrote:
>> vsk added a comment.
>>
>> Ping, any updates on this patch?
>>
>>
>> http://reviews.llvm.org/D20748
>>
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D20748: Handle recursion in LLVMIRGeneration Timer

2016-05-27 Thread Davide Italiano via cfe-commits
davide created this revision.
davide added reviewers: rafael, vsk.
davide added a subscriber: cfe-commits.

See http://reviews.llvm.org/D20735 for more context.
Implementing this clang-side is not as terrible as I originally thought. Maybe 
needs a test case, but I wasn't able to reduce one easily (yet). 

http://reviews.llvm.org/D20748

Files:
  clang/lib/CodeGen/CodeGenAction.cpp

Index: clang/lib/CodeGen/CodeGenAction.cpp
===
--- clang/lib/CodeGen/CodeGenAction.cpp
+++ clang/lib/CodeGen/CodeGenAction.cpp
@@ -50,6 +50,7 @@
 ASTContext *Context;

 Timer LLVMIRGeneration;
+unsigned LLVMIRGenerationRefCount;

 std::unique_ptr Gen;

@@ -73,6 +74,7 @@
 : Diags(Diags), Action(Action), CodeGenOpts(CodeGenOpts),
   TargetOpts(TargetOpts), LangOpts(LangOpts), AsmOutStream(OS),
   Context(nullptr), LLVMIRGeneration("LLVM IR Generation Time"),
+  LLVMIRGenerationRefCount(0),
   Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts,
 CodeGenOpts, C, CoverageInfo)) {
   llvm::TimePassesIsEnabled = TimePasses;
@@ -112,13 +114,20 @@
  Context->getSourceManager(),
  "LLVM IR generation of declaration");

-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.startTimer();
+  // Recurse.
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount += 1;
+if (LLVMIRGenerationRefCount == 1)
+  LLVMIRGeneration.startTimer();
+  }

   Gen->HandleTopLevelDecl(D);

-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.stopTimer();
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount -= 1;
+if (LLVMIRGenerationRefCount == 0)
+  LLVMIRGeneration.stopTimer();
+  }

   return true;
 }
@@ -139,13 +148,19 @@
 void HandleTranslationUnit(ASTContext ) override {
   {
 PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.startTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount += 1;
+  if (LLVMIRGenerationRefCount == 1)
+LLVMIRGeneration.startTimer();
+}

 Gen->HandleTranslationUnit(C);

-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.stopTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount -= 1;
+  if (LLVMIRGenerationRefCount == 0)
+LLVMIRGeneration.stopTimer();
+}
   }

   // Silently ignore if we weren't initialized for some reason.


Index: clang/lib/CodeGen/CodeGenAction.cpp
===
--- clang/lib/CodeGen/CodeGenAction.cpp
+++ clang/lib/CodeGen/CodeGenAction.cpp
@@ -50,6 +50,7 @@
 ASTContext *Context;

 Timer LLVMIRGeneration;
+unsigned LLVMIRGenerationRefCount;

 std::unique_ptr Gen;

@@ -73,6 +74,7 @@
 : Diags(Diags), Action(Action), CodeGenOpts(CodeGenOpts),
   TargetOpts(TargetOpts), LangOpts(LangOpts), AsmOutStream(OS),
   Context(nullptr), LLVMIRGeneration("LLVM IR Generation Time"),
+  LLVMIRGenerationRefCount(0),
   Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts,
 CodeGenOpts, C, CoverageInfo)) {
   llvm::TimePassesIsEnabled = TimePasses;
@@ -112,13 +114,20 @@
  Context->getSourceManager(),
  "LLVM IR generation of declaration");

-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.startTimer();
+  // Recurse.
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount += 1;
+if (LLVMIRGenerationRefCount == 1)
+  LLVMIRGeneration.startTimer();
+  }

   Gen->HandleTopLevelDecl(D);

-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.stopTimer();
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount -= 1;
+if (LLVMIRGenerationRefCount == 0)
+  LLVMIRGeneration.stopTimer();
+  }

   return true;
 }
@@ -139,13 +148,19 @@
 void HandleTranslationUnit(ASTContext ) override {
   {
 PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.startTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount += 1;
+  if (LLVMIRGenerationRefCount == 1)
+LLVMIRGeneration.startTimer();
+}

 Gen->HandleTranslationUnit(C);

-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.stopTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount -= 1;
+  if (LLVMIRGenerationRefCount == 0)
+

Re: [PATCH] D20748: Handle recursion in LLVMIRGeneration Timer

2016-06-15 Thread Davide Italiano via cfe-commits
davide added a comment.

ping?


http://reviews.llvm.org/D20748



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


r259302 - assert(false) -> llvm_unreachable().

2016-01-30 Thread Davide Italiano via cfe-commits
Author: davide
Date: Sat Jan 30 02:03:54 2016
New Revision: 259302

URL: http://llvm.org/viewvc/llvm-project?rev=259302=rev
Log:
assert(false) -> llvm_unreachable().

Modified:
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=259302=259301=259302=diff
==
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Sat Jan 30 02:03:54 2016
@@ -985,7 +985,7 @@ void StringLiteral::setString(const ASTC
   break;
 }
 default:
-  assert(false && "unsupported CharByteWidth");
+  llvm_unreachable("unsupported CharByteWidth");
   }
 }
 

Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=259302=259301=259302=diff
==
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Sat Jan 30 02:03:54 2016
@@ -2462,7 +2462,7 @@ void StmtPrinter::VisitOpaqueValueExpr(O
 
 void StmtPrinter::VisitTypoExpr(TypoExpr *Node) {
   // TODO: Print something reasonable for a TypoExpr, if necessary.
-  assert(false && "Cannot print TypoExpr nodes");
+  llvm_unreachable("Cannot print TypoExpr nodes");
 }
 
 void StmtPrinter::VisitAsTypeExpr(AsTypeExpr *Node) {

Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=259302=259301=259302=diff
==
--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Sat Jan 30 02:03:54 2016
@@ -1652,7 +1652,7 @@ void ASTStmtWriter::VisitOpaqueValueExpr
 void ASTStmtWriter::VisitTypoExpr(TypoExpr *E) {
   VisitExpr(E);
   // TODO: Figure out sane writer behavior for a TypoExpr, if necessary
-  assert(false && "Cannot write TypoExpr nodes");
+  llvm_unreachable("Cannot write TypoExpr nodes");
 }
 
 
//===--===//


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


[PATCH] D17787: [Modules] Don't swallow errors when parsing optional attributes

2016-03-01 Thread Davide Italiano via cfe-commits
davide created this revision.
davide added reviewers: silvas, doug.gregor.
davide added a subscriber: cfe-commits.

I found this by visual inspection while trying to get up-to-speed on modules, 
so I'm still uncertain how to test it. If the current one is really the actual 
behaviour, then parse can return void.

http://reviews.llvm.org/D17787

Files:
  lib/Lex/ModuleMap.cpp

Index: lib/Lex/ModuleMap.cpp
===
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -1402,7 +1402,8 @@
   
   // Parse the optional attribute list.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
   
   // Parse the opening brace.
   if (!Tok.is(MMToken::LBrace)) {
@@ -2067,7 +2068,9 @@
 
   // Parse the optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
+
   if (Attrs.IsExhaustive && !ActiveModule->Parent) {
 ActiveModule->ConfigMacrosExhaustive = true;
   }
@@ -2215,7 +2218,8 @@
 
   // Parse optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
 
   if (ActiveModule) {
 // Note that we have an inferred submodule.


Index: lib/Lex/ModuleMap.cpp
===
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -1402,7 +1402,8 @@
   
   // Parse the optional attribute list.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
   
   // Parse the opening brace.
   if (!Tok.is(MMToken::LBrace)) {
@@ -2067,7 +2068,9 @@
 
   // Parse the optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
+
   if (Attrs.IsExhaustive && !ActiveModule->Parent) {
 ActiveModule->ConfigMacrosExhaustive = true;
   }
@@ -2215,7 +2218,8 @@
 
   // Parse optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
 
   if (ActiveModule) {
 // Note that we have an inferred submodule.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18011: [modules] Diagnose insufficient privileges when trying to load the modulemap

2016-03-10 Thread Davide Italiano via cfe-commits
davide added a comment.

Hmm, I think you're right. It's not actually that silent (it fails with a fatal 
error when trying to load/read).
That said, I think it might still be valuable to emit a diagnostic -- Richard 
what do you think?

I noticed you reported a very similar problem here: 
https://llvm.org/bugs/show_bug.cgi?id=20468

Also, I looked at the code more closely and I think the right place to diagnose 
this would be `lib/Frontend/FrontendAction.cpp`, in `BeginSourceFile`, around 
line 390, and not where I'm diagnosing it right now. Thoughts?


http://reviews.llvm.org/D18011



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


Re: [PATCH] D18011: [modules] Diagnose insufficient privileges when trying to load the modulemap

2016-03-09 Thread Davide Italiano via cfe-commits
davide updated this revision to Diff 50181.
davide added a comment.

Typo.


http://reviews.llvm.org/D18011

Files:
  include/clang/Basic/DiagnosticFrontendKinds.td
  lib/Frontend/FrontendActions.cpp
  test/Modules/Inputs/insufficient-privileges.modulemap

Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -272,7 +272,23 @@
   << Filename;
 return false;
   }
-  
+
+  // Emit a diagnostic if we can't read the module map.
+  vfs::Status Result;
+  bool S = CI.getFileManager().getNoncachedStatValue(Filename, Result);
+  if (!S) {
+llvm::sys::fs::perms P = Result.getPermissions();
+if (!(P & llvm::sys::fs::perms::all_read)) {
+  CI.getDiagnostics().Report(diag::err_module_map_wrong_perms)
+<< Filename;
+  return false;
+}
+  } else {
+CI.getDiagnostics().Report(diag::err_module_map_missing_stat)
+  << Filename;
+return false;
+  }
+
   // Set up embedding for any specified files. Do this before we load any
   // source files, including the primary module map for the compilation.
   for (const auto  : CI.getFrontendOpts().ModulesEmbedFiles) {
Index: include/clang/Basic/DiagnosticFrontendKinds.td
===
--- include/clang/Basic/DiagnosticFrontendKinds.td
+++ include/clang/Basic/DiagnosticFrontendKinds.td
@@ -179,6 +179,10 @@
   "compilation">, InGroup>, 
DefaultError;
 def err_module_map_not_found : Error<"module map file '%0' not found">, 
   DefaultFatal;
+def err_module_map_wrong_perms : Error<"insufficient privileges to read file 
'%0'">,
+  DefaultFatal;
+def err_module_map_missing_stat : Error<"cannot retrieve status infos for file 
'%0'">,
+  DefaultFatal;
 def err_missing_module_name : Error<
   "no module name provided; specify one with -fmodule-name=">, 
   DefaultFatal;


Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -272,7 +272,23 @@
   << Filename;
 return false;
   }
-  
+
+  // Emit a diagnostic if we can't read the module map.
+  vfs::Status Result;
+  bool S = CI.getFileManager().getNoncachedStatValue(Filename, Result);
+  if (!S) {
+llvm::sys::fs::perms P = Result.getPermissions();
+if (!(P & llvm::sys::fs::perms::all_read)) {
+  CI.getDiagnostics().Report(diag::err_module_map_wrong_perms)
+<< Filename;
+  return false;
+}
+  } else {
+CI.getDiagnostics().Report(diag::err_module_map_missing_stat)
+  << Filename;
+return false;
+  }
+
   // Set up embedding for any specified files. Do this before we load any
   // source files, including the primary module map for the compilation.
   for (const auto  : CI.getFrontendOpts().ModulesEmbedFiles) {
Index: include/clang/Basic/DiagnosticFrontendKinds.td
===
--- include/clang/Basic/DiagnosticFrontendKinds.td
+++ include/clang/Basic/DiagnosticFrontendKinds.td
@@ -179,6 +179,10 @@
   "compilation">, InGroup>, DefaultError;
 def err_module_map_not_found : Error<"module map file '%0' not found">, 
   DefaultFatal;
+def err_module_map_wrong_perms : Error<"insufficient privileges to read file '%0'">,
+  DefaultFatal;
+def err_module_map_missing_stat : Error<"cannot retrieve status infos for file '%0'">,
+  DefaultFatal;
 def err_missing_module_name : Error<
   "no module name provided; specify one with -fmodule-name=">, 
   DefaultFatal;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r263060 - [modules] Simplify code logic. NFC.

2016-03-09 Thread Davide Italiano via cfe-commits
Author: davide
Date: Wed Mar  9 15:09:51 2016
New Revision: 263060

URL: http://llvm.org/viewvc/llvm-project?rev=263060=rev
Log:
[modules] Simplify code logic. NFC.

Modified:
cfe/trunk/lib/Basic/Module.cpp

Modified: cfe/trunk/lib/Basic/Module.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Module.cpp?rev=263060=263059=263060=diff
==
--- cfe/trunk/lib/Basic/Module.cpp (original)
+++ cfe/trunk/lib/Basic/Module.cpp Wed Mar  9 15:09:51 2016
@@ -418,12 +418,8 @@ void Module::print(raw_ostream , unsi
 OS.indent(Indent + 2);
 OS << "export ";
 printModuleId(OS, UnresolvedExports[I].Id);
-if (UnresolvedExports[I].Wildcard) {
-  if (UnresolvedExports[I].Id.empty())
-OS << "*";
-  else
-OS << ".*";
-}
+if (UnresolvedExports[I].Wildcard)
+  OS << (UnresolvedExports[I].Id.empty() ? "*" : ".*");
 OS << "\n";
   }
 


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


[PATCH] D18011: [modules] Diagnose insufficient privileges when trying to load the modulemap

2016-03-09 Thread Davide Italiano via cfe-commits
davide created this revision.
davide added reviewers: rsmith, silvas, doug.gregor.
davide added a subscriber: cfe-commits.

I stumbled upon this yesterday. Without this patch in palce, the module map 
load is silently ignored, and this might cause subtle breakages.

http://reviews.llvm.org/D18011

Files:
  include/clang/Basic/DiagnosticFrontendKinds.td
  lib/Frontend/FrontendActions.cpp
  test/Modules/Inputs/insufficient-privileges.modulemap

Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -272,7 +272,23 @@
   << Filename;
 return false;
   }
-  
+
+  // Emit a diagnostic if we can't read the source map.
+  vfs::Status Result;
+  bool S = CI.getFileManager().getNoncachedStatValue(Filename, Result);
+  if (!S) {
+llvm::sys::fs::perms P = Result.getPermissions();
+if (!(P & llvm::sys::fs::perms::all_read)) {
+  CI.getDiagnostics().Report(diag::err_module_map_wrong_perms)
+<< Filename;
+  return false;
+}
+  } else {
+CI.getDiagnostics().Report(diag::err_module_map_missing_stat)
+  << Filename;
+return false;
+  }
+
   // Set up embedding for any specified files. Do this before we load any
   // source files, including the primary module map for the compilation.
   for (const auto  : CI.getFrontendOpts().ModulesEmbedFiles) {
Index: include/clang/Basic/DiagnosticFrontendKinds.td
===
--- include/clang/Basic/DiagnosticFrontendKinds.td
+++ include/clang/Basic/DiagnosticFrontendKinds.td
@@ -179,6 +179,10 @@
   "compilation">, InGroup>, 
DefaultError;
 def err_module_map_not_found : Error<"module map file '%0' not found">, 
   DefaultFatal;
+def err_module_map_wrong_perms : Error<"insufficient privileges to read file 
'%0'">,
+  DefaultFatal;
+def err_module_map_missing_stat : Error<"cannot retrieve status infos for file 
'%0'">,
+  DefaultFatal;
 def err_missing_module_name : Error<
   "no module name provided; specify one with -fmodule-name=">, 
   DefaultFatal;


Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -272,7 +272,23 @@
   << Filename;
 return false;
   }
-  
+
+  // Emit a diagnostic if we can't read the source map.
+  vfs::Status Result;
+  bool S = CI.getFileManager().getNoncachedStatValue(Filename, Result);
+  if (!S) {
+llvm::sys::fs::perms P = Result.getPermissions();
+if (!(P & llvm::sys::fs::perms::all_read)) {
+  CI.getDiagnostics().Report(diag::err_module_map_wrong_perms)
+<< Filename;
+  return false;
+}
+  } else {
+CI.getDiagnostics().Report(diag::err_module_map_missing_stat)
+  << Filename;
+return false;
+  }
+
   // Set up embedding for any specified files. Do this before we load any
   // source files, including the primary module map for the compilation.
   for (const auto  : CI.getFrontendOpts().ModulesEmbedFiles) {
Index: include/clang/Basic/DiagnosticFrontendKinds.td
===
--- include/clang/Basic/DiagnosticFrontendKinds.td
+++ include/clang/Basic/DiagnosticFrontendKinds.td
@@ -179,6 +179,10 @@
   "compilation">, InGroup>, DefaultError;
 def err_module_map_not_found : Error<"module map file '%0' not found">, 
   DefaultFatal;
+def err_module_map_wrong_perms : Error<"insufficient privileges to read file '%0'">,
+  DefaultFatal;
+def err_module_map_missing_stat : Error<"cannot retrieve status infos for file '%0'">,
+  DefaultFatal;
 def err_missing_module_name : Error<
   "no module name provided; specify one with -fmodule-name=">, 
   DefaultFatal;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19029: Always use --eh-frame-hdr on FreeBSD, even for -static

2016-04-12 Thread Davide Italiano via cfe-commits
davide added a subscriber: davide.
davide added a comment.

LGTM.


Repository:
  rL LLVM

http://reviews.llvm.org/D19029



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


Re: [PATCH] D19029: Always use --eh-frame-hdr on FreeBSD, even for -static

2016-04-12 Thread Davide Italiano via cfe-commits
LGTM.

On Tue, Apr 12, 2016 at 2:17 PM, Ed Maste  wrote:
> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL266123: Always use --eh-frame-hdr on FreeBSD, even for 
> -static (authored by emaste).
>
> Changed prior to commit:
>   http://reviews.llvm.org/D19029?vs=53452=53460#toc
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D19029
>
> Files:
>   cfe/trunk/lib/Driver/Tools.cpp
>   cfe/trunk/test/Driver/freebsd.c
>
> Index: cfe/trunk/test/Driver/freebsd.c
> ===
> --- cfe/trunk/test/Driver/freebsd.c
> +++ cfe/trunk/test/Driver/freebsd.c
> @@ -82,6 +82,7 @@
>  // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -static %s \
>  // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
>  // RUN:   | FileCheck --check-prefix=CHECK-STATIC %s
> +// CHECK-STATIC: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
>  // CHECK-STATIC: crt1.o
>  // CHECK-STATIC: crtbeginT.o
>
> Index: cfe/trunk/lib/Driver/Tools.cpp
> ===
> --- cfe/trunk/lib/Driver/Tools.cpp
> +++ cfe/trunk/lib/Driver/Tools.cpp
> @@ -8197,12 +8197,12 @@
>if (IsPIE)
>  CmdArgs.push_back("-pie");
>
> +  CmdArgs.push_back("--eh-frame-hdr");
>if (Args.hasArg(options::OPT_static)) {
>  CmdArgs.push_back("-Bstatic");
>} else {
>  if (Args.hasArg(options::OPT_rdynamic))
>CmdArgs.push_back("-export-dynamic");
> -CmdArgs.push_back("--eh-frame-hdr");
>  if (Args.hasArg(options::OPT_shared)) {
>CmdArgs.push_back("-Bshareable");
>  } else {
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r262789 - [Modules] Don't swallow errors when parsing optional attributes.

2016-03-05 Thread Davide Italiano via cfe-commits
Author: davide
Date: Sat Mar  5 22:20:05 2016
New Revision: 262789

URL: http://llvm.org/viewvc/llvm-project?rev=262789=rev
Log:
[Modules] Don't swallow errors when parsing optional attributes.

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

Added:
cfe/trunk/test/Modules/parse-attributes.modulemap
Modified:
cfe/trunk/lib/Lex/ModuleMap.cpp

Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=262789=262788=262789=diff
==
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Sat Mar  5 22:20:05 2016
@@ -1402,7 +1402,9 @@ void ModuleMapParser::parseModuleDecl()
   
   // Parse the optional attribute list.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
+
   
   // Parse the opening brace.
   if (!Tok.is(MMToken::LBrace)) {
@@ -2067,7 +2069,9 @@ void ModuleMapParser::parseConfigMacros(
 
   // Parse the optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
+
   if (Attrs.IsExhaustive && !ActiveModule->Parent) {
 ActiveModule->ConfigMacrosExhaustive = true;
   }
@@ -2215,7 +2219,8 @@ void ModuleMapParser::parseInferredModul
 
   // Parse optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
 
   if (ActiveModule) {
 // Note that we have an inferred submodule.

Added: cfe/trunk/test/Modules/parse-attributes.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/parse-attributes.modulemap?rev=262789=auto
==
--- cfe/trunk/test/Modules/parse-attributes.modulemap (added)
+++ cfe/trunk/test/Modules/parse-attributes.modulemap Sat Mar  5 22:20:05 2016
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t.modules
+// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t.modules \
+// RUN:   -fmodule-map-file=%s -I%S -include "Inputs/empty.h" \
+// RUN:   -fsyntax-only -x c++ /dev/null 2>&1 | FileCheck %s
+
+// CHECK: error: expected ']' to close attribute
+// CHECK-NOT: error: expected '{' to start module 'A'
+
+module A [system {
+  header "Inputs/empty.h"
+  private header "Inputs/empty.h"
+}


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


Re: [PATCH] D17787: [Modules] Don't swallow errors when parsing optional attributes

2016-03-05 Thread Davide Italiano via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL262789: [Modules] Don't swallow errors when parsing optional 
attributes. (authored by davide).

Changed prior to commit:
  http://reviews.llvm.org/D17787?vs=49575=49888#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17787

Files:
  cfe/trunk/lib/Lex/ModuleMap.cpp
  cfe/trunk/test/Modules/parse-attributes.modulemap

Index: cfe/trunk/lib/Lex/ModuleMap.cpp
===
--- cfe/trunk/lib/Lex/ModuleMap.cpp
+++ cfe/trunk/lib/Lex/ModuleMap.cpp
@@ -1402,7 +1402,9 @@
   
   // Parse the optional attribute list.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
+
   
   // Parse the opening brace.
   if (!Tok.is(MMToken::LBrace)) {
@@ -2067,7 +2069,9 @@
 
   // Parse the optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
+
   if (Attrs.IsExhaustive && !ActiveModule->Parent) {
 ActiveModule->ConfigMacrosExhaustive = true;
   }
@@ -2215,7 +2219,8 @@
 
   // Parse optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
 
   if (ActiveModule) {
 // Note that we have an inferred submodule.
Index: cfe/trunk/test/Modules/parse-attributes.modulemap
===
--- cfe/trunk/test/Modules/parse-attributes.modulemap
+++ cfe/trunk/test/Modules/parse-attributes.modulemap
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t.modules
+// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t.modules \
+// RUN:   -fmodule-map-file=%s -I%S -include "Inputs/empty.h" \
+// RUN:   -fsyntax-only -x c++ /dev/null 2>&1 | FileCheck %s
+
+// CHECK: error: expected ']' to close attribute
+// CHECK-NOT: error: expected '{' to start module 'A'
+
+module A [system {
+  header "Inputs/empty.h"
+  private header "Inputs/empty.h"
+}


Index: cfe/trunk/lib/Lex/ModuleMap.cpp
===
--- cfe/trunk/lib/Lex/ModuleMap.cpp
+++ cfe/trunk/lib/Lex/ModuleMap.cpp
@@ -1402,7 +1402,9 @@
   
   // Parse the optional attribute list.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
+
   
   // Parse the opening brace.
   if (!Tok.is(MMToken::LBrace)) {
@@ -2067,7 +2069,9 @@
 
   // Parse the optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
+
   if (Attrs.IsExhaustive && !ActiveModule->Parent) {
 ActiveModule->ConfigMacrosExhaustive = true;
   }
@@ -2215,7 +2219,8 @@
 
   // Parse optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
 
   if (ActiveModule) {
 // Note that we have an inferred submodule.
Index: cfe/trunk/test/Modules/parse-attributes.modulemap
===
--- cfe/trunk/test/Modules/parse-attributes.modulemap
+++ cfe/trunk/test/Modules/parse-attributes.modulemap
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t.modules
+// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t.modules \
+// RUN:   -fmodule-map-file=%s -I%S -include "Inputs/empty.h" \
+// RUN:   -fsyntax-only -x c++ /dev/null 2>&1 | FileCheck %s
+
+// CHECK: error: expected ']' to close attribute
+// CHECK-NOT: error: expected '{' to start module 'A'
+
+module A [system {
+  header "Inputs/empty.h"
+  private header "Inputs/empty.h"
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D17794: [modules] addHeaderInclude() can't fail.

2016-03-01 Thread Davide Italiano via cfe-commits
davide created this revision.
davide added reviewers: silvas, rsmith, christof.
davide added a subscriber: cfe-commits.

I noticed that addHeaderInclude() returns bool although it can never fail. 
I find this a little bit weird from a semantic point of view. My best guess is 
that the 'bool' return type was put there 'just in case'.
I'd like to change its return type to void until real evidence that this 
function can fail is provided, unless, of course, I'm missing something.


http://reviews.llvm.org/D17794

Files:
  lib/Frontend/FrontendActions.cpp

Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -152,10 +152,10 @@
   return Includes;
 }
 
-static std::error_code addHeaderInclude(StringRef HeaderName,
-SmallVectorImpl ,
-const LangOptions ,
-bool IsExternC) {
+static void addHeaderInclude(StringRef HeaderName,
+ SmallVectorImpl ,
+ const LangOptions ,
+ bool IsExternC) {
   if (IsExternC && LangOpts.CPlusPlus)
 Includes += "extern \"C\" {\n";
   if (LangOpts.ObjC1)
@@ -168,7 +168,6 @@
   Includes += "\"\n";
   if (IsExternC && LangOpts.CPlusPlus)
 Includes += "}\n";
-  return std::error_code();
 }
 
 /// \brief Collect the set of header includes needed to construct the given 
@@ -194,22 +193,17 @@
   // file relative to the module build directory (the directory containing
   // the module map file) so this will find the same file that we found
   // while parsing the module map.
-  if (std::error_code Err = addHeaderInclude(H.NameAsWritten, Includes,
- LangOpts, Module->IsExternC))
-return Err;
+  addHeaderInclude(H.NameAsWritten, Includes, LangOpts, Module->IsExternC);
 }
   }
   // Note that Module->PrivateHeaders will not be a TopHeader.
 
   if (Module::Header UmbrellaHeader = Module->getUmbrellaHeader()) {
 Module->addTopHeader(UmbrellaHeader.Entry);
-if (Module->Parent) {
+if (Module->Parent)
   // Include the umbrella header for submodules.
-  if (std::error_code Err = addHeaderInclude(UmbrellaHeader.NameAsWritten,
- Includes, LangOpts,
- Module->IsExternC))
-return Err;
-}
+  addHeaderInclude(UmbrellaHeader.NameAsWritten, Includes, LangOpts,
+   Module->IsExternC);
   } else if (Module::DirectoryName UmbrellaDir = Module->getUmbrellaDir()) {
 // Add all of the headers we find in this subdirectory.
 std::error_code EC;
@@ -248,9 +242,7 @@
 
   // Include this header as part of the umbrella directory.
   Module->addTopHeader(Header);
-  if (std::error_code Err = addHeaderInclude(RelativeHeader, Includes,
- LangOpts, Module->IsExternC))
-return Err;
+  addHeaderInclude(RelativeHeader, Includes, LangOpts, Module->IsExternC);
 }
 
 if (EC)
@@ -356,10 +348,9 @@
   SmallString<256> HeaderContents;
   std::error_code Err = std::error_code();
   if (Module::Header UmbrellaHeader = Module->getUmbrellaHeader())
-Err = addHeaderInclude(UmbrellaHeader.NameAsWritten, HeaderContents,
-   CI.getLangOpts(), Module->IsExternC);
-  if (!Err)
-Err = collectModuleHeaderIncludes(
+addHeaderInclude(UmbrellaHeader.NameAsWritten, HeaderContents,
+ CI.getLangOpts(), Module->IsExternC);
+  Err = collectModuleHeaderIncludes(
 CI.getLangOpts(), FileMgr,
 CI.getPreprocessor().getHeaderSearchInfo().getModuleMap(), Module,
 HeaderContents);


Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -152,10 +152,10 @@
   return Includes;
 }
 
-static std::error_code addHeaderInclude(StringRef HeaderName,
-SmallVectorImpl ,
-const LangOptions ,
-bool IsExternC) {
+static void addHeaderInclude(StringRef HeaderName,
+ SmallVectorImpl ,
+ const LangOptions ,
+ bool IsExternC) {
   if (IsExternC && LangOpts.CPlusPlus)
 Includes += "extern \"C\" {\n";
   if (LangOpts.ObjC1)
@@ -168,7 +168,6 @@
   Includes += "\"\n";
   if (IsExternC && LangOpts.CPlusPlus)
 Includes += "}\n";
-  return std::error_code();
 }
 
 /// \brief Collect the set of header includes needed to construct the given 
@@ -194,22 +193,17 @@
   // file relative to the module build directory (the 

Re: [PATCH] D17794: [modules] addHeaderInclude() can't fail.

2016-03-01 Thread Davide Italiano via cfe-commits
davide added a comment.

As an added bonus, this simplifies the code a little bit.


http://reviews.llvm.org/D17794



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


Re: [PATCH] D17787: [Modules] Don't swallow errors when parsing optional attributes

2016-03-01 Thread Davide Italiano via cfe-commits
davide added a reviewer: rsmith.
davide updated this revision to Diff 49575.
davide added a comment.

Added a test. Yes, with the patch we stop immediately if we fail to parse 
attributes, while the old code kept emitting diagnostics. I like the new 
behaviour better, but I'll defer the decision to you.


http://reviews.llvm.org/D17787

Files:
  lib/Lex/ModuleMap.cpp
  test/Modules/parse-attributes.modulemap

Index: test/Modules/parse-attributes.modulemap
===
--- test/Modules/parse-attributes.modulemap
+++ test/Modules/parse-attributes.modulemap
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t.modules
+// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t.modules \
+// RUN:   -fmodule-map-file=%s -I%S -include "Inputs/empty.h" \
+// RUN:   -fsyntax-only -x c++ /dev/null 2>&1 | FileCheck %s
+
+// CHECK: error: expected ']' to close attribute
+// CHECK-NOT: error: expected '{' to start module 'A'
+
+module A [system {
+  header "Inputs/empty.h"
+  private header "Inputs/empty.h"
+}
Index: lib/Lex/ModuleMap.cpp
===
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -1402,7 +1402,9 @@
   
   // Parse the optional attribute list.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
+
   
   // Parse the opening brace.
   if (!Tok.is(MMToken::LBrace)) {
@@ -2067,7 +2069,9 @@
 
   // Parse the optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
+
   if (Attrs.IsExhaustive && !ActiveModule->Parent) {
 ActiveModule->ConfigMacrosExhaustive = true;
   }
@@ -2215,7 +2219,8 @@
 
   // Parse optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
 
   if (ActiveModule) {
 // Note that we have an inferred submodule.


Index: test/Modules/parse-attributes.modulemap
===
--- test/Modules/parse-attributes.modulemap
+++ test/Modules/parse-attributes.modulemap
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t.modules
+// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t.modules \
+// RUN:   -fmodule-map-file=%s -I%S -include "Inputs/empty.h" \
+// RUN:   -fsyntax-only -x c++ /dev/null 2>&1 | FileCheck %s
+
+// CHECK: error: expected ']' to close attribute
+// CHECK-NOT: error: expected '{' to start module 'A'
+
+module A [system {
+  header "Inputs/empty.h"
+  private header "Inputs/empty.h"
+}
Index: lib/Lex/ModuleMap.cpp
===
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -1402,7 +1402,9 @@
   
   // Parse the optional attribute list.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
+
   
   // Parse the opening brace.
   if (!Tok.is(MMToken::LBrace)) {
@@ -2067,7 +2069,9 @@
 
   // Parse the optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
+
   if (Attrs.IsExhaustive && !ActiveModule->Parent) {
 ActiveModule->ConfigMacrosExhaustive = true;
   }
@@ -2215,7 +2219,8 @@
 
   // Parse optional attributes.
   Attributes Attrs;
-  parseOptionalAttributes(Attrs);
+  if (parseOptionalAttributes(Attrs))
+return;
 
   if (ActiveModule) {
 // Note that we have an inferred submodule.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17794: [modules] addHeaderInclude() can't fail.

2016-03-01 Thread Davide Italiano via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL262463: [modules] addHeaderInclude() can't fail. (authored 
by davide).

Changed prior to commit:
  http://reviews.llvm.org/D17794?vs=49578=49581#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17794

Files:
  cfe/trunk/lib/Frontend/FrontendActions.cpp

Index: cfe/trunk/lib/Frontend/FrontendActions.cpp
===
--- cfe/trunk/lib/Frontend/FrontendActions.cpp
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp
@@ -152,10 +152,10 @@
   return Includes;
 }
 
-static std::error_code addHeaderInclude(StringRef HeaderName,
-SmallVectorImpl ,
-const LangOptions ,
-bool IsExternC) {
+static void addHeaderInclude(StringRef HeaderName,
+ SmallVectorImpl ,
+ const LangOptions ,
+ bool IsExternC) {
   if (IsExternC && LangOpts.CPlusPlus)
 Includes += "extern \"C\" {\n";
   if (LangOpts.ObjC1)
@@ -168,7 +168,6 @@
   Includes += "\"\n";
   if (IsExternC && LangOpts.CPlusPlus)
 Includes += "}\n";
-  return std::error_code();
 }
 
 /// \brief Collect the set of header includes needed to construct the given 
@@ -194,22 +193,17 @@
   // file relative to the module build directory (the directory containing
   // the module map file) so this will find the same file that we found
   // while parsing the module map.
-  if (std::error_code Err = addHeaderInclude(H.NameAsWritten, Includes,
- LangOpts, Module->IsExternC))
-return Err;
+  addHeaderInclude(H.NameAsWritten, Includes, LangOpts, Module->IsExternC);
 }
   }
   // Note that Module->PrivateHeaders will not be a TopHeader.
 
   if (Module::Header UmbrellaHeader = Module->getUmbrellaHeader()) {
 Module->addTopHeader(UmbrellaHeader.Entry);
-if (Module->Parent) {
+if (Module->Parent)
   // Include the umbrella header for submodules.
-  if (std::error_code Err = addHeaderInclude(UmbrellaHeader.NameAsWritten,
- Includes, LangOpts,
- Module->IsExternC))
-return Err;
-}
+  addHeaderInclude(UmbrellaHeader.NameAsWritten, Includes, LangOpts,
+   Module->IsExternC);
   } else if (Module::DirectoryName UmbrellaDir = Module->getUmbrellaDir()) {
 // Add all of the headers we find in this subdirectory.
 std::error_code EC;
@@ -248,9 +242,7 @@
 
   // Include this header as part of the umbrella directory.
   Module->addTopHeader(Header);
-  if (std::error_code Err = addHeaderInclude(RelativeHeader, Includes,
- LangOpts, Module->IsExternC))
-return Err;
+  addHeaderInclude(RelativeHeader, Includes, LangOpts, Module->IsExternC);
 }
 
 if (EC)
@@ -356,10 +348,9 @@
   SmallString<256> HeaderContents;
   std::error_code Err = std::error_code();
   if (Module::Header UmbrellaHeader = Module->getUmbrellaHeader())
-Err = addHeaderInclude(UmbrellaHeader.NameAsWritten, HeaderContents,
-   CI.getLangOpts(), Module->IsExternC);
-  if (!Err)
-Err = collectModuleHeaderIncludes(
+addHeaderInclude(UmbrellaHeader.NameAsWritten, HeaderContents,
+ CI.getLangOpts(), Module->IsExternC);
+  Err = collectModuleHeaderIncludes(
 CI.getLangOpts(), FileMgr,
 CI.getPreprocessor().getHeaderSearchInfo().getModuleMap(), Module,
 HeaderContents);


Index: cfe/trunk/lib/Frontend/FrontendActions.cpp
===
--- cfe/trunk/lib/Frontend/FrontendActions.cpp
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp
@@ -152,10 +152,10 @@
   return Includes;
 }
 
-static std::error_code addHeaderInclude(StringRef HeaderName,
-SmallVectorImpl ,
-const LangOptions ,
-bool IsExternC) {
+static void addHeaderInclude(StringRef HeaderName,
+ SmallVectorImpl ,
+ const LangOptions ,
+ bool IsExternC) {
   if (IsExternC && LangOpts.CPlusPlus)
 Includes += "extern \"C\" {\n";
   if (LangOpts.ObjC1)
@@ -168,7 +168,6 @@
   Includes += "\"\n";
   if (IsExternC && LangOpts.CPlusPlus)
 Includes += "}\n";
-  return std::error_code();
 }
 
 /// \brief Collect the set of header includes needed to construct the given 
@@ -194,22 +193,17 @@
   // file relative to the module build directory (the directory containing
   // the module map file) so this will find the same file that we found
   // while parsing the module map.
-  if 

r262463 - [modules] addHeaderInclude() can't fail.

2016-03-01 Thread Davide Italiano via cfe-commits
Author: davide
Date: Wed Mar  2 00:09:18 2016
New Revision: 262463

URL: http://llvm.org/viewvc/llvm-project?rev=262463=rev
Log:
[modules] addHeaderInclude() can't fail.

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

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

Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=262463=262462=262463=diff
==
--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Wed Mar  2 00:09:18 2016
@@ -152,10 +152,10 @@ operator+=(SmallVectorImpl 
   return Includes;
 }
 
-static std::error_code addHeaderInclude(StringRef HeaderName,
-SmallVectorImpl ,
-const LangOptions ,
-bool IsExternC) {
+static void addHeaderInclude(StringRef HeaderName,
+ SmallVectorImpl ,
+ const LangOptions ,
+ bool IsExternC) {
   if (IsExternC && LangOpts.CPlusPlus)
 Includes += "extern \"C\" {\n";
   if (LangOpts.ObjC1)
@@ -168,7 +168,6 @@ static std::error_code addHeaderInclude(
   Includes += "\"\n";
   if (IsExternC && LangOpts.CPlusPlus)
 Includes += "}\n";
-  return std::error_code();
 }
 
 /// \brief Collect the set of header includes needed to construct the given 
@@ -194,22 +193,17 @@ collectModuleHeaderIncludes(const LangOp
   // file relative to the module build directory (the directory containing
   // the module map file) so this will find the same file that we found
   // while parsing the module map.
-  if (std::error_code Err = addHeaderInclude(H.NameAsWritten, Includes,
- LangOpts, Module->IsExternC))
-return Err;
+  addHeaderInclude(H.NameAsWritten, Includes, LangOpts, Module->IsExternC);
 }
   }
   // Note that Module->PrivateHeaders will not be a TopHeader.
 
   if (Module::Header UmbrellaHeader = Module->getUmbrellaHeader()) {
 Module->addTopHeader(UmbrellaHeader.Entry);
-if (Module->Parent) {
+if (Module->Parent)
   // Include the umbrella header for submodules.
-  if (std::error_code Err = addHeaderInclude(UmbrellaHeader.NameAsWritten,
- Includes, LangOpts,
- Module->IsExternC))
-return Err;
-}
+  addHeaderInclude(UmbrellaHeader.NameAsWritten, Includes, LangOpts,
+   Module->IsExternC);
   } else if (Module::DirectoryName UmbrellaDir = Module->getUmbrellaDir()) {
 // Add all of the headers we find in this subdirectory.
 std::error_code EC;
@@ -248,9 +242,7 @@ collectModuleHeaderIncludes(const LangOp
 
   // Include this header as part of the umbrella directory.
   Module->addTopHeader(Header);
-  if (std::error_code Err = addHeaderInclude(RelativeHeader, Includes,
- LangOpts, Module->IsExternC))
-return Err;
+  addHeaderInclude(RelativeHeader, Includes, LangOpts, Module->IsExternC);
 }
 
 if (EC)
@@ -356,10 +348,9 @@ bool GenerateModuleAction::BeginSourceFi
   SmallString<256> HeaderContents;
   std::error_code Err = std::error_code();
   if (Module::Header UmbrellaHeader = Module->getUmbrellaHeader())
-Err = addHeaderInclude(UmbrellaHeader.NameAsWritten, HeaderContents,
-   CI.getLangOpts(), Module->IsExternC);
-  if (!Err)
-Err = collectModuleHeaderIncludes(
+addHeaderInclude(UmbrellaHeader.NameAsWritten, HeaderContents,
+ CI.getLangOpts(), Module->IsExternC);
+  Err = collectModuleHeaderIncludes(
 CI.getLangOpts(), FileMgr,
 CI.getPreprocessor().getHeaderSearchInfo().getModuleMap(), Module,
 HeaderContents);


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


Re: [PATCH] D20748: Handle recursion in LLVMIRGeneration Timer

2016-07-18 Thread Davide Italiano via cfe-commits
davide added a comment.

Richard, can you please take a look at this? The more I look at it the more it 
seems weird that we can recurse in this case, but I may miss something


https://reviews.llvm.org/D20748



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


Re: [PATCH] D20748: Handle recursion in LLVMIRGeneration Timer

2016-07-21 Thread Davide Italiano via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL276242: [CodeGen] Handle recursion in LLVMIRGeneration 
Timer. (authored by davide).

Changed prior to commit:
  https://reviews.llvm.org/D20748?vs=58833=64826#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D20748

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

Index: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp
@@ -49,6 +49,7 @@
 ASTContext *Context;
 
 Timer LLVMIRGeneration;
+unsigned LLVMIRGenerationRefCount;
 
 std::unique_ptr Gen;
 
@@ -73,6 +74,7 @@
   TargetOpts(TargetOpts), LangOpts(LangOpts),
   AsmOutStream(std::move(OS)), Context(nullptr),
   LLVMIRGeneration("LLVM IR Generation Time"),
+  LLVMIRGenerationRefCount(0),
   Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts,
 CodeGenOpts, C, CoverageInfo)) {
   llvm::TimePassesIsEnabled = TimePasses;
@@ -112,13 +114,20 @@
  Context->getSourceManager(),
  "LLVM IR generation of declaration");
 
-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.startTimer();
+  // Recurse.
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount += 1;
+if (LLVMIRGenerationRefCount == 1)
+  LLVMIRGeneration.startTimer();
+  }
 
   Gen->HandleTopLevelDecl(D);
 
-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.stopTimer();
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount -= 1;
+if (LLVMIRGenerationRefCount == 0)
+  LLVMIRGeneration.stopTimer();
+  }
 
   return true;
 }
@@ -139,13 +148,19 @@
 void HandleTranslationUnit(ASTContext ) override {
   {
 PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.startTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount += 1;
+  if (LLVMIRGenerationRefCount == 1)
+LLVMIRGeneration.startTimer();
+}
 
 Gen->HandleTranslationUnit(C);
 
-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.stopTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount -= 1;
+  if (LLVMIRGenerationRefCount == 0)
+LLVMIRGeneration.stopTimer();
+}
   }
 
   // Silently ignore if we weren't initialized for some reason.


Index: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp
@@ -49,6 +49,7 @@
 ASTContext *Context;
 
 Timer LLVMIRGeneration;
+unsigned LLVMIRGenerationRefCount;
 
 std::unique_ptr Gen;
 
@@ -73,6 +74,7 @@
   TargetOpts(TargetOpts), LangOpts(LangOpts),
   AsmOutStream(std::move(OS)), Context(nullptr),
   LLVMIRGeneration("LLVM IR Generation Time"),
+  LLVMIRGenerationRefCount(0),
   Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts,
 CodeGenOpts, C, CoverageInfo)) {
   llvm::TimePassesIsEnabled = TimePasses;
@@ -112,13 +114,20 @@
  Context->getSourceManager(),
  "LLVM IR generation of declaration");
 
-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.startTimer();
+  // Recurse.
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount += 1;
+if (LLVMIRGenerationRefCount == 1)
+  LLVMIRGeneration.startTimer();
+  }
 
   Gen->HandleTopLevelDecl(D);
 
-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.stopTimer();
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount -= 1;
+if (LLVMIRGenerationRefCount == 0)
+  LLVMIRGeneration.stopTimer();
+  }
 
   return true;
 }
@@ -139,13 +148,19 @@
 void HandleTranslationUnit(ASTContext ) override {
   {
 PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.startTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount += 1;
+  if (LLVMIRGenerationRefCount == 1)
+LLVMIRGeneration.startTimer();
+}
 
 Gen->HandleTranslationUnit(C);
 
-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.stopTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount -= 1;
+  if (LLVMIRGenerationRefCount == 0)
+LLVMIRGeneration.stopTimer();
+}
   }
 
   // Silently ignore 

r276242 - [CodeGen] Handle recursion in LLVMIRGeneration Timer.

2016-07-21 Thread Davide Italiano via cfe-commits
Author: davide
Date: Thu Jul 21 01:28:48 2016
New Revision: 276242

URL: http://llvm.org/viewvc/llvm-project?rev=276242=rev
Log:
[CodeGen] Handle recursion in LLVMIRGeneration Timer.

This can happen when emitting a local decl, which triggers
loading a decl imported from an AST file, which we then
hand to the AST consumer. Timer is not allowed to recurse
so an assertion fire. Keep a reference counter to avoid this
problem. LGTM'd by Richard Smith on IRC.

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

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

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=276242=276241=276242=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Thu Jul 21 01:28:48 2016
@@ -49,6 +49,7 @@ namespace clang {
 ASTContext *Context;
 
 Timer LLVMIRGeneration;
+unsigned LLVMIRGenerationRefCount;
 
 std::unique_ptr Gen;
 
@@ -73,6 +74,7 @@ namespace clang {
   TargetOpts(TargetOpts), LangOpts(LangOpts),
   AsmOutStream(std::move(OS)), Context(nullptr),
   LLVMIRGeneration("LLVM IR Generation Time"),
+  LLVMIRGenerationRefCount(0),
   Gen(CreateLLVMCodeGen(Diags, InFile, HeaderSearchOpts, PPOpts,
 CodeGenOpts, C, CoverageInfo)) {
   llvm::TimePassesIsEnabled = TimePasses;
@@ -112,13 +114,20 @@ namespace clang {
  Context->getSourceManager(),
  "LLVM IR generation of declaration");
 
-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.startTimer();
+  // Recurse.
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount += 1;
+if (LLVMIRGenerationRefCount == 1)
+  LLVMIRGeneration.startTimer();
+  }
 
   Gen->HandleTopLevelDecl(D);
 
-  if (llvm::TimePassesIsEnabled)
-LLVMIRGeneration.stopTimer();
+  if (llvm::TimePassesIsEnabled) {
+LLVMIRGenerationRefCount -= 1;
+if (LLVMIRGenerationRefCount == 0)
+  LLVMIRGeneration.stopTimer();
+  }
 
   return true;
 }
@@ -139,13 +148,19 @@ namespace clang {
 void HandleTranslationUnit(ASTContext ) override {
   {
 PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.startTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount += 1;
+  if (LLVMIRGenerationRefCount == 1)
+LLVMIRGeneration.startTimer();
+}
 
 Gen->HandleTranslationUnit(C);
 
-if (llvm::TimePassesIsEnabled)
-  LLVMIRGeneration.stopTimer();
+if (llvm::TimePassesIsEnabled) {
+  LLVMIRGenerationRefCount -= 1;
+  if (LLVMIRGenerationRefCount == 0)
+LLVMIRGeneration.stopTimer();
+}
   }
 
   // Silently ignore if we weren't initialized for some reason.


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


Re: [PATCH] D23498: Left shifts of negative values are defined if -fwrapv is set

2016-08-16 Thread Davide Italiano via cfe-commits
davide added a comment.

The `Sema` bits look fine to me. I'll let Filipe comment on the sanitizer part.


https://reviews.llvm.org/D23498



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


r293848 - [CodeGen] Update test after recent changes in llvm (r293846).

2017-02-01 Thread Davide Italiano via cfe-commits
Author: davide
Date: Wed Feb  1 18:47:53 2017
New Revision: 293848

URL: http://llvm.org/viewvc/llvm-project?rev=293848=rev
Log:
[CodeGen] Update test after recent changes in llvm (r293846).

Modified:
cfe/trunk/test/CodeGen/link-bitcode-file.c

Modified: cfe/trunk/test/CodeGen/link-bitcode-file.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/link-bitcode-file.c?rev=293848=293847=293848=diff
==
--- cfe/trunk/test/CodeGen/link-bitcode-file.c (original)
+++ cfe/trunk/test/CodeGen/link-bitcode-file.c Wed Feb  1 18:47:53 2017
@@ -27,7 +27,7 @@ int f2(void) { return 43; }
 #else
 
 // CHECK-NO-BC-LABEL: define i32 @g
-// CHECK-NO-BC: ret i32 %call
+// CHECK-NO-BC: ret i32 42
 int g(void) {
   return f();
 }


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


r293810 - [CodeGen] Update test after recent changes in llvm (r293799).

2017-02-01 Thread Davide Italiano via cfe-commits
Author: davide
Date: Wed Feb  1 14:43:28 2017
New Revision: 293810

URL: http://llvm.org/viewvc/llvm-project?rev=293810=rev
Log:
[CodeGen] Update test after recent changes in llvm (r293799).

Modified:
cfe/trunk/test/CodeGen/link-bitcode-file.c

Modified: cfe/trunk/test/CodeGen/link-bitcode-file.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/link-bitcode-file.c?rev=293810=293809=293810=diff
==
--- cfe/trunk/test/CodeGen/link-bitcode-file.c (original)
+++ cfe/trunk/test/CodeGen/link-bitcode-file.c Wed Feb  1 14:43:28 2017
@@ -27,7 +27,7 @@ int f2(void) { return 43; }
 #else
 
 // CHECK-NO-BC-LABEL: define i32 @g
-// CHECK-NO-BC: ret i32 42
+// CHECK-NO-BC: ret i32 %call
 int g(void) {
   return f();
 }


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


r294623 - [CodeGen] Remove unneeded `private`. NFCI.

2017-02-09 Thread Davide Italiano via cfe-commits
Author: davide
Date: Thu Feb  9 15:19:51 2017
New Revision: 294623

URL: http://llvm.org/viewvc/llvm-project?rev=294623=rev
Log:
[CodeGen] Remove unneeded `private`. NFCI.

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

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=294623=294622=294623=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Feb  9 15:19:51 2017
@@ -73,7 +73,6 @@ class EmitAssemblyHelper {
 
   std::unique_ptr OS;
 
-private:
   TargetIRAnalysis getTargetIRAnalysis() const {
 if (TM)
   return TM->getTargetIRAnalysis();


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


Re: r294879 - [Driver] Use stem() and not filename().

2017-02-11 Thread Davide Italiano via cfe-commits
On Sat, Feb 11, 2017 at 4:19 PM, Rui Ueyama <r...@google.com> wrote:
> On Sat, Feb 11, 2017 at 3:44 PM, Davide Italiano via cfe-commits
> <cfe-commits@lists.llvm.org> wrote:
>>
>> Author: davide
>> Date: Sat Feb 11 17:44:37 2017
>> New Revision: 294879
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=294879=rev
>> Log:
>> [Driver] Use stem() and not filename().
>>
>> On Windows the filename might have an extension, namely
>> `.exe`, so the search will fail. Sorry, I don't have a
>> good way to test this as it seems to fail only in some
>> weird configurations. r284430 has the same modification
>> for Fuchsia.
>>
>> Modified:
>> cfe/trunk/lib/Driver/Tools.cpp
>>
>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=294879=294878=294879=diff
>>
>> ==
>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>> +++ cfe/trunk/lib/Driver/Tools.cpp Sat Feb 11 17:44:37 2017
>> @@ -10163,7 +10163,7 @@ void gnutools::Linker::ConstructJob(Comp
>>Args.ClaimAllArgs(options::OPT_w);
>>
>>const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
>> -  if (llvm::sys::path::filename(Exec) == "lld") {
>> +  if (llvm::sys::path::stem(Exec) == "lld") {
>>  CmdArgs.push_back("-flavor");
>>  CmdArgs.push_back("old-gnu");
>

Probably not, I'm just reducing diffs with out local branch. I think
we can remove it altogether.

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r294879 - [Driver] Use stem() and not filename().

2017-02-11 Thread Davide Italiano via cfe-commits
Author: davide
Date: Sat Feb 11 17:44:37 2017
New Revision: 294879

URL: http://llvm.org/viewvc/llvm-project?rev=294879=rev
Log:
[Driver] Use stem() and not filename().

On Windows the filename might have an extension, namely
`.exe`, so the search will fail. Sorry, I don't have a
good way to test this as it seems to fail only in some
weird configurations. r284430 has the same modification
for Fuchsia.

Modified:
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=294879=294878=294879=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sat Feb 11 17:44:37 2017
@@ -10163,7 +10163,7 @@ void gnutools::Linker::ConstructJob(Comp
   Args.ClaimAllArgs(options::OPT_w);
 
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
-  if (llvm::sys::path::filename(Exec) == "lld") {
+  if (llvm::sys::path::stem(Exec) == "lld") {
 CmdArgs.push_back("-flavor");
 CmdArgs.push_back("old-gnu");
 CmdArgs.push_back("-target");


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


r294961 - [PM] Add support for instrumented PGO in the new pass manager (clang-side)

2017-02-13 Thread Davide Italiano via cfe-commits
Author: davide
Date: Mon Feb 13 10:07:05 2017
New Revision: 294961

URL: http://llvm.org/viewvc/llvm-project?rev=294961=rev
Log:
[PM] Add support for instrumented PGO in the new pass manager (clang-side)

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

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

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=294961=294960=294961=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Mon Feb 13 10:07:05 2017
@@ -61,6 +61,9 @@ using namespace llvm;
 
 namespace {
 
+// Default filename used for profile generation.
+static constexpr StringLiteral DefaultProfileGenName = "default_%m.profraw";
+
 class EmitAssemblyHelper {
   DiagnosticsEngine 
   const HeaderSearchOptions 
@@ -448,7 +451,7 @@ void EmitAssemblyHelper::CreatePasses(le
 if (!CodeGenOpts.InstrProfileOutput.empty())
   PMBuilder.PGOInstrGen = CodeGenOpts.InstrProfileOutput;
 else
-  PMBuilder.PGOInstrGen = "default_%m.profraw";
+  PMBuilder.PGOInstrGen = DefaultProfileGenName;
   }
   if (CodeGenOpts.hasProfileIRUse())
 PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath;
@@ -775,7 +778,24 @@ void EmitAssemblyHelper::EmitAssemblyWit
 return;
   TheModule->setDataLayout(TM->createDataLayout());
 
-  PassBuilder PB(TM.get());
+  PGOOptions PGOOpt;
+
+  // -fprofile-generate.
+  PGOOpt.RunProfileGen = CodeGenOpts.hasProfileIRInstr();
+  if (PGOOpt.RunProfileGen)
+PGOOpt.ProfileGenFile = CodeGenOpts.InstrProfileOutput.empty() ?
+  DefaultProfileGenName : CodeGenOpts.InstrProfileOutput;
+
+  // -fprofile-use.
+  if (CodeGenOpts.hasProfileIRUse())
+PGOOpt.ProfileUseFile = CodeGenOpts.ProfileInstrumentUsePath;
+
+  // Only pass a PGO options struct if -fprofile-generate or
+  // -fprofile-use were passed on the cmdline.
+  PassBuilder PB(TM.get(),
+(PGOOpt.RunProfileGen ||
+  !PGOOpt.ProfileUseFile.empty()) ?
+Optional(PGOOpt) : None);
 
   LoopAnalysisManager LAM;
   FunctionAnalysisManager FAM;


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


r279479 - [AST] Remove unused function, to silence a GCC7 warning.

2016-08-22 Thread Davide Italiano via cfe-commits
Author: davide
Date: Mon Aug 22 16:33:12 2016
New Revision: 279479

URL: http://llvm.org/viewvc/llvm-project?rev=279479=rev
Log:
[AST] Remove unused function, to silence a GCC7 warning.

Modified:
cfe/trunk/lib/AST/StmtProfile.cpp

Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=279479=279478=279479=diff
==
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Mon Aug 22 16:33:12 2016
@@ -93,10 +93,6 @@ void StmtProfiler::VisitCompoundStmt(con
   VisitStmt(S);
 }
 
-void StmtProfiler::VisitSwitchCase(const SwitchCase *S) {
-  VisitStmt(S);
-}
-
 void StmtProfiler::VisitCaseStmt(const CaseStmt *S) {
   VisitStmt(S);
 }


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


r283217 - [ThinLTO] Spell `llvm-ar` correctly.

2016-10-04 Thread Davide Italiano via cfe-commits
Author: davide
Date: Tue Oct  4 08:16:00 2016
New Revision: 283217

URL: http://llvm.org/viewvc/llvm-project?rev=283217=rev
Log:
[ThinLTO] Spell `llvm-ar` correctly.

Modified:
cfe/trunk/docs/ThinLTO.rst

Modified: cfe/trunk/docs/ThinLTO.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ThinLTO.rst?rev=283217=283216=283217=diff
==
--- cfe/trunk/docs/ThinLTO.rst (original)
+++ cfe/trunk/docs/ThinLTO.rst Tue Oct  4 08:16:00 2016
@@ -140,7 +140,7 @@ To bootstrap clang/LLVM with ThinLTO, fo
   * ``-DCMAKE_C_COMPILER=/path/to/host/clang``
   * ``-DCMAKE_CXX_COMPILER=/path/to/host/clang++``
   * ``-DCMAKE_RANLIB=/path/to/host/llvm-ranlib``
-  * ``-DCMAKE_AR=/path/to/host/llvm-nm``
+  * ``-DCMAKE_AR=/path/to/host/llvm-ar``
 
 #. To use additional linker arguments for controlling the backend
parallelism_ or enabling incremental_ builds of the bootstrap compiler,


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


[PATCH] D25190: [ThinLTO doc] Fix typo

2016-10-03 Thread Davide Italiano via cfe-commits
davide created this revision.
davide added reviewers: mehdi_amini, tejohnson.
davide added a subscriber: cfe-commits.

This looks like an obvious typo to me, but I don't know the whole ThinLTO 
story, so.


https://reviews.llvm.org/D25190

Files:
  clang/docs/ThinLTO.rst


Index: clang/docs/ThinLTO.rst
===
--- clang/docs/ThinLTO.rst
+++ clang/docs/ThinLTO.rst
@@ -140,7 +140,7 @@
   * ``-DCMAKE_C_COMPILER=/path/to/host/clang``
   * ``-DCMAKE_CXX_COMPILER=/path/to/host/clang++``
   * ``-DCMAKE_RANLIB=/path/to/host/llvm-ranlib``
-  * ``-DCMAKE_AR=/path/to/host/llvm-nm``
+  * ``-DCMAKE_AR=/path/to/host/llvm-ar``

 #. To use additional linker arguments for controlling the backend
parallelism_ or enabling incremental_ builds of the bootstrap compiler,


Index: clang/docs/ThinLTO.rst
===
--- clang/docs/ThinLTO.rst
+++ clang/docs/ThinLTO.rst
@@ -140,7 +140,7 @@
   * ``-DCMAKE_C_COMPILER=/path/to/host/clang``
   * ``-DCMAKE_CXX_COMPILER=/path/to/host/clang++``
   * ``-DCMAKE_RANLIB=/path/to/host/llvm-ranlib``
-  * ``-DCMAKE_AR=/path/to/host/llvm-nm``
+  * ``-DCMAKE_AR=/path/to/host/llvm-ar``

 #. To use additional linker arguments for controlling the backend
parallelism_ or enabling incremental_ builds of the bootstrap compiler,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25700: [Driver] Use stem rather than filename for executable name

2016-10-17 Thread Davide Italiano via cfe-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

Was going to commit the same. Thanks. LGTM.


Repository:
  rL LLVM

https://reviews.llvm.org/D25700



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


[PATCH] D25700: [Driver] Use stem rather than filename for executable name

2016-10-17 Thread Davide Italiano via cfe-commits
davide added a comment.

And yes, if you can add a test case that will be great (there's no bot that 
caught this upstream) but one of our internal bots did.


Repository:
  rL LLVM

https://reviews.llvm.org/D25700



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


r284137 - [ThinLTO] Update doc to include lld (now supported).

2016-10-13 Thread Davide Italiano via cfe-commits
Author: davide
Date: Thu Oct 13 12:42:38 2016
New Revision: 284137

URL: http://llvm.org/viewvc/llvm-project?rev=284137=rev
Log:
[ThinLTO] Update doc to include lld (now supported).

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

Modified:
cfe/trunk/docs/ThinLTO.rst

Modified: cfe/trunk/docs/ThinLTO.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ThinLTO.rst?rev=284137=284136=284137=diff
==
--- cfe/trunk/docs/ThinLTO.rst (original)
+++ cfe/trunk/docs/ThinLTO.rst Thu Oct 13 12:42:38 2016
@@ -62,8 +62,8 @@ ThinLTO is currently supported for the f
   `_.
 - **ld64**:
   Starting with `Xcode 8 `_.
-
-Additionally, support is being added to the *lld* linker.
+- **lld**:
+  Starting with r284050 (ELF only).
 
 Usage
 =
@@ -109,6 +109,8 @@ be reduced to ``N`` via:
   ``-Wl,-plugin-opt,jobs=N``
 - ld64:
   ``-Wl,-mllvm,-threads=N``
+- lld:
+  ``-Wl,--thinlto-jobs=N``
 
 Incremental
 ---


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


Re: r284137 - [ThinLTO] Update doc to include lld (now supported).

2016-10-16 Thread Davide Italiano via cfe-commits
On Sun, Oct 16, 2016 at 6:43 PM, Sean Silva  wrote:
> Nice to see this land!
>
> One nit:
> Currently, doesn't LLD/ELF ignore -plugin-opt? That will mean that if a user
> uses the "gold syntax" then LLD will silently ignore it, which isn't good.
> At the very least, can we issue an error if we see `-plugin-opt jobs=N` and
> suggest the LLD spelling?
>
> Or maybe just accept the gold syntax? Our current handling of `-plugin` and
> `-plugin-opt` is intended to make LLD transparently Do The Right Thing when
> LLD is invoked as if it were gold, so clearly gold compatibility is
> important enough for that. This suggests it is important enough to be
> compatible from a ThinLTO perspective too.
>

I agree with what you're suggesting.  My initial vote would be for
error'ing out on anything we can't understand that's passed via
`-plugin-opt` and see what breaks (and add incremental support for
every feature needed).
Teresa, Rafael, any opinions about it?

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25537: [ThinLTO] Update doc to include lld

2016-10-12 Thread Davide Italiano via cfe-commits
davide updated this revision to Diff 74459.
davide added a comment.

I mentioned that's ELF only. Are you OK with that or you want me to put more 
detailed info?


https://reviews.llvm.org/D25537

Files:
  docs/ThinLTO.rst


Index: docs/ThinLTO.rst
===
--- docs/ThinLTO.rst
+++ docs/ThinLTO.rst
@@ -62,8 +62,8 @@
   `_.
 - **ld64**:
   Starting with `Xcode 8 `_.
-
-Additionally, support is being added to the *lld* linker.
+- **lld**:
+  Starting with r284050 (ELF only).
 
 Usage
 =
@@ -109,6 +109,8 @@
   ``-Wl,-plugin-opt,jobs=N``
 - ld64:
   ``-Wl,-mllvm,-threads=N``
+- lld:
+  ``-Wl,--thinlto-jobs=N``
 
 Incremental
 ---


Index: docs/ThinLTO.rst
===
--- docs/ThinLTO.rst
+++ docs/ThinLTO.rst
@@ -62,8 +62,8 @@
   `_.
 - **ld64**:
   Starting with `Xcode 8 `_.
-
-Additionally, support is being added to the *lld* linker.
+- **lld**:
+  Starting with r284050 (ELF only).
 
 Usage
 =
@@ -109,6 +109,8 @@
   ``-Wl,-plugin-opt,jobs=N``
 - ld64:
   ``-Wl,-mllvm,-threads=N``
+- lld:
+  ``-Wl,--thinlto-jobs=N``
 
 Incremental
 ---
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25537: [ThinLTO] Update doc to include lld

2016-10-12 Thread Davide Italiano via cfe-commits
davide created this revision.
davide added reviewers: tejohnson, mehdi_amini.
davide added a subscriber: cfe-commits.

https://reviews.llvm.org/D25537

Files:
  docs/ThinLTO.rst


Index: docs/ThinLTO.rst
===
--- docs/ThinLTO.rst
+++ docs/ThinLTO.rst
@@ -62,8 +62,8 @@
   `_.
 - **ld64**:
   Starting with `Xcode 8 `_.
-
-Additionally, support is being added to the *lld* linker.
+- **lld**:
+  Starting with r284050.
 
 Usage
 =
@@ -109,6 +109,8 @@
   ``-Wl,-plugin-opt,jobs=N``
 - ld64:
   ``-Wl,-mllvm,-threads=N``
+- lld:
+  ``-Wl,--thinlto-jobs=N``
 
 Incremental
 ---


Index: docs/ThinLTO.rst
===
--- docs/ThinLTO.rst
+++ docs/ThinLTO.rst
@@ -62,8 +62,8 @@
   `_.
 - **ld64**:
   Starting with `Xcode 8 `_.
-
-Additionally, support is being added to the *lld* linker.
+- **lld**:
+  Starting with r284050.
 
 Usage
 =
@@ -109,6 +109,8 @@
   ``-Wl,-plugin-opt,jobs=N``
 - ld64:
   ``-Wl,-mllvm,-threads=N``
+- lld:
+  ``-Wl,--thinlto-jobs=N``
 
 Incremental
 ---
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r284419 - [Coverage] Update test after r284418.

2016-10-17 Thread Davide Italiano via cfe-commits
Author: davide
Date: Mon Oct 17 15:06:32 2016
New Revision: 284419

URL: http://llvm.org/viewvc/llvm-project?rev=284419=rev
Log:
[Coverage] Update test after r284418.

We now strip coverage metadata if debug info are not present.

Modified:
cfe/trunk/test/CodeGen/code-coverage.c

Modified: cfe/trunk/test/CodeGen/code-coverage.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/code-coverage.c?rev=284419=284418=284419=diff
==
--- cfe/trunk/test/CodeGen/code-coverage.c (original)
+++ cfe/trunk/test/CodeGen/code-coverage.c Mon Oct 17 15:06:32 2016
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data %s -o - | 
FileCheck %s
 // RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data 
-coverage-no-function-names-in-data %s -o - | FileCheck %s --check-prefix 
WITHOUTNAMES
-// RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data 
-coverage-notes-file=aaa.gcno -coverage-data-file=bbb.gcda %s -o - | FileCheck 
%s --check-prefix GCOV_FILE_INFO
+// RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data 
-coverage-notes-file=aaa.gcno -coverage-data-file=bbb.gcda -dwarf-column-info 
-debug-info-kind=limited -dwarf-version=4 %s -o - | FileCheck %s --check-prefix 
GCOV_FILE_INFO
 
 // 
 


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


Re: r284137 - [ThinLTO] Update doc to include lld (now supported).

2016-10-17 Thread Davide Italiano via cfe-commits
Glad we all agree. I opened
https://llvm.org/bugs/show_bug.cgi?id=30720 to keep track of this.

On Mon, Oct 17, 2016 at 9:08 AM, Rui Ueyama <r...@google.com> wrote:
> Agreed. We should define them as aliases to existing options without
> -plugin-opt.
>
> On Sun, Oct 16, 2016 at 6:43 PM, Sean Silva via cfe-commits
> <cfe-commits@lists.llvm.org> wrote:
>>
>> Nice to see this land!
>>
>> One nit:
>> Currently, doesn't LLD/ELF ignore -plugin-opt? That will mean that if a
>> user uses the "gold syntax" then LLD will silently ignore it, which isn't
>> good. At the very least, can we issue an error if we see `-plugin-opt
>> jobs=N` and suggest the LLD spelling?
>>
>> Or maybe just accept the gold syntax? Our current handling of `-plugin`
>> and `-plugin-opt` is intended to make LLD transparently Do The Right Thing
>> when LLD is invoked as if it were gold, so clearly gold compatibility is
>> important enough for that. This suggests it is important enough to be
>> compatible from a ThinLTO perspective too.
>>
>> -- Sean Silva
>>
>> On Thu, Oct 13, 2016 at 10:42 AM, Davide Italiano via cfe-commits
>> <cfe-commits@lists.llvm.org> wrote:
>>>
>>> Author: davide
>>> Date: Thu Oct 13 12:42:38 2016
>>> New Revision: 284137
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=284137=rev
>>> Log:
>>> [ThinLTO] Update doc to include lld (now supported).
>>>
>>> Differential Revision:  https://reviews.llvm.org/D25537
>>>
>>> Modified:
>>> cfe/trunk/docs/ThinLTO.rst
>>>
>>> Modified: cfe/trunk/docs/ThinLTO.rst
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ThinLTO.rst?rev=284137=284136=284137=diff
>>>
>>> ==
>>> --- cfe/trunk/docs/ThinLTO.rst (original)
>>> +++ cfe/trunk/docs/ThinLTO.rst Thu Oct 13 12:42:38 2016
>>> @@ -62,8 +62,8 @@ ThinLTO is currently supported for the f
>>><http://llvm.org/docs/GoldPlugin.html>`_.
>>>  - **ld64**:
>>>Starting with `Xcode 8 <https://developer.apple.com/xcode/>`_.
>>> -
>>> -Additionally, support is being added to the *lld* linker.
>>> +- **lld**:
>>> +  Starting with r284050 (ELF only).
>>>
>>>  Usage
>>>  =
>>> @@ -109,6 +109,8 @@ be reduced to ``N`` via:
>>>``-Wl,-plugin-opt,jobs=N``
>>>  - ld64:
>>>``-Wl,-mllvm,-threads=N``
>>> +- lld:
>>> +  ``-Wl,--thinlto-jobs=N``
>>>
>>>  Incremental
>>>  ---
>>>
>>>
>>> ___
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>



-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r298160 - [Sema] Unbreak GCC -Werror build (enum compare).

2017-03-17 Thread Davide Italiano via cfe-commits
Author: davide
Date: Fri Mar 17 17:19:20 2017
New Revision: 298160

URL: http://llvm.org/viewvc/llvm-project?rev=298160=rev
Log:
[Sema] Unbreak GCC -Werror build (enum compare).

Modified:
cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp

Modified: cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp?rev=298160=298159=298160=diff
==
--- cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp Fri Mar 17 17:19:20 2017
@@ -596,8 +596,8 @@ bool Sema::BuildCXXNestedNameSpecifier(S
   }
   // Replacement '::' -> ':' is not allowed, just issue respective error.
   Diag(R.getNameLoc(), OnlyNamespace
-   ? diag::err_expected_namespace_name
-   : diag::err_expected_class_or_namespace)
+   ? unsigned(diag::err_expected_namespace_name)
+   : 
unsigned(diag::err_expected_class_or_namespace))
   << IdInfo.Identifier << getLangOpts().CPlusPlus;
   if (NamedDecl *ND = R.getAsSingle())
 Diag(ND->getLocation(), diag::note_entity_declared_at)


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


r299315 - [Driver] Don't crash on invalid values of -mrelocation-model=.

2017-04-01 Thread Davide Italiano via cfe-commits
Author: davide
Date: Sat Apr  1 16:07:07 2017
New Revision: 299315

URL: http://llvm.org/viewvc/llvm-project?rev=299315=rev
Log:
[Driver] Don't crash on invalid values of -mrelocation-model=.

This is handled in a similar way we handle invalid -mcode-model.

PR: 31840

Added:
cfe/trunk/test/Driver/reloc-model.c
Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=299315=299314=299315=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Sat Apr  1 16:07:07 2017
@@ -323,7 +323,8 @@ static llvm::CodeModel::Model getCodeMod
 }
 
 static llvm::Reloc::Model getRelocModel(const CodeGenOptions ) {
-  // Keep this synced with the equivalent code in tools/driver/cc1as_main.cpp.
+  // Keep this synced with the equivalent code in
+  // lib/Frontend/CompilerInvocation.cpp
   llvm::Optional RM;
   RM = llvm::StringSwitch(CodeGenOpts.RelocationModel)
   .Case("static", llvm::Reloc::Static)

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=299315=299314=299315=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sat Apr  1 16:07:07 2017
@@ -330,6 +330,17 @@ static StringRef getCodeModel(ArgList 
   return "default";
 }
 
+static StringRef getRelocModel(ArgList , DiagnosticsEngine ) {
+  if (Arg *A = Args.getLastArg(OPT_mrelocation_model)) {
+StringRef Value = A->getValue();
+if (Value == "static" || Value == "pic" || Value == "ropi" ||
+Value == "rwpi" || Value == "ropi-rwpi" || Value == "dynamic-no-pic")
+  return Value;
+Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Value;
+  }
+  return "pic";
+}
+
 /// \brief Create a new Regex instance out of the string value in \p RpassArg.
 /// It returns a pointer to the newly generated Regex instance.
 static std::shared_ptr
@@ -615,7 +626,7 @@ static bool ParseCodeGenArgs(CodeGenOpti
   Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
   Args.hasArg(OPT_cl_fast_relaxed_math);
   Opts.UnwindTables = Args.hasArg(OPT_munwind_tables);
-  Opts.RelocationModel = Args.getLastArgValue(OPT_mrelocation_model, "pic");
+  Opts.RelocationModel = getRelocModel(Args, Diags);
   Opts.ThreadModel = Args.getLastArgValue(OPT_mthread_model, "posix");
   if (Opts.ThreadModel != "posix" && Opts.ThreadModel != "single")
 Diags.Report(diag::err_drv_invalid_value)

Added: cfe/trunk/test/Driver/reloc-model.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/reloc-model.c?rev=299315=auto
==
--- cfe/trunk/test/Driver/reloc-model.c (added)
+++ cfe/trunk/test/Driver/reloc-model.c Sat Apr  1 16:07:07 2017
@@ -0,0 +1,4 @@
+// RUN: not %clang -cc1 -mrelocation-model tinkywinky \
+// RUN: -emit-llvm %s 2>&1 | FileCheck -check-prefix CHECK-INVALID %s
+
+// CHECK-INVALID: error: invalid value 'tinkywinky' in '-mrelocation-model 
tinkywinky'


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


r299364 - [TargetInfo] Use llvm::alignOf() instead of rewriting it. NFCI.

2017-04-03 Thread Davide Italiano via cfe-commits
Author: davide
Date: Mon Apr  3 11:51:39 2017
New Revision: 299364

URL: http://llvm.org/viewvc/llvm-project?rev=299364=rev
Log:
[TargetInfo] Use llvm::alignOf() instead of rewriting it. NFCI.

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

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=299364=299363=299364=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon Apr  3 11:51:39 2017
@@ -4917,7 +4917,7 @@ ABIArgInfo AArch64ABIInfo::classifyArgum
   return coerceToIntArray(Ty, getContext(), getVMContext());
 }
 unsigned Alignment = getContext().getTypeAlign(Ty);
-Size = 64 * ((Size + 63) / 64); // round up to multiple of 8 bytes
+Size = llvm::alignTo(Size, 64); // round up to multiple of 8 bytes
 
 // We use a pair of i64 for 16-byte aggregate with 8-byte alignment.
 // For aggregates with 16-byte alignment, we use i128.
@@ -4967,7 +4967,7 @@ ABIArgInfo AArch64ABIInfo::classifyRetur
   return coerceToIntArray(RetTy, getContext(), getVMContext());
 }
 unsigned Alignment = getContext().getTypeAlign(RetTy);
-Size = 64 * ((Size + 63) / 64); // round up to multiple of 8 bytes
+Size = llvm::alignTo(Size, 64); // round up to multiple of 8 bytes
 
 // We use a pair of i64 for 16-byte aggregate with 8-byte alignment.
 // For aggregates with 16-byte alignment, we use i128.


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


r301339 - [PGO] Update test now that we don't call IndirectCallPromotion.

2017-04-25 Thread Davide Italiano via cfe-commits
Author: davide
Date: Tue Apr 25 12:48:10 2017
New Revision: 301339

URL: http://llvm.org/viewvc/llvm-project?rev=301339=rev
Log:
[PGO] Update test now that we don't call IndirectCallPromotion.

Modified:
cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c

Modified: cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c?rev=301339=301338=301339=diff
==
--- cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c (original)
+++ cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Tue Apr 25 12:48:10 2017
@@ -32,10 +32,10 @@ void unroll() {
 baz(i);
 }
 
-// Checks if icp is invoked by normal compile, but not thinlto compile.
+// Checks that icp is invoked.
 // O2-LABEL: define void @icp
 // THINLTO-LABEL: define void @icp
-// O2: if.true.direct_targ
+// O2-NOT: if.true.direct_targ
 // ThinLTO-NOT: if.true.direct_targ
 void icp(void (*p)()) {
   p();


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


r301344 - [PGO/tests] Update comment to reflect reality.

2017-04-25 Thread Davide Italiano via cfe-commits
Author: davide
Date: Tue Apr 25 13:04:31 2017
New Revision: 301344

URL: http://llvm.org/viewvc/llvm-project?rev=301344=rev
Log:
[PGO/tests] Update comment to reflect reality.

Modified:
cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c

Modified: cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c?rev=301344=301343=301344=diff
==
--- cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c (original)
+++ cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Tue Apr 25 13:04:31 2017
@@ -32,7 +32,7 @@ void unroll() {
 baz(i);
 }
 
-// Checks that icp is invoked.
+// Check that icp is not invoked (both -O2 and ThinLTO).
 // O2-LABEL: define void @icp
 // THINLTO-LABEL: define void @icp
 // O2-NOT: if.true.direct_targ


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


r304499 - [CodeGen] Surround assertion with parentheses.

2017-06-01 Thread Davide Italiano via cfe-commits
Author: davide
Date: Thu Jun  1 18:55:18 2017
New Revision: 304499

URL: http://llvm.org/viewvc/llvm-project?rev=304499=rev
Log:
[CodeGen] Surround assertion with parentheses.

This should placate GCC's -Wparentheses.

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

Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=304499=304498=304499=diff
==
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Thu Jun  1 18:55:18 2017
@@ -3887,7 +3887,7 @@ Value *CodeGenFunction::EmitCheckedInBou
   /// Return the result of the given binary operation.
   auto eval = [&](BinaryOperator::Opcode Opcode, llvm::Value *LHS,
   llvm::Value *RHS) -> llvm::Value * {
-assert(Opcode == BO_Add || Opcode == BO_Mul && "Can't eval binop");
+assert((Opcode == BO_Add || Opcode == BO_Mul) && "Can't eval binop");
 
 // If the operands are constants, return a constant result.
 if (auto *LHSCI = dyn_cast(LHS)) {


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


r304322 - [CodeGen] Surround assertion with parens and format.

2017-05-31 Thread Davide Italiano via cfe-commits
Author: davide
Date: Wed May 31 13:51:36 2017
New Revision: 304322

URL: http://llvm.org/viewvc/llvm-project?rev=304322=rev
Log:
[CodeGen] Surround assertion with parens and format.

This should placate GCC7 with -Werror.

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

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=304322=304321=304322=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed May 31 13:51:36 2017
@@ -472,10 +472,10 @@ void CodeGenModule::Release() {
   // Width of wchar_t in bytes
   uint64_t WCharWidth =
   Context.getTypeSizeInChars(Context.getWideCharType()).getQuantity();
-  assert(LangOpts.ShortWChar ||
- llvm::TargetLibraryInfoImpl::getTargetWCharSize(Target.getTriple()) ==
- Target.getWCharWidth() / 8 &&
- "LLVM wchar_t size out of sync");
+  assert((LangOpts.ShortWChar ||
+  llvm::TargetLibraryInfoImpl::getTargetWCharSize(Target.getTriple()) 
==
+  Target.getWCharWidth() / 8) &&
+ "LLVM wchar_t size out of sync");
 
   // We need to record the widths of enums and wchar_t, so that we can generate
   // the correct build attributes in the ARM backend. wchar_size is also used 
by


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


r315621 - [SemaChecking] Suppress a GCC warning. NFCI.

2017-10-12 Thread Davide Italiano via cfe-commits
Author: davide
Date: Thu Oct 12 14:08:29 2017
New Revision: 315621

URL: http://llvm.org/viewvc/llvm-project?rev=315621=rev
Log:
[SemaChecking] Suppress a GCC warning. NFCI.

Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=315621=315620=315621=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Oct 12 14:08:29 2017
@@ -8652,7 +8652,8 @@ bool CheckTautologicalComparison(Sema 
 
   bool ConstIsLowerBound = (Op == BO_LT || Op == BO_LE) ^ RhsConstant;
   bool ResultWhenConstEqualsOther = (Op == BO_LE || Op == BO_GE);
-  bool ResultWhenConstNeOther = ConstIsLowerBound ^ ValueType == 
LimitType::Max;
+  bool ResultWhenConstNeOther =
+  ConstIsLowerBound ^ (ValueType == LimitType::Max);
   if (ResultWhenConstEqualsOther != ResultWhenConstNeOther)
 return false; // The comparison is not tautological.
 


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


r314605 - [Analysis] Remove unused makeLvalueToRValue variant.

2017-09-30 Thread Davide Italiano via cfe-commits
Author: davide
Date: Sat Sep 30 14:49:15 2017
New Revision: 314605

URL: http://llvm.org/viewvc/llvm-project?rev=314605=rev
Log:
[Analysis] Remove unused makeLvalueToRValue variant.

Modified:
cfe/trunk/lib/Analysis/BodyFarm.cpp

Modified: cfe/trunk/lib/Analysis/BodyFarm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BodyFarm.cpp?rev=314605=314604=314605=diff
==
--- cfe/trunk/lib/Analysis/BodyFarm.cpp (original)
+++ cfe/trunk/lib/Analysis/BodyFarm.cpp Sat Sep 30 14:49:15 2017
@@ -78,10 +78,6 @@ public:
   /// Create an implicit cast for lvalue-to-rvaluate conversions.
   ImplicitCastExpr *makeLvalueToRvalue(const Expr *Arg, QualType Ty);
   
-  /// Create an implicit cast for lvalue-to-rvaluate conversions.
-  ImplicitCastExpr *makeLvalueToRvalue(const Expr *Arg,
-   bool GetNonReferenceType = false);
-
   /// Make RValue out of variable declaration, creating a temporary
   /// DeclRefExpr in the process.
   ImplicitCastExpr *
@@ -164,15 +160,6 @@ ImplicitCastExpr *ASTMaker::makeLvalueTo
   return makeImplicitCast(Arg, Ty, CK_LValueToRValue);
 }
 
-ImplicitCastExpr *ASTMaker::makeLvalueToRvalue(const Expr *Arg,
-   bool GetNonReferenceType) {
-
-  QualType Type = Arg->getType();
-  if (GetNonReferenceType)
-Type = Type.getNonReferenceType();
-  return makeImplicitCast(Arg, Type, CK_LValueToRValue);
-}
-
 ImplicitCastExpr *
 ASTMaker::makeLvalueToRvalue(const VarDecl *Arg,
  bool RefersToEnclosingVariableOrCapture,


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


r314367 - [Targets/X86] Remove unneded `return` in setMaxAtomicWidth(). NFCI.

2017-09-27 Thread Davide Italiano via cfe-commits
Author: davide
Date: Wed Sep 27 17:24:20 2017
New Revision: 314367

URL: http://llvm.org/viewvc/llvm-project?rev=314367=rev
Log:
[Targets/X86] Remove unneded `return` in setMaxAtomicWidth(). NFCI.

Modified:
cfe/trunk/lib/Basic/Targets/X86.h

Modified: cfe/trunk/lib/Basic/Targets/X86.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.h?rev=314367=314366=314367=diff
==
--- cfe/trunk/lib/Basic/Targets/X86.h (original)
+++ cfe/trunk/lib/Basic/Targets/X86.h Wed Sep 27 17:24:20 2017
@@ -875,7 +875,6 @@ public:
   void setMaxAtomicWidth() override {
 if (hasFeature("cx16"))
   MaxAtomicInlineWidth = 128;
-return;
   }
 
   ArrayRef getTargetBuiltins() const override;


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


Re: r325850 - [Darwin] Add a test to check clang produces accelerator tables.

2018-02-23 Thread Davide Italiano via cfe-commits
Apologies, I'm taking a look now.

On Fri, Feb 23, 2018 at 5:33 AM, Yvan Roux <yvan.r...@linaro.org> wrote:
> Hi Davide,
>
>
> This patch broke ARM and AArch64 bots (x86_64 apple targets are not
> available on these bots).
> Logs are available here:
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/15940/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Adebug-info-section-macho.c
>
> Thanks
> Yvan
>
> On 23 February 2018 at 02:25, Davide Italiano via cfe-commits
> <cfe-commits@lists.llvm.org> wrote:
>> Author: davide
>> Date: Thu Feb 22 17:25:03 2018
>> New Revision: 325850
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=325850=rev
>> Log:
>> [Darwin] Add a test to check clang produces accelerator tables.
>>
>> This test was previously in lldb, and was only checking that clang
>> was emitting the correct section. So, it belongs here and not
>> in the debugger.
>>
>> Added:
>> cfe/trunk/test/CodeGen/debug-info-section-macho.c
>>
>> Added: cfe/trunk/test/CodeGen/debug-info-section-macho.c
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-section-macho.c?rev=325850=auto
>> ==
>> --- cfe/trunk/test/CodeGen/debug-info-section-macho.c (added)
>> +++ cfe/trunk/test/CodeGen/debug-info-section-macho.c Thu Feb 22 17:25:03 
>> 2018
>> @@ -0,0 +1,16 @@
>> +// Test that clang produces the __apple accelerator tables,
>> +// e.g., __apple_types, correctly.
>> +// RUN: %clang %s -target x86_64-apple-macosx10.13.0 -c -g -o %t-ex
>> +// RUN: llvm-objdump -section-headers %t-ex | FileCheck %s
>> +
>> +int main (int argc, char const *argv[]) { return argc; }
>> +
>> +// CHECK: __debug_str
>> +// CHECK-NEXT: __debug_abbrev
>> +// CHECK-NEXT: __debug_info
>> +// CHECK-NEXT: __debug_ranges
>> +// CHECK-NEXT: __debug_macinfo
>> +// CHECK-NEXT: __apple_names
>> +// CHECK-NEXT: __apple_objc
>> +// CHECK-NEXT: __apple_namespac
>> +// CHECK-NEXT: __apple_types
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits



-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r325850 - [Darwin] Add a test to check clang produces accelerator tables.

2018-02-22 Thread Davide Italiano via cfe-commits
Author: davide
Date: Thu Feb 22 17:25:03 2018
New Revision: 325850

URL: http://llvm.org/viewvc/llvm-project?rev=325850=rev
Log:
[Darwin] Add a test to check clang produces accelerator tables.

This test was previously in lldb, and was only checking that clang
was emitting the correct section. So, it belongs here and not
in the debugger.

Added:
cfe/trunk/test/CodeGen/debug-info-section-macho.c

Added: cfe/trunk/test/CodeGen/debug-info-section-macho.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-section-macho.c?rev=325850=auto
==
--- cfe/trunk/test/CodeGen/debug-info-section-macho.c (added)
+++ cfe/trunk/test/CodeGen/debug-info-section-macho.c Thu Feb 22 17:25:03 2018
@@ -0,0 +1,16 @@
+// Test that clang produces the __apple accelerator tables,
+// e.g., __apple_types, correctly.
+// RUN: %clang %s -target x86_64-apple-macosx10.13.0 -c -g -o %t-ex
+// RUN: llvm-objdump -section-headers %t-ex | FileCheck %s
+
+int main (int argc, char const *argv[]) { return argc; }
+
+// CHECK: __debug_str
+// CHECK-NEXT: __debug_abbrev
+// CHECK-NEXT: __debug_info
+// CHECK-NEXT: __debug_ranges
+// CHECK-NEXT: __debug_macinfo
+// CHECK-NEXT: __apple_names
+// CHECK-NEXT: __apple_objc
+// CHECK-NEXT: __apple_namespac
+// CHECK-NEXT: __apple_types


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


Re: [PATCH] D48892: [libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY

2018-07-05 Thread Davide Italiano via cfe-commits
On Thu, Jul 5, 2018 at 11:37 AM Duncan P. N. Exon Smith via
Phabricator  wrote:
>
> dexonsmith added a comment.
>
> In https://reviews.llvm.org/D48892#1153473, @davide wrote:
>
> > The lldb bot started failing very recently and the blamelist hints at this 
> > change.
> >
> > http://green.lab.llvm.org/green/job/lldb-cmake//
> >
> > Can you please take a look?
> >
> > For your convenience, this is failing building LibCxx testcases with a 
> > linker error:
> >
> >   Build Command Output:
> >   Undefined symbols for architecture x86_64:
> > "std::__1::__vector_base_common::__vector_base_common()", 
> > referenced from:
> > std::__1::__vector_base 
> > >::__vector_base() in main.o
> > std::__1::__vector_base > std::__1::char_traits, std::__1::allocator >, 
> > std::__1::allocator > std::__1::char_traits, std::__1::allocator > > 
> > >::__vector_base() in main.o
> >   ld: symbol(s) not found for architecture x86_64
> >   clang-7: error: linker command failed with exit code 1 (use -v to see 
> > invocation)
> >   make: *** [a.out] Error 1
> >
>
>
> Interesting.  The failing jobs all have things like this:
>
>   #include 
>   #ifdef _LIBCPP_INLINE_VISIBILITY
>   #undef _LIBCPP_INLINE_VISIBILITY
>   #endif
>   #define _LIBCPP_INLINE_VISIBILITY
>   #include 
>   #include 
>
> We should revert to green, but... why is LLDB doing that?

FWIW, I don't think there's any really good reason for this. The
original test was committed with this `VISIBILITY` dance but the
commit message doesn't really contain any informations.
I guess I'm going just to spin a build locally, see whether it sticks
and remove the offending lines instead of reverting Louis commit.

I'll follow up here.

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


Re: [PATCH] D48892: [libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY

2018-07-05 Thread Davide Italiano via cfe-commits
On Thu, Jul 5, 2018 at 11:46 AM Louis Dionne via Phabricator
 wrote:
>
> ldionne added a comment.
>
> I reverted this commit. Sorry for the blunder. I'll take a look at why LLDB's 
> tests are doing this.
>

No need to revert this immediately. I can probably take a look and fix
what the lldb tests are doing (and in case I can't, we can revert).
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D48892: [libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY

2018-07-05 Thread Davide Italiano via cfe-commits
On Thu, Jul 5, 2018 at 11:49 AM Davide Italiano via llvm-commits
 wrote:
>
> On Thu, Jul 5, 2018 at 11:37 AM Duncan P. N. Exon Smith via
> Phabricator  wrote:
> >
> > dexonsmith added a comment.
> >
> > In https://reviews.llvm.org/D48892#1153473, @davide wrote:
> >
> > > The lldb bot started failing very recently and the blamelist hints at 
> > > this change.
> > >
> > > http://green.lab.llvm.org/green/job/lldb-cmake//
> > >
> > > Can you please take a look?
> > >
> > > For your convenience, this is failing building LibCxx testcases with a 
> > > linker error:
> > >
> > >   Build Command Output:
> > >   Undefined symbols for architecture x86_64:
> > > "std::__1::__vector_base_common::__vector_base_common()", 
> > > referenced from:
> > > std::__1::__vector_base 
> > > >::__vector_base() in main.o
> > > std::__1::__vector_base > > std::__1::char_traits, std::__1::allocator >, 
> > > std::__1::allocator > > std::__1::char_traits, std::__1::allocator > > 
> > > >::__vector_base() in main.o
> > >   ld: symbol(s) not found for architecture x86_64
> > >   clang-7: error: linker command failed with exit code 1 (use -v to see 
> > > invocation)
> > >   make: *** [a.out] Error 1
> > >
> >
> >
> > Interesting.  The failing jobs all have things like this:
> >
> >   #include 
> >   #ifdef _LIBCPP_INLINE_VISIBILITY
> >   #undef _LIBCPP_INLINE_VISIBILITY
> >   #endif
> >   #define _LIBCPP_INLINE_VISIBILITY
> >   #include 
> >   #include 
> >
> > We should revert to green, but... why is LLDB doing that?
>
> FWIW, I don't think there's any really good reason for this. The
> original test was committed with this `VISIBILITY` dance but the
> commit message doesn't really contain any informations.
> I guess I'm going just to spin a build locally, see whether it sticks
> and remove the offending lines instead of reverting Louis commit.
>
> I'll follow up here.
>

Actually, never mind, I realized you just reverted this.

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


r345643 - Revert "[ASTImporter] Reorder fields after structure import is finished"

2018-10-30 Thread Davide Italiano via cfe-commits
Author: davide
Date: Tue Oct 30 13:46:29 2018
New Revision: 345643

URL: http://llvm.org/viewvc/llvm-project?rev=345643=rev
Log:
Revert "[ASTImporter] Reorder fields after structure import is finished"

This reverts commit r345545 because it breaks some lldb tests.

Modified:
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/unittests/AST/ASTImporterTest.cpp

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=345643=345642=345643=diff
==
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Tue Oct 30 13:46:29 2018
@@ -1658,53 +1658,13 @@ ASTNodeImporter::ImportDeclContext(DeclC
 auto ToDCOrErr = Importer.ImportContext(FromDC);
 return ToDCOrErr.takeError();
   }
-
-  const auto *FromRD = dyn_cast(FromDC);
+  llvm::SmallVector ImportedDecls;
   for (auto *From : FromDC->decls()) {
 ExpectedDecl ImportedOrErr = import(From);
-if (!ImportedOrErr) {
-  // For RecordDecls, failed import of a field will break the layout of the
-  // structure. Handle it as an error.
-  if (FromRD)
-return ImportedOrErr.takeError();
+if (!ImportedOrErr)
   // Ignore the error, continue with next Decl.
   // FIXME: Handle this case somehow better.
-  else
-consumeError(ImportedOrErr.takeError());
-}
-  }
-
-  // Reorder declarations in RecordDecls because they may have another
-  // order. Keeping field order is vitable because it determines structure
-  // layout.
-  // FIXME: This is an ugly fix. Unfortunately, I cannot come with better
-  // solution for this issue. We cannot defer expression import here because
-  // type import can depend on them.
-  if (!FromRD)
-return Error::success();
-
-  auto ImportedDC = import(cast(FromDC));
-  assert(ImportedDC);
-  auto *ToRD = cast(*ImportedDC);
-
-  for (auto *D : FromRD->decls()) {
-if (isa(D) || isa(D)) {
-  Decl *ToD = Importer.GetAlreadyImportedOrNull(D);
-  assert(ToRD == ToD->getDeclContext() && ToRD->containsDecl(ToD));
-  ToRD->removeDecl(ToD);
-}
-  }
-
-  assert(ToRD->field_empty());
-
-  for (auto *D : FromRD->decls()) {
-if (isa(D) || isa(D)) {
-  Decl *ToD = Importer.GetAlreadyImportedOrNull(D);
-  assert(ToRD == ToD->getDeclContext());
-  assert(ToRD == ToD->getLexicalDeclContext());
-  assert(!ToRD->containsDecl(ToD));
-  ToRD->addDeclInternal(ToD);
-}
+  consumeError(ImportedOrErr.takeError());
   }
 
   return Error::success();

Modified: cfe/trunk/unittests/AST/ASTImporterTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTImporterTest.cpp?rev=345643=345642=345643=diff
==
--- cfe/trunk/unittests/AST/ASTImporterTest.cpp (original)
+++ cfe/trunk/unittests/AST/ASTImporterTest.cpp Tue Oct 30 13:46:29 2018
@@ -1457,7 +1457,7 @@ TEST_P(ASTImporterTestBase, CXXRecordDec
 }
 
 TEST_P(ASTImporterTestBase,
-   CXXRecordDeclFieldOrderShouldNotDependOnImportOrder) {
+   DISABLED_CXXRecordDeclFieldOrderShouldNotDependOnImportOrder) {
   Decl *From, *To;
   std::tie(From, To) = getImportedDecl(
   // The original recursive algorithm of ASTImporter first imports 'c' then
@@ -3767,16 +3767,5 @@ INSTANTIATE_TEST_CASE_P(ParameterizedTes
 INSTANTIATE_TEST_CASE_P(ParameterizedTests, ImportVariables,
 DefaultTestValuesForRunOptions, );
 
-TEST_P(ImportDecl, ImportFieldOrder) {
-  MatchVerifier Verifier;
-  testImport("struct declToImport {"
- "  int b = a + 2;"
- "  int a = 5;"
- "};",
- Lang_CXX11, "", Lang_CXX11, Verifier,
- recordDecl(hasFieldOrder({"b", "a"})));
-}
-
-
 } // end namespace ast_matchers
 } // end namespace clang


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


r347794 - Revert "[ASTImporter] Changed use of Import to Import_New in ASTImporter."

2018-11-28 Thread Davide Italiano via cfe-commits
Author: davide
Date: Wed Nov 28 11:15:23 2018
New Revision: 347794

URL: http://llvm.org/viewvc/llvm-project?rev=347794=rev
Log:
Revert "[ASTImporter] Changed use of Import to Import_New in ASTImporter."

This broke the lldb bots.

Modified:
cfe/trunk/include/clang/AST/ASTImporter.h
cfe/trunk/lib/AST/ASTImporter.cpp

Modified: cfe/trunk/include/clang/AST/ASTImporter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTImporter.h?rev=347794=347793=347794=diff
==
--- cfe/trunk/include/clang/AST/ASTImporter.h (original)
+++ cfe/trunk/include/clang/AST/ASTImporter.h Wed Nov 28 11:15:23 2018
@@ -154,10 +154,15 @@ class Attr;
 /// \return Error information (success or error).
 template 
 LLVM_NODISCARD llvm::Error importInto(ImportT , const ImportT ) {
-  auto ToOrErr = Import_New(From);
-  if (ToOrErr)
-To = *ToOrErr;
-  return ToOrErr.takeError();
+  To = Import(From);
+  if (From && !To)
+  return llvm::make_error();
+  return llvm::Error::success();
+  // FIXME: this should be the final code
+  //auto ToOrErr = Import(From);
+  //if (ToOrErr)
+  //  To = *ToOrErr;
+  //return ToOrErr.takeError();
 }
 
 /// Import the given type from the "from" context into the "to"

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=347794=347793=347794=diff
==
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Wed Nov 28 11:15:23 2018
@@ -154,6 +154,25 @@ namespace clang {
 return None;
   }
 
+  // FIXME: Temporary until every import returns Expected.
+  template <>
+  LLVM_NODISCARD Error
+  ASTImporter::importInto(SourceLocation , const SourceLocation ) {
+To = Import(From);
+if (From.isValid() && To.isInvalid())
+return llvm::make_error();
+return Error::success();
+  }
+  // FIXME: Temporary until every import returns Expected.
+  template <>
+  LLVM_NODISCARD Error
+  ASTImporter::importInto(QualType , const QualType ) {
+To = Import(From);
+if (!From.isNull() && To.isNull())
+return llvm::make_error();
+return Error::success();
+  }
+
   class ASTNodeImporter : public TypeVisitor,
   public DeclVisitor,
   public StmtVisitor {
@@ -7665,8 +7684,14 @@ ASTImporter::ASTImporter(ASTContext 
 ASTImporter::~ASTImporter() = default;
 
 Expected ASTImporter::Import_New(QualType FromT) {
+  QualType ToT = Import(FromT);
+  if (ToT.isNull() && !FromT.isNull())
+return make_error();
+  return ToT;
+}
+QualType ASTImporter::Import(QualType FromT) {
   if (FromT.isNull())
-return QualType{};
+return {};
 
   const Type *FromTy = FromT.getTypePtr();
 
@@ -7679,64 +7704,46 @@ Expected ASTImporter::Import_N
   // Import the type
   ASTNodeImporter Importer(*this);
   ExpectedType ToTOrErr = Importer.Visit(FromTy);
-  if (!ToTOrErr)
-return ToTOrErr.takeError();
+  if (!ToTOrErr) {
+llvm::consumeError(ToTOrErr.takeError());
+return {};
+  }
 
   // Record the imported type.
   ImportedTypes[FromTy] = (*ToTOrErr).getTypePtr();
 
   return ToContext.getQualifiedType(*ToTOrErr, FromT.getLocalQualifiers());
 }
-QualType ASTImporter::Import(QualType From) {
-  llvm::Expected To = Import_New(From);
-  if (To)
-return *To;
-  else
-llvm::consumeError(To.takeError());
-  return {};
-}
 
 Expected ASTImporter::Import_New(TypeSourceInfo *FromTSI) {
+  TypeSourceInfo *ToTSI = Import(FromTSI);
+  if (!ToTSI && FromTSI)
+return llvm::make_error();
+  return ToTSI;
+}
+TypeSourceInfo *ASTImporter::Import(TypeSourceInfo *FromTSI) {
   if (!FromTSI)
 return FromTSI;
 
   // FIXME: For now we just create a "trivial" type source info based
   // on the type and a single location. Implement a real version of this.
-  ExpectedType TOrErr = Import_New(FromTSI->getType());
-  if (!TOrErr)
-return TOrErr.takeError();
-  ExpectedSLoc BeginLocOrErr = Import_New(FromTSI->getTypeLoc().getBeginLoc());
-  if (!BeginLocOrErr)
-return BeginLocOrErr.takeError();
+  QualType T = Import(FromTSI->getType());
+  if (T.isNull())
+return nullptr;
 
-  return ToContext.getTrivialTypeSourceInfo(*TOrErr, *BeginLocOrErr);
-}
-TypeSourceInfo *ASTImporter::Import(TypeSourceInfo *From) {
-  llvm::Expected To = Import_New(From);
-  if (To)
-return *To;
-  else
-llvm::consumeError(To.takeError());
-  return nullptr;
+  return ToContext.getTrivialTypeSourceInfo(
+  T, Import(FromTSI->getTypeLoc().getBeginLoc()));
 }
 
 Expected ASTImporter::Import_New(const Attr *FromAttr) {
+  return Import(FromAttr);
+}
+Attr *ASTImporter::Import(const Attr *FromAttr) {
   Attr *ToAttr = FromAttr->clone(ToContext);
-  if (auto ToRangeOrErr = Import_New(FromAttr->getRange()))
-   

[clang] [llvm] Use XMACROS for MachO platforms. (PR #69262)

2023-10-16 Thread Davide Italiano via cfe-commits

https://github.com/dcci approved this pull request.

LGTM

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


[lldb] [llvm] [clang] [BOLT] Fix unconditional output of boltedcollection in merge-fdata (PR #78653)

2024-01-18 Thread Davide Italiano via cfe-commits

https://github.com/dcci commented:

LG

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


[llvm] [clang] [CloneFunction][DebugInfo] Avoid cloning DILocalVariables of inlined functions (PR #75385)

2024-01-16 Thread Davide Italiano via cfe-commits

dcci wrote:

Hitting the same problem on a bunch of services. I am going to revert this to 
unblock people, our repro is similar enough to the one Jeremy shared.

```
$ ./exe
clang -cc1 version 18.0.0git based upon LLVM 18.0.0git default target 
x86_64-redhat-linux-gnu
clang++: /home/davidino/llvm-project/llvm/include/llvm/Support/Casting.h:109: 
static bool llvm::isa_impl_cl::doit(const From *) [To = llvm::DILocalScope, From = const llvm::DIScope *]: 
Assertion `Val && "isa<> used on a null pointer"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and 
include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.  Program arguments: /home/davidino/llvm-build-upstream/bin/clang++ 
@/tmp/fbcc.4ddf7_1j/compiler.argsfile
1.  Running pass 'Function Pass Manager' on module 
'buck-out/v2/gen/fbcode/349d8ab5ad6260b7/dsi/logger/configs/CacheClientFciRequestLoggerConfig/__logger__/__objects__/Logger.cpp.o'.
2.  Running pass 'X86 Assembly Printer' on function 
'@_ZN8facebook6logger27CacheClientFciRequestLogger9invokeLogIDnDnEEibT_PKciT0_'
 #0 0x7f123a20a448 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) 
(/home/davidino/llvm-build-upstream/bin/../lib/libLLVMSupport.so.18git+0x20a448)
 #1 0x7f123a207eee llvm::sys::RunSignalHandlers() 
(/home/davidino/llvm-build-upstream/bin/../lib/libLLVMSupport.so.18git+0x207eee)
 #2 0x7f123a20ab18 SignalHandler(int) Signals.cpp:0:0
 #3 0x7f1239854db0 __restore_rt (/lib64/libc.so.6+0x54db0)
 #4 0x7f12398a365c __pthread_kill_implementation (/lib64/libc.so.6+0xa365c)
 #5 0x7f1239854d06 gsignal (/lib64/libc.so.6+0x54d06)
 #6 0x7f12398287f3 abort (/lib64/libc.so.6+0x287f3)
 #7 0x7f123982871b _nl_load_domain.cold (/lib64/libc.so.6+0x2871b)
 #8 0x7f123984dca6 (/lib64/libc.so.6+0x4dca6)
 #9 0x7f123d3f54c3 getRetainedNodeScope(llvm::MDNode const*) 
DwarfDebug.cpp:0:0
#10 0x7f123d3f686a llvm::DwarfDebug::endFunctionImpl(llvm::MachineFunction 
const*) 
(/home/davidino/llvm-build-upstream/bin/../lib/../lib/libLLVMAsmPrinter.so.18git+0x10086a)
#11 0x7f123d3ce46f 
llvm::DebugHandlerBase::endFunction(llvm::MachineFunction const*) 
(/home/davidino/llvm-build-upstream/bin/../lib/../lib/libLLVMAsmPrinter.so.18git+0xd846f)
#12 0x7f123d3a70fb llvm::AsmPrinter::emitFunctionBody() 
(/home/davidino/llvm-build-upstream/bin/../lib/../lib/libLLVMAsmPrinter.so.18git+0xb10fb)
#13 0x7f1240c3db08 
llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) 
X86AsmPrinter.cpp:0:0
#14 0x7f123e1de48d 
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) 
(/home/davidino/llvm-build-upstream/bin/../lib/libLLVMCodeGen.so.18git+0x5de48d)
#15 0x7f123a8a0842 llvm::FPPassManager::runOnFunction(llvm::Function&) 
(/home/davidino/llvm-build-upstream/bin/../lib/libLLVMCore.so.18git+0x4a0842)
#16 0x7f123a8a7542 llvm::FPPassManager::runOnModule(llvm::Module&) 
(/home/davidino/llvm-build-upstream/bin/../lib/libLLVMCore.so.18git+0x4a7542)
#17 0x7f123a8a0f56 llvm::legacy::PassManagerImpl::run(llvm::Module&) 
(/home/davidino/llvm-build-upstream/bin/../lib/libLLVMCore.so.18git+0x4a0f56)
#18 0x7f123cbd248a codegen(llvm::lto::Config const&, llvm::TargetMachine*, 
std::function>> (unsigned int, llvm::Twine 
const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex const&) 
LTOBackend.cpp:0:0
#19 0x7f123cbd35cb llvm::lto::thinBackend(llvm::lto::Config const&, 
unsigned int, 
std::function>> (unsigned int, llvm::Twine 
const&)>, llvm::Module&, llvm::ModuleSummaryIndex const&, 
llvm::DenseMap, std::equal_to, std::allocator>, llvm::DenseMapInfo, 
llvm::detail::DenseMapPair, std::equal_to, std::allocator>>> const&, llvm::DenseMap, llvm::detail::DenseMapPair> const&, llvm::MapVector, 
llvm::detail::DenseMapPair>, 
llvm::SmallVector, 0u>>*, 
std::vector> 
const&)::$_6::operator()(llvm::Module&, llvm::TargetMachine*, 
std::unique_ptr>) const LTOBackend.cpp:0:0
#20 0x7f123cbd3329 llvm::lto::thinBackend(llvm::lto::Config const&, 
unsigned int, 
std::function>> (unsigned int, llvm::Twine 
const&)>, llvm::Module&, llvm::ModuleSummaryIndex const&, 
llvm::DenseMap, std::equal_to, std::allocator>, llvm::DenseMapInfo, 
llvm::detail::DenseMapPair, std::equal_to, std::allocator>>> const&, llvm::DenseMap, llvm::detail::DenseMapPair> const&, llvm::MapVector, 
llvm::detail::DenseMapPair>, 
llvm::SmallVector, 0u>>*, 
std::vector> const&) 
(/home/davidino/llvm-build-upstream/bin/../lib/../lib/libLLVMLTO.so.18git+0x5a329)
#21 0x7f123e8a1d0a clang::EmitBackendOutput(clang::DiagnosticsEngine&, 
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, 
clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, 
llvm::Module*, clang::BackendAction, 
llvm::IntrusiveRefCntPtr, 
std::unique_ptr>, clang::BackendConsumer*) 
(/home/davidino/llvm-build-upstream/bin/../lib/libclangCodeGen.so.18git+0x2a1d0a)
#22 0x7f123ed589dc 

[clang] b6f922f - Revert "[CloneFunction][DebugInfo] Avoid cloning DILocalVariables of inlined functions (#75385)"

2024-01-16 Thread Davide Italiano via cfe-commits

Author: Davide Italiano
Date: 2024-01-16T17:01:01-08:00
New Revision: b6f922fbf5e983122271aa12acb33f6172046d4d

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

LOG: Revert "[CloneFunction][DebugInfo] Avoid cloning DILocalVariables of 
inlined functions (#75385)"

This reverts commit fc6faa1113e9069f41b5500db051210af0eea843.

Added: 
llvm/test/DebugInfo/Generic/split-dwarf-local-import.ll
llvm/test/DebugInfo/Generic/split-dwarf-local-import2.ll
llvm/test/DebugInfo/Generic/split-dwarf-local-import3.ll

Modified: 
clang/test/CodeGen/debug-info-codeview-unnamed.c
clang/test/CodeGen/debug-info-unused-types.c
clang/test/CodeGen/debug-info-unused-types.cpp
clang/test/CodeGenCXX/debug-info-access.cpp
clang/test/CodeGenCXX/debug-info-anon-union-vars.cpp
clang/test/CodeGenCXX/debug-info-codeview-unnamed.cpp
clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp
clang/test/CodeGenCXX/debug-lambda-this.cpp
llvm/include/llvm/IR/DIBuilder.h
llvm/include/llvm/IR/DebugInfo.h
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/IR/DIBuilder.cpp
llvm/lib/IR/DebugInfo.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Transforms/Utils/CloneFunction.cpp
llvm/test/Bitcode/upgrade-cu-locals.ll
llvm/test/Bitcode/upgrade-cu-locals.ll.bc
llvm/test/DebugInfo/Generic/verifier-invalid-disubprogram.ll
llvm/test/DebugInfo/X86/set.ll
llvm/unittests/Transforms/Utils/CloningTest.cpp

Removed: 
llvm/test/Bitcode/clone-local-types.ll
llvm/test/DebugInfo/Generic/inlined-local-type.ll
llvm/test/DebugInfo/Generic/lexical-block-retained-types.ll
llvm/test/DebugInfo/Generic/lexical-block-types.ll
llvm/test/DebugInfo/X86/local-type-as-template-parameter.ll
llvm/test/DebugInfo/X86/split-dwarf-local-import.ll
llvm/test/DebugInfo/X86/split-dwarf-local-import2.ll
llvm/test/DebugInfo/X86/split-dwarf-local-import3.ll



diff  --git a/clang/test/CodeGen/debug-info-codeview-unnamed.c 
b/clang/test/CodeGen/debug-info-codeview-unnamed.c
index 16ffb3682236f18..bd2a7543e56b2ba 100644
--- a/clang/test/CodeGen/debug-info-codeview-unnamed.c
+++ b/clang/test/CodeGen/debug-info-codeview-unnamed.c
@@ -8,23 +8,23 @@ int main(int argc, char* argv[], char* arge[]) {
   //
   struct { int bar; } one = {42};
   //
-  // LINUX:  [[TYPE_OF_ONE:![0-9]+]] = distinct !DICompositeType(
+  // LINUX:  !{{[0-9]+}} = !DILocalVariable(name: "one"
+  // LINUX-SAME: type: [[TYPE_OF_ONE:![0-9]+]]
+  // LINUX-SAME: )
+  // LINUX:  [[TYPE_OF_ONE]] = distinct !DICompositeType(
   // LINUX-SAME: tag: DW_TAG_structure_type
   // LINUX-NOT:  name:
   // LINUX-NOT:  identifier:
   // LINUX-SAME: )
-  // LINUX:  !{{[0-9]+}} = !DILocalVariable(name: "one"
-  // LINUX-SAME: type: [[TYPE_OF_ONE]]
-  // LINUX-SAME: )
   //
-  // MSVC:   [[TYPE_OF_ONE:![0-9]+]] = distinct !DICompositeType
+  // MSVC:   !{{[0-9]+}} = !DILocalVariable(name: "one"
+  // MSVC-SAME:  type: [[TYPE_OF_ONE:![0-9]+]]
+  // MSVC-SAME:  )
+  // MSVC:   [[TYPE_OF_ONE]] = distinct !DICompositeType
   // MSVC-SAME:  tag: DW_TAG_structure_type
   // MSVC-NOT:   name:
   // MSVC-NOT:   identifier:
   // MSVC-SAME:  )
-  // MSVC:   !{{[0-9]+}} = !DILocalVariable(name: "one"
-  // MSVC-SAME:  type: [[TYPE_OF_ONE]]
-  // MSVC-SAME:  )
 
   return 0;
 }

diff  --git a/clang/test/CodeGen/debug-info-unused-types.c 
b/clang/test/CodeGen/debug-info-unused-types.c
index 31d608d92a06b41..3e9f7b07658e36e 100644
--- a/clang/test/CodeGen/debug-info-unused-types.c
+++ b/clang/test/CodeGen/debug-info-unused-types.c
@@ -18,15 +18,13 @@ void quux(void) {
 // CHECK: !DICompileUnit{{.+}}retainedTypes: [[RETTYPES:![0-9]+]]
 // CHECK: [[TYPE0:![0-9]+]] = !DICompositeType(tag: DW_TAG_enumeration_type, 
name: "bar"
 // CHECK: [[TYPE1:![0-9]+]] = !DIEnumerator(name: "BAR"
-// CHECK: [[RETTYPES]] = !{[[TYPE2:![0-9]+]], [[TYPE3:![0-9]+]], [[TYPE0]], 
[[TYPE4:![0-9]+]], {{![0-9]+}}}
-// CHECK: [[TYPE2]] = !DIDerivedType(tag: DW_TAG_typedef, name: "my_int"
-// CHECK: [[TYPE3]] = distinct !DICompositeType(tag: DW_TAG_structure_type, 
name: "foo"
-// CHECK: [[TYPE4]] = distinct !DICompositeType(tag: DW_TAG_union_type, name: 
"baz"
-// CHECK: [[SP:![0-9]+]] = distinct !DISubprogram(name: "quux", {{.*}}, 
retainedNodes: [[SPRETNODES:![0-9]+]]
-// CHECK: [[SPRETNODES]] = !{[[TYPE5:![0-9]+]], [[TYPE6:![0-9]+]], 
[[TYPE8:![0-9]+]]}
-// CHECK: [[TYPE5]] = distinct !DICompositeType(tag: DW_TAG_structure_type, 
name: "y"
-// CHECK: [[TYPE6]] = !DICompositeType(tag: 

[clang] [llvm] [CloneFunction][DebugInfo] Avoid cloning DILocalVariables of inlined functions (PR #75385)

2024-01-16 Thread Davide Italiano via cfe-commits

dcci wrote:

Reverted in 
https://github.com/llvm/llvm-project/commit/b6f922fbf5e983122271aa12acb33f6172046d4d

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