Re: [PATCH] D21204: clang-format: [JS] post-fix non-null assertion operator.

2016-06-09 Thread Martin Probst via cfe-commits
mprobst added inline comments.


Comment at: lib/Format/TokenAnnotator.cpp:2128
@@ +2127,3 @@
+if (Right.is(tok::exclaim) && (Left.isOneOf(tok::identifier, tok::r_paren,
+tok::r_square, tok::r_brace) ||
+   Left.Tok.isLiteral()))

Tests added. A literal cannot really be null, but the operator is allowed after 
any kind of expression, and it's straight forward to test for it here.


http://reviews.llvm.org/D21204



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


Re: [PATCH] D21204: clang-format: [JS] post-fix non-null assertion operator.

2016-06-09 Thread Martin Probst via cfe-commits
mprobst updated this revision to Diff 60311.
mprobst added a comment.

- more tests


http://reviews.llvm.org/D21204

Files:
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1291,5 +1291,14 @@
"var x   =  hello();");
 }
 
+TEST_F(FormatTestJS, NonNullAssertionOperator) {
+  verifyFormat("let x = foo!.bar();\n");
+  verifyFormat("let x = foo ? bar! : baz;\n");
+  verifyFormat("let x = !foo;\n");
+  verifyFormat("let x = foo[0]!;\n");
+  verifyFormat("let x = (foo)!;\n");
+  verifyFormat("let x = {foo: 1}!;\n");
+}
+
 } // end namespace tooling
 } // end namespace clang
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -2123,6 +2123,11 @@
   // locations that should have whitespace following are identified by the
   // above set of follower tokens.
   return false;
+// Postfix non-null assertion operator, as in `foo!.bar()`.
+if (Right.is(tok::exclaim) && (Left.isOneOf(tok::identifier, tok::r_paren,
+tok::r_square, tok::r_brace) ||
+   Left.Tok.isLiteral()))
+  return false;
   } else if (Style.Language == FormatStyle::LK_Java) {
 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
   return true;


Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1291,5 +1291,14 @@
"var x   =  hello();");
 }
 
+TEST_F(FormatTestJS, NonNullAssertionOperator) {
+  verifyFormat("let x = foo!.bar();\n");
+  verifyFormat("let x = foo ? bar! : baz;\n");
+  verifyFormat("let x = !foo;\n");
+  verifyFormat("let x = foo[0]!;\n");
+  verifyFormat("let x = (foo)!;\n");
+  verifyFormat("let x = {foo: 1}!;\n");
+}
+
 } // end namespace tooling
 } // end namespace clang
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -2123,6 +2123,11 @@
   // locations that should have whitespace following are identified by the
   // above set of follower tokens.
   return false;
+// Postfix non-null assertion operator, as in `foo!.bar()`.
+if (Right.is(tok::exclaim) && (Left.isOneOf(tok::identifier, tok::r_paren,
+tok::r_square, tok::r_brace) ||
+   Left.Tok.isLiteral()))
+  return false;
   } else if (Style.Language == FormatStyle::LK_Java) {
 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
   return true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21204: clang-format: [JS] post-fix non-null assertion operator.

2016-06-09 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
This revision is now accepted and ready to land.


Comment at: lib/Format/TokenAnnotator.cpp:2128
@@ +2127,3 @@
+if (Right.is(tok::exclaim) &&
+(Left.isOneOf(tok::identifier, tok::r_paren, tok::r_square) ||
+ Left.Tok.isLiteral()))

Can you add a test for each of these? Also, how can a literal be null?


http://reviews.llvm.org/D21204



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


Re: [PATCH] D21204: clang-format: [JS] post-fix non-null assertion operator.

2016-06-09 Thread Martin Probst via cfe-commits
mprobst updated this revision to Diff 60308.
mprobst marked an inline comment as done.
mprobst added a comment.

- invert check to whitelist known tokens that can precede a non-null assertion.


http://reviews.llvm.org/D21204

Files:
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1291,5 +1291,12 @@
"var x   =  hello();");
 }
 
+TEST_F(FormatTestJS, NonNullAssertionOperator) {
+  verifyFormat("let x = foo!.bar();\n");
+  verifyFormat("let x = foo ? bar! : baz;\n");
+  verifyFormat("let x = !foo;\n");
+  verifyFormat("let x = foo!;\n");
+}
+
 } // end namespace tooling
 } // end namespace clang
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -2123,6 +2123,11 @@
   // locations that should have whitespace following are identified by the
   // above set of follower tokens.
   return false;
+// Postfix non-null assertion operator, as in `foo!.bar()`.
+if (Right.is(tok::exclaim) &&
+(Left.isOneOf(tok::identifier, tok::r_paren, tok::r_square) ||
+ Left.Tok.isLiteral()))
+  return false;
   } else if (Style.Language == FormatStyle::LK_Java) {
 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
   return true;


Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1291,5 +1291,12 @@
"var x   =  hello();");
 }
 
+TEST_F(FormatTestJS, NonNullAssertionOperator) {
+  verifyFormat("let x = foo!.bar();\n");
+  verifyFormat("let x = foo ? bar! : baz;\n");
+  verifyFormat("let x = !foo;\n");
+  verifyFormat("let x = foo!;\n");
+}
+
 } // end namespace tooling
 } // end namespace clang
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -2123,6 +2123,11 @@
   // locations that should have whitespace following are identified by the
   // above set of follower tokens.
   return false;
+// Postfix non-null assertion operator, as in `foo!.bar()`.
+if (Right.is(tok::exclaim) &&
+(Left.isOneOf(tok::identifier, tok::r_paren, tok::r_square) ||
+ Left.Tok.isLiteral()))
+  return false;
   } else if (Style.Language == FormatStyle::LK_Java) {
 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
   return true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21204: clang-format: [JS] post-fix non-null assertion operator.

2016-06-09 Thread Martin Probst via cfe-commits
mprobst added inline comments.


Comment at: lib/Format/TokenAnnotator.cpp:2127
@@ +2126,3 @@
+// Postfix non-null assertion operator, as in `foo!.bar()`.
+if (Right.is(tok::exclaim) && Right.Next &&
+Right.Next->isNot(tok::identifier) && !Right.Next->Tok.isLiteral())

djasper wrote:
> From a quick look at our codebase, I think you need to also rule out the 
> following for Right.Next:
> 
>   - (, [, {
>   - !  ('!!' seems to be a thing)
>   - -, +, ~ (don't know exactly what this does to a JS boolean value)
>   - %, $ (not entirely sure whether these become part of the identifier)
> 
> 
Actually, I think inverting the condition and "whitelisting" preceding tokens 
makes more sense and is probably a lot more robust. PTAL, now checking left for 
identifier, r_paren, r_square, literal.


http://reviews.llvm.org/D21204



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


r272368 - Check for null pointers before calling the Stmt Profiler

2016-06-09 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Thu Jun  9 23:52:09 2016
New Revision: 272368

URL: http://llvm.org/viewvc/llvm-project?rev=272368=rev
Log:
Check for null pointers before calling the Stmt Profiler

Some calls from OMPClauseProfiler were calling the Stmt Profiler with null
pointers, but the profiler can only handle non-null pointers.  Add an assert
to the VisitStmt for valid pointers, and check all calls from OMPClauseProfiler
to be non-null pointers.

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=272368=272367=272368=diff
==
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Thu Jun  9 23:52:09 2016
@@ -69,6 +69,7 @@ namespace {
 }
 
 void StmtProfiler::VisitStmt(const Stmt *S) {
+  assert(S && "Requires non-null Stmt pointer");
   ID.AddInteger(S->getStmtClass());
   for (const Stmt *SubStmt : S->children()) {
 if (SubStmt)
@@ -355,14 +356,16 @@ void OMPClauseProfiler::VisitOMPNogroupC
 template
 void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
   for (auto *E : Node->varlists()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
 }
 
 void OMPClauseProfiler::VisitOMPPrivateClause(const OMPPrivateClause *C) {
   VisitOMPClauseList(C);
   for (auto *E : C->private_copies()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
 }
 void
@@ -370,10 +373,12 @@ OMPClauseProfiler::VisitOMPFirstprivateC
   VisitOMPClauseList(C);
   VistOMPClauseWithPreInit(C);
   for (auto *E : C->private_copies()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
   for (auto *E : C->inits()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
 }
 void
@@ -381,13 +386,16 @@ OMPClauseProfiler::VisitOMPLastprivateCl
   VisitOMPClauseList(C);
   VistOMPClauseWithPostUpdate(C);
   for (auto *E : C->source_exprs()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
   for (auto *E : C->destination_exprs()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
   for (auto *E : C->assignment_ops()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
 }
 void OMPClauseProfiler::VisitOMPSharedClause(const OMPSharedClause *C) {
@@ -401,63 +409,80 @@ void OMPClauseProfiler::VisitOMPReductio
   VisitOMPClauseList(C);
   VistOMPClauseWithPostUpdate(C);
   for (auto *E : C->privates()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
   for (auto *E : C->lhs_exprs()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
   for (auto *E : C->rhs_exprs()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
   for (auto *E : C->reduction_ops()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
 }
 void OMPClauseProfiler::VisitOMPLinearClause(const OMPLinearClause *C) {
   VisitOMPClauseList(C);
   VistOMPClauseWithPostUpdate(C);
   for (auto *E : C->privates()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
   for (auto *E : C->inits()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
   for (auto *E : C->updates()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
   for (auto *E : C->finals()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
-  Profiler->VisitStmt(C->getStep());
-  Profiler->VisitStmt(C->getCalcStep());
+  if (C->getStep())
+Profiler->VisitStmt(C->getStep());
+  if (C->getCalcStep())
+Profiler->VisitStmt(C->getCalcStep());
 }
 void OMPClauseProfiler::VisitOMPAlignedClause(const OMPAlignedClause *C) {
   VisitOMPClauseList(C);
-  Profiler->VisitStmt(C->getAlignment());
+  if (C->getAlignment())
+Profiler->VisitStmt(C->getAlignment());
 }
 void OMPClauseProfiler::VisitOMPCopyinClause(const OMPCopyinClause *C) {
   VisitOMPClauseList(C);
   for (auto *E : C->source_exprs()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
   for (auto *E : C->destination_exprs()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
   for (auto *E : C->assignment_ops()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
 }
 void
 OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) {
   VisitOMPClauseList(C);
   for (auto *E : C->source_exprs()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
   for (auto *E : C->destination_exprs()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
   for (auto *E : C->assignment_ops()) {
-Profiler->VisitStmt(E);
+if (E)
+  Profiler->VisitStmt(E);
   }
 }
 void 

Re: [PATCH] D21204: clang-format: [JS] post-fix non-null assertion operator.

2016-06-09 Thread Daniel Jasper via cfe-commits
djasper added inline comments.


Comment at: lib/Format/TokenAnnotator.cpp:2127
@@ +2126,3 @@
+// Postfix non-null assertion operator, as in `foo!.bar()`.
+if (Right.is(tok::exclaim) && Right.Next &&
+Right.Next->isNot(tok::identifier) && !Right.Next->Tok.isLiteral())

From a quick look at our codebase, I think you need to also rule out the 
following for Right.Next:

  - (, [, {
  - !  ('!!' seems to be a thing)
  - -, +, ~ (don't know exactly what this does to a JS boolean value)
  - %, $ (not entirely sure whether these become part of the identifier)




http://reviews.llvm.org/D21204



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


r272366 - Fix recognition of shadowed template parameter

2016-06-09 Thread Serge Pavlov via cfe-commits
Author: sepavloff
Date: Thu Jun  9 23:39:07 2016
New Revision: 272366

URL: http://llvm.org/viewvc/llvm-project?rev=272366=rev
Log:
Fix recognition of shadowed template parameter

Crash reported in PR28023 is caused by the fact that non-type template
parameters are found by tag name lookup.  In the code provided in that PR:

template struct A {
  struct B {
template  friend struct V;
  };
};

the template parameter V is found when lookup for redeclarations of 'struct V'
is made. Latter on the error about shadowing of 'V' is emitted but the semantic
context of 'struct V' is already determined wrong: 'struct A' instead of
translation unit.

The fix moves the check for shadowing toward the beginning of the method and
thus prevents from wrong context calculations.

This change fixes PR28023.

Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/CXX/temp/temp.res/temp.local/p6.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=272366=272365=272366=diff
==
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu Jun  9 23:39:07 2016
@@ -929,6 +929,13 @@ Sema::CheckClassTemplate(Scope *S, unsig
   if (Previous.begin() != Previous.end())
 PrevDecl = (*Previous.begin())->getUnderlyingDecl();
 
+  if (PrevDecl && PrevDecl->isTemplateParameter()) {
+// Maybe we will complain about the shadowed template parameter.
+DiagnoseTemplateParameterShadow(NameLoc, PrevDecl);
+// Just pretend that we didn't see the previous declaration.
+PrevDecl = nullptr;
+  }
+
   // If there is a previous declaration with the same name, check
   // whether this is a valid redeclaration.
   ClassTemplateDecl *PrevClassTemplate
@@ -1054,12 +1061,7 @@ Sema::CheckClassTemplate(Scope *S, unsig
 // definition, as part of error recovery?
 return true;
   }
-}
-  } else if (PrevDecl && PrevDecl->isTemplateParameter()) {
-// Maybe we will complain about the shadowed template parameter.
-DiagnoseTemplateParameterShadow(NameLoc, PrevDecl);
-// Just pretend that we didn't see the previous declaration.
-PrevDecl = nullptr;
+}
   } else if (PrevDecl) {
 // C++ [temp]p5:
 //   A class template shall not have the same name as any other

Modified: cfe/trunk/test/CXX/temp/temp.res/temp.local/p6.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.res/temp.local/p6.cpp?rev=272366=272365=272366=diff
==
--- cfe/trunk/test/CXX/temp/temp.res/temp.local/p6.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.res/temp.local/p6.cpp Thu Jun  9 23:39:07 2016
@@ -5,11 +5,11 @@ namespace N {}
 template struct X {}; // expected-error {{declaration of 'T' 
shadows template parameter}}
 
-template struct Y { // expected-note 17{{declared here}}
+template struct Y { // expected-note 18{{declared here}}
   template struct A {}; // expected-error {{declaration of 'T' 
shadows template parameter}}
 
   struct B {
-template struct T {}; // FIXME: desired-error {{declaration of 
'T' shadows template parameter}}
+template struct T {}; // expected-error {{declaration of 'T' 
shadows template parameter}}
   };
   struct C {
 template void T(); // expected-error {{declaration of 'T' 
shadows template parameter}}
@@ -65,11 +65,11 @@ template struct Y { // expec
   friend struct T; // expected-error {{declaration of 'T' shadows template 
parameter}}
 };
 
-template struct Z { // expected-note 15{{declared here}}
+template struct Z { // expected-note 16{{declared here}}
   template struct A {}; // expected-error {{declaration of 'T' 
shadows template parameter}}
 
   struct B {
-template struct T {}; // FIXME: desired-error {{declaration of 
'T' shadows template parameter}}
+template struct T {}; // expected-error {{declaration of 'T' 
shadows template parameter}}
   };
   struct C {
 template void T(); // expected-error {{declaration of 'T' 
shadows template parameter}}
@@ -129,7 +129,8 @@ void f(int T) {} // expected-error {{dec
 
 // FIXME: These are ill-formed: a template-parameter shall not have the same 
name as the template name.
 namespace A {
-  template struct T {};
+  template struct T {};  // expected-error{{declaration of 'T' 
shadows template parameter}}
+ // expected-note@-1{{template parameter 
is declared here}}
 }
 namespace B {
   template void T() {}
@@ -137,3 +138,13 @@ namespace B {
 namespace C {
   template int T;
 }
+
+namespace PR28023 {
+template  // expected-note{{template parameter is declared here}}
+struct A {
+  struct B {
+template  friend struct V;  // expected-error{{declaration of 'V' 
shadows template parameter}}
+  };
+};
+A<0>::B a;
+}


___
cfe-commits mailing 

Re: [PATCH] D21163: Strip Android version when looking up toolchain paths.

2016-06-09 Thread Tim Northover via cfe-commits
t.p.northover accepted this revision.
t.p.northover added a reviewer: t.p.northover.
t.p.northover added a comment.
This revision is now accepted and ready to land.

I think that looks good. Thanks for adding the test!

Tim.


http://reviews.llvm.org/D21163



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


r272361 - Reduce sizeof(CXXConstructorDecl) by 4-8 bytes.

2016-06-09 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Jun  9 21:01:28 2016
New Revision: 272361

URL: http://llvm.org/viewvc/llvm-project?rev=272361=rev
Log:
Reduce sizeof(CXXConstructorDecl) by 4-8 bytes.

Modified:
cfe/trunk/include/clang/AST/DeclCXX.h

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=272361=272360=272361=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Thu Jun  9 21:01:28 2016
@@ -2165,17 +2165,18 @@ public:
 /// \endcode
 class CXXConstructorDecl : public CXXMethodDecl {
   void anchor() override;
-  /// \brief Whether this constructor declaration has the \c explicit keyword
-  /// specified.
-  bool IsExplicitSpecified : 1;
 
   /// \name Support for base and member initializers.
   /// \{
   /// \brief The arguments used to initialize the base or member.
   LazyCXXCtorInitializersPtr CtorInitializers;
-  unsigned NumCtorInitializers;
+  unsigned NumCtorInitializers : 31;
   /// \}
 
+  /// \brief Whether this constructor declaration has the \c explicit keyword
+  /// specified.
+  unsigned IsExplicitSpecified : 1;
+
   CXXConstructorDecl(ASTContext , CXXRecordDecl *RD, SourceLocation StartLoc,
  const DeclarationNameInfo ,
  QualType T, TypeSourceInfo *TInfo,
@@ -2183,8 +2184,8 @@ class CXXConstructorDecl : public CXXMet
  bool isImplicitlyDeclared, bool isConstexpr)
 : CXXMethodDecl(CXXConstructor, C, RD, StartLoc, NameInfo, T, TInfo,
 SC_None, isInline, isConstexpr, SourceLocation()),
-  IsExplicitSpecified(isExplicitSpecified), CtorInitializers(nullptr),
-  NumCtorInitializers(0) {
+  CtorInitializers(nullptr), NumCtorInitializers(0),
+  IsExplicitSpecified(isExplicitSpecified) {
 setImplicit(isImplicitlyDeclared);
   }
 


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


Re: [PATCH] D20964: [clang-tidy] Add modernize-use-emplace

2016-06-09 Thread Vedant Kumar via cfe-commits
vsk added inline comments.


Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:41
@@ +40,3 @@
+  // (and destructed) as in push_back case.
+  auto isCtorOfSmartPtr = hasDeclaration(cxxConstructorDecl(
+  ofClass(hasAnyName("std::shared_ptr", "std::unique_ptr", "std::auto_ptr",

I agree that blacklisting some smart pointers is not a complete solution, and 
that we shouldn't introduce a check which emits false positives.

ISTM it's **only** safe to perform the "push(T(...)) -> emplace(...)" change 
if: it's safe to assume that if "emplace(...)" does not successfully call 
"T(...)", it's OK for the program to fail/leak/crash. Do we get to make this 
assumption ever? Perhaps just in no-exceptions mode?


http://reviews.llvm.org/D20964



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


Re: [PATCH] D21163: Strip Android version when looking up toolchain paths.

2016-06-09 Thread Josh Gao via cfe-commits
jmgao updated this revision to Diff 60294.
jmgao added a comment.

Add test.


http://reviews.llvm.org/D21163

Files:
  lib/Driver/Driver.cpp
  test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld
  test/Driver/Inputs/android_triple_version/bin/arm-linux-androideabi-ld.exe
  test/Driver/android-triple-version.c

Index: test/Driver/android-triple-version.c
===
--- /dev/null
+++ test/Driver/android-triple-version.c
@@ -0,0 +1,10 @@
+// Android's target triples can contain a version number in the environment
+// field (e.g. arm-linux-androideabi9).
+// Make sure that any version is stripped when finding toolchain binaries.
+
+// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
+// RUN: %clang -### -target arm-linux-androideabi %s 2>&1 | FileCheck %s
+// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
+// RUN: %clang -### -target arm-linux-androideabi9 %s 2>&1 | FileCheck %s
+
+// CHECK: arm-linux-androideabi-ld
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2343,7 +2343,15 @@
 const char *Tool, const ToolChain ,
 SmallVectorImpl ) const {
   // FIXME: Needs a better variable than DefaultTargetTriple
-  Names.emplace_back(DefaultTargetTriple + "-" + Tool);
+  StringRef Triple = DefaultTargetTriple;
+
+  // On Android, the target triple can include a version number that needs to
+  // be stripped.
+  if (TC.getTriple().isAndroid()) {
+Triple = Triple.rtrim("0123456789");
+  }
+
+  Names.emplace_back((Triple + "-" + Tool).str());
   Names.emplace_back(Tool);
 
   // Allow the discovery of tools prefixed with LLVM's default target triple.


Index: test/Driver/android-triple-version.c
===
--- /dev/null
+++ test/Driver/android-triple-version.c
@@ -0,0 +1,10 @@
+// Android's target triples can contain a version number in the environment
+// field (e.g. arm-linux-androideabi9).
+// Make sure that any version is stripped when finding toolchain binaries.
+
+// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
+// RUN: %clang -### -target arm-linux-androideabi %s 2>&1 | FileCheck %s
+// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
+// RUN: %clang -### -target arm-linux-androideabi9 %s 2>&1 | FileCheck %s
+
+// CHECK: arm-linux-androideabi-ld
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2343,7 +2343,15 @@
 const char *Tool, const ToolChain ,
 SmallVectorImpl ) const {
   // FIXME: Needs a better variable than DefaultTargetTriple
-  Names.emplace_back(DefaultTargetTriple + "-" + Tool);
+  StringRef Triple = DefaultTargetTriple;
+
+  // On Android, the target triple can include a version number that needs to
+  // be stripped.
+  if (TC.getTriple().isAndroid()) {
+Triple = Triple.rtrim("0123456789");
+  }
+
+  Names.emplace_back((Triple + "-" + Tool).str());
   Names.emplace_back(Tool);
 
   // Allow the discovery of tools prefixed with LLVM's default target triple.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19260: [analyzer][scan-build-py] subprocess output handling reviewed in clang module

2016-06-09 Thread Devin Coughlin via cfe-commits
dcoughlin accepted this revision.
dcoughlin added a comment.
This revision is now accepted and ready to land.

This looks good to me. I've run this on a suite of open source projects and it 
reported no changes in the reference results. Thanks for simplifying and adding 
the extra tests!



Comment at: tools/scan-build-py/libscanbuild/clang.py:90
@@ -89,2 +89,3 @@
 
-{: (, )} """
+predicate.patterns = [re.compile(r'^' + a + r'(\.|$)') for a in checkers]
+return predicate

What's the benefit of using a function attribute here rather than simply 
closing over a local variable?


http://reviews.llvm.org/D19260



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


r272357 - Remove CXXConstructExpr::getFoundDecl(); it turned out to not be useful.

2016-06-09 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Jun  9 19:58:19 2016
New Revision: 272357

URL: http://llvm.org/viewvc/llvm-project?rev=272357=rev
Log:
Remove CXXConstructExpr::getFoundDecl(); it turned out to not be useful.

Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/TreeTransform.h

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=272357=272356=272357=diff
==
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Thu Jun  9 19:58:19 2016
@@ -1187,7 +1187,7 @@ private:
 protected:
   CXXConstructExpr(const ASTContext , StmtClass SC, QualType T,
SourceLocation Loc,
-   NamedDecl *Found, CXXConstructorDecl *Ctor,
+   CXXConstructorDecl *Ctor,
bool Elidable,
ArrayRef Args,
bool HadMultipleCandidates,
@@ -1211,7 +1211,6 @@ public:
 
   static CXXConstructExpr *Create(const ASTContext , QualType T,
   SourceLocation Loc,
-  NamedDecl *Found,
   CXXConstructorDecl *Ctor,
   bool Elidable,
   ArrayRef Args,
@@ -1222,9 +1221,6 @@ public:
   ConstructionKind ConstructKind,
   SourceRange ParenOrBraceRange);
 
-  /// \brief Get the declaration that was found by name lookup.
-  NamedDecl *getFoundDecl() const;
-
   /// \brief Get the constructor that this expression will (ultimately) call.
   CXXConstructorDecl *getConstructor() const { return Constructor; }
 
@@ -1393,7 +1389,6 @@ class CXXTemporaryObjectExpr : public CX
 
 public:
   CXXTemporaryObjectExpr(const ASTContext ,
- NamedDecl *Found,
  CXXConstructorDecl *Cons,
  TypeSourceInfo *Type,
  ArrayRef Args,

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=272357=272356=272357=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu Jun  9 19:58:19 2016
@@ -4283,6 +4283,17 @@ public:
 bool RequiresZeroInit, unsigned ConstructKind,
 SourceRange ParenRange);
 
+  /// Build a CXXConstructExpr whose constructor has already been resolved if
+  /// it denotes an inherited constructor.
+  ExprResult
+  BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
+CXXConstructorDecl *Constructor, bool Elidable,
+MultiExprArg Exprs,
+bool HadMultipleCandidates, bool IsListInitialization,
+bool IsStdInitListInitialization,
+bool RequiresZeroInit, unsigned ConstructKind,
+SourceRange ParenRange);
+
   // FIXME: Can we remove this and have the above BuildCXXConstructExpr check 
if
   // the constructor can be elidable?
   ExprResult

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=272357=272356=272357=diff
==
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Thu Jun  9 19:58:19 2016
@@ -5796,11 +5796,6 @@ Expr *ASTNodeImporter::VisitCXXConstruct
   if (T.isNull())
 return nullptr;
 
-  NamedDecl *ToFound =
-dyn_cast_or_null(Importer.Import(E->getFoundDecl()));
-  if (!ToFound)
-return nullptr;
-
   CXXConstructorDecl *ToCCD =
 dyn_cast_or_null(Importer.Import(E->getConstructor()));
   if (!ToCCD)
@@ -5813,7 +5808,7 @@ Expr *ASTNodeImporter::VisitCXXConstruct
 
   return CXXConstructExpr::Create(Importer.getToContext(), T,
   Importer.Import(E->getLocation()),
-  ToFound, ToCCD, E->isElidable(),
+  ToCCD, E->isElidable(),
   ToArgs, E->hadMultipleCandidates(),
   E->isListInitialization(),
   E->isStdInitListInitialization(),

Modified: cfe/trunk/lib/AST/ExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprCXX.cpp?rev=272357=272356=272357=diff

Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-09 Thread Richard Smith via cfe-commits
rsmith added a comment.

Thanks for the updates, LGTM (@bruno, did you get the performance numbers you 
wanted?)


http://reviews.llvm.org/D19843



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


r272350 - Add doxygen comments to mmintrin.h's intrinsics.

2016-06-09 Thread Ekaterina Romanova via cfe-commits
Author: kromanova
Date: Thu Jun  9 19:10:40 2016
New Revision: 272350

URL: http://llvm.org/viewvc/llvm-project?rev=272350=rev
Log:
Add doxygen comments to mmintrin.h's intrinsics.

The doxygen comments are automatically generated based on Sony's intrinsics docu
ment.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.


Modified:
cfe/trunk/lib/Headers/mmintrin.h

Modified: cfe/trunk/lib/Headers/mmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/mmintrin.h?rev=272350=272349=272350=diff
==
--- cfe/trunk/lib/Headers/mmintrin.h (original)
+++ cfe/trunk/lib/Headers/mmintrin.h Thu Jun  9 19:10:40 2016
@@ -34,366 +34,1314 @@ typedef char __v8qi __attribute__((__vec
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("mmx")))
 
+/// \brief Clears the MMX state by setting the state of the x87 stack registers
+///to empty.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c EMMS instruction.
+///
 static __inline__ void __DEFAULT_FN_ATTRS
 _mm_empty(void)
 {
 __builtin_ia32_emms();
 }
 
+/// \brief Constructs a 64-bit integer vector, setting the lower 32 bits to the
+///value of the 32-bit integer parameter and setting the upper 32 bits to 
0.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VMOVD / MOVD instruction.
+///
+/// \param __i
+///A 32-bit integer value.
+/// \returns A 64-bit integer vector. The lower 32 bits contain the value of 
the
+///parameter. The upper 32 bits are set to 0.
 static __inline__ __m64 __DEFAULT_FN_ATTRS
 _mm_cvtsi32_si64(int __i)
 {
 return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
 }
 
+/// \brief Returns the lower 32 bits of a 64-bit integer vector as a 32-bit
+///signed integer.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VMOVD / MOVD instruction.
+///
+/// \param __m
+///A 64-bit integer vector.
+/// \returns A 32-bit signed integer value containing the lower 32 bits of the
+///parameter.
 static __inline__ int __DEFAULT_FN_ATTRS
 _mm_cvtsi64_si32(__m64 __m)
 {
 return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
 }
 
+/// \brief Casts a 64-bit signed integer value into a 64-bit integer vector.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VMOVQ / MOVD instruction.
+///
+/// \param __i
+///A 64-bit signed integer.
+/// \returns A 64-bit integer vector containing the same bitwise pattern as the
+///parameter.
 static __inline__ __m64 __DEFAULT_FN_ATTRS
 _mm_cvtsi64_m64(long long __i)
 {
 return (__m64)__i;
 }
 
+/// \brief Casts a 64-bit integer vector into a 64-bit signed integer value.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VMOVQ / MOVD instruction.
+///
+/// \param __m
+///A 64-bit integer vector.
+/// \returns A 64-bit signed integer containing the same bitwise pattern as the
+///parameter.
 static __inline__ long long __DEFAULT_FN_ATTRS
 _mm_cvtm64_si64(__m64 __m)
 {
 return (long long)__m;
 }
 
+/// \brief Converts 16-bit signed integers from both 64-bit integer vector
+///parameters of [4 x i16] into 8-bit signed integer values, and constructs
+///a 64-bit integer vector of [8 x i8] as the result. Positive values
+///greater than 0x7F are saturated to 0x7F. Negative values less than 0x80
+///are saturated to 0x80.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c PACKSSWB instruction.
+///
+/// \param __m1
+///A 64-bit integer vector of [4 x i16]. Each 16-bit element is treated as 
a
+///16-bit signed integer and is converted to an 8-bit signed integer with
+///saturation. Positive values greater than 0x7F are saturated to 0x7F.
+///Negative values less than 0x80 are saturated to 0x80. The converted
+///[4 x i8] values are written to the lower 32 bits of the result.
+/// \param __m2
+///A 64-bit integer vector of [4 x i16]. Each 16-bit element is treated as 
a
+///16-bit signed integer and is converted to an 8-bit signed integer with
+///saturation. Positive values greater than 0x7F are saturated to 0x7F.
+///Negative values less than 0x80 are saturated to 0x80. The converted
+///[4 x i8] values are written to the upper 32 bits of the result.
+/// \returns A 64-bit integer vector of [8 x i8] containing the converted
+///values.
 static __inline__ __m64 __DEFAULT_FN_ATTRS
 _mm_packs_pi16(__m64 __m1, __m64 __m2)
 {
 return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
 }
 
+/// \brief Converts 32-bit signed integers from both 64-bit integer vector
+///parameters of [2 x i32] into 16-bit signed integer values, and 
constructs
+///a 64-bit integer vector of [4 x i16] as the result. Positive values
+///greater than 0x7FFF are saturated 

Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-09 Thread Eric Niebler via cfe-commits
eric_niebler updated this revision to Diff 60281.
eric_niebler added a comment.

Replace `StringSet` with `StringSwitch`, ASCII range ends at 0x7f not 0xff, 
miscellaneous formatting tweaks.


http://reviews.llvm.org/D19843

Files:
  include/clang/Basic/DiagnosticLexKinds.td
  include/clang/Basic/FileManager.h
  include/clang/Basic/VirtualFileSystem.h
  include/clang/Lex/DirectoryLookup.h
  include/clang/Lex/HeaderSearch.h
  lib/Basic/FileManager.cpp
  lib/Basic/VirtualFileSystem.cpp
  lib/Lex/HeaderSearch.cpp
  lib/Lex/PPDirectives.cpp
  test/Lexer/Inputs/case-insensitive-include.h
  test/Lexer/case-insensitive-include-ms.c
  test/Lexer/case-insensitive-include.c
  test/Lexer/case-insensitive-system-include.c
  test/PCH/case-insensitive-include.c

Index: test/PCH/case-insensitive-include.c
===
--- test/PCH/case-insensitive-include.c
+++ test/PCH/case-insensitive-include.c
@@ -2,7 +2,7 @@
 
 // Test this without pch.
 // RUN: cp %S/Inputs/case-insensitive-include.h %T
-// RUN: %clang_cc1 -fsyntax-only %s -include %s -I %T -verify
+// RUN: %clang_cc1 -Wno-nonportable-include-path -fsyntax-only %s -include %s -I %T -verify
 
 // Test with pch.
 // RUN: %clang_cc1 -emit-pch -o %t.pch %s -I %T
Index: test/Lexer/case-insensitive-system-include.c
===
--- /dev/null
+++ test/Lexer/case-insensitive-system-include.c
@@ -0,0 +1,10 @@
+// REQUIRES: case-insensitive-filesystem
+
+// RUN: mkdir -p %T/asystempath
+// RUN: cp %S/Inputs/case-insensitive-include.h %T/asystempath/
+// RUN: cd %T
+// RUN: %clang_cc1 -fsyntax-only %s -include %s -isystem %T/asystempath -verify -Wnonportable-system-include-path
+// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s -include %s -isystem %T/asystempath -Wnonportable-system-include-path 2>&1 | FileCheck %s
+
+#include "CASE-INSENSITIVE-INCLUDE.H" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:38}:"\"case-insensitive-include.h\""
Index: test/Lexer/case-insensitive-include.c
===
--- /dev/null
+++ test/Lexer/case-insensitive-include.c
@@ -0,0 +1,35 @@
+// REQUIRES: case-insensitive-filesystem
+
+// RUN: mkdir -p %T/apath
+// RUN: mkdir -p %T/asystempath
+// RUN: cp %S/Inputs/case-insensitive-include.h %T
+// RUN: cp %S/Inputs/case-insensitive-include.h %T/asystempath/case-insensitive-include2.h
+// RUN: cd %T
+// RUN: %clang_cc1 -fsyntax-only %s -include %s -I %T -isystem %T/asystempath -verify
+// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s -include %s -I %T -isystem %T/asystempath 2>&1 | FileCheck %s
+
+// Known standard header, so warn:
+#include  // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:20}:""
+
+#include "case-insensitive-include.h"
+#include "Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:38}:"\"case-insensitive-include.h\""
+
+#include "../Output/./case-insensitive-include.h"
+#include "../Output/./Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"../Output/./case-insensitive-include.h\""
+#include "../output/./case-insensitive-include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"../Output/./case-insensitive-include.h\""
+
+#include "apath/.././case-insensitive-include.h"
+#include "apath/.././Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:49}:"\"apath/.././case-insensitive-include.h\""
+#include "APath/.././case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-(
+
+#include "../Output/./apath/.././case-insensitive-include.h"
+#include "../Output/./APath/.././case-insensitive-include.h" // For the sake of efficiency, this case is not diagnosed. :-(
+#include "../output/./apath/.././case-insensitive-include.h" // expected-warning {{non-portable path}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:61}:"\"../Output/./apath/.././case-insensitive-include.h\""
+
+#include "CASE-INSENSITIVE-INCLUDE2.H" // Found in an -isystem directory. No warning.
Index: test/Lexer/case-insensitive-include-ms.c
===
--- /dev/null
+++ test/Lexer/case-insensitive-include-ms.c
@@ -0,0 +1,18 @@
+// REQUIRES: case-insensitive-filesystem
+
+// RUN: mkdir -p %T/apath
+// RUN: cp %S/Inputs/case-insensitive-include.h %T
+// RUN: cd %T
+// RUN: %clang_cc1 -fsyntax-only -fms-compatibility %s -include %s -I %T -verify
+// RUN: %clang_cc1 -fsyntax-only -fms-compatibility -fdiagnostics-parseable-fixits %s -include %s -I %T 2>&1 | FileCheck %s
+
+#include 

Re: [PATCH] D21198: RenderScript support in the Frontend

2016-06-09 Thread Pirama Arumuga Nainar via cfe-commits
pirama added a comment.

Thanks for the review.  Docs update is in http://reviews.llvm.org/D21212


Repository:
  rL LLVM

http://reviews.llvm.org/D21198



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


[PATCH] D21212: Add documentation for RenderScript changes

2016-06-09 Thread Pirama Arumuga Nainar via cfe-commits
pirama created this revision.
pirama added a reviewer: rsmith.
pirama added subscribers: srhines, cfe-commits.
Herald added subscribers: danalbert, tberghammer.

- Document the new 'kernel' attribute
- Mention RenderScript support in the Release Notes.

http://reviews.llvm.org/D21212

Files:
  docs/ReleaseNotes.rst
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td

Index: include/clang/Basic/AttrDocs.td
===
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -2433,3 +2433,12 @@
 See :doc:`LTOVisibility`.
   }];
 }
+
+def RenderScriptKernelAttributeDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((kernel))`` is used to mark a ``kernel`` function in 
RenderScript_.  See the RenderScript_ documentation for more information.
+
+.. _RenderScript: 
https://developer.android.com/guide/topics/renderscript/compute.html
+  }];
+}
Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -731,7 +731,7 @@
 def Kernel : Attr {
   let Spellings = [GNU<"kernel">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
+  let Documentation = [RenderScriptKernelAttributeDocs];
 }
 
 def Deprecated : InheritableAttr {
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -84,6 +84,11 @@
 ---
 The -faltivec and -maltivec flags no longer silently include altivec.h on 
Power platforms.
 
+`RenderScript
+`_
+support added to the Frontend and enabled by the '-x renderscript' option or
+the '.rs' file extension.
+
 ...
 
 C11 Feature Support


Index: include/clang/Basic/AttrDocs.td
===
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -2433,3 +2433,12 @@
 See :doc:`LTOVisibility`.
   }];
 }
+
+def RenderScriptKernelAttributeDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+``__attribute__((kernel))`` is used to mark a ``kernel`` function in RenderScript_.  See the RenderScript_ documentation for more information.
+
+.. _RenderScript: https://developer.android.com/guide/topics/renderscript/compute.html
+  }];
+}
Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -731,7 +731,7 @@
 def Kernel : Attr {
   let Spellings = [GNU<"kernel">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
+  let Documentation = [RenderScriptKernelAttributeDocs];
 }
 
 def Deprecated : InheritableAttr {
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -84,6 +84,11 @@
 ---
 The -faltivec and -maltivec flags no longer silently include altivec.h on Power platforms.
 
+`RenderScript
+`_
+support added to the Frontend and enabled by the '-x renderscript' option or
+the '.rs' file extension.
+
 ...
 
 C11 Feature Support
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21198: RenderScript support in the Frontend

2016-06-09 Thread Pirama Arumuga Nainar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272342: RenderScript support in the Frontend (authored by 
pirama).

Changed prior to commit:
  http://reviews.llvm.org/D21198?vs=60277=60279#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21198

Files:
  cfe/trunk/include/clang/Basic/Attr.td
  cfe/trunk/include/clang/Basic/LangOptions.def
  cfe/trunk/include/clang/Frontend/FrontendOptions.h
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/lib/Frontend/FrontendActions.cpp
  cfe/trunk/lib/Sema/SemaDeclAttr.cpp
  cfe/trunk/test/CodeGen/fp16-ops.c
  cfe/trunk/test/Sema/renderscript.rs

Index: cfe/trunk/include/clang/Basic/Attr.td
===
--- cfe/trunk/include/clang/Basic/Attr.td
+++ cfe/trunk/include/clang/Basic/Attr.td
@@ -728,6 +728,12 @@
   let ASTNode = 0;
 }
 
+def Kernel : Attr {
+  let Spellings = [GNU<"kernel">];
+  let Subjects = SubjectList<[Function]>;
+  let Documentation = [Undocumented];
+}
+
 def Deprecated : InheritableAttr {
   let Spellings = [GCC<"deprecated">, Declspec<"deprecated">,
CXX11<"","deprecated", 201309>];
Index: cfe/trunk/include/clang/Basic/LangOptions.def
===
--- cfe/trunk/include/clang/Basic/LangOptions.def
+++ cfe/trunk/include/clang/Basic/LangOptions.def
@@ -185,6 +185,7 @@
 LANGOPT(OpenMP, 32, 0, "OpenMP support and version of OpenMP (31, 40 or 45)")
 LANGOPT(OpenMPUseTLS  , 1, 0, "Use TLS for threadprivates or runtime calls")
 LANGOPT(OpenMPIsDevice, 1, 0, "Generate code only for OpenMP target device")
+LANGOPT(RenderScript  , 1, 0, "RenderScript")
 
 LANGOPT(CUDAIsDevice  , 1, 0, "compiling for CUDA device")
 LANGOPT(CUDAAllowVariadicFunctions, 1, 0, "allowing variadic functions in CUDA device code")
Index: cfe/trunk/include/clang/Frontend/FrontendOptions.h
===
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h
@@ -74,6 +74,7 @@
   IK_OpenCL,
   IK_CUDA,
   IK_PreprocessedCuda,
+  IK_RenderScript,
   IK_AST,
   IK_LLVM_IR
 };
Index: cfe/trunk/test/CodeGen/fp16-ops.c
===
--- cfe/trunk/test/CodeGen/fp16-ops.c
+++ cfe/trunk/test/CodeGen/fp16-ops.c
@@ -7,6 +7,8 @@
 // RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
 // RUN: %clang_cc1 -emit-llvm -o - -triple aarch64-none-linux-gnueabi -fnative-half-type %s \
 // RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
+// RUN: %clang_cc1 -emit-llvm -o - -x renderscript %s \
+// RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
 typedef unsigned cond_t;
 
 volatile cond_t test;
Index: cfe/trunk/test/Sema/renderscript.rs
===
--- cfe/trunk/test/Sema/renderscript.rs
+++ cfe/trunk/test/Sema/renderscript.rs
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -x renderscript -D__RENDERSCRIPT__ %s
+// RUN: %clang_cc1 -fsyntax-only -verify -x c %s
+
+#ifndef __RENDERSCRIPT__
+// expected-warning@+2 {{kernel attribute ignored}}
+#endif
+void __attribute__((kernel)) kernel();
+
+// expected-warning@+1 {{'kernel' attribute only applies to functions}}
+int __attribute__((kernel)) global;
+
+#ifndef __RENDERSCRIPT__
+// expected-error@+2 {{function return value cannot have __fp16 type; did you forget * ?}}
+#endif
+__fp16 fp16_return();
+
+#ifndef __RENDERSCRIPT__
+// expected-error@+2 {{parameters cannot have __fp16 type; did you forget * ?}}
+#endif
+void fp16_arg(__fp16 p);
Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
===
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp
@@ -1292,6 +1292,7 @@
   .Case("objective-c++-header", IK_ObjCXX)
   .Cases("ast", "pcm", IK_AST)
   .Case("ir", IK_LLVM_IR)
+  .Case("renderscript", IK_RenderScript)
   .Default(IK_None);
 if (DashX == IK_None)
   Diags.Report(diag::err_drv_invalid_value)
@@ -1495,6 +1496,9 @@
 case IK_PreprocessedObjCXX:
   LangStd = LangStandard::lang_gnucxx98;
   break;
+case IK_RenderScript:
+  LangStd = LangStandard::lang_c99;
+  break;
 }
   }
 
@@ -1537,6 +1541,12 @@
   Opts.CUDA = IK == IK_CUDA || IK == IK_PreprocessedCuda ||
   LangStd == LangStandard::lang_cuda;
 
+  Opts.RenderScript = IK == IK_RenderScript;
+  if (Opts.RenderScript) {
+Opts.NativeHalfType = 1;
+Opts.NativeHalfArgsAndReturns = 1;
+  }
+
   // OpenCL and C++ both have bool, true, false keywords.
   Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
 
Index: cfe/trunk/lib/Frontend/FrontendActions.cpp
===
--- cfe/trunk/lib/Frontend/FrontendActions.cpp
+++ 

r272342 - RenderScript support in the Frontend

2016-06-09 Thread Pirama Arumuga Nainar via cfe-commits
Author: pirama
Date: Thu Jun  9 18:34:20 2016
New Revision: 272342

URL: http://llvm.org/viewvc/llvm-project?rev=272342=rev
Log:
RenderScript support in the Frontend

Summary:

Create a new Frontend LangOpt to specify the renderscript language. It
is enabled by the "-x renderscript" option from the driver.

Add a "kernel" function attribute only for RenderScript (an "ignored
attribute" warning is generated otherwise).

Make the NativeHalfType and NativeHalfArgsAndReturns LangOpts be implied
by the RenderScript LangOpt.

Reviewers: rsmith

Subscribers: cfe-commits, srhines

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

Added:
cfe/trunk/test/Sema/renderscript.rs
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Frontend/FrontendOptions.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/FrontendActions.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/CodeGen/fp16-ops.c

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=272342=272341=272342=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Thu Jun  9 18:34:20 2016
@@ -728,6 +728,12 @@ def OpenCLNoSVM : Attr {
   let ASTNode = 0;
 }
 
+def Kernel : Attr {
+  let Spellings = [GNU<"kernel">];
+  let Subjects = SubjectList<[Function]>;
+  let Documentation = [Undocumented];
+}
+
 def Deprecated : InheritableAttr {
   let Spellings = [GCC<"deprecated">, Declspec<"deprecated">,
CXX11<"","deprecated", 201309>];

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=272342=272341=272342=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Thu Jun  9 18:34:20 2016
@@ -185,6 +185,7 @@ LANGOPT(CUDA  , 1, 0, "CUDA"
 LANGOPT(OpenMP, 32, 0, "OpenMP support and version of OpenMP (31, 
40 or 45)")
 LANGOPT(OpenMPUseTLS  , 1, 0, "Use TLS for threadprivates or runtime 
calls")
 LANGOPT(OpenMPIsDevice, 1, 0, "Generate code only for OpenMP target 
device")
+LANGOPT(RenderScript  , 1, 0, "RenderScript")
 
 LANGOPT(CUDAIsDevice  , 1, 0, "compiling for CUDA device")
 LANGOPT(CUDAAllowVariadicFunctions, 1, 0, "allowing variadic functions in CUDA 
device code")

Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=272342=272341=272342=diff
==
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Thu Jun  9 18:34:20 2016
@@ -74,6 +74,7 @@ enum InputKind {
   IK_OpenCL,
   IK_CUDA,
   IK_PreprocessedCuda,
+  IK_RenderScript,
   IK_AST,
   IK_LLVM_IR
 };

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=272342=272341=272342=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Jun  9 18:34:20 2016
@@ -1292,6 +1292,7 @@ static InputKind ParseFrontendArgs(Front
   .Case("objective-c++-header", IK_ObjCXX)
   .Cases("ast", "pcm", IK_AST)
   .Case("ir", IK_LLVM_IR)
+  .Case("renderscript", IK_RenderScript)
   .Default(IK_None);
 if (DashX == IK_None)
   Diags.Report(diag::err_drv_invalid_value)
@@ -1495,6 +1496,9 @@ void CompilerInvocation::setLangDefaults
 case IK_PreprocessedObjCXX:
   LangStd = LangStandard::lang_gnucxx98;
   break;
+case IK_RenderScript:
+  LangStd = LangStandard::lang_c99;
+  break;
 }
   }
 
@@ -1537,6 +1541,12 @@ void CompilerInvocation::setLangDefaults
   Opts.CUDA = IK == IK_CUDA || IK == IK_PreprocessedCuda ||
   LangStd == LangStandard::lang_cuda;
 
+  Opts.RenderScript = IK == IK_RenderScript;
+  if (Opts.RenderScript) {
+Opts.NativeHalfType = 1;
+Opts.NativeHalfArgsAndReturns = 1;
+  }
+
   // OpenCL and C++ both have bool, true, false keywords.
   Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
 

Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=272342=272341=272342=diff
==
--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Thu Jun  9 18:34:20 2016
@@ -735,6 

Re: [PATCH] D21198: RenderScript support in the Frontend

2016-06-09 Thread Pirama Arumuga Nainar via cfe-commits
pirama updated this revision to Diff 60277.
pirama added a comment.

Reorder IK_RenderScript before IK_AST like Richard had requested.


http://reviews.llvm.org/D21198

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/LangOptions.def
  include/clang/Frontend/FrontendOptions.h
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/FrontendActions.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/fp16-ops.c
  test/Sema/renderscript.rs

Index: test/Sema/renderscript.rs
===
--- /dev/null
+++ test/Sema/renderscript.rs
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -x renderscript -D__RENDERSCRIPT__ %s
+// RUN: %clang_cc1 -fsyntax-only -verify -x c %s
+
+#ifndef __RENDERSCRIPT__
+// expected-warning@+2 {{kernel attribute ignored}}
+#endif
+void __attribute__((kernel)) kernel();
+
+// expected-warning@+1 {{'kernel' attribute only applies to functions}}
+int __attribute__((kernel)) global;
+
+#ifndef __RENDERSCRIPT__
+// expected-error@+2 {{function return value cannot have __fp16 type; did you forget * ?}}
+#endif
+__fp16 fp16_return();
+
+#ifndef __RENDERSCRIPT__
+// expected-error@+2 {{parameters cannot have __fp16 type; did you forget * ?}}
+#endif
+void fp16_arg(__fp16 p);
Index: test/CodeGen/fp16-ops.c
===
--- test/CodeGen/fp16-ops.c
+++ test/CodeGen/fp16-ops.c
@@ -7,6 +7,8 @@
 // RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
 // RUN: %clang_cc1 -emit-llvm -o - -triple aarch64-none-linux-gnueabi -fnative-half-type %s \
 // RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
+// RUN: %clang_cc1 -emit-llvm -o - -x renderscript %s \
+// RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
 typedef unsigned cond_t;
 
 volatile cond_t test;
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -4185,6 +4185,17 @@
 Attr.getAttributeSpellingListIndex()));
 }
 
+static void handleKernelAttr(Sema , Decl *D, const AttributeList ) {
+  if (S.LangOpts.RenderScript) {
+D->addAttr(::new (S.Context)
+   KernelAttr(Attr.getRange(), S.Context,
+  Attr.getAttributeSpellingListIndex()));
+  } else {
+S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "kernel";
+  }
+}
+
+
 //===--===//
 // Checker-specific attribute handlers.
 //===--===//
@@ -5914,6 +5925,10 @@
   case AttributeList::AT_TypeTagForDatatype:
 handleTypeTagForDatatypeAttr(S, D, Attr);
 break;
+
+  case AttributeList::AT_Kernel:
+handleKernelAttr(S, D, Attr);
+break;
   }
 }
 
Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -735,6 +735,7 @@
   case IK_PreprocessedObjCXX:
   case IK_AST:
   case IK_LLVM_IR:
+  case IK_RenderScript:
 // We can't do anything with these.
 return;
   }
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1292,6 +1292,7 @@
   .Case("objective-c++-header", IK_ObjCXX)
   .Cases("ast", "pcm", IK_AST)
   .Case("ir", IK_LLVM_IR)
+  .Case("renderscript", IK_RenderScript)
   .Default(IK_None);
 if (DashX == IK_None)
   Diags.Report(diag::err_drv_invalid_value)
@@ -1495,6 +1496,9 @@
 case IK_PreprocessedObjCXX:
   LangStd = LangStandard::lang_gnucxx98;
   break;
+case IK_RenderScript:
+  LangStd = LangStandard::lang_c99;
+  break;
 }
   }
 
@@ -1537,6 +1541,12 @@
   Opts.CUDA = IK == IK_CUDA || IK == IK_PreprocessedCuda ||
   LangStd == LangStandard::lang_cuda;
 
+  Opts.RenderScript = IK == IK_RenderScript;
+  if (Opts.RenderScript) {
+Opts.NativeHalfType = 1;
+Opts.NativeHalfArgsAndReturns = 1;
+  }
+
   // OpenCL and C++ both have bool, true, false keywords.
   Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
 
Index: include/clang/Frontend/FrontendOptions.h
===
--- include/clang/Frontend/FrontendOptions.h
+++ include/clang/Frontend/FrontendOptions.h
@@ -74,6 +74,7 @@
   IK_OpenCL,
   IK_CUDA,
   IK_PreprocessedCuda,
+  IK_RenderScript,
   IK_AST,
   IK_LLVM_IR
 };
Index: include/clang/Basic/LangOptions.def
===
--- include/clang/Basic/LangOptions.def
+++ include/clang/Basic/LangOptions.def
@@ -185,6 +185,7 @@
 LANGOPT(OpenMP, 32, 0, "OpenMP support and version of OpenMP (31, 40 or 45)")
 LANGOPT(OpenMPUseTLS  , 1, 0, "Use TLS for threadprivates or runtime calls")
 

Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-09 Thread Eric Niebler via cfe-commits
eric_niebler added inline comments.


Comment at: lib/Lex/PPDirectives.cpp:33
@@ -28,2 +32,2 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/SaveAndRestore.h"

rsmith wrote:
> eric_niebler wrote:
> > You mean, instead of the `StringSet` below? Looks like `StringSwitch` just 
> > turns into cascading `memcmp`'s. Bet I can tell you how that performs 
> > versus a hash set. :-) Also, with the `StringSet`, I get to initialize it 
> > once and reuse it many times. I expect that will be pretty darn quick at 
> > runtime, but I'm looking forward to @bruno's results.
> Right, I'm not suggesting `StringSwitch` will be faster; it's preferable for 
> other reasons (it avoids the memory and shutdown costs of the static local 
> set). We should stick with what you have if the performance advantage is 
> measurable; otherwise my preference would be to use `StringSwitch`. But it's 
> only a slight preference -- if you'd rather not, I won't complain.
> 
> [`StringSwitch` isn't /quite/ as bad as you're suggesting: it always first 
> compares on length, and it typically compiles into a switch on string length 
> followed by memcmps. Moreover, the code should be "obvious" enough that 
> compilers can (at least in principle) optimize those memcmps very 
> aggressively, right down into the equivalent of an unrolled DFA or a perfect 
> hash function, but I'm not at all confident that LLVM will actually do that 
> =)]
@rsmith wrote:
> We should stick with what you have if the performance advantage is 
> measurable; otherwise my preference would be to use `StringSwitch`.

I tried `StringSwitch` on Windows.h where there are lots of wrongly-cased 
#includes. I couldn't measure the difference. I'll update the diff. 


http://reviews.llvm.org/D19843



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


Re: [PATCH] D21206: clang-format: [JS] recognized named functions in AnnotatingParser.

2016-06-09 Thread Martin Probst via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272330: clang-format: [JS] recognized named functions in 
AnnotatingParser. (authored by mprobst).

Changed prior to commit:
  http://reviews.llvm.org/D21206?vs=60254=60268#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21206

Files:
  cfe/trunk/lib/Format/TokenAnnotator.cpp
  cfe/trunk/unittests/Format/FormatTestJS.cpp

Index: cfe/trunk/lib/Format/TokenAnnotator.cpp
===
--- cfe/trunk/lib/Format/TokenAnnotator.cpp
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp
@@ -142,7 +142,10 @@
   // static_assert, if and while usually contain expressions.
   Contexts.back().IsExpression = true;
 } else if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous 
&&
-   Left->Previous->is(Keywords.kw_function)) {
+   (Left->Previous->is(Keywords.kw_function) ||
+(Left->Previous->endsSequence(tok::identifier,
+  Keywords.kw_function {
+  // function(...) or function f(...)
   Contexts.back().IsExpression = false;
 } else if (Left->Previous && Left->Previous->is(tok::r_square) &&
Left->Previous->MatchingParen &&
Index: cfe/trunk/unittests/Format/FormatTestJS.cpp
===
--- cfe/trunk/unittests/Format/FormatTestJS.cpp
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp
@@ -903,6 +903,8 @@
   verifyFormat("let x: Foo = new Foo();");
   verifyFormat("function(x: A|B): C {}");
   verifyFormat("function(x: A|B = A | B): C {}");
+  verifyFormat("function x(path: number|string) {}");
+  verifyFormat("function x(): string|number {}");
 }
 
 TEST_F(FormatTestJS, ClassDeclarations) {


Index: cfe/trunk/lib/Format/TokenAnnotator.cpp
===
--- cfe/trunk/lib/Format/TokenAnnotator.cpp
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp
@@ -142,7 +142,10 @@
   // static_assert, if and while usually contain expressions.
   Contexts.back().IsExpression = true;
 } else if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous &&
-   Left->Previous->is(Keywords.kw_function)) {
+   (Left->Previous->is(Keywords.kw_function) ||
+(Left->Previous->endsSequence(tok::identifier,
+  Keywords.kw_function {
+  // function(...) or function f(...)
   Contexts.back().IsExpression = false;
 } else if (Left->Previous && Left->Previous->is(tok::r_square) &&
Left->Previous->MatchingParen &&
Index: cfe/trunk/unittests/Format/FormatTestJS.cpp
===
--- cfe/trunk/unittests/Format/FormatTestJS.cpp
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp
@@ -903,6 +903,8 @@
   verifyFormat("let x: Foo = new Foo();");
   verifyFormat("function(x: A|B): C {}");
   verifyFormat("function(x: A|B = A | B): C {}");
+  verifyFormat("function x(path: number|string) {}");
+  verifyFormat("function x(): string|number {}");
 }
 
 TEST_F(FormatTestJS, ClassDeclarations) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272330 - clang-format: [JS] recognized named functions in AnnotatingParser.

2016-06-09 Thread Martin Probst via cfe-commits
Author: mprobst
Date: Thu Jun  9 17:49:04 2016
New Revision: 272330

URL: http://llvm.org/viewvc/llvm-project?rev=272330=rev
Log:
clang-format: [JS] recognized named functions in AnnotatingParser.

Summary: This also fixes union type formatting in function parameter types.

Before: function x(path: number| string) {}
After: function x(path: number|string) {}

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=272330=272329=272330=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Thu Jun  9 17:49:04 2016
@@ -142,7 +142,10 @@ private:
   // static_assert, if and while usually contain expressions.
   Contexts.back().IsExpression = true;
 } else if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous 
&&
-   Left->Previous->is(Keywords.kw_function)) {
+   (Left->Previous->is(Keywords.kw_function) ||
+(Left->Previous->endsSequence(tok::identifier,
+  Keywords.kw_function {
+  // function(...) or function f(...)
   Contexts.back().IsExpression = false;
 } else if (Left->Previous && Left->Previous->is(tok::r_square) &&
Left->Previous->MatchingParen &&

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=272330=272329=272330=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Thu Jun  9 17:49:04 2016
@@ -903,6 +903,8 @@ TEST_F(FormatTestJS, UnionIntersectionTy
   verifyFormat("let x: Foo = new Foo();");
   verifyFormat("function(x: A|B): C {}");
   verifyFormat("function(x: A|B = A | B): C {}");
+  verifyFormat("function x(path: number|string) {}");
+  verifyFormat("function x(): string|number {}");
 }
 
 TEST_F(FormatTestJS, ClassDeclarations) {


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


r272325 - Redirect unused output in test to /dev/null

2016-06-09 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Thu Jun  9 17:39:20 2016
New Revision: 272325

URL: http://llvm.org/viewvc/llvm-project?rev=272325=rev
Log:
Redirect unused output in test to /dev/null

Discard unused output so when the test fails, it only prints information that
is helpful about the failure.  No functional change.

Modified:
cfe/trunk/test/Modules/cxx-templates.cpp

Modified: cfe/trunk/test/Modules/cxx-templates.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/cxx-templates.cpp?rev=272325=272324=272325=diff
==
--- cfe/trunk/test/Modules/cxx-templates.cpp (original)
+++ cfe/trunk/test/Modules/cxx-templates.cpp Thu Jun  9 17:39:20 2016
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t
-// RUN: not %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps 
-fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++14 
-ast-dump-lookups | FileCheck %s --check-prefix=CHECK-GLOBAL
-// RUN: not %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps 
-fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++14 
-ast-dump-lookups -ast-dump-filter N | FileCheck %s 
--check-prefix=CHECK-NAMESPACE-N
-// RUN: not %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps 
-fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++14 
-ast-dump -ast-dump-filter SomeTemplate | FileCheck %s --check-prefix=CHECK-DUMP
+// RUN: not %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps 
-fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++14 
-ast-dump-lookups 2>/dev/null | FileCheck %s --check-prefix=CHECK-GLOBAL
+// RUN: not %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps 
-fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++14 
-ast-dump-lookups -ast-dump-filter N 2>/dev/null | FileCheck %s 
--check-prefix=CHECK-NAMESPACE-N
+// RUN: not %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps 
-fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -std=c++14 
-ast-dump -ast-dump-filter SomeTemplate 2>/dev/null | FileCheck %s 
--check-prefix=CHECK-DUMP
 // RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps 
-fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify 
-std=c++14
 // RUN: %clang_cc1 -x objective-c++ -fmodules -fimplicit-module-maps 
-fno-modules-error-recovery -fmodules-cache-path=%t -I %S/Inputs %s -verify 
-std=c++14 -DEARLY_IMPORT
 


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


r272323 - [CMake] Version is aways greater than 3

2016-06-09 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Thu Jun  9 17:38:40 2016
New Revision: 272323

URL: http://llvm.org/viewvc/llvm-project?rev=272323=rev
Log:
[CMake] Version is aways greater than 3

We don't need any checks for this code anymore. Since CMake version is always 
greater than 3 we can always generate the exports file.

Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=272323=272322=272323=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Thu Jun  9 17:38:40 2016
@@ -606,31 +606,28 @@ if(APPLE)
   endif()
 endif()
 
-if (CLANG_BUILT_STANDALONE OR CMAKE_VERSION VERSION_EQUAL 3 OR
-CMAKE_VERSION VERSION_GREATER 3)
-  # Generate a list of CMake library targets so that other CMake projects can
-  # link against them. LLVM calls its version of this file LLVMExports.cmake, 
but
-  # the usual CMake convention seems to be ${Project}Targets.cmake.
-  set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang)
-  set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}")
-  get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
-  export(TARGETS ${CLANG_EXPORTS} FILE 
${clang_cmake_builddir}/ClangTargets.cmake)
+# Generate a list of CMake library targets so that other CMake projects can
+# link against them. LLVM calls its version of this file LLVMExports.cmake, but
+# the usual CMake convention seems to be ${Project}Targets.cmake.
+set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang)
+set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}")
+get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
+export(TARGETS ${CLANG_EXPORTS} FILE 
${clang_cmake_builddir}/ClangTargets.cmake)
 
-  # Install a /lib/cmake/clang/ClangConfig.cmake file so that
-  # find_package(Clang) works. Install the target list with it.
-  install(EXPORT ClangTargets DESTINATION ${CLANG_INSTALL_PACKAGE_DIR})
+# Install a /lib/cmake/clang/ClangConfig.cmake file so that
+# find_package(Clang) works. Install the target list with it.
+install(EXPORT ClangTargets DESTINATION ${CLANG_INSTALL_PACKAGE_DIR})
 
-  install(FILES
-${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/ClangConfig.cmake
-DESTINATION lib${LLVM_LIBDIR_SUFFIX}/cmake/clang)
+install(FILES
+  ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/ClangConfig.cmake
+  DESTINATION lib${LLVM_LIBDIR_SUFFIX}/cmake/clang)
 
-  # Also copy ClangConfig.cmake to the build directory so that dependent 
projects
-  # can build against a build directory of Clang more easily.
-  configure_file(
-${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/ClangConfig.cmake
-${CLANG_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang/ClangConfig.cmake
-COPYONLY)
-endif ()
+# Also copy ClangConfig.cmake to the build directory so that dependent projects
+# can build against a build directory of Clang more easily.
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/ClangConfig.cmake
+  ${CLANG_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang/ClangConfig.cmake
+  COPYONLY)
 
 if (CLANG_ENABLE_BOOTSTRAP)
   include(ExternalProject)


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


Re: [PATCH] D21206: clang-format: [JS] recognized named functions in AnnotatingParser.

2016-06-09 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

The change looks good, but can you add a before/after example to change 
description?


http://reviews.llvm.org/D21206



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


r272324 - [CMake] Cleaning up CMake version checks in ExternalProject calls

2016-06-09 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Thu Jun  9 17:38:42 2016
New Revision: 272324

URL: http://llvm.org/viewvc/llvm-project?rev=272324=rev
Log:
[CMake] Cleaning up CMake version checks in ExternalProject calls

Now that we're on CMake 3.4.3 all the ExternalProject features we use are 
supported everywhere, so we don't need the version checks anymore.

Modified:
cfe/trunk/CMakeLists.txt
cfe/trunk/runtime/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=272324=272323=272324=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Thu Jun  9 17:38:42 2016
@@ -632,19 +632,6 @@ configure_file(
 if (CLANG_ENABLE_BOOTSTRAP)
   include(ExternalProject)
 
-  if(CMAKE_VERSION VERSION_GREATER 3.1.0)
-set(cmake_3_1_EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL 1)
-  endif()
-
-  if(CMAKE_VERSION VERSION_GREATER 3.3.20150708)
-set(cmake_3_4_USES_TERMINAL_OPTIONS
-  USES_TERMINAL_CONFIGURE 1
-  USES_TERMINAL_BUILD 1
-  USES_TERMINAL_INSTALL 1
-  )
-set(cmake_3_4_USES_TERMINAL USES_TERMINAL 1)
-  endif()
-
   if(NOT CLANG_STAGE)
 set(CLANG_STAGE stage1)
 message(STATUS "Setting current clang stage to: ${CLANG_STAGE}")
@@ -770,7 +757,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
 SOURCE_DIR ${CMAKE_SOURCE_DIR}
 STAMP_DIR ${STAMP_DIR}
 BINARY_DIR ${BINARY_DIR}
-${cmake_3_1_EXCLUDE_FROM_ALL}
+EXCLUDE_FROM_ALL 1
 CMAKE_ARGS
 # We shouldn't need to set this here, but INSTALL_DIR doesn't
 # seem to work, so instead I'm passing this through
@@ -783,7 +770,9 @@ if (CLANG_ENABLE_BOOTSTRAP)
 CMAKE_COMMAND ${cmake_command}
 INSTALL_COMMAND ""
 STEP_TARGETS configure build
-${cmake_3_4_USES_TERMINAL_OPTIONS}
+USES_TERMINAL_CONFIGURE 1
+USES_TERMINAL_BUILD 1
+USES_TERMINAL_INSTALL 1
 )
 
   # exclude really-install from main target
@@ -792,7 +781,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
 COMMAND ${cmake_command} --build  --target install
 COMMENT "Performing install step for '${NEXT_CLANG_STAGE}'"
 DEPENDEES build
-${cmake_3_4_USES_TERMINAL}
+USES_TERMINAL 1
   )
   ExternalProject_Add_StepTargets(${NEXT_CLANG_STAGE} really-install)
   add_custom_target(${NEXT_CLANG_STAGE}-install DEPENDS 
${NEXT_CLANG_STAGE}-really-install)
@@ -808,7 +797,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
   COMMAND ${cmake_command} --build  --target ${target}
   COMMENT "Performing ${target} for '${NEXT_CLANG_STAGE}'"
   DEPENDEES configure
-  ${cmake_3_4_USES_TERMINAL}
+  USES_TERMINAL 1
 )
 
 if(target MATCHES "^stage[0-9]*")

Modified: cfe/trunk/runtime/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/runtime/CMakeLists.txt?rev=272324=272323=272324=diff
==
--- cfe/trunk/runtime/CMakeLists.txt (original)
+++ cfe/trunk/runtime/CMakeLists.txt Thu Jun  9 17:38:42 2016
@@ -34,13 +34,6 @@ if(NOT EXISTS ${COMPILER_RT_SRC_ROOT})
 endif()
 
 if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/)
-  if(CMAKE_VERSION VERSION_GREATER 3.3.20150708)
-set(cmake_3_4_USES_TERMINAL_OPTIONS
-  USES_TERMINAL_CONFIGURE 1
-  USES_TERMINAL_BUILD 1
-  USES_TERMINAL_INSTALL 1
-  )
-  endif()
 
   # Add compiler-rt as an external project.
   set(COMPILER_RT_PREFIX ${CMAKE_BINARY_DIR}/projects/compiler-rt)
@@ -86,7 +79,9 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND E
${COMPILER_RT_PASSTHROUGH_VARIABLES}
 INSTALL_COMMAND ""
 STEP_TARGETS configure build
-${cmake_3_4_USES_TERMINAL_OPTIONS}
+USES_TERMINAL_CONFIGURE 1
+USES_TERMINAL_BUILD 1
+USES_TERMINAL_INSTALL 1
 )
 
   get_ext_project_build_command(run_clean_compiler_rt clean)


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


Re: [PATCH] D20388: AMDGPU: Fix supported CL features

2016-06-09 Thread Jan Vesely via cfe-commits
jvesely marked an inline comment as done.
jvesely added a comment.

Repository:
  rL LLVM

http://reviews.llvm.org/D20388



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


Re: [PATCH] D20388: AMDGPU: Fix supported CL features

2016-06-09 Thread Jan Vesely via cfe-commits
jvesely updated this revision to Diff 60259.
jvesely added a comment.

tests all extensions against expected outcome (add negative tests)
enable cl_khr_icd (works ok with mesa)


Repository:
  rL LLVM

http://reviews.llvm.org/D20388

Files:
  lib/Basic/Targets.cpp
  test/Misc/amdgcn.languageOptsOpenCL.cl
  test/Misc/r600.languageOptsOpenCL.cl

Index: test/Misc/r600.languageOptsOpenCL.cl
===
--- /dev/null
+++ test/Misc/r600.languageOptsOpenCL.cl
@@ -0,0 +1,225 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple r600-unknown-unknown -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple r600-unknown-unknown -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple r600-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple r600-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -target-cpu cayman
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple r600-unknown-unknown -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple r600-unknown-unknown -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple r600-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple r600-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -target-cpu cypress
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown -target-cpu turks
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown -target-cpu turks
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple r600-unknown-unknown -target-cpu turks
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple r600-unknown-unknown -target-cpu turks
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple r600-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -target-cpu turks
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple r600-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -target-cpu turks
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple r600-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -target-cpu turks
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple r600-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES -target-cpu turks
+
+// Extensions in all versions
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#ifdef cl_khr_fp16
+#error "Incorrect cl_khr_fp16 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp16: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_fp16' - ignoring}}
+
+#ifdef cl_khr_int64_base_atomics
+#error "Incorrect cl_khr_int64_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_int64_base_atomics' - ignoring}}
+
+#ifdef cl_khr_int64_extended_atomics
+#error "Incorrect cl_khr_int64_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_int64_extended_atomics' - ignoring}}
+
+#ifdef cl_khr_gl_sharing
+#error "Incorrect cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_gl_sharing' - ignoring}}
+
+#ifndef cl_khr_icd
+#error "Missing cl_khr_icd define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_icd: enable
+
+// Core features in CL 1.1
+
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined 

Re: [PATCH] D20389: NVPTX: Add supported CL features

2016-06-09 Thread Jan Vesely via cfe-commits
jvesely updated this revision to Diff 60257.
jvesely added a comment.

add back require registered target


Repository:
  rL LLVM

http://reviews.llvm.org/D20389

Files:
  lib/Basic/Targets.cpp
  test/Misc/nvptx.languageOptsOpenCL.cl

Index: test/Misc/nvptx.languageOptsOpenCL.cl
===
--- /dev/null
+++ test/Misc/nvptx.languageOptsOpenCL.cl
@@ -0,0 +1,211 @@
+// REQUIRES: nvptx-registered-target
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+
+// Extensions in all versions
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#ifdef cl_khr_fp16
+#error "Incorrect cl_khr_fp16 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp16: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_fp16' - ignoring}}
+
+#ifdef cl_khr_int64_base_atomics
+#error "Incorrect cl_khr_int64_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_int64_base_atomics' - ignoring}}
+
+#ifdef cl_khr_int64_extended_atomics
+#error "Incorrect cl_khr_int64_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_int64_extended_atomics' - ignoring}}
+
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+
+#ifndef cl_khr_icd
+#error "Missing cl_khr_icd define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_icd: enable
+
+// Core features in CL 1.1
+
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is core feature or supported optional core feature - ignoring}}
+#endif
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring}}
+#endif
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_extended_atomics' is core feature or supported optional core feature - ignoring}}
+#endif
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_base_atomics' is core feature or supported optional core feature - ignoring}}
+#endif
+
+#ifndef cl_khr_local_int32_extended_atomics
+#error "Missing cl_khr_local_int32_extended_atomics 

[PATCH] D21206: clang-format: [JS] recognized named functions in AnnotatingParser.

2016-06-09 Thread Martin Probst via cfe-commits
mprobst created this revision.
mprobst added a reviewer: djasper.
mprobst added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

This also fixes union type formatting in function parameter types.

http://reviews.llvm.org/D21206

Files:
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -903,6 +903,8 @@
   verifyFormat("let x: Foo = new Foo();");
   verifyFormat("function(x: A|B): C {}");
   verifyFormat("function(x: A|B = A | B): C {}");
+  verifyFormat("function x(path: number|string) {}");
+  verifyFormat("function x(): string|number {}");
 }
 
 TEST_F(FormatTestJS, ClassDeclarations) {
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -142,7 +142,10 @@
   // static_assert, if and while usually contain expressions.
   Contexts.back().IsExpression = true;
 } else if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous 
&&
-   Left->Previous->is(Keywords.kw_function)) {
+   (Left->Previous->is(Keywords.kw_function) ||
+(Left->Previous->endsSequence(tok::identifier,
+  Keywords.kw_function {
+  // function(...) or function f(...)
   Contexts.back().IsExpression = false;
 } else if (Left->Previous && Left->Previous->is(tok::r_square) &&
Left->Previous->MatchingParen &&


Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -903,6 +903,8 @@
   verifyFormat("let x: Foo = new Foo();");
   verifyFormat("function(x: A|B): C {}");
   verifyFormat("function(x: A|B = A | B): C {}");
+  verifyFormat("function x(path: number|string) {}");
+  verifyFormat("function x(): string|number {}");
 }
 
 TEST_F(FormatTestJS, ClassDeclarations) {
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -142,7 +142,10 @@
   // static_assert, if and while usually contain expressions.
   Contexts.back().IsExpression = true;
 } else if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous &&
-   Left->Previous->is(Keywords.kw_function)) {
+   (Left->Previous->is(Keywords.kw_function) ||
+(Left->Previous->endsSequence(tok::identifier,
+  Keywords.kw_function {
+  // function(...) or function f(...)
   Contexts.back().IsExpression = false;
 } else if (Left->Previous && Left->Previous->is(tok::r_square) &&
Left->Previous->MatchingParen &&
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272318 - Fix a crash in the AST dumper.

2016-06-09 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Thu Jun  9 17:03:04 2016
New Revision: 272318

URL: http://llvm.org/viewvc/llvm-project?rev=272318=rev
Log:
Fix a crash in the AST dumper.

Boxed expressions in a template context may have a null method decl.  If so,
don't try to access the selector.

Modified:
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/test/Misc/ast-dump-decl.mm

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=272318=272317=272318=diff
==
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Thu Jun  9 17:03:04 2016
@@ -2177,8 +2177,10 @@ void ASTDumper::VisitObjCMessageExpr(con
 
 void ASTDumper::VisitObjCBoxedExpr(const ObjCBoxedExpr *Node) {
   VisitExpr(Node);
-  OS << " selector=";
-  Node->getBoxingMethod()->getSelector().print(OS);
+  if (auto *BoxingMethod = Node->getBoxingMethod()) {
+OS << " selector=";
+BoxingMethod->getSelector().print(OS);
+  }
 }
 
 void ASTDumper::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node) {

Modified: cfe/trunk/test/Misc/ast-dump-decl.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/ast-dump-decl.mm?rev=272318=272317=272318=diff
==
--- cfe/trunk/test/Misc/ast-dump-decl.mm (original)
+++ cfe/trunk/test/Misc/ast-dump-decl.mm Thu Jun  9 17:03:04 2016
@@ -21,3 +21,13 @@
 // CHECK-NEXT: CXXConstructExpr
 // CHECK-NEXT:   ObjCIvarDecl{{.*}} X
 // CHECK-NEXT:   ObjCMethodDecl{{.*}} foo
+
+// @() boxing expressions.
+template 
+struct BoxingTest {
+  static id box(T value) {
+return @(value);
+  }
+};
+
+// CHECK: ObjCBoxedExpr{{.*}} ''{{$}}


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


Re: [PATCH] D21198: RenderScript support in the Frontend

2016-06-09 Thread Pirama Arumuga Nainar via cfe-commits
pirama updated this revision to Diff 60252.
pirama added a comment.

Cleanup bad merge


http://reviews.llvm.org/D21198

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/LangOptions.def
  include/clang/Frontend/FrontendOptions.h
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/FrontendActions.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/fp16-ops.c
  test/Sema/renderscript.rs

Index: test/Sema/renderscript.rs
===
--- /dev/null
+++ test/Sema/renderscript.rs
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -x renderscript -D__RENDERSCRIPT__ %s
+// RUN: %clang_cc1 -fsyntax-only -verify -x c %s
+
+#ifndef __RENDERSCRIPT__
+// expected-warning@+2 {{kernel attribute ignored}}
+#endif
+void __attribute__((kernel)) kernel();
+
+// expected-warning@+1 {{'kernel' attribute only applies to functions}}
+int __attribute__((kernel)) global;
+
+#ifndef __RENDERSCRIPT__
+// expected-error@+2 {{function return value cannot have __fp16 type; did you forget * ?}}
+#endif
+__fp16 fp16_return();
+
+#ifndef __RENDERSCRIPT__
+// expected-error@+2 {{parameters cannot have __fp16 type; did you forget * ?}}
+#endif
+void fp16_arg(__fp16 p);
Index: test/CodeGen/fp16-ops.c
===
--- test/CodeGen/fp16-ops.c
+++ test/CodeGen/fp16-ops.c
@@ -7,6 +7,8 @@
 // RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
 // RUN: %clang_cc1 -emit-llvm -o - -triple aarch64-none-linux-gnueabi -fnative-half-type %s \
 // RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
+// RUN: %clang_cc1 -emit-llvm -o - -x renderscript %s \
+// RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
 typedef unsigned cond_t;
 
 volatile cond_t test;
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -4185,6 +4185,17 @@
 Attr.getAttributeSpellingListIndex()));
 }
 
+static void handleKernelAttr(Sema , Decl *D, const AttributeList ) {
+  if (S.LangOpts.RenderScript) {
+D->addAttr(::new (S.Context)
+   KernelAttr(Attr.getRange(), S.Context,
+  Attr.getAttributeSpellingListIndex()));
+  } else {
+S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "kernel";
+  }
+}
+
+
 //===--===//
 // Checker-specific attribute handlers.
 //===--===//
@@ -5914,6 +5925,10 @@
   case AttributeList::AT_TypeTagForDatatype:
 handleTypeTagForDatatypeAttr(S, D, Attr);
 break;
+
+  case AttributeList::AT_Kernel:
+handleKernelAttr(S, D, Attr);
+break;
   }
 }
 
Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -735,6 +735,7 @@
   case IK_PreprocessedObjCXX:
   case IK_AST:
   case IK_LLVM_IR:
+  case IK_RenderScript:
 // We can't do anything with these.
 return;
   }
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1292,6 +1292,7 @@
   .Case("objective-c++-header", IK_ObjCXX)
   .Cases("ast", "pcm", IK_AST)
   .Case("ir", IK_LLVM_IR)
+  .Case("renderscript", IK_RenderScript)
   .Default(IK_None);
 if (DashX == IK_None)
   Diags.Report(diag::err_drv_invalid_value)
@@ -1495,6 +1496,9 @@
 case IK_PreprocessedObjCXX:
   LangStd = LangStandard::lang_gnucxx98;
   break;
+case IK_RenderScript:
+  LangStd = LangStandard::lang_c99;
+  break;
 }
   }
 
@@ -1537,6 +1541,12 @@
   Opts.CUDA = IK == IK_CUDA || IK == IK_PreprocessedCuda ||
   LangStd == LangStandard::lang_cuda;
 
+  Opts.RenderScript = IK == IK_RenderScript;
+  if (Opts.RenderScript) {
+Opts.NativeHalfType = 1;
+Opts.NativeHalfArgsAndReturns = 1;
+  }
+
   // OpenCL and C++ both have bool, true, false keywords.
   Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
 
Index: include/clang/Frontend/FrontendOptions.h
===
--- include/clang/Frontend/FrontendOptions.h
+++ include/clang/Frontend/FrontendOptions.h
@@ -75,6 +75,7 @@
   IK_CUDA,
   IK_PreprocessedCuda,
   IK_AST,
+  IK_RenderScript,
   IK_LLVM_IR
 };
 
Index: include/clang/Basic/LangOptions.def
===
--- include/clang/Basic/LangOptions.def
+++ include/clang/Basic/LangOptions.def
@@ -185,6 +185,7 @@
 LANGOPT(OpenMP, 32, 0, "OpenMP support and version of OpenMP (31, 40 or 45)")
 LANGOPT(OpenMPUseTLS  , 1, 0, "Use TLS for threadprivates or runtime calls")
 LANGOPT(OpenMPIsDevice, 1, 0, "Generate code only for OpenMP 

Re: [PATCH] D20338: [PCH] Fixed overridden files always invalidating preamble even when unchanged

2016-06-09 Thread Cameron via cfe-commits
cameron314 updated this revision to Diff 60250.
cameron314 added a comment.

Here's the final fix (it's the line in FileManager.cpp, plus a test).


http://reviews.llvm.org/D20338

Files:
  include/clang/Frontend/ASTUnit.h
  lib/Basic/FileManager.cpp
  lib/Frontend/ASTUnit.cpp
  unittests/Frontend/CMakeLists.txt
  unittests/Frontend/PchPreambleTest.cpp

Index: unittests/Frontend/PchPreambleTest.cpp
===
--- /dev/null
+++ unittests/Frontend/PchPreambleTest.cpp
@@ -0,0 +1,155 @@
+//-- unittests/Frontend/PchPreambleTest.cpp - FrontendAction tests ---//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "clang/Frontend/ASTUnit.h"
+#include "clang/Frontend/CompilerInvocation.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/FrontendActions.h"
+#include "clang/Frontend/FrontendOptions.h"
+#include "clang/Basic/Diagnostic.h"
+#include "clang/Basic/FileManager.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "gtest/gtest.h"
+#include 
+
+using namespace llvm;
+using namespace clang;
+
+namespace {
+
+class ReadCountingInMemoryFileSystem : public vfs::InMemoryFileSystem
+{
+  std::map ReadCounts;
+
+public:
+  ErrorOr openFileForRead(const Twine ) override
+  {
+SmallVector PathVec;
+Path.toVector(PathVec);
+llvm::sys::path::remove_dots(PathVec, true);
+++ReadCounts[std::string(PathVec.begin(), PathVec.end())];
+return InMemoryFileSystem::openFileForRead(Path);
+  }
+
+  unsigned GetReadCount(const Twine ) const
+  {
+auto it = ReadCounts.find(Path.str());
+return it == ReadCounts.end() ? 0 : it->second;
+  }
+};
+
+class PchPreambleTest : public ::testing::Test {
+  IntrusiveRefCntPtr VFS;
+  StringMap RemappedFiles;
+  std::shared_ptr PCHContainerOpts;
+  FileSystemOptions FSOpts;
+
+public:
+  void SetUp() override {
+VFS = new ReadCountingInMemoryFileSystem();
+// We need the working directory to be set to something absolute,
+// otherwise it ends up being inadvertently set to the current
+// working directory in the real file system due to a series of
+// unfortunate conditions interacting badly.
+// What's more, this path *must* be absolute on all (real)
+// filesystems, so just '/' won't work (e.g. on Win32).
+VFS->setCurrentWorkingDirectory("//./");
+  }
+
+  void TearDown() override {
+  }
+
+  void AddFile(const std::string , const std::string ) {
+::time_t now;
+::time();
+VFS->addFile(Filename, now, MemoryBuffer::getMemBufferCopy(Contents, Filename));
+  }
+
+  void RemapFile(const std::string , const std::string ) {
+RemappedFiles[Filename] = Contents;
+  }
+
+  std::unique_ptr ParseAST(const std::string ) {
+PCHContainerOpts = std::make_shared();
+CompilerInvocation *CI = new CompilerInvocation;
+CI->getFrontendOpts().Inputs.push_back(
+  FrontendInputFile(EntryFile, FrontendOptions::getInputKindForExtension(
+llvm::sys::path::extension(EntryFile).substr(1;
+
+CI->getTargetOpts().Triple = "i386-unknown-linux-gnu";
+
+CI->getPreprocessorOpts().RemappedFileBuffers = GetRemappedFiles();
+
+PreprocessorOptions  = CI->getPreprocessorOpts();
+PPOpts.RemappedFilesKeepOriginalName = true;
+
+IntrusiveRefCntPtr
+  Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions));
+
+FileManager *FileMgr = new FileManager(FSOpts, VFS);
+
+std::unique_ptr AST = ASTUnit::LoadFromCompilerInvocation(
+  CI, PCHContainerOpts, Diags, FileMgr, false, false,
+  /*PrecompilePreambleAfterNParses=*/1);
+return AST;
+  }
+
+  bool ReparseAST(const std::unique_ptr ) {
+FileManager *FileMgr = new FileManager(FSOpts, VFS);
+bool reparseFailed = AST->Reparse(PCHContainerOpts, GetRemappedFiles(), FileMgr);
+return reparseFailed;
+  }
+
+  unsigned GetFileReadCount(const std::string ) const {
+return VFS->GetReadCount(Filename);
+  }
+
+private:
+  std::vector>
+  GetRemappedFiles() const {
+std::vector> Remapped;
+for (const auto  : RemappedFiles) {
+  std::unique_ptr buf = MemoryBuffer::getMemBufferCopy(
+RemappedFile.second, RemappedFile.first());
+  Remapped.emplace_back(RemappedFile.first(), buf.release());
+}
+return Remapped;
+  }
+};
+
+TEST_F(PchPreambleTest, ReparseWithOverriddenFileDoesNotInvalidatePreamble) {
+  std::string Header1 = "//./header1.h";
+  std::string Header2 = "//./header2.h";
+  std::string MainName = "//./main.cpp";
+  AddFile(Header1, "");
+  AddFile(Header2, "#pragma once");
+  AddFile(MainName,
+

Re: [PATCH] D21198: RenderScript support in the Frontend

2016-06-09 Thread Pirama Arumuga Nainar via cfe-commits
pirama added a comment.

Oops, this update merged changes from http://reviews.llvm.org/D21199 as well.  
Let me clean up and upload a new patch.


http://reviews.llvm.org/D21198



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


r272317 - Add a RenderScript language type

2016-06-09 Thread Pirama Arumuga Nainar via cfe-commits
Author: pirama
Date: Thu Jun  9 16:57:40 2016
New Revision: 272317

URL: http://llvm.org/viewvc/llvm-project?rev=272317=rev
Log:
Add a RenderScript language type

Summary:
Add RenderScript language type and associate it with ".rs" extensions.
Test that the driver passes "-x renderscript" to the frontend for ".rs"
files.

(Also add '.rs' to the list of suffixes tested by lit).

Reviewers: rsmith

Subscribers: cfe-commits, srhines

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

Added:
cfe/trunk/test/Driver/renderscript.rs
Modified:
cfe/trunk/include/clang/Driver/Types.def
cfe/trunk/lib/Driver/Types.cpp
cfe/trunk/test/Driver/lit.local.cfg
cfe/trunk/test/lit.cfg

Modified: cfe/trunk/include/clang/Driver/Types.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.def?rev=272317=272316=272317=diff
==
--- cfe/trunk/include/clang/Driver/Types.def (original)
+++ cfe/trunk/include/clang/Driver/Types.def Thu Jun  9 16:57:40 2016
@@ -53,6 +53,7 @@ TYPE("c++",  CXX,
 TYPE("objective-c++-cpp-output", PP_ObjCXX,INVALID, "mii",   "u")
 TYPE("objc++-cpp-output",PP_ObjCXX_Alias, INVALID,  "mii",   "u")
 TYPE("objective-c++",ObjCXX,   PP_ObjCXX,   "mm","u")
+TYPE("renderscript", RenderScript, PP_C,"rs","u")
 
 // C family input files to precompile.
 TYPE("c-header-cpp-output",  PP_CHeader,   INVALID, "i", "p")

Modified: cfe/trunk/lib/Driver/Types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Types.cpp?rev=272317=272316=272317=diff
==
--- cfe/trunk/lib/Driver/Types.cpp (original)
+++ cfe/trunk/lib/Driver/Types.cpp Thu Jun  9 16:57:40 2016
@@ -204,6 +204,7 @@ types::ID types::lookupTypeForExtension(
.Case("pcm", TY_ModuleFile)
.Case("pch", TY_PCH)
.Case("gch", TY_PCH)
+   .Case("rs", TY_RenderScript)
.Default(TY_INVALID);
 }
 

Modified: cfe/trunk/test/Driver/lit.local.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/lit.local.cfg?rev=272317=272316=272317=diff
==
--- cfe/trunk/test/Driver/lit.local.cfg (original)
+++ cfe/trunk/test/Driver/lit.local.cfg Thu Jun  9 16:57:40 2016
@@ -1,5 +1,5 @@
 config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.f95',
-   '.cu']
+   '.cu', '.rs']
 config.substitutions = list(config.substitutions)
 config.substitutions.insert(0,
 ('%clang_cc1',

Added: cfe/trunk/test/Driver/renderscript.rs
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/renderscript.rs?rev=272317=auto
==
--- cfe/trunk/test/Driver/renderscript.rs (added)
+++ cfe/trunk/test/Driver/renderscript.rs Thu Jun  9 16:57:40 2016
@@ -0,0 +1,3 @@
+// RUN: %clang -### 2>&1 %s | FileCheck %s
+
+// CHECK: "-x" "renderscript"

Modified: cfe/trunk/test/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=272317=272316=272317=diff
==
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Thu Jun  9 16:57:40 2016
@@ -44,7 +44,7 @@ else:
 config.test_format = lit.formats.ShTest(execute_external)
 
 # suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', 
'.modulemap', '.test']
+config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', 
'.modulemap', '.test', '.rs']
 
 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
 # subdirectories contain auxiliary inputs for various tests in their parent


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


Re: [PATCH] D21199: Add a RenderScript language type

2016-06-09 Thread Pirama Arumuga Nainar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272317: Add a RenderScript language type (authored by 
pirama).

Changed prior to commit:
  http://reviews.llvm.org/D21199?vs=60238=60249#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21199

Files:
  cfe/trunk/include/clang/Driver/Types.def
  cfe/trunk/lib/Driver/Types.cpp
  cfe/trunk/test/Driver/lit.local.cfg
  cfe/trunk/test/Driver/renderscript.rs
  cfe/trunk/test/lit.cfg

Index: cfe/trunk/include/clang/Driver/Types.def
===
--- cfe/trunk/include/clang/Driver/Types.def
+++ cfe/trunk/include/clang/Driver/Types.def
@@ -53,6 +53,7 @@
 TYPE("objective-c++-cpp-output", PP_ObjCXX,INVALID, "mii",   "u")
 TYPE("objc++-cpp-output",PP_ObjCXX_Alias, INVALID,  "mii",   "u")
 TYPE("objective-c++",ObjCXX,   PP_ObjCXX,   "mm","u")
+TYPE("renderscript", RenderScript, PP_C,"rs","u")
 
 // C family input files to precompile.
 TYPE("c-header-cpp-output",  PP_CHeader,   INVALID, "i", "p")
Index: cfe/trunk/test/lit.cfg
===
--- cfe/trunk/test/lit.cfg
+++ cfe/trunk/test/lit.cfg
@@ -44,7 +44,7 @@
 config.test_format = lit.formats.ShTest(execute_external)
 
 # suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', 
'.modulemap', '.test']
+config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', 
'.modulemap', '.test', '.rs']
 
 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
 # subdirectories contain auxiliary inputs for various tests in their parent
Index: cfe/trunk/test/Driver/lit.local.cfg
===
--- cfe/trunk/test/Driver/lit.local.cfg
+++ cfe/trunk/test/Driver/lit.local.cfg
@@ -1,5 +1,5 @@
 config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.f95',
-   '.cu']
+   '.cu', '.rs']
 config.substitutions = list(config.substitutions)
 config.substitutions.insert(0,
 ('%clang_cc1',
Index: cfe/trunk/test/Driver/renderscript.rs
===
--- cfe/trunk/test/Driver/renderscript.rs
+++ cfe/trunk/test/Driver/renderscript.rs
@@ -0,0 +1,3 @@
+// RUN: %clang -### 2>&1 %s | FileCheck %s
+
+// CHECK: "-x" "renderscript"
Index: cfe/trunk/lib/Driver/Types.cpp
===
--- cfe/trunk/lib/Driver/Types.cpp
+++ cfe/trunk/lib/Driver/Types.cpp
@@ -204,6 +204,7 @@
.Case("pcm", TY_ModuleFile)
.Case("pch", TY_PCH)
.Case("gch", TY_PCH)
+   .Case("rs", TY_RenderScript)
.Default(TY_INVALID);
 }
 


Index: cfe/trunk/include/clang/Driver/Types.def
===
--- cfe/trunk/include/clang/Driver/Types.def
+++ cfe/trunk/include/clang/Driver/Types.def
@@ -53,6 +53,7 @@
 TYPE("objective-c++-cpp-output", PP_ObjCXX,INVALID, "mii",   "u")
 TYPE("objc++-cpp-output",PP_ObjCXX_Alias, INVALID,  "mii",   "u")
 TYPE("objective-c++",ObjCXX,   PP_ObjCXX,   "mm","u")
+TYPE("renderscript", RenderScript, PP_C,"rs","u")
 
 // C family input files to precompile.
 TYPE("c-header-cpp-output",  PP_CHeader,   INVALID, "i", "p")
Index: cfe/trunk/test/lit.cfg
===
--- cfe/trunk/test/lit.cfg
+++ cfe/trunk/test/lit.cfg
@@ -44,7 +44,7 @@
 config.test_format = lit.formats.ShTest(execute_external)
 
 # suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', '.modulemap', '.test']
+config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', '.modulemap', '.test', '.rs']
 
 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
 # subdirectories contain auxiliary inputs for various tests in their parent
Index: cfe/trunk/test/Driver/lit.local.cfg
===
--- cfe/trunk/test/Driver/lit.local.cfg
+++ cfe/trunk/test/Driver/lit.local.cfg
@@ -1,5 +1,5 @@
 config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.f95',
-   '.cu']
+   '.cu', '.rs']
 config.substitutions = list(config.substitutions)
 config.substitutions.insert(0,
 ('%clang_cc1',
Index: cfe/trunk/test/Driver/renderscript.rs
===
--- cfe/trunk/test/Driver/renderscript.rs
+++ cfe/trunk/test/Driver/renderscript.rs
@@ -0,0 +1,3 @@
+// RUN: %clang -### 2>&1 %s | FileCheck %s
+
+// CHECK: "-x" 

Re: [PATCH] D21198: RenderScript support in the Frontend

2016-06-09 Thread Pirama Arumuga Nainar via cfe-commits
pirama updated this revision to Diff 60247.
pirama updated the summary for this revision.
pirama added a comment.

Re-ordered enum


http://reviews.llvm.org/D21198

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/LangOptions.def
  include/clang/Driver/Types.def
  include/clang/Frontend/FrontendOptions.h
  lib/Driver/Types.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/FrontendActions.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/fp16-ops.c
  test/Driver/lit.local.cfg
  test/Driver/renderscript.rs
  test/Sema/renderscript.rs
  test/lit.cfg

Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -44,7 +44,7 @@
 config.test_format = lit.formats.ShTest(execute_external)
 
 # suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', '.modulemap', '.test']
+config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', '.modulemap', '.test', '.rs']
 
 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
 # subdirectories contain auxiliary inputs for various tests in their parent
Index: test/Sema/renderscript.rs
===
--- /dev/null
+++ test/Sema/renderscript.rs
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -x renderscript -D__RENDERSCRIPT__ %s
+// RUN: %clang_cc1 -fsyntax-only -verify -x c %s
+
+#ifndef __RENDERSCRIPT__
+// expected-warning@+2 {{kernel attribute ignored}}
+#endif
+void __attribute__((kernel)) kernel();
+
+// expected-warning@+1 {{'kernel' attribute only applies to functions}}
+int __attribute__((kernel)) global;
+
+#ifndef __RENDERSCRIPT__
+// expected-error@+2 {{function return value cannot have __fp16 type; did you forget * ?}}
+#endif
+__fp16 fp16_return();
+
+#ifndef __RENDERSCRIPT__
+// expected-error@+2 {{parameters cannot have __fp16 type; did you forget * ?}}
+#endif
+void fp16_arg(__fp16 p);
Index: test/Driver/renderscript.rs
===
--- /dev/null
+++ test/Driver/renderscript.rs
@@ -0,0 +1,3 @@
+// RUN: %clang -### 2>&1 %s | FileCheck %s
+
+// CHECK: "-x" "renderscript"
Index: test/Driver/lit.local.cfg
===
--- test/Driver/lit.local.cfg
+++ test/Driver/lit.local.cfg
@@ -1,5 +1,5 @@
 config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.f95',
-   '.cu']
+   '.cu', '.rs']
 config.substitutions = list(config.substitutions)
 config.substitutions.insert(0,
 ('%clang_cc1',
Index: test/CodeGen/fp16-ops.c
===
--- test/CodeGen/fp16-ops.c
+++ test/CodeGen/fp16-ops.c
@@ -7,6 +7,8 @@
 // RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
 // RUN: %clang_cc1 -emit-llvm -o - -triple aarch64-none-linux-gnueabi -fnative-half-type %s \
 // RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
+// RUN: %clang_cc1 -emit-llvm -o - -x renderscript %s \
+// RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
 typedef unsigned cond_t;
 
 volatile cond_t test;
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -4185,6 +4185,17 @@
 Attr.getAttributeSpellingListIndex()));
 }
 
+static void handleKernelAttr(Sema , Decl *D, const AttributeList ) {
+  if (S.LangOpts.RenderScript) {
+D->addAttr(::new (S.Context)
+   KernelAttr(Attr.getRange(), S.Context,
+  Attr.getAttributeSpellingListIndex()));
+  } else {
+S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "kernel";
+  }
+}
+
+
 //===--===//
 // Checker-specific attribute handlers.
 //===--===//
@@ -5914,6 +5925,10 @@
   case AttributeList::AT_TypeTagForDatatype:
 handleTypeTagForDatatypeAttr(S, D, Attr);
 break;
+
+  case AttributeList::AT_Kernel:
+handleKernelAttr(S, D, Attr);
+break;
   }
 }
 
Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -735,6 +735,7 @@
   case IK_PreprocessedObjCXX:
   case IK_AST:
   case IK_LLVM_IR:
+  case IK_RenderScript:
 // We can't do anything with these.
 return;
   }
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1292,6 +1292,7 @@
   .Case("objective-c++-header", IK_ObjCXX)
   .Cases("ast", "pcm", IK_AST)
   .Case("ir", IK_LLVM_IR)
+  .Case("renderscript", 

Re: Does anyone need these zorg modules?

2016-06-09 Thread Galina Kistanova via cfe-commits
Hello,

Last call for the next builder modules:

ChrootSetup.py
DragonEggBuilder.py
KLEEBuilder.py
ScriptedBuilder.py
gccSuiteBuilder.py

I am going to remove them.
If anyone have plans for any of them please speak up!

Thanks

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


Re: [PATCH] D20338: [PCH] Fixed overridden files always invalidating preamble even when unchanged

2016-06-09 Thread Cameron via cfe-commits
cameron314 added inline comments.


Comment at: lib/Basic/FileManager.cpp:389
@@ -383,2 +388,3 @@
   UFE->File.reset();
+  UFE->IsVirtual = true;
   return UFE;

rsmith wrote:
> Yes. The `IsValid` flag is just supposed to mean that this file has actually 
> been added to the `UniqueRealFiles` map rather than having been 
> default-constructed by `operator[]`.
Excellent then, I'll get rid of `IsVirtual` and use `IsValid` in place. This 
will condense things down to a one-line change plus a large diff for the test ^^


http://reviews.llvm.org/D20338



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


Re: [PATCH] D21198: RenderScript support in the Frontend

2016-06-09 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Please make sure that any relevant parts of our documentation are also updated. 
Given how small and self-contained this is, that we have a reasonable 
expectation of good support and maintainership, and that it's a reasonably 
well-established language variant, I don't have any problem with it living in 
upstream clang.



Comment at: include/clang/Frontend/FrontendOptions.h:77-79
@@ -76,4 +76,5 @@
   IK_PreprocessedCuda,
   IK_AST,
-  IK_LLVM_IR
+  IK_LLVM_IR,
+  IK_RenderScript
 };

Please reorder this before `IK_AST`, so that we keep the source languages 
before the somewhat-more clang-internal things.


http://reviews.llvm.org/D21198



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


LLVM buildmaster will be restarted tonight

2016-06-09 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 6 PM Pacific time
today.

Thanks

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


[PATCH] D21204: clang-format: [JS] post-fix non-null assertion operator.

2016-06-09 Thread Martin Probst via cfe-commits
mprobst created this revision.
mprobst added a reviewer: djasper.
mprobst added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

Do not insert whitespace preceding the "!" postfix operator. This is an
incomplete fix, but should cover common usage.

http://reviews.llvm.org/D21204

Files:
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1291,5 +1291,12 @@
"var x   =  hello();");
 }
 
+TEST_F(FormatTestJS, NonNullAssertionOperator) {
+  verifyFormat("let x = foo!.bar();\n");
+  verifyFormat("let x = foo ? bar! : baz;\n");
+  verifyFormat("let x = !foo;\n");
+  verifyFormat("let x = foo!;\n");
+}
+
 } // end namespace tooling
 } // end namespace clang
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -2123,6 +2123,10 @@
   // locations that should have whitespace following are identified by the
   // above set of follower tokens.
   return false;
+// Postfix non-null assertion operator, as in `foo!.bar()`.
+if (Right.is(tok::exclaim) && Right.Next &&
+Right.Next->isNot(tok::identifier) && !Right.Next->Tok.isLiteral())
+  return false;
   } else if (Style.Language == FormatStyle::LK_Java) {
 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
   return true;


Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1291,5 +1291,12 @@
"var x   =  hello();");
 }
 
+TEST_F(FormatTestJS, NonNullAssertionOperator) {
+  verifyFormat("let x = foo!.bar();\n");
+  verifyFormat("let x = foo ? bar! : baz;\n");
+  verifyFormat("let x = !foo;\n");
+  verifyFormat("let x = foo!;\n");
+}
+
 } // end namespace tooling
 } // end namespace clang
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -2123,6 +2123,10 @@
   // locations that should have whitespace following are identified by the
   // above set of follower tokens.
   return false;
+// Postfix non-null assertion operator, as in `foo!.bar()`.
+if (Right.is(tok::exclaim) && Right.Next &&
+Right.Next->isNot(tok::identifier) && !Right.Next->Tok.isLiteral())
+  return false;
   } else if (Style.Language == FormatStyle::LK_Java) {
 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
   return true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272312 - [CMake] Cleaning up CMake feature gating on 2.8.12

2016-06-09 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Thu Jun  9 16:29:55 2016
New Revision: 272312

URL: http://llvm.org/viewvc/llvm-project?rev=272312=rev
Log:
[CMake] Cleaning up CMake feature gating on 2.8.12

CMake 2.8.12 introduced interface libraries and some related policies. This 
removes the conditional block because we're now past 2.8.12.

Modified:
cfe/trunk/CMakeLists.txt
cfe/trunk/examples/AnnotateFunctions/CMakeLists.txt
cfe/trunk/examples/PrintFunctionNames/CMakeLists.txt
cfe/trunk/examples/analyzer-plugin/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=272312=272311=272312=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Thu Jun  9 16:29:55 2016
@@ -1,19 +1,5 @@
 cmake_minimum_required(VERSION 3.4.3)
 
-# FIXME: It may be removed when we use 2.8.12.
-if(CMAKE_VERSION VERSION_LESS 2.8.12)
-  # Invalidate a couple of keywords.
-  set(cmake_2_8_12_INTERFACE)
-  set(cmake_2_8_12_PRIVATE)
-else()
-  # Use ${cmake_2_8_12_KEYWORD} intead of KEYWORD in target_link_libraries().
-  set(cmake_2_8_12_INTERFACE INTERFACE)
-  set(cmake_2_8_12_PRIVATE PRIVATE)
-  if(POLICY CMP0022)
-cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
-  endif()
-endif()
-
 # If we are not building as a part of LLVM, build Clang as an
 # standalone project, using LLVM as an external library:
 if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
@@ -421,7 +407,7 @@ macro(add_clang_library name)
   llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS} 
${srcs})
 
   if(TARGET ${name})
-target_link_libraries(${name} ${cmake_2_8_12_INTERFACE} 
${LLVM_COMMON_LIBS})
+target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
 
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libclang")
   install(TARGETS ${name}

Modified: cfe/trunk/examples/AnnotateFunctions/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/AnnotateFunctions/CMakeLists.txt?rev=272312=272311=272312=diff
==
--- cfe/trunk/examples/AnnotateFunctions/CMakeLists.txt (original)
+++ cfe/trunk/examples/AnnotateFunctions/CMakeLists.txt Thu Jun  9 16:29:55 2016
@@ -1,7 +1,7 @@
 add_llvm_loadable_module(AnnotateFunctions AnnotateFunctions.cpp)
 
 if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
-  target_link_libraries(AnnotateFunctions ${cmake_2_8_12_PRIVATE}
+  target_link_libraries(AnnotateFunctions PRIVATE
 clangAST
 clangBasic
 clangFrontend

Modified: cfe/trunk/examples/PrintFunctionNames/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/PrintFunctionNames/CMakeLists.txt?rev=272312=272311=272312=diff
==
--- cfe/trunk/examples/PrintFunctionNames/CMakeLists.txt (original)
+++ cfe/trunk/examples/PrintFunctionNames/CMakeLists.txt Thu Jun  9 16:29:55 
2016
@@ -12,7 +12,7 @@ endif()
 add_llvm_loadable_module(PrintFunctionNames PrintFunctionNames.cpp)
 
 if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
-  target_link_libraries(PrintFunctionNames ${cmake_2_8_12_PRIVATE}
+  target_link_libraries(PrintFunctionNames PRIVATE
 clangAST
 clangBasic
 clangFrontend

Modified: cfe/trunk/examples/analyzer-plugin/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/analyzer-plugin/CMakeLists.txt?rev=272312=272311=272312=diff
==
--- cfe/trunk/examples/analyzer-plugin/CMakeLists.txt (original)
+++ cfe/trunk/examples/analyzer-plugin/CMakeLists.txt Thu Jun  9 16:29:55 2016
@@ -1,7 +1,7 @@
 add_llvm_loadable_module(SampleAnalyzerPlugin MainCallChecker.cpp)
 
 if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
-  target_link_libraries(SampleAnalyzerPlugin ${cmake_2_8_12_PRIVATE}
+  target_link_libraries(SampleAnalyzerPlugin PRIVATE
 clangAnalysis
 clangAST
 clangStaticAnalyzerCore


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


Re: [PATCH] D20933: Preallocate ExplodedNode hash table

2016-06-09 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Ah, right, please, add a comment explaining what we are doing and why.


http://reviews.llvm.org/D20933



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


Re: [PATCH] D20933: Preallocate ExplodedNode hash table

2016-06-09 Thread Anna Zaks via cfe-commits
zaks.anna accepted this revision.
zaks.anna added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


http://reviews.llvm.org/D20933



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


[PATCH] D21199: Add a RenderScript language type

2016-06-09 Thread Pirama Arumuga Nainar via cfe-commits
pirama created this revision.
pirama added a reviewer: rsmith.
pirama added subscribers: srhines, cfe-commits.

Add RenderScript language type and associate it with ".rs" extensions.
Test that the driver passes "-x renderscript" to the frontend for ".rs"
files.

(Also add '.rs' to the list of suffixes tested by lit).

http://reviews.llvm.org/D21199

Files:
  include/clang/Driver/Types.def
  lib/Driver/Types.cpp
  test/Driver/lit.local.cfg
  test/Driver/renderscript.rs
  test/lit.cfg

Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -44,7 +44,7 @@
 config.test_format = lit.formats.ShTest(execute_external)
 
 # suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', 
'.modulemap', '.test']
+config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', 
'.modulemap', '.test', '.rs']
 
 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
 # subdirectories contain auxiliary inputs for various tests in their parent
Index: test/Driver/renderscript.rs
===
--- /dev/null
+++ test/Driver/renderscript.rs
@@ -0,0 +1,3 @@
+// RUN: %clang -### 2>&1 %s | FileCheck %s
+
+// CHECK: "-x" "renderscript"
Index: test/Driver/lit.local.cfg
===
--- test/Driver/lit.local.cfg
+++ test/Driver/lit.local.cfg
@@ -1,5 +1,5 @@
 config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.f95',
-   '.cu']
+   '.cu', '.rs']
 config.substitutions = list(config.substitutions)
 config.substitutions.insert(0,
 ('%clang_cc1',
Index: lib/Driver/Types.cpp
===
--- lib/Driver/Types.cpp
+++ lib/Driver/Types.cpp
@@ -204,6 +204,7 @@
.Case("pcm", TY_ModuleFile)
.Case("pch", TY_PCH)
.Case("gch", TY_PCH)
+   .Case("rs", TY_RenderScript)
.Default(TY_INVALID);
 }
 
Index: include/clang/Driver/Types.def
===
--- include/clang/Driver/Types.def
+++ include/clang/Driver/Types.def
@@ -53,6 +53,7 @@
 TYPE("objective-c++-cpp-output", PP_ObjCXX,INVALID, "mii",   "u")
 TYPE("objc++-cpp-output",PP_ObjCXX_Alias, INVALID,  "mii",   "u")
 TYPE("objective-c++",ObjCXX,   PP_ObjCXX,   "mm","u")
+TYPE("renderscript", RenderScript, PP_C,"rs","u")
 
 // C family input files to precompile.
 TYPE("c-header-cpp-output",  PP_CHeader,   INVALID, "i", "p")


Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -44,7 +44,7 @@
 config.test_format = lit.formats.ShTest(execute_external)
 
 # suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', '.modulemap', '.test']
+config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl', '.s', '.S', '.modulemap', '.test', '.rs']
 
 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
 # subdirectories contain auxiliary inputs for various tests in their parent
Index: test/Driver/renderscript.rs
===
--- /dev/null
+++ test/Driver/renderscript.rs
@@ -0,0 +1,3 @@
+// RUN: %clang -### 2>&1 %s | FileCheck %s
+
+// CHECK: "-x" "renderscript"
Index: test/Driver/lit.local.cfg
===
--- test/Driver/lit.local.cfg
+++ test/Driver/lit.local.cfg
@@ -1,5 +1,5 @@
 config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.f95',
-   '.cu']
+   '.cu', '.rs']
 config.substitutions = list(config.substitutions)
 config.substitutions.insert(0,
 ('%clang_cc1',
Index: lib/Driver/Types.cpp
===
--- lib/Driver/Types.cpp
+++ lib/Driver/Types.cpp
@@ -204,6 +204,7 @@
.Case("pcm", TY_ModuleFile)
.Case("pch", TY_PCH)
.Case("gch", TY_PCH)
+   .Case("rs", TY_RenderScript)
.Default(TY_INVALID);
 }
 
Index: include/clang/Driver/Types.def
===
--- include/clang/Driver/Types.def
+++ include/clang/Driver/Types.def
@@ -53,6 +53,7 @@
 TYPE("objective-c++-cpp-output", PP_ObjCXX,INVALID, "mii",   "u")
 TYPE("objc++-cpp-output",PP_ObjCXX_Alias, INVALID,  "mii",   "u")
 TYPE("objective-c++",ObjCXX,   PP_ObjCXX,   "mm","u")
+TYPE("renderscript", RenderScript, PP_C,"rs","u")
 
 // C family input files to precompile.
 

[PATCH] D21198: Add a RenderScript language type

2016-06-09 Thread Pirama Arumuga Nainar via cfe-commits
pirama created this revision.
pirama added a reviewer: rsmith.
pirama added subscribers: srhines, cfe-commits.

Add RenderScript language type and associate it with ".rs" extensions.
Test that the driver passes "-x renderscript" to the frontend for ".rs"
files.

(Also add '.rs' to the list of suffixes tested by lit).

http://reviews.llvm.org/D21198

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/LangOptions.def
  include/clang/Frontend/FrontendOptions.h
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/FrontendActions.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/fp16-ops.c
  test/Sema/renderscript.rs

Index: test/Sema/renderscript.rs
===
--- /dev/null
+++ test/Sema/renderscript.rs
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -x renderscript -D__RENDERSCRIPT__ %s
+// RUN: %clang_cc1 -fsyntax-only -verify -x c %s
+
+#ifndef __RENDERSCRIPT__
+// expected-warning@+2 {{kernel attribute ignored}}
+#endif
+void __attribute__((kernel)) kernel();
+
+// expected-warning@+1 {{'kernel' attribute only applies to functions}}
+int __attribute__((kernel)) global;
+
+#ifndef __RENDERSCRIPT__
+// expected-error@+2 {{function return value cannot have __fp16 type; did you forget * ?}}
+#endif
+__fp16 fp16_return();
+
+#ifndef __RENDERSCRIPT__
+// expected-error@+2 {{parameters cannot have __fp16 type; did you forget * ?}}
+#endif
+void fp16_arg(__fp16 p);
Index: test/CodeGen/fp16-ops.c
===
--- test/CodeGen/fp16-ops.c
+++ test/CodeGen/fp16-ops.c
@@ -7,6 +7,8 @@
 // RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
 // RUN: %clang_cc1 -emit-llvm -o - -triple aarch64-none-linux-gnueabi -fnative-half-type %s \
 // RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
+// RUN: %clang_cc1 -emit-llvm -o - -x renderscript %s \
+// RUN:   | FileCheck %s --check-prefix=NATIVE-HALF
 typedef unsigned cond_t;
 
 volatile cond_t test;
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -4185,6 +4185,17 @@
 Attr.getAttributeSpellingListIndex()));
 }
 
+static void handleKernelAttr(Sema , Decl *D, const AttributeList ) {
+  if (S.LangOpts.RenderScript) {
+D->addAttr(::new (S.Context)
+   KernelAttr(Attr.getRange(), S.Context,
+  Attr.getAttributeSpellingListIndex()));
+  } else {
+S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "kernel";
+  }
+}
+
+
 //===--===//
 // Checker-specific attribute handlers.
 //===--===//
@@ -5914,6 +5925,10 @@
   case AttributeList::AT_TypeTagForDatatype:
 handleTypeTagForDatatypeAttr(S, D, Attr);
 break;
+
+  case AttributeList::AT_Kernel:
+handleKernelAttr(S, D, Attr);
+break;
   }
 }
 
Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -735,6 +735,7 @@
   case IK_PreprocessedObjCXX:
   case IK_AST:
   case IK_LLVM_IR:
+  case IK_RenderScript:
 // We can't do anything with these.
 return;
   }
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1292,6 +1292,7 @@
   .Case("objective-c++-header", IK_ObjCXX)
   .Cases("ast", "pcm", IK_AST)
   .Case("ir", IK_LLVM_IR)
+  .Case("renderscript", IK_RenderScript)
   .Default(IK_None);
 if (DashX == IK_None)
   Diags.Report(diag::err_drv_invalid_value)
@@ -1495,6 +1496,9 @@
 case IK_PreprocessedObjCXX:
   LangStd = LangStandard::lang_gnucxx98;
   break;
+case IK_RenderScript:
+  LangStd = LangStandard::lang_c99;
+  break;
 }
   }
 
@@ -1537,6 +1541,12 @@
   Opts.CUDA = IK == IK_CUDA || IK == IK_PreprocessedCuda ||
   LangStd == LangStandard::lang_cuda;
 
+  Opts.RenderScript = IK == IK_RenderScript;
+  if (Opts.RenderScript) {
+Opts.NativeHalfType = 1;
+Opts.NativeHalfArgsAndReturns = 1;
+  }
+
   // OpenCL and C++ both have bool, true, false keywords.
   Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
 
Index: include/clang/Frontend/FrontendOptions.h
===
--- include/clang/Frontend/FrontendOptions.h
+++ include/clang/Frontend/FrontendOptions.h
@@ -75,7 +75,8 @@
   IK_CUDA,
   IK_PreprocessedCuda,
   IK_AST,
-  IK_LLVM_IR
+  IK_LLVM_IR,
+  IK_RenderScript
 };
 
   
Index: include/clang/Basic/LangOptions.def
===
--- include/clang/Basic/LangOptions.def
+++ include/clang/Basic/LangOptions.def
@@ -185,6 

r272310 - Revert "[Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr."

2016-06-09 Thread Tim Shen via cfe-commits
Author: timshen
Date: Thu Jun  9 16:13:39 2016
New Revision: 272310

URL: http://llvm.org/viewvc/llvm-project?rev=272310=rev
Log:
Revert "[Temporary] Add an ExprWithCleanups for each C++ 
MaterializeTemporaryExpr."

This reverts r272296, since there are clang-tidy failures that appear to
be caused by this change.

Removed:
cfe/trunk/include/clang/Sema/CleanupInfo.h
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/include/clang/Sema/ScopeInfo.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/Analysis/Consumed.cpp
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/lib/Sema/SemaCoroutine.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaLambda.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=272310=272309=272310=diff
==
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Thu Jun  9 16:13:39 2016
@@ -2877,8 +2877,7 @@ private:
   Stmt *SubExpr;
 
   ExprWithCleanups(EmptyShell, unsigned NumObjects);
-  ExprWithCleanups(Expr *SubExpr, bool CleanupsHaveSideEffects,
-   ArrayRef Objects);
+  ExprWithCleanups(Expr *SubExpr, ArrayRef Objects);
 
   friend TrailingObjects;
   friend class ASTStmtReader;
@@ -2888,7 +2887,6 @@ public:
   unsigned numObjects);
 
   static ExprWithCleanups *Create(const ASTContext , Expr *subexpr,
-  bool CleanupsHaveSideEffects,
   ArrayRef objects);
 
   ArrayRef getObjects() const {
@@ -2905,9 +2903,6 @@ public:
 
   Expr *getSubExpr() { return cast(SubExpr); }
   const Expr *getSubExpr() const { return cast(SubExpr); }
-  bool cleanupsHaveSideEffects() const {
-return ExprWithCleanupsBits.CleanupsHaveSideEffects;
-  }
 
   /// As with any mutator of the AST, be very careful
   /// when modifying an existing AST to preserve its invariants.

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=272310=272309=272310=diff
==
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Thu Jun  9 16:13:39 2016
@@ -192,10 +192,7 @@ protected:
 
 unsigned : NumExprBits;
 
-// When false, it must not have side effects.
-bool CleanupsHaveSideEffects : 1;
-
-unsigned NumObjects : 32 - 1 - NumExprBits;
+unsigned NumObjects : 32 - NumExprBits;
   };
 
   class PseudoObjectExprBitfields {

Removed: cfe/trunk/include/clang/Sema/CleanupInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/CleanupInfo.h?rev=272309=auto
==
--- cfe/trunk/include/clang/Sema/CleanupInfo.h (original)
+++ cfe/trunk/include/clang/Sema/CleanupInfo.h (removed)
@@ -1,47 +0,0 @@
-//===--- CleanupInfo.cpp - Cleanup Control in Sema 
===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-//
-//  This file implements a set of operations on whether generating an
-//  ExprWithCleanups in a full expression.
-//
-//===--===//
-
-#ifndef LLVM_CLANG_SEMA_CLEANUP_INFO_H
-#define LLVM_CLANG_SEMA_CLEANUP_INFO_H
-
-namespace clang {
-
-class CleanupInfo {
-  bool ExprNeedsCleanups = false;
-  bool CleanupsHaveSideEffects = false;
-
-public:
-  bool exprNeedsCleanups() const { return ExprNeedsCleanups; }
-
-  bool cleanupsHaveSideEffects() const { return CleanupsHaveSideEffects; }
-
-  void setExprNeedsCleanups(bool SideEffects) {
-ExprNeedsCleanups = true;
-CleanupsHaveSideEffects |= SideEffects;
-  }
-
-  void reset() {
-ExprNeedsCleanups = false;
-CleanupsHaveSideEffects = false;
-  }
-
-  void mergeFrom(CleanupInfo Rhs) {
-ExprNeedsCleanups |= Rhs.ExprNeedsCleanups;
-CleanupsHaveSideEffects |= Rhs.CleanupsHaveSideEffects;
-  }
-};
-
-} // end namespace clang
-
-#endif

Modified: 

Re: [PATCH] D21054: CodeGen: Update Clang to use the new type metadata.

2016-06-09 Thread Evgeniy Stepanov via cfe-commits
eugenis accepted this revision.
eugenis added a reviewer: eugenis.
eugenis added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D21054



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


Re: [PATCH] D20338: [PCH] Fixed overridden files always invalidating preamble even when unchanged

2016-06-09 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Basic/FileManager.cpp:389
@@ -383,2 +388,3 @@
   UFE->File.reset();
+  UFE->IsVirtual = true;
   return UFE;

Yes. The `IsValid` flag is just supposed to mean that this file has actually 
been added to the `UniqueRealFiles` map rather than having been 
default-constructed by `operator[]`.


http://reviews.llvm.org/D20338



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


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-09 Thread Eric Niebler via cfe-commits
eric_niebler added a comment.

> Before this goes in again, I want to double check that this doesn't affect 
> compile time on darwin + frameworks.


@bruno, you're not likely to find a difference for darwin + frameworks since 
the frameworks headers like `Cocoa/Cocoa.h` don't exist on-disk with that path 
-- at least not on my machine. As a result, the attempt to get the "real path 
name" fails and no diagnostic is issued; the code path you want to measure will 
never be hit. This appears to be a shortcoming of the way I'm trying to get the 
true case of the files as they are opened. Correctly handing this would greatly 
increase the complexity of the patch. Apple == :-(


http://reviews.llvm.org/D19843



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


Re: [PATCH] D20821: Fix a few issues while skipping function bodies

2016-06-09 Thread Richard Smith via cfe-commits
rsmith added a comment.

Please call `Parser::ConsumeAndStoreFunctionPrologue` rather than trying to 
reinvent it. You're still getting a number of cases wrong that it handles 
properly.

You also need to handle the case where the code completion token appears within 
the constructor *mem-initializer*s.


http://reviews.llvm.org/D20821



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


Re: [PATCH] D21187: Allow use of lambda expressions in array bounds

2016-06-09 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith.


Comment at: lib/Sema/SemaExpr.cpp:12825
@@ -12824,1 +12824,3 @@
+  // BlockContext.
+  } else if (!Rec.IsArrayBound) {
 // C++1y [expr.const]p2:

This isn't correct; you still need to produce the diagnostic even if we're in 
an array bound, but it should be an `ExtWarn` controlled by `-Wvla`. A case like

void f() {
  int arr[ true ? 1 : []{return 0}() ];
}

is ill-formed in standard C++, but as we can evaluate the array bound as a 
constant, Clang will no longer diagnose it with this change in place.


Comment at: lib/Sema/SemaExpr.cpp:12834-12839
@@ -12832,8 +12833,8 @@
 } else {
   // Mark the capture expressions odr-used. This was deferred
   // during lambda expression creation.
   for (auto *Lambda : Rec.Lambdas) {
 for (auto *C : Lambda->capture_inits())
   MarkDeclarationsReferencedInExpr(C);
   }
 }

If you accept lambdas inside VLA bounds, you need to do this step for them.


Comment at: lib/Sema/SemaExpr.cpp:12848-12853
@@ -12846,8 +12847,8 @@
   if (Rec.isUnevaluated() || Rec.Context == ConstantEvaluated) {
 ExprCleanupObjects.erase(ExprCleanupObjects.begin() + 
Rec.NumCleanupObjects,
  ExprCleanupObjects.end());
 ExprNeedsCleanups = Rec.ParentNeedsCleanups;
 CleanupVarDeclMarking();
 std::swap(MaybeODRUseExprs, Rec.SavedMaybeODRUseExprs);
   // Otherwise, merge the contexts together.
   } else {

This also looks wrong for your lambda-in-VLA-bound case.

Perhaps the best thing to do is to check whether we have a VLA *before* we pop 
the ExpressionEvaluationContextRecord, and if so, convert the context from 
ConstantEvaluated to Evaluated.


http://reviews.llvm.org/D21187



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


Re: [PATCH] D20490: [Parser] Fix a crash on invalid where a delayed TypoExpr was corrected twice

2016-06-09 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Parse/ParseExpr.cpp:450-452
@@ -449,1 +449,5 @@
+
+// In this case, ActOnBinOp performed the CorrectDelayedTyposInExpr 
check.
+if (!getLangOpts().CPlusPlus)
+  continue;
   } else {

The inconsistent behavior of `ActOnBinOp` seems somewhere between an 
implementation detail and a bug; it doesn't seem reasonable for the parser to 
rely on that. I'm not particularly happy about making changes like this without 
some documentation of the overall design that shows whose responsibility it is 
to correct typos in which cases.


Before we introduced `TypoExpr`, the parser was permitted to simply discard 
`Expr` nodes that it didn't use (because it'd hit a parse error). Ideally, I'd 
like to return to that state of affairs, by removing the relevant 
`CorrectDelayedTyposInExpr` calls from the parser and having Sema automatically 
diagnose them when we get to the end of the relevant context, if we've not 
already done so.

Another reasonable-seeming option would be to add a 
`Sema::ActOnDiscardedExpr(Expr*)` that the parser can call (which calls 
`CorrectDelayedTyposInExpr`), and make it clear that the parser is responsible 
for passing each Expr that it receives from Sema to exactly one ActOn* function 
(unless otherwise specified) -- that way, at least the responsibilities will be 
clear, but it doesn't help us avoid bugs where `TypoExpr`s are accidentally 
discarded.


http://reviews.llvm.org/D20490



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


Re: [PATCH] D20933: Preallocate ExplodedNode hash table

2016-06-09 Thread Ben Craig via cfe-commits
bcraig added a comment.

I got better valgrind numbers (symbols are important).
Before: 106,131,538
After: 106,657,666
Diff: 526,128 larger.

Note that this is sampled peaks for heap usage.  They may not be accurate.  
Regardless, the peak usage increased by less than .5%.


http://reviews.llvm.org/D20933



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


Re: [PATCH] D20933: Preallocate ExplodedNode hash table

2016-06-09 Thread Ben Craig via cfe-commits
bcraig updated this revision to Diff 60177.
bcraig added a comment.

Capping the pre-reserve space


http://reviews.llvm.org/D20933

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
  lib/StaticAnalyzer/Core/CoreEngine.cpp

Index: lib/StaticAnalyzer/Core/CoreEngine.cpp
===
--- lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -208,6 +208,9 @@
 
   // Check if we have a steps limit
   bool UnlimitedSteps = Steps == 0;
+  const unsigned PreReservationCap = 400;
+  if(!UnlimitedSteps)
+G.reserve(std::min(Steps,PreReservationCap));
 
   while (WList->hasWork()) {
 if (!UnlimitedSteps) {
Index: include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
===
--- include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
@@ -321,6 +321,8 @@
   bool empty() const { return NumNodes == 0; }
   unsigned size() const { return NumNodes; }
 
+  void reserve(unsigned NodeCount) { Nodes.reserve(NodeCount); }
+
   // Iterators.
   typedef ExplodedNodeNodeTy;
   typedef llvm::FoldingSet  AllNodesTy;


Index: lib/StaticAnalyzer/Core/CoreEngine.cpp
===
--- lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -208,6 +208,9 @@
 
   // Check if we have a steps limit
   bool UnlimitedSteps = Steps == 0;
+  const unsigned PreReservationCap = 400;
+  if(!UnlimitedSteps)
+G.reserve(std::min(Steps,PreReservationCap));
 
   while (WList->hasWork()) {
 if (!UnlimitedSteps) {
Index: include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
===
--- include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
@@ -321,6 +321,8 @@
   bool empty() const { return NumNodes == 0; }
   unsigned size() const { return NumNodes; }
 
+  void reserve(unsigned NodeCount) { Nodes.reserve(NodeCount); }
+
   // Iterators.
   typedef ExplodedNodeNodeTy;
   typedef llvm::FoldingSet  AllNodesTy;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20964: [clang-tidy] Add modernize-use-emplace

2016-06-09 Thread Vedant Kumar via cfe-commits
vsk added a subscriber: vsk.
vsk added a comment.

@Eugene.Zelenko thanks for pointing this out, I had totally missed this patch! 
Once we get this reviewed I'm willing to abandon my version. Some comments 
inline --



Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:26
@@ +25,3 @@
+  // + add handling of `push` for std::stack, std::queue, std::priority_queue
+  // + add handling of `insert` for stl associative container, but be cerfull
+  // because this requires special treatment (it could cause performance

cerfull -> careful


Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:37
@@ +36,3 @@
+
+  // We can't replace push_backs of smart pointer becase
+  // if emplacement will fail (f.e. bad_alloc in vector) we will have leak of

becase -> because


Comment at: test/clang-tidy/modernize-use-emplace.cpp:147
@@ +146,3 @@
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use emplace_back {{..}}
+  // CHECK-FIXES: v.emplace_back(1, 2);
+  v.push_back(S   {1, 2});

I don't think this is correct. Comments immediately before/after `S` or 
immediately before/after the second right parenthesis should be preserved. C.f 
the implementation in D21185.


http://reviews.llvm.org/D20964



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


Re: [PATCH] D21162: [CUDA] Implement __shfl* intrinsics in clang headers.

2016-06-09 Thread Justin Lebar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272299: [CUDA] Implement __shfl* intrinsics in clang 
headers. (authored by jlebar).

Changed prior to commit:
  http://reviews.llvm.org/D21162?vs=60223=60230#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21162

Files:
  cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
  cfe/trunk/lib/Headers/__clang_cuda_intrinsics.h
  cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h

Index: cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
+++ cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
@@ -402,6 +402,17 @@
 BUILTIN(__nvvm_bar0_and, "ii", "")
 BUILTIN(__nvvm_bar0_or, "ii", "")
 
+// Shuffle
+
+BUILTIN(__builtin_ptx_shfl_down_i32, "", "")
+BUILTIN(__builtin_ptx_shfl_down_f32, "ffii", "")
+BUILTIN(__builtin_ptx_shfl_up_i32, "", "")
+BUILTIN(__builtin_ptx_shfl_up_f32, "ffii", "")
+BUILTIN(__builtin_ptx_shfl_bfly_i32, "", "")
+BUILTIN(__builtin_ptx_shfl_bfly_f32, "ffii", "")
+BUILTIN(__builtin_ptx_shfl_idx_i32, "", "")
+BUILTIN(__builtin_ptx_shfl_idx_f32, "ffii", "")
+
 // Membar
 
 BUILTIN(__nvvm_membar_cta, "v", "")
Index: cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
===
--- cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
+++ cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -198,13 +198,14 @@
 #include "sm_20_atomic_functions.hpp"
 #include "sm_20_intrinsics.hpp"
 #include "sm_32_atomic_functions.hpp"
-// sm_30_intrinsics.h has declarations that use default argument, so
-// we have to include it and it will in turn include .hpp
-#include "sm_30_intrinsics.h"
-
-// Don't include sm_32_intrinsics.h.  That header defines __ldg using inline
-// asm, but we want to define it using builtins, because we can't use the
-// [addr+imm] addressing mode if we use the inline asm in the header.
+
+// Don't include sm_30_intrinsics.h and sm_32_intrinsics.h.  These define the
+// __shfl and __ldg intrinsics using inline (volatile) asm, but we want to
+// define them using builtins so that the optimizer can reason about and across
+// these instructions.  In particular, using intrinsics for ldg gets us the
+// [addr+imm] addressing mode, which, although it doesn't actually exist in the
+// hardware, seems to generate faster machine code because ptxas can more easily
+// reason about our code.
 
 #undef __MATH_FUNCTIONS_HPP__
 
Index: cfe/trunk/lib/Headers/__clang_cuda_intrinsics.h
===
--- cfe/trunk/lib/Headers/__clang_cuda_intrinsics.h
+++ cfe/trunk/lib/Headers/__clang_cuda_intrinsics.h
@@ -26,6 +26,76 @@
 #error "This file is for CUDA compilation only."
 #endif
 
+// sm_30 intrinsics: __shfl_{up,down,xor}.
+
+#define __SM_30_INTRINSICS_H__
+#define __SM_30_INTRINSICS_HPP__
+
+#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 300
+
+#pragma push_macro("__MAKE_SHUFFLES")
+#define __MAKE_SHUFFLES(__FnName, __IntIntrinsic, __FloatIntrinsic, __Mask)\
+  inline __device__ int __FnName(int __in, int __offset,   \
+ int __width = warpSize) { \
+return __IntIntrinsic(__in, __offset,  \
+  ((warpSize - __width) << 8) | (__Mask)); \
+  }\
+  inline __device__ float __FnName(float __in, int __offset,   \
+   int __width = warpSize) {   \
+return __FloatIntrinsic(__in, __offset,\
+((warpSize - __width) << 8) | (__Mask));   \
+  }\
+  inline __device__ unsigned int __FnName(unsigned int __in, int __offset, \
+  int __width = warpSize) {\
+return static_cast(  \
+::__FnName(static_cast(__in), __offset, __width));\
+  }\
+  inline __device__ long long __FnName(long long __in, int __offset,   \
+   int __width = warpSize) {   \
+struct __Bits {\
+  int __a, __b;\
+}; \
+_Static_assert(sizeof(__in) == sizeof(__Bits));\
+_Static_assert(sizeof(__Bits) == 2 * sizeof(int)); \
+__Bits __tmp;   

r272299 - [CUDA] Implement __shfl* intrinsics in clang headers.

2016-06-09 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Thu Jun  9 15:04:57 2016
New Revision: 272299

URL: http://llvm.org/viewvc/llvm-project?rev=272299=rev
Log:
[CUDA] Implement __shfl* intrinsics in clang headers.

Summary: Clang changes to make use of the LLVM intrinsics added in D21160.

Reviewers: tra

Subscribers: jholewinski, cfe-commits

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

Modified:
cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
cfe/trunk/lib/Headers/__clang_cuda_intrinsics.h
cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h

Modified: cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def?rev=272299=272298=272299=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsNVPTX.def Thu Jun  9 15:04:57 2016
@@ -402,6 +402,17 @@ BUILTIN(__nvvm_bar0_popc, "ii", "")
 BUILTIN(__nvvm_bar0_and, "ii", "")
 BUILTIN(__nvvm_bar0_or, "ii", "")
 
+// Shuffle
+
+BUILTIN(__builtin_ptx_shfl_down_i32, "", "")
+BUILTIN(__builtin_ptx_shfl_down_f32, "ffii", "")
+BUILTIN(__builtin_ptx_shfl_up_i32, "", "")
+BUILTIN(__builtin_ptx_shfl_up_f32, "ffii", "")
+BUILTIN(__builtin_ptx_shfl_bfly_i32, "", "")
+BUILTIN(__builtin_ptx_shfl_bfly_f32, "ffii", "")
+BUILTIN(__builtin_ptx_shfl_idx_i32, "", "")
+BUILTIN(__builtin_ptx_shfl_idx_f32, "ffii", "")
+
 // Membar
 
 BUILTIN(__nvvm_membar_cta, "v", "")

Modified: cfe/trunk/lib/Headers/__clang_cuda_intrinsics.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_intrinsics.h?rev=272299=272298=272299=diff
==
--- cfe/trunk/lib/Headers/__clang_cuda_intrinsics.h (original)
+++ cfe/trunk/lib/Headers/__clang_cuda_intrinsics.h Thu Jun  9 15:04:57 2016
@@ -26,6 +26,76 @@
 #error "This file is for CUDA compilation only."
 #endif
 
+// sm_30 intrinsics: __shfl_{up,down,xor}.
+
+#define __SM_30_INTRINSICS_H__
+#define __SM_30_INTRINSICS_HPP__
+
+#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 300
+
+#pragma push_macro("__MAKE_SHUFFLES")
+#define __MAKE_SHUFFLES(__FnName, __IntIntrinsic, __FloatIntrinsic, __Mask)
\
+  inline __device__ int __FnName(int __in, int __offset,   
\
+ int __width = warpSize) { 
\
+return __IntIntrinsic(__in, __offset,  
\
+  ((warpSize - __width) << 8) | (__Mask)); 
\
+  }
\
+  inline __device__ float __FnName(float __in, int __offset,   
\
+   int __width = warpSize) {   
\
+return __FloatIntrinsic(__in, __offset,
\
+((warpSize - __width) << 8) | (__Mask));   
\
+  }
\
+  inline __device__ unsigned int __FnName(unsigned int __in, int __offset, 
\
+  int __width = warpSize) {
\
+return static_cast(  
\
+::__FnName(static_cast(__in), __offset, __width));
\
+  }
\
+  inline __device__ long long __FnName(long long __in, int __offset,   
\
+   int __width = warpSize) {   
\
+struct __Bits {
\
+  int __a, __b;
\
+}; 
\
+_Static_assert(sizeof(__in) == sizeof(__Bits));
\
+_Static_assert(sizeof(__Bits) == 2 * sizeof(int)); 
\
+__Bits __tmp;  
\
+memcpy(&__in, &__tmp, sizeof(__in));   
\
+__tmp.__a = ::__FnName(__tmp.__a, __offset, __width);  
\
+__tmp.__b = ::__FnName(__tmp.__b, __offset, __width);  
\
+long long __out;   
\
+memcpy(&__out, &__tmp, sizeof(__tmp)); 
\
+return __out;  
\
+  }
\
+  inline __device__ unsigned long long __FnName(   
\
+  unsigned long long __in, int __offset, int __width = warpSize) { 
\
+return static_cast(
\
+ 

Re: [PATCH] D20389: NVPTX: Add supported CL features

2016-06-09 Thread Jan Vesely via cfe-commits
jvesely marked 2 inline comments as done.
jvesely added a comment.

Repository:
  rL LLVM

http://reviews.llvm.org/D20389



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


Re: [PATCH] D20498: [Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr

2016-06-09 Thread Tim Shen via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272296: [Temporary] Add an ExprWithCleanups for each C++ 
MaterializeTemporaryExpr. (authored by timshen).

Changed prior to commit:
  http://reviews.llvm.org/D20498?vs=58694=60227#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20498

Files:
  cfe/trunk/include/clang/AST/ExprCXX.h
  cfe/trunk/include/clang/AST/Stmt.h
  cfe/trunk/include/clang/Sema/CleanupInfo.h
  cfe/trunk/include/clang/Sema/ScopeInfo.h
  cfe/trunk/include/clang/Sema/Sema.h
  cfe/trunk/lib/AST/Expr.cpp
  cfe/trunk/lib/AST/ExprCXX.cpp
  cfe/trunk/lib/Analysis/Consumed.cpp
  cfe/trunk/lib/CodeGen/CGExprConstant.cpp
  cfe/trunk/lib/Sema/Sema.cpp
  cfe/trunk/lib/Sema/SemaCast.cpp
  cfe/trunk/lib/Sema/SemaCoroutine.cpp
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/lib/Sema/SemaExpr.cpp
  cfe/trunk/lib/Sema/SemaExprCXX.cpp
  cfe/trunk/lib/Sema/SemaExprObjC.cpp
  cfe/trunk/lib/Sema/SemaInit.cpp
  cfe/trunk/lib/Sema/SemaLambda.cpp
  cfe/trunk/lib/Sema/SemaOpenMP.cpp
  cfe/trunk/lib/Sema/SemaStmt.cpp
  cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
  cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
  cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Index: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
===
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp
@@ -764,6 +764,12 @@
 return Visit(DIE->getExpr());
   }
 
+  llvm::Constant *VisitExprWithCleanups(ExprWithCleanups *E) {
+if (!E->cleanupsHaveSideEffects())
+  return Visit(E->getSubExpr());
+return nullptr;
+  }
+
   llvm::Constant *VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {
 return Visit(E->GetTemporaryExpr());
   }
Index: cfe/trunk/lib/AST/ExprCXX.cpp
===
--- cfe/trunk/lib/AST/ExprCXX.cpp
+++ cfe/trunk/lib/AST/ExprCXX.cpp
@@ -1039,23 +1039,27 @@
 }
 
 ExprWithCleanups::ExprWithCleanups(Expr *subexpr,
+   bool CleanupsHaveSideEffects,
ArrayRef objects)
   : Expr(ExprWithCleanupsClass, subexpr->getType(),
  subexpr->getValueKind(), subexpr->getObjectKind(),
  subexpr->isTypeDependent(), subexpr->isValueDependent(),
  subexpr->isInstantiationDependent(),
  subexpr->containsUnexpandedParameterPack()),
 SubExpr(subexpr) {
+  ExprWithCleanupsBits.CleanupsHaveSideEffects = CleanupsHaveSideEffects;
   ExprWithCleanupsBits.NumObjects = objects.size();
   for (unsigned i = 0, e = objects.size(); i != e; ++i)
 getTrailingObjects()[i] = objects[i];
 }
 
 ExprWithCleanups *ExprWithCleanups::Create(const ASTContext , Expr *subexpr,
+   bool CleanupsHaveSideEffects,
ArrayRef objects) {
   void *buffer = C.Allocate(totalSizeToAlloc(objects.size()),
 llvm::alignOf());
-  return new (buffer) ExprWithCleanups(subexpr, objects);
+  return new (buffer)
+  ExprWithCleanups(subexpr, CleanupsHaveSideEffects, objects);
 }
 
 ExprWithCleanups::ExprWithCleanups(EmptyShell empty, unsigned numObjects)
Index: cfe/trunk/lib/AST/Expr.cpp
===
--- cfe/trunk/lib/AST/Expr.cpp
+++ cfe/trunk/lib/AST/Expr.cpp
@@ -2890,7 +2890,6 @@
   case CXXThrowExprClass:
   case CXXNewExprClass:
   case CXXDeleteExprClass:
-  case ExprWithCleanupsClass:
   case CoawaitExprClass:
   case CoyieldExprClass:
 // These always have a side-effect.
@@ -2903,6 +2902,12 @@
 return Finder.hasSideEffects();
   }
 
+  case ExprWithCleanupsClass:
+if (IncludePossibleEffects)
+  if (cast(this)->cleanupsHaveSideEffects())
+return true;
+break;
+
   case ParenExprClass:
   case ArraySubscriptExprClass:
   case OMPArraySectionExprClass:
Index: cfe/trunk/lib/Sema/SemaStmt.cpp
===
--- cfe/trunk/lib/Sema/SemaStmt.cpp
+++ cfe/trunk/lib/Sema/SemaStmt.cpp
@@ -1518,6 +1518,10 @@
   // variables Increment and DRE.
   bool ProcessIterationStmt(Sema , Stmt* Statement, bool ,
 DeclRefExpr *) {
+if (auto Cleanups = dyn_cast(Statement))
+  if (!Cleanups->cleanupsHaveSideEffects())
+Statement = Cleanups->getSubExpr();
+
 if (UnaryOperator *UO = dyn_cast(Statement)) {
   switch (UO->getOpcode()) {
 default: return false;
@@ -2472,6 +2476,10 @@
 
   QualType VariableType = VD->getType();
 
+  if (auto Cleanups = dyn_cast(InitExpr))
+if (!Cleanups->cleanupsHaveSideEffects())
+  InitExpr = Cleanups->getSubExpr();
+
   const MaterializeTemporaryExpr *MTE =
   dyn_cast(InitExpr);
 
Index: cfe/trunk/lib/Sema/SemaLambda.cpp
===
--- cfe/trunk/lib/Sema/SemaLambda.cpp
+++ 

Re: [PATCH] D20389: NVPTX: Add supported CL features

2016-06-09 Thread Jan Vesely via cfe-commits
jvesely updated this revision to Diff 60226.
jvesely added a comment.

Test all known extensions against expected nvptx outcome (add negative tests)


Repository:
  rL LLVM

http://reviews.llvm.org/D20389

Files:
  lib/Basic/Targets.cpp
  test/Misc/nvptx.languageOptsOpenCL.cl

Index: test/Misc/nvptx.languageOptsOpenCL.cl
===
--- /dev/null
+++ test/Misc/nvptx.languageOptsOpenCL.cl
@@ -0,0 +1,210 @@
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple nvptx-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple nvptx64-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
+
+// Extensions in all versions
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#ifdef cl_khr_fp16
+#error "Incorrect cl_khr_fp16 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp16: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_fp16' - ignoring}}
+
+#ifdef cl_khr_int64_base_atomics
+#error "Incorrect cl_khr_int64_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_int64_base_atomics' - ignoring}}
+
+#ifdef cl_khr_int64_extended_atomics
+#error "Incorrect cl_khr_int64_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
+// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_int64_extended_atomics' - ignoring}}
+
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+
+#ifndef cl_khr_icd
+#error "Missing cl_khr_icd define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_icd: enable
+
+// Core features in CL 1.1
+
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_byte_addressable_store' is core feature or supported optional core feature - ignoring}}
+#endif
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_base_atomics' is core feature or supported optional core feature - ignoring}}
+#endif
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_global_int32_extended_atomics' is core feature or supported optional core feature - ignoring}}
+#endif
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
+#if (__OPENCL_C_VERSION__ >= 110) && defined TEST_CORE_FEATURES
+// expected-warning@-2{{OpenCL extension 'cl_khr_local_int32_base_atomics' is core feature or supported optional core feature - ignoring}}
+#endif
+
+#ifndef cl_khr_local_int32_extended_atomics
+#error "Missing cl_khr_local_int32_extended_atomics 

r272296 - [Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr.

2016-06-09 Thread Tim Shen via cfe-commits
Author: timshen
Date: Thu Jun  9 14:54:46 2016
New Revision: 272296

URL: http://llvm.org/viewvc/llvm-project?rev=272296=rev
Log:
[Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr.

These ExprWithCleanups are added for holding a RunCleanupsScope not
for destructor calls; rather, they are for lifetime marks. This requires
ExprWithCleanups to keep a bit to indicate whether it have cleanups with
side effects (e.g. dtor calls).

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

Added:
cfe/trunk/include/clang/Sema/CleanupInfo.h
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/include/clang/Sema/ScopeInfo.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/Analysis/Consumed.cpp
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/lib/Sema/SemaCoroutine.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaLambda.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=272296=272295=272296=diff
==
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Thu Jun  9 14:54:46 2016
@@ -2877,7 +2877,8 @@ private:
   Stmt *SubExpr;
 
   ExprWithCleanups(EmptyShell, unsigned NumObjects);
-  ExprWithCleanups(Expr *SubExpr, ArrayRef Objects);
+  ExprWithCleanups(Expr *SubExpr, bool CleanupsHaveSideEffects,
+   ArrayRef Objects);
 
   friend TrailingObjects;
   friend class ASTStmtReader;
@@ -2887,6 +2888,7 @@ public:
   unsigned numObjects);
 
   static ExprWithCleanups *Create(const ASTContext , Expr *subexpr,
+  bool CleanupsHaveSideEffects,
   ArrayRef objects);
 
   ArrayRef getObjects() const {
@@ -2903,6 +2905,9 @@ public:
 
   Expr *getSubExpr() { return cast(SubExpr); }
   const Expr *getSubExpr() const { return cast(SubExpr); }
+  bool cleanupsHaveSideEffects() const {
+return ExprWithCleanupsBits.CleanupsHaveSideEffects;
+  }
 
   /// As with any mutator of the AST, be very careful
   /// when modifying an existing AST to preserve its invariants.

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=272296=272295=272296=diff
==
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Thu Jun  9 14:54:46 2016
@@ -192,7 +192,10 @@ protected:
 
 unsigned : NumExprBits;
 
-unsigned NumObjects : 32 - NumExprBits;
+// When false, it must not have side effects.
+bool CleanupsHaveSideEffects : 1;
+
+unsigned NumObjects : 32 - 1 - NumExprBits;
   };
 
   class PseudoObjectExprBitfields {

Added: cfe/trunk/include/clang/Sema/CleanupInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/CleanupInfo.h?rev=272296=auto
==
--- cfe/trunk/include/clang/Sema/CleanupInfo.h (added)
+++ cfe/trunk/include/clang/Sema/CleanupInfo.h Thu Jun  9 14:54:46 2016
@@ -0,0 +1,47 @@
+//===--- CleanupInfo.cpp - Cleanup Control in Sema 
===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+//  This file implements a set of operations on whether generating an
+//  ExprWithCleanups in a full expression.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_SEMA_CLEANUP_INFO_H
+#define LLVM_CLANG_SEMA_CLEANUP_INFO_H
+
+namespace clang {
+
+class CleanupInfo {
+  bool ExprNeedsCleanups = false;
+  bool CleanupsHaveSideEffects = false;
+
+public:
+  bool exprNeedsCleanups() const { return ExprNeedsCleanups; }
+
+  bool cleanupsHaveSideEffects() const { return CleanupsHaveSideEffects; }
+
+  void setExprNeedsCleanups(bool SideEffects) {
+ExprNeedsCleanups = true;
+CleanupsHaveSideEffects |= SideEffects;
+  }
+
+  void reset() {
+ExprNeedsCleanups = false;
+CleanupsHaveSideEffects = false;
+  }
+
+  void 

Re: [PATCH] D20490: [Parser] Fix a crash on invalid where a delayed TypoExpr was corrected twice

2016-06-09 Thread Erik Pilkington via cfe-commits
erik.pilkington added a comment.

Pong!!


http://reviews.llvm.org/D20490



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


Re: [PATCH] D20498: [Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr

2016-06-09 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D20498



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


Re: [PATCH] D21162: [CUDA] Implement __shfl* intrinsics in clang headers.

2016-06-09 Thread Justin Lebar via cfe-commits
jlebar added inline comments.


Comment at: lib/Headers/__clang_cuda_intrinsics.h:77-80
@@ +76,6 @@
+_Static_assert(sizeof(__tmp) == sizeof(__in)); 
\
+memcpy(&__tmp, &__in, sizeof(__in));   
\
+__tmp = ::__FnName(__tmp, __offset, __width);  
\
+double __out;  
\
+memcpy(&__out, &__tmp, sizeof(__out)); 
\
+return __out;  
\

tra wrote:
> Could we use a union instead?
I'm pretty sure using a union for this purpose is UB in C++.  "[9.5.1] In a 
union, at most one of the non-static data members can be active at any time, 
that is, the value of at most one of the non-static data members can be stored 
in a union at any time"  Although apparently it's fine in C11, 
http://stackoverflow.com/questions/25664848/unions-and-type-punning


Comment at: lib/Headers/__clang_cuda_intrinsics.h:87
@@ +86,3 @@
+__MAKE_SHUFFLES(__shfl_up, __builtin_ptx_shfl_up_i32, 
__builtin_ptx_shfl_up_f32,
+0);
+__MAKE_SHUFFLES(__shfl_down, __builtin_ptx_shfl_down_i32,

tra wrote:
> Ugh. Took me a while to figure out why 0 is used here.
> Unlike other variants shfl.up apparently applies to lanes >= maxLane. Who 
> would have thought.
> Might add a comment here so it's not mistaken for a typo.
Done, thanks.


http://reviews.llvm.org/D21162



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


Re: [PATCH] D21162: [CUDA] Implement __shfl* intrinsics in clang headers.

2016-06-09 Thread Justin Lebar via cfe-commits
jlebar updated this revision to Diff 60223.
jlebar marked 2 inline comments as done.
jlebar added a comment.

Update after tra's review.


http://reviews.llvm.org/D21162

Files:
  include/clang/Basic/BuiltinsNVPTX.def
  lib/Headers/__clang_cuda_intrinsics.h
  lib/Headers/__clang_cuda_runtime_wrapper.h

Index: lib/Headers/__clang_cuda_runtime_wrapper.h
===
--- lib/Headers/__clang_cuda_runtime_wrapper.h
+++ lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -198,13 +198,14 @@
 #include "sm_20_atomic_functions.hpp"
 #include "sm_20_intrinsics.hpp"
 #include "sm_32_atomic_functions.hpp"
-// sm_30_intrinsics.h has declarations that use default argument, so
-// we have to include it and it will in turn include .hpp
-#include "sm_30_intrinsics.h"
 
-// Don't include sm_32_intrinsics.h.  That header defines __ldg using inline
-// asm, but we want to define it using builtins, because we can't use the
-// [addr+imm] addressing mode if we use the inline asm in the header.
+// Don't include sm_30_intrinsics.h and sm_32_intrinsics.h.  These define the
+// __shfl and __ldg intrinsics using inline (volatile) asm, but we want to
+// define them using builtins so that the optimizer can reason about and across
+// these instructions.  In particular, using intrinsics for ldg gets us the
+// [addr+imm] addressing mode, which, although it doesn't actually exist in the
+// hardware, seems to generate faster machine code because ptxas can more easily
+// reason about our code.
 
 #undef __MATH_FUNCTIONS_HPP__
 
Index: lib/Headers/__clang_cuda_intrinsics.h
===
--- lib/Headers/__clang_cuda_intrinsics.h
+++ lib/Headers/__clang_cuda_intrinsics.h
@@ -26,6 +26,76 @@
 #error "This file is for CUDA compilation only."
 #endif
 
+// sm_30 intrinsics: __shfl_{up,down,xor}.
+
+#define __SM_30_INTRINSICS_H__
+#define __SM_30_INTRINSICS_HPP__
+
+#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 300
+
+#pragma push_macro("__MAKE_SHUFFLES")
+#define __MAKE_SHUFFLES(__FnName, __IntIntrinsic, __FloatIntrinsic, __Mask)\
+  inline __device__ int __FnName(int __in, int __offset,   \
+ int __width = warpSize) { \
+return __IntIntrinsic(__in, __offset,  \
+  ((warpSize - __width) << 8) | (__Mask)); \
+  }\
+  inline __device__ float __FnName(float __in, int __offset,   \
+   int __width = warpSize) {   \
+return __FloatIntrinsic(__in, __offset,\
+((warpSize - __width) << 8) | (__Mask));   \
+  }\
+  inline __device__ unsigned int __FnName(unsigned int __in, int __offset, \
+  int __width = warpSize) {\
+return static_cast(  \
+::__FnName(static_cast(__in), __offset, __width));\
+  }\
+  inline __device__ long long __FnName(long long __in, int __offset,   \
+   int __width = warpSize) {   \
+struct __Bits {\
+  int __a, __b;\
+}; \
+_Static_assert(sizeof(__in) == sizeof(__Bits));\
+_Static_assert(sizeof(__Bits) == 2 * sizeof(int)); \
+__Bits __tmp;  \
+memcpy(&__in, &__tmp, sizeof(__in));   \
+__tmp.__a = ::__FnName(__tmp.__a, __offset, __width);  \
+__tmp.__b = ::__FnName(__tmp.__b, __offset, __width);  \
+long long __out;   \
+memcpy(&__out, &__tmp, sizeof(__tmp)); \
+return __out;  \
+  }\
+  inline __device__ unsigned long long __FnName(   \
+  unsigned long long __in, int __offset, int __width = warpSize) { \
+return static_cast(\
+::__FnName(static_cast(__in), __offset, __width)); \
+  }\
+  inline __device__ double __FnName(double 

Re: [PATCH] D20933: Preallocate ExplodedNode hash table

2016-06-09 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

> If the underlying allocator that does a poor job at reusing freed memory, 
> then trivial 

>  functions will use about 1 MB more than before, then free the memory 
> immediately.


You could probably flag some of those functions, especially the ones that do 
not contain inlinable calls. (Ex: Has low complexity (CFG::getNumBlockIDs()) 
and does not call anything that can be inlined.) Said that, it's "a nice to 
have".


http://reviews.llvm.org/D20933



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


Re: [PATCH] D20964: [clang-tidy] Add modernize-use-emplace

2016-06-09 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

There are alternative implementation in http://reviews.llvm.org/D21185. Will be 
good idea to how one which take the best from both :-)


http://reviews.llvm.org/D20964



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


Re: [PATCH] D21185: [clang-tidy] Add performance-emplace-into-containers

2016-06-09 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

See also http://reviews.llvm.org/D20964. I think modernize is better place for 
such check.


http://reviews.llvm.org/D21185



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


Re: [PATCH] D19854: Define Contiki OS toolchain

2016-06-09 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

This needs a driver test.


http://reviews.llvm.org/D19854



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


Re: [PATCH] D20347: Add support to clang-cl driver for /GS switch

2016-06-09 Thread Nico Weber via cfe-commits
thakis added a comment.

probably at least the "the XOR with RSP/EBP/ESP" bit still (and maybe EH 
function upgrades instead of bailing)



Comment at: lib/Driver/Tools.cpp:9990
@@ +9989,3 @@
+   /*default=*/false))
+CmdArgs.push_back("/GS-");
+

To pass on /GS- to the fallback compiler when needed, I suppose.


http://reviews.llvm.org/D20347



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


Fwd: Java Interface for clang

2016-06-09 Thread Maryam Mehraban via cfe-commits
Hello everybody,

I want to use clang and its facilities to parse c and c++ . but I need to
use it in java.
In my searches , saw jClang or Clang bindings for java, checking the date
of pages returned to me was before 2015.
so I know what is the status of jclang or is there any solution to use
clang and libraries in java.
thanks very much.
Mary.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-06-09 Thread Hans Wennborg via cfe-commits
hans updated this revision to Diff 60220.
hans added a comment.

Adding the version that caches directory contents.

This has the problem the it doesn't play with modules, the rewriter, and 
possibly others, because they write to the file system without any way for the 
vfs to find out. I've tried to find a good way to fix that, but didn't come up 
with anything. One way would be to maintain a global counter like 
llvm::sys::fileSystemChangeCount which when changed would invalidate the maps, 
but I don't know if that would be acceptable.


http://reviews.llvm.org/D21113

Files:
  include/clang/Basic/VirtualFileSystem.h
  include/clang/Driver/Options.td
  include/clang/Lex/HeaderSearchOptions.h
  lib/Basic/VirtualFileSystem.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Driver/cl-options.c
  test/Frontend/Inputs/case-insensitive-paths.h
  test/Frontend/case-insensitive-paths.c
  unittests/Basic/VirtualFileSystemTest.cpp

Index: unittests/Basic/VirtualFileSystemTest.cpp
===
--- unittests/Basic/VirtualFileSystemTest.cpp
+++ unittests/Basic/VirtualFileSystemTest.cpp
@@ -107,8 +107,15 @@
 
   vfs::directory_iterator dir_begin(const Twine ,
 std::error_code ) override {
-return vfs::directory_iterator(
+auto I = vfs::directory_iterator(
 std::make_shared(FilesAndDirs, Dir));
+
+// Even if there is no entry for /foo, /foo/bar may exist, so only set the
+// error code if /foo returns an empty iterator.
+if (I == vfs::directory_iterator())
+  EC = status(Dir).getError();
+
+return I;
   }
 
   void addEntry(StringRef Path, const vfs::Status ) {
@@ -1164,3 +1171,52 @@
   }
   EXPECT_EQ(I, E);
 }
+
+class CaseInsensitiveFileSystemTest : public ::testing::Test {
+private:
+  IntrusiveRefCntPtr Base;
+
+protected:
+  IntrusiveRefCntPtr FS;
+
+  CaseInsensitiveFileSystemTest()
+  : Base(new DummyFileSystem()),
+FS(new clang::vfs::CaseInsensitiveFileSystem(Base)) {
+Base->addRegularFile("/foo");
+Base->addDirectory("/bar");
+Base->addRegularFile("/bar/baz");
+  }
+};
+
+TEST_F(CaseInsensitiveFileSystemTest, Basic) {
+  // Not just accepting anything.
+  auto Status = FS->status("/F00");
+  ASSERT_EQ(llvm::errc::no_such_file_or_directory, Status.getError());
+
+  // Case-insensitive file is found.
+  Status = FS->status("/FoO");
+  ASSERT_FALSE(Status.getError());
+
+  // Case-insensitive dir works too.
+  Status = FS->status("/bAr/baZ");
+  ASSERT_FALSE(Status.getError());
+
+  // Test openFileForRead.
+  auto File = FS->openFileForRead("/F00");
+  ASSERT_EQ(llvm::errc::no_such_file_or_directory, File.getError());
+  File = FS->openFileForRead("/Foo");
+  ASSERT_FALSE(File.getError());
+  File = FS->openFileForRead("/Bar/Baz");
+  ASSERT_FALSE(File.getError());
+
+  // Test directory listing.
+  std::error_code EC;
+  auto Dir = FS->dir_begin("/b4r", EC);
+  ASSERT_EQ(llvm::errc::no_such_file_or_directory, EC);
+  Dir = FS->dir_begin("/bAr", EC);
+  ASSERT_FALSE(EC);
+  ASSERT_EQ("/bar/baz", Dir->getName());
+  Dir.increment(EC);
+  ASSERT_FALSE(EC);
+  ASSERT_EQ(vfs::directory_iterator(), Dir);
+}
Index: test/Frontend/case-insensitive-paths.c
===
--- /dev/null
+++ test/Frontend/case-insensitive-paths.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -fcase-insensitive-paths -verify %s
+// RUN: %clang_cc1 -fsyntax-only --show-includes -fcase-insensitive-paths %s | FileCheck %s
+
+#include "InpUts/CasE-InsensitivE-Paths.h" // expected-no-diagnostics
+
+// Make sure the real filename is used when printing header dependencies.
+// CHECK: including file: {{.*}}case-insensitive-paths.h
Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -466,6 +466,7 @@
 // RUN: -mllvm -disable-llvm-optzns \
 // RUN: -Wunused-variable \
 // RUN: -fmacro-backtrace-limit=0 \
+// RUN: -fcase-insensitive-paths \
 // RUN: -Werror /Zs -- %s 2>&1
 
 
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1447,6 +1447,8 @@
 
   for (const Arg *A : Args.filtered(OPT_ivfsoverlay))
 Opts.AddVFSOverlayFile(A->getValue());
+
+  Opts.CaseInsensitive = Args.hasArg(OPT_fcase_insensitive_paths);
 }
 
 void CompilerInvocation::setLangDefaults(LangOptions , InputKind IK,
@@ -2538,12 +2540,8 @@
   GraveYard[Idx] = Ptr;
 }
 
-IntrusiveRefCntPtr
-createVFSFromCompilerInvocation(const CompilerInvocation ,
-DiagnosticsEngine ) {
-  if (CI.getHeaderSearchOpts().VFSOverlayFiles.empty())
-return vfs::getRealFileSystem();
-
+static IntrusiveRefCntPtr
+getOverlayFS(const CompilerInvocation , DiagnosticsEngine ) {
   

RE: [PATCH] D21173: [X86] _MM_ALIGN16 attribute support for non-windows targets

2016-06-09 Thread Rackover, Zvi via cfe-commits
Thanks the suggestion, David. I did not realize __attribute__ is supported by 
Windows targets.

Zvi

From: David Majnemer [mailto:david.majne...@gmail.com]
Sent: Thursday, June 09, 2016 17:48
To: reviews+d21173+public+9a6e31402e430...@reviews.llvm.org; Rackover, Zvi 

Cc: Aboud, Amjad ; mku...@google.com; 
echri...@gmail.com; cfe-commits@lists.llvm.org
Subject: Re: [PATCH] D21173: [X86] _MM_ALIGN16 attribute support for 
non-windows targets



On Thursday, June 9, 2016, Zvi Rackover via cfe-commits 
> wrote:
zvi created this revision.
zvi added reviewers: aaboud, mkuper, echristo, cfe-commits.
zvi set the repository for this revision to rL LLVM.
zvi added a project: clang-c.
Herald added a subscriber: mehdi_amini.

This patch adds support for the _MM_ALIGN16 attribute on non-windows targets. 
This aligns Clang with ICC which supports the attribute on all targets.

Fixes PR28056

Repository:
  rL LLVM

http://reviews.llvm.org/D21173

Files:
  lib/Headers/xmmintrin.h
  test/Headers/xmmintrin.c

Index: test/Headers/xmmintrin.c
===
--- test/Headers/xmmintrin.c
+++ test/Headers/xmmintrin.c
@@ -7,6 +7,9 @@
 // REQUIRES: x86-registered-target
 #include 

+// CHECK: @c = common global i8 0, align 16
+_MM_ALIGN16 char c;
+
 // Make sure the last step of _mm_cvtps_pi16 converts <4 x i32> to <4 x i16> by
 // checking that clang emits PACKSSDW instead of PACKSSWB.

Index: lib/Headers/xmmintrin.h
===
--- lib/Headers/xmmintrin.h
+++ lib/Headers/xmmintrin.h
@@ -2823,6 +2823,8 @@

 #ifdef _MSC_VER
 #define _MM_ALIGN16 __declspec(align(16))
+#else
+#define _MM_ALIGN16 __attribute__((aligned(16)))
 #endif

I would just use the __attribute__ spelling, no need for two definitions


 #define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w))

-
Intel Israel (74) Limited

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


Re: [PATCH] D21173: [X86] _MM_ALIGN16 attribute support for non-windows targets

2016-06-09 Thread Zvi Rackover via cfe-commits
zvi updated this revision to Diff 60217.
zvi added a comment.

Following David Majnemer's suggestion on cfe-commits: I would just use the 
__attribute__ spelling, no need for two definitions


Repository:
  rL LLVM

http://reviews.llvm.org/D21173

Files:
  lib/Headers/xmmintrin.h
  test/Headers/xmmintrin.c

Index: test/Headers/xmmintrin.c
===
--- test/Headers/xmmintrin.c
+++ test/Headers/xmmintrin.c
@@ -7,6 +7,9 @@
 // REQUIRES: x86-registered-target
 #include 
 
+// CHECK: @c = common global i8 0, align 16
+_MM_ALIGN16 char c;
+
 // Make sure the last step of _mm_cvtps_pi16 converts <4 x i32> to <4 x i16> by
 // checking that clang emits PACKSSDW instead of PACKSSWB.
 
Index: lib/Headers/xmmintrin.h
===
--- lib/Headers/xmmintrin.h
+++ lib/Headers/xmmintrin.h
@@ -2821,9 +2821,7 @@
 }
 
 
-#ifdef _MSC_VER
-#define _MM_ALIGN16 __declspec(align(16))
-#endif
+#define _MM_ALIGN16 __attribute__((aligned(16)))
 
 #define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w))
 


Index: test/Headers/xmmintrin.c
===
--- test/Headers/xmmintrin.c
+++ test/Headers/xmmintrin.c
@@ -7,6 +7,9 @@
 // REQUIRES: x86-registered-target
 #include 
 
+// CHECK: @c = common global i8 0, align 16
+_MM_ALIGN16 char c;
+
 // Make sure the last step of _mm_cvtps_pi16 converts <4 x i32> to <4 x i16> by
 // checking that clang emits PACKSSDW instead of PACKSSWB.
 
Index: lib/Headers/xmmintrin.h
===
--- lib/Headers/xmmintrin.h
+++ lib/Headers/xmmintrin.h
@@ -2821,9 +2821,7 @@
 }
 
 
-#ifdef _MSC_VER
-#define _MM_ALIGN16 __declspec(align(16))
-#endif
+#define _MM_ALIGN16 __attribute__((aligned(16)))
 
 #define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w))
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20328: [libcxx] Externally threaded libc++ variant

2016-06-09 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

@mclow.lists, @EricWF: Gentle (and shameless) ping!


http://reviews.llvm.org/D20328



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


Re: [PATCH] D20338: [PCH] Fixed overridden files always invalidating preamble even when unchanged

2016-06-09 Thread Cameron via cfe-commits
cameron314 added a comment.

This is a fairly important bug for anyone hosting clang as a library (e.g. 
IDEs).
Can someone have a look at this patch when they have a free moment?


http://reviews.llvm.org/D20338



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


Re: [PATCH] D20132: [libclang] Add clang_getAllSkippedRanges function

2016-06-09 Thread Cameron via cfe-commits
cameron314 added a comment.

Can someone have a look at this now that there's a test?


http://reviews.llvm.org/D20132



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


[libcxx] r272288 - Make the comparison objects that we pass in for various tests look more like actual comparison objects. No functional change.

2016-06-09 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Jun  9 13:34:38 2016
New Revision: 272288

URL: http://llvm.org/viewvc/llvm-project?rev=272288=rev
Log:
Make the comparison objects that we pass in for various tests look more like 
actual comparison objects. No functional change.

Modified:

libcxx/trunk/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp

libcxx/trunk/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp?rev=272288=272287=272288=diff
==
--- 
libcxx/trunk/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
 Thu Jun  9 13:34:38 2016
@@ -28,6 +28,7 @@ struct some_comp
 {
 typedef T value_type;
 some_comp();
+bool operator()(const T&, const T&) const { return false; }
 };
 
 int main()

Modified: 
libcxx/trunk/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
URL: 

Re: [PATCH] D20347: Add support to clang-cl driver for /GS switch

2016-06-09 Thread Hans Wennborg via cfe-commits
hans added a comment.

Is this waiting for anything more now that http://reviews.llvm.org/D20346 has 
landed?


http://reviews.llvm.org/D20347



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


Re: [PATCH] D20979: [OpenCL] Use function attribute/metadata to represent kernel attributes

2016-06-09 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

In http://reviews.llvm.org/D20979#452616, @yaxunl wrote:

> In http://reviews.llvm.org/D20979#452463, @Anastasia wrote:
>
> > Looking good generally, I am just not sure about mixing two different 
> > representations.
>
>
> If we choose only one form of representation, would you suggest to use 
> function metadata or function attribute?


I am still not sure if this is the intended use of target-dependent attributes 
to be honest. So I would prefer metadata representation.

Also if we use metadata could we avoid parsing values from strings potentially 
in contrast to attributes that represent all values as strings?

Related to your earlier comments about inflexibility of metadata, would it be 
possible to extend MDNode to be able to insert new operands?


http://reviews.llvm.org/D20979



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


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-06-09 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/Headers/opencl-c-header.cl:70
@@ +69,3 @@
+// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s | FileCheck %s
+// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - -cl-std=CL2.0 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s
+// RUN: %clang_cc1 -triple amdgcn--amdhsa -emit-llvm -o - -cl-std=CL2.0  
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s

yaxunl wrote:
> I added check to the second compilation to make sure module is read, also 
> changed the modules to be read only so that they won't be created again.
Ok, now I see what you are testing here. :)

Do you think we could add:
  CHECK-NOT: Reading modules

For the cases the modules are regenerated new?


http://reviews.llvm.org/D20444



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


Re: [PATCH] D21185: [clang-tidy] Add performance-emplace-into-containers

2016-06-09 Thread Vedant Kumar via cfe-commits
vsk updated this revision to Diff 60206.
vsk added a comment.

- Fix the diagnostic message. Suggested by Erik Pilkington.


http://reviews.llvm.org/D21185

Files:
  clang-tidy/performance/CMakeLists.txt
  clang-tidy/performance/EmplaceCheck.cpp
  clang-tidy/performance/EmplaceCheck.h
  clang-tidy/performance/PerformanceTidyModule.cpp
  test/clang-tidy/performance-emplace-into-containers.cpp

Index: test/clang-tidy/performance-emplace-into-containers.cpp
===
--- /dev/null
+++ test/clang-tidy/performance-emplace-into-containers.cpp
@@ -0,0 +1,57 @@
+// RUN: %check_clang_tidy %s performance-emplace-into-containers %t -- -- -std=c++11
+
+namespace std {
+
+template 
+struct vector {
+  void push_back(const T );
+  void push_back(T &);
+
+  template 
+  void emplace_back(Args &&... args);
+};
+
+} // std
+
+struct X {
+  int x;
+  X() : x(0) {}
+  X(int x) : x(x) {}
+  X(int x, int y) : x(x + y) {}
+  X(const X ) : x(Obj.x) {}
+};
+
+void f1() {
+  std::vector v1;
+
+  v1.push_back(X());
+  // CHECK-MESSAGES: [[@LINE-1]]:6: warning: Consider constructing {{.*}}
+  // CHECK-FIXES: v1.emplace_back()
+
+  v1.push_back(X(/*a*/));
+  // CHECK-MESSAGES: [[@LINE-1]]:6: warning: Consider constructing {{.*}}
+  // CHECK-FIXES: v1.emplace_back(/*a*/)
+
+  v1.push_back(X(0, 0));
+  // CHECK-MESSAGES: [[@LINE-1]]:6: warning: Consider constructing {{.*}}
+  // CHECK-FIXES: v1.emplace_back(0, 0)
+
+  v1/*a*/./*b*/push_back(/*c*/X(/*d*/0,/*e*/0/*f*/)/*g*/)/*h*/ ;
+  // CHECK-MESSAGES: [[@LINE-1]]:16: warning: Consider constructing {{.*}}
+  // CHECK-FIXES: v1/*a*/./*b*/emplace_back(/*c*//*d*/0,/*e*/0/*f*//*g*/)/*h*/ ;
+
+  // Do not try to deal with initializer lists.
+  v1.push_back({0, 0});
+
+  // Do not try to deal with functional casts. FIXME?
+  X x{0, 0};
+  v1.push_back(X(x));
+  v1.push_back(X(0));
+
+  // Do not try to deal with weird expansions.
+#define M1 X(0, 0)
+#define M2 push_back
+  v1.push_back(M1);
+  v1.M2(X(0, 0));
+  v1.M2(M1);
+}
Index: clang-tidy/performance/PerformanceTidyModule.cpp
===
--- clang-tidy/performance/PerformanceTidyModule.cpp
+++ clang-tidy/performance/PerformanceTidyModule.cpp
@@ -11,6 +11,7 @@
 #include "../ClangTidyModule.h"
 #include "../ClangTidyModuleRegistry.h"
 
+#include "EmplaceCheck.h"
 #include "FasterStringFindCheck.h"
 #include "ForRangeCopyCheck.h"
 #include "ImplicitCastInLoopCheck.h"
@@ -24,6 +25,8 @@
 class PerformanceModule : public ClangTidyModule {
 public:
   void addCheckFactories(ClangTidyCheckFactories ) override {
+CheckFactories.registerCheck(
+"performance-emplace-into-containers");
 CheckFactories.registerCheck(
 "performance-faster-string-find");
 CheckFactories.registerCheck(
Index: clang-tidy/performance/EmplaceCheck.h
===
--- /dev/null
+++ clang-tidy/performance/EmplaceCheck.h
@@ -0,0 +1,30 @@
+//===--- EmplaceCheck.h - clang-tidy --===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_EMPLACE_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_EMPLACE_H
+
+#include "../ClangTidy.h"
+
+namespace clang {
+namespace tidy {
+namespace performance {
+
+class EmplaceCheck : public ClangTidyCheck {
+public:
+  EmplaceCheck(StringRef Name, ClangTidyContext *Context);
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+  void check(const ast_matchers::MatchFinder::MatchResult ) override;
+};
+
+} // namespace performance
+} // namespace tidy
+} // namespace clang
+
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_EMPLACE_H
Index: clang-tidy/performance/EmplaceCheck.cpp
===
--- /dev/null
+++ clang-tidy/performance/EmplaceCheck.cpp
@@ -0,0 +1,98 @@
+//===--- EmplaceCheck.cpp - clang-tidy ===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "EmplaceCheck.h"
+#include "clang/Lex/Lexer.h"
+
+namespace clang {
+namespace tidy {
+namespace performance {
+
+using namespace ast_matchers;
+
+EmplaceCheck::EmplaceCheck(StringRef Name, ClangTidyContext *Context)
+: ClangTidyCheck(Name, Context) {}
+
+void EmplaceCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(
+  cxxMemberCallExpr(
+  on(expr(hasType(cxxRecordDecl(hasName("std::vector"),
+  

Re: [PATCH] D21162: [CUDA] Implement __shfl* intrinsics in clang headers.

2016-06-09 Thread Artem Belevich via cfe-commits
tra added inline comments.


Comment at: lib/Headers/__clang_cuda_intrinsics.h:77-80
@@ +76,6 @@
+_Static_assert(sizeof(__tmp) == sizeof(__in)); 
\
+memcpy(&__tmp, &__in, sizeof(__in));   
\
+__tmp = ::__FnName(__tmp, __offset, __width);  
\
+double __out;  
\
+memcpy(&__out, &__tmp, sizeof(__out)); 
\
+return __out;  
\

Could we use a union instead?


Comment at: lib/Headers/__clang_cuda_intrinsics.h:87
@@ +86,3 @@
+__MAKE_SHUFFLES(__shfl_up, __builtin_ptx_shfl_up_i32, 
__builtin_ptx_shfl_up_f32,
+0);
+__MAKE_SHUFFLES(__shfl_down, __builtin_ptx_shfl_down_i32,

Ugh. Took me a while to figure out why 0 is used here.
Unlike other variants shfl.up apparently applies to lanes >= maxLane. Who would 
have thought.
Might add a comment here so it's not mistaken for a typo.


http://reviews.llvm.org/D21162



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


Java Interface for clang

2016-06-09 Thread Maryam Mehraban via cfe-commits
Hello everybody,

I want to use clang and its facilities to parse c and c++ . but I need to
use it in java.
In my searches , saw jClang or Clang bindings for java, checking the date
of pages returned to me was before 2015.
so I know what is the status of jclang or is there any solution to use
clang and libraries in java.
thanks very much.
Mary.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272280 - Revert "[CMake] Fix an issue building out-of-tree introduced in r272200"

2016-06-09 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Thu Jun  9 12:24:16 2016
New Revision: 272280

URL: http://llvm.org/viewvc/llvm-project?rev=272280=rev
Log:
Revert "[CMake] Fix an issue building out-of-tree introduced in r272200"

This reverts r272275. This actually wasn't the right way to fix the problem. 
The correct solution is in r272279.

Applying the fix to LLVM as done in r272279, means this fix will get picked up 
by all projects building out of tree using LLVM's CMake modules. As opposed to 
the fix I had in r272275, which would require each project to change.

Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=272280=272279=272280=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Thu Jun  9 12:24:16 2016
@@ -56,8 +56,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
   list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR)
 
-  get_filename_component(LLVM_TOOLS_INSTALL_DIR ${TOOLS_BINARY_DIR} NAME)
-
   if(NOT MSVC_IDE)
 set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
   CACHE BOOL "Enable assertions")


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


Re: [PATCH] D21185: [clang-tidy] Add performance-emplace-into-containers

2016-06-09 Thread Vedant Kumar via cfe-commits
vsk added a reviewer: flx.
vsk updated this revision to Diff 60194.
vsk added a comment.

- Fix handling of push_back(X(/* comment */)).
- Don't try to emit a warning when the callee comes from a macro expansion.
- Get rid of a weird/wrong comment about checking for "default constructors".

As a side note, I'd appreciate advice on how to apply this check to the llvm 
codebase (via some kind of cmake invocation?) and gather numbers.


http://reviews.llvm.org/D21185

Files:
  clang-tidy/performance/CMakeLists.txt
  clang-tidy/performance/EmplaceCheck.cpp
  clang-tidy/performance/EmplaceCheck.h
  clang-tidy/performance/PerformanceTidyModule.cpp
  test/clang-tidy/performance-emplace-into-containers.cpp

Index: test/clang-tidy/performance-emplace-into-containers.cpp
===
--- /dev/null
+++ test/clang-tidy/performance-emplace-into-containers.cpp
@@ -0,0 +1,57 @@
+// RUN: %check_clang_tidy %s performance-emplace-into-containers %t -- -- -std=c++11
+
+namespace std {
+
+template 
+struct vector {
+  void push_back(const T );
+  void push_back(T &);
+
+  template 
+  void emplace_back(Args &&... args);
+};
+
+} // std
+
+struct X {
+  int x;
+  X() : x(0) {}
+  X(int x) : x(x) {}
+  X(int x, int y) : x(x + y) {}
+  X(const X ) : x(Obj.x) {}
+};
+
+void f1() {
+  std::vector v1;
+
+  v1.push_back(X());
+  // CHECK-MESSAGES: [[@LINE-1]]:6: warning: Avoid a copy {{.*}}
+  // CHECK-FIXES: v1.emplace_back()
+
+  v1.push_back(X(/*a*/));
+  // CHECK-MESSAGES: [[@LINE-1]]:6: warning: Avoid a copy {{.*}}
+  // CHECK-FIXES: v1.emplace_back(/*a*/)
+
+  v1.push_back(X(0, 0));
+  // CHECK-MESSAGES: [[@LINE-1]]:6: warning: Avoid a copy {{.*}}
+  // CHECK-FIXES: v1.emplace_back(0, 0)
+
+  v1/*a*/./*b*/push_back(/*c*/X(/*d*/0,/*e*/0/*f*/)/*g*/)/*h*/ ;
+  // CHECK-MESSAGES: [[@LINE-1]]:16: warning: Avoid a copy {{.*}}
+  // CHECK-FIXES: v1/*a*/./*b*/emplace_back(/*c*//*d*/0,/*e*/0/*f*//*g*/)/*h*/ ;
+
+  // Do not try to deal with initializer lists.
+  v1.push_back({0, 0});
+
+  // Do not try to deal with functional casts. FIXME?
+  X x{0, 0};
+  v1.push_back(X(x));
+  v1.push_back(X(0));
+
+  // Do not try to deal with weird expansions.
+#define M1 X(0, 0)
+#define M2 push_back
+  v1.push_back(M1);
+  v1.M2(X(0, 0));
+  v1.M2(M1);
+}
Index: clang-tidy/performance/PerformanceTidyModule.cpp
===
--- clang-tidy/performance/PerformanceTidyModule.cpp
+++ clang-tidy/performance/PerformanceTidyModule.cpp
@@ -11,6 +11,7 @@
 #include "../ClangTidyModule.h"
 #include "../ClangTidyModuleRegistry.h"
 
+#include "EmplaceCheck.h"
 #include "FasterStringFindCheck.h"
 #include "ForRangeCopyCheck.h"
 #include "ImplicitCastInLoopCheck.h"
@@ -24,6 +25,8 @@
 class PerformanceModule : public ClangTidyModule {
 public:
   void addCheckFactories(ClangTidyCheckFactories ) override {
+CheckFactories.registerCheck(
+"performance-emplace-into-containers");
 CheckFactories.registerCheck(
 "performance-faster-string-find");
 CheckFactories.registerCheck(
Index: clang-tidy/performance/EmplaceCheck.h
===
--- /dev/null
+++ clang-tidy/performance/EmplaceCheck.h
@@ -0,0 +1,30 @@
+//===--- EmplaceCheck.h - clang-tidy --===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_EMPLACE_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_EMPLACE_H
+
+#include "../ClangTidy.h"
+
+namespace clang {
+namespace tidy {
+namespace performance {
+
+class EmplaceCheck : public ClangTidyCheck {
+public:
+  EmplaceCheck(StringRef Name, ClangTidyContext *Context);
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+  void check(const ast_matchers::MatchFinder::MatchResult ) override;
+};
+
+} // namespace performance
+} // namespace tidy
+} // namespace clang
+
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_EMPLACE_H
Index: clang-tidy/performance/EmplaceCheck.cpp
===
--- /dev/null
+++ clang-tidy/performance/EmplaceCheck.cpp
@@ -0,0 +1,98 @@
+//===--- EmplaceCheck.cpp - clang-tidy ===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "EmplaceCheck.h"
+#include "clang/Lex/Lexer.h"
+
+namespace clang {
+namespace tidy {
+namespace performance {
+
+using namespace ast_matchers;
+

Re: [clang-tools-extra] r272188 - clang-rename: implement renaming of classes inside dynamic_cast

2016-06-09 Thread Miklos Vajna via cfe-commits
Hi Galina,

On Thu, Jun 09, 2016 at 10:15:27AM -0700, Galina Kistanova 
 wrote:
> This revision broke tests on one of builders:
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/14332

Please accept  if it's the correct fix.
It fixed the problem for me.

Regards,

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


[PATCH] D21187: Allow use of lambda expressions in array bounds

2016-06-09 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision.
ahatanak added a subscriber: cfe-commits.

clang currently errors out when a lambda expression is used to compute the size 
of an array even though clang supports variable-length arrays as a C99 
extension. For example,

$ cat vla1.cpp

```
int foo3();

struct S1 {
  virtual ~S1();
};

struct S2 : S1 {
};

void foo(S1 *s1) {
  unsigned char a1[([](int a) {return a; })(1)];
  unsigned char a2[foo3()]; // This is OK.
  unsigned char a3[!dynamic_cast(s1) + 1];  // This is OK.
}
```

$ clang++ vla1.cpp -c -std=c++11
vla1.cpp:11:21: error: a lambda expression may not appear inside of a constant 
expression
  unsigned char a1[([](int a) {return a; })(1)];
^
1 error generated.

To handle VLAs in a more consistent way, this patch makes changes to allow 
lambda expressions to be used for array bounds if it is in a BlockContext.

http://reviews.llvm.org/D21187

Files:
  include/clang/Parse/Parser.h
  include/clang/Sema/Sema.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseExpr.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaExpr.cpp
  test/SemaCXX/lambda-expressions.cpp

Index: test/SemaCXX/lambda-expressions.cpp
===
--- test/SemaCXX/lambda-expressions.cpp
+++ test/SemaCXX/lambda-expressions.cpp
@@ -499,3 +499,12 @@
   };
 }
 }
+
+namespace array_bound {
+void foo() {
+  int a0[([](){ return 4; })()];
+  int a2[([](int n){ return n; })(4)];
+}
+
+int a2[([](){ return 4; })()]; // expected-error {{a lambda expression may not appear inside of a constant expression}} expected-error {{variable length array declaration not allowed at file scope}}
+}
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -12791,10 +12791,10 @@
 void
 Sema::PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext,
   Decl *LambdaContextDecl,
-  bool IsDecltype) {
+  bool IsDecltype, bool IsArrayBound) {
   ExprEvalContexts.emplace_back(NewContext, ExprCleanupObjects.size(),
 ExprNeedsCleanups, LambdaContextDecl,
-IsDecltype);
+IsDecltype, IsArrayBound);
   ExprNeedsCleanups = false;
   if (!MaybeODRUseExprs.empty())
 std::swap(MaybeODRUseExprs, ExprEvalContexts.back().SavedMaybeODRUseExprs);
@@ -12814,21 +12814,22 @@
 
   if (!Rec.Lambdas.empty()) {
 if (Rec.isUnevaluated() || Rec.Context == ConstantEvaluated) {
-  unsigned D;
   if (Rec.isUnevaluated()) {
 // C++11 [expr.prim.lambda]p2:
 //   A lambda-expression shall not appear in an unevaluated operand
 //   (Clause 5).
-D = diag::err_lambda_unevaluated_operand;
-  } else {
+for (const auto *L : Rec.Lambdas)
+  Diag(L->getLocStart(), diag::err_lambda_unevaluated_operand);
+  // Don't error out on lambdas used to compute array size in a
+  // BlockContext.
+  } else if (!Rec.IsArrayBound) {
 // C++1y [expr.const]p2:
 //   A conditional-expression e is a core constant expression unless the
 //   evaluation of e, following the rules of the abstract machine, would
 //   evaluate [...] a lambda-expression.
-D = diag::err_lambda_in_constant_expression;
+for (const auto *L : Rec.Lambdas)
+  Diag(L->getLocStart(), diag::err_lambda_in_constant_expression);
   }
-  for (const auto *L : Rec.Lambdas)
-Diag(L->getLocStart(), D);
 } else {
   // Mark the capture expressions odr-used. This was deferred
   // during lambda expression creation.
Index: lib/Sema/Sema.cpp
===
--- lib/Sema/Sema.cpp
+++ lib/Sema/Sema.cpp
@@ -124,7 +124,8 @@
   // Tell diagnostics how to render things from the AST library.
   Diags.SetArgToStringFn(, );
 
-  ExprEvalContexts.emplace_back(PotentiallyEvaluated, 0, false, nullptr, false);
+  ExprEvalContexts.emplace_back(PotentiallyEvaluated, 0, false, nullptr, false,
+false);
 
   FunctionScopes.push_back(new FunctionScopeInfo(Diags));
 
Index: lib/Parse/ParseExpr.cpp
===
--- lib/Parse/ParseExpr.cpp
+++ lib/Parse/ParseExpr.cpp
@@ -194,13 +194,14 @@
 }
 
 
-ExprResult Parser::ParseConstantExpression(TypeCastState isTypeCast) {
+ExprResult Parser::ParseConstantExpression(TypeCastState isTypeCast,
+   bool IsArrayBound) {
   // C++03 [basic.def.odr]p2:
   //   An expression is potentially evaluated unless it appears where an
   //   integral constant expression is required (see 5.19) [...].
   // C++98 and C++11 have no such rule, but this is only a defect in C++98.
-  EnterExpressionEvaluationContext 

Re: [PATCH] D21162: [CUDA] Implement __shfl* intrinsics in clang headers.

2016-06-09 Thread Justin Lebar via cfe-commits
jlebar added a comment.

Thank you for the reviews, Justin!


http://reviews.llvm.org/D21162



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


Re: [clang-tools-extra] r272188 - clang-rename: implement renaming of classes inside dynamic_cast

2016-06-09 Thread Galina Kistanova via cfe-commits
Hi Miklos,

This revision broke tests on one of builders:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/14332

Please have a look at this?

Thanks

Galina


On Wed, Jun 8, 2016 at 11:38 AM, Miklos Vajna via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: vmiklos
> Date: Wed Jun  8 13:38:23 2016
> New Revision: 272188
>
> URL: http://llvm.org/viewvc/llvm-project?rev=272188=rev
> Log:
> clang-rename: implement renaming of classes inside dynamic_cast
>
> Refactor to do the same as what is done already for static_cast.
>
> Reviewers: klimek
>
> Differential Revision: http://reviews.llvm.org/D21120
>
> Added:
> clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
> Modified:
> clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
>
> Modified: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp?rev=272188=272187=272188=diff
>
> ==
> --- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp (original)
> +++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp Wed Jun  8
> 13:38:23 2016
> @@ -124,20 +124,11 @@ public:
>}
>
>bool VisitCXXStaticCastExpr(clang::CXXStaticCastExpr *Expr) {
> -clang::QualType Type = Expr->getType();
> -// See if this a cast of a pointer.
> -const RecordDecl* Decl = Type->getPointeeCXXRecordDecl();
> -if (!Decl) {
> -  // See if this is a cast of a reference.
> -  Decl = Type->getAsCXXRecordDecl();
> -}
> -
> -if (Decl && getUSRForDecl(Decl) == USR) {
> -  SourceLocation Location =
> Expr->getTypeInfoAsWritten()->getTypeLoc().getBeginLoc();
> -  LocationsFound.push_back(Location);
> -}
> +return handleCXXNamedCastExpr(Expr);
> +  }
>
> -return true;
> +  bool VisitCXXDynamicCastExpr(clang::CXXDynamicCastExpr *Expr) {
> +return handleCXXNamedCastExpr(Expr);
>}
>
>// Non-visitors:
> @@ -159,6 +150,23 @@ private:
>  }
>}
>
> +  bool handleCXXNamedCastExpr(clang::CXXNamedCastExpr *Expr) {
> +clang::QualType Type = Expr->getType();
> +// See if this a cast of a pointer.
> +const RecordDecl* Decl = Type->getPointeeCXXRecordDecl();
> +if (!Decl) {
> +  // See if this is a cast of a reference.
> +  Decl = Type->getAsCXXRecordDecl();
> +}
> +
> +if (Decl && getUSRForDecl(Decl) == USR) {
> +  SourceLocation Location =
> Expr->getTypeInfoAsWritten()->getTypeLoc().getBeginLoc();
> +  LocationsFound.push_back(Location);
> +}
> +
> +return true;
> +  }
> +
>// All the locations of the USR were found.
>const std::string USR;
>// Old name that is renamed.
>
> Added: clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp?rev=272188=auto
>
> ==
> --- clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp (added)
> +++ clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp Wed Jun
> 8 13:38:23 2016
> @@ -0,0 +1,25 @@
> +// RUN: cat %s > %t.cpp
> +// RUN: clang-rename -offset=186 -new-name=X %t.cpp -i --
> +// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
> +class Base {
> +  virtual int getValue() const = 0;
> +};
> +
> +class Derived : public Base {
> +public:
> +  int getValue() const {
> +return 0;
> +  }
> +};
> +
> +int main() {
> +  Derived D;
> +  const Base  = D;
> +  const Base *Pointer = 
> +
> +  dynamic_cast(Reference).getValue(); // CHECK:
> dynamic_cast
> +  dynamic_cast(Pointer)->getValue();  // CHECK:
> dynamic_cast
> +}
> +
> +// Use grep -FUbo 'Derived'  to get the correct offset of foo when
> changing
> +// this file.
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21162: [CUDA] Implement __shfl* intrinsics in clang headers.

2016-06-09 Thread Justin Lebar via cfe-commits
jlebar added a comment.

(Art, I would appreciate a second set of eyes on this one, as the last time I 
did this -- with ldg -- I messed up pretty badly.)


http://reviews.llvm.org/D21162



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


Re: [PATCH] D20498: [Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr

2016-06-09 Thread Tim Shen via cfe-commits
timshen marked an inline comment as done.
timshen added a comment.

Ping? :)


http://reviews.llvm.org/D20498



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


Re: [PATCH] D21163: Strip Android version when looking up toolchain paths.

2016-06-09 Thread Tim Northover via cfe-commits
t.p.northover added a subscriber: t.p.northover.
t.p.northover added a comment.

This could do with a test in test/Driver.


http://reviews.llvm.org/D21163



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


r272275 - [CMake] Fix an issue building out-of-tree introduced in r272200

2016-06-09 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Thu Jun  9 11:21:10 2016
New Revision: 272275

URL: http://llvm.org/viewvc/llvm-project?rev=272275=rev
Log:
[CMake] Fix an issue building out-of-tree introduced in r272200

The out-of-tree build needs to read LLVM_TOOLS_INSTALL_DIR out of 
TOOLS_BINARY_DIR because LLVM_TOOLS_INSTALL_DIR is used by AddLLVM.cmake

Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=272275=272274=272275=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Thu Jun  9 11:21:10 2016
@@ -56,6 +56,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
   list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR)
 
+  get_filename_component(LLVM_TOOLS_INSTALL_DIR ${TOOLS_BINARY_DIR} NAME)
+
   if(NOT MSVC_IDE)
 set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
   CACHE BOOL "Enable assertions")


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


Re: [PATCH] D18081: Make sizeof and alignof a CXCursor_UnaryExpr

2016-06-09 Thread Olivier Goffart via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272274: Make sizeof and alignof a CXCursor_UnaryExpr 
(authored by ogoffart).

Changed prior to commit:
  http://reviews.llvm.org/D18081?vs=50408=60187#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18081

Files:
  cfe/trunk/include/clang-c/Index.h
  cfe/trunk/test/Index/annotate-tokens.c
  cfe/trunk/tools/libclang/CXCursor.cpp

Index: cfe/trunk/tools/libclang/CXCursor.cpp
===
--- cfe/trunk/tools/libclang/CXCursor.cpp
+++ cfe/trunk/tools/libclang/CXCursor.cpp
@@ -256,7 +256,6 @@
   case Stmt::PredefinedExprClass:
   case Stmt::ShuffleVectorExprClass:
   case Stmt::ConvertVectorExprClass:
-  case Stmt::UnaryExprOrTypeTraitExprClass:
   case Stmt::VAArgExprClass:
   case Stmt::ObjCArrayLiteralClass:
   case Stmt::ObjCDictionaryLiteralClass:
@@ -327,6 +326,7 @@
 K = CXCursor_UnaryOperator;
 break;
 
+  case Stmt::UnaryExprOrTypeTraitExprClass:
   case Stmt::CXXNoexceptExprClass:
 K = CXCursor_UnaryExpr;
 break;
Index: cfe/trunk/include/clang-c/Index.h
===
--- cfe/trunk/include/clang-c/Index.h
+++ cfe/trunk/include/clang-c/Index.h
@@ -1932,7 +1932,7 @@
*/
   CXCursor_CXXDeleteExpr = 135,
 
-  /** \brief A unary expression.
+  /** \brief A unary expression. (noexcept, sizeof, or other traits)
*/
   CXCursor_UnaryExpr = 136,
 
Index: cfe/trunk/test/Index/annotate-tokens.c
===
--- cfe/trunk/test/Index/annotate-tokens.c
+++ cfe/trunk/test/Index/annotate-tokens.c
@@ -80,10 +80,10 @@
 // CHECK: Punctuation: "(" [5:3 - 5:4] CStyleCastExpr=
 // CHECK: Keyword: "void" [5:4 - 5:8] CStyleCastExpr=
 // CHECK: Punctuation: ")" [5:8 - 5:9] CStyleCastExpr=
-// CHECK: Keyword: "sizeof" [5:9 - 5:15] UnexposedExpr=
-// CHECK: Punctuation: "(" [5:15 - 5:16] UnexposedExpr=
+// CHECK: Keyword: "sizeof" [5:9 - 5:15] UnaryExpr=
+// CHECK: Punctuation: "(" [5:15 - 5:16] UnaryExpr=
 // CHECK: Identifier: "T" [5:16 - 5:17] TypeRef=T:1:13
-// CHECK: Punctuation: ")" [5:17 - 5:18] UnexposedExpr=
+// CHECK: Punctuation: ")" [5:17 - 5:18] UnaryExpr=
 // CHECK: Punctuation: ";" [5:18 - 5:19] CompoundStmt=
 // CHECK: Keyword: "struct" [7:3 - 7:9] VarDecl=x:7:12 (Definition)
 // CHECK: Identifier: "X" [7:10 - 7:11] TypeRef=struct X:2:8


Index: cfe/trunk/tools/libclang/CXCursor.cpp
===
--- cfe/trunk/tools/libclang/CXCursor.cpp
+++ cfe/trunk/tools/libclang/CXCursor.cpp
@@ -256,7 +256,6 @@
   case Stmt::PredefinedExprClass:
   case Stmt::ShuffleVectorExprClass:
   case Stmt::ConvertVectorExprClass:
-  case Stmt::UnaryExprOrTypeTraitExprClass:
   case Stmt::VAArgExprClass:
   case Stmt::ObjCArrayLiteralClass:
   case Stmt::ObjCDictionaryLiteralClass:
@@ -327,6 +326,7 @@
 K = CXCursor_UnaryOperator;
 break;
 
+  case Stmt::UnaryExprOrTypeTraitExprClass:
   case Stmt::CXXNoexceptExprClass:
 K = CXCursor_UnaryExpr;
 break;
Index: cfe/trunk/include/clang-c/Index.h
===
--- cfe/trunk/include/clang-c/Index.h
+++ cfe/trunk/include/clang-c/Index.h
@@ -1932,7 +1932,7 @@
*/
   CXCursor_CXXDeleteExpr = 135,
 
-  /** \brief A unary expression.
+  /** \brief A unary expression. (noexcept, sizeof, or other traits)
*/
   CXCursor_UnaryExpr = 136,
 
Index: cfe/trunk/test/Index/annotate-tokens.c
===
--- cfe/trunk/test/Index/annotate-tokens.c
+++ cfe/trunk/test/Index/annotate-tokens.c
@@ -80,10 +80,10 @@
 // CHECK: Punctuation: "(" [5:3 - 5:4] CStyleCastExpr=
 // CHECK: Keyword: "void" [5:4 - 5:8] CStyleCastExpr=
 // CHECK: Punctuation: ")" [5:8 - 5:9] CStyleCastExpr=
-// CHECK: Keyword: "sizeof" [5:9 - 5:15] UnexposedExpr=
-// CHECK: Punctuation: "(" [5:15 - 5:16] UnexposedExpr=
+// CHECK: Keyword: "sizeof" [5:9 - 5:15] UnaryExpr=
+// CHECK: Punctuation: "(" [5:15 - 5:16] UnaryExpr=
 // CHECK: Identifier: "T" [5:16 - 5:17] TypeRef=T:1:13
-// CHECK: Punctuation: ")" [5:17 - 5:18] UnexposedExpr=
+// CHECK: Punctuation: ")" [5:17 - 5:18] UnaryExpr=
 // CHECK: Punctuation: ";" [5:18 - 5:19] CompoundStmt=
 // CHECK: Keyword: "struct" [7:3 - 7:9] VarDecl=x:7:12 (Definition)
 // CHECK: Identifier: "X" [7:10 - 7:11] TypeRef=struct X:2:8
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >