r253900 - clang-format: Re-add code path deleted in r253873 and add missing test.

2015-11-23 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Nov 23 13:11:45 2015
New Revision: 253900

URL: http://llvm.org/viewvc/llvm-project?rev=253900=rev
Log:
clang-format: Re-add code path deleted in r253873 and add missing test.

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

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=253900=253899=253900=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Nov 23 13:11:45 2015
@@ -1068,6 +1068,15 @@ private:
 
 FormatToken *LeftOfParens = Tok.MatchingParen->getPreviousNonComment();
 if (LeftOfParens) {
+  // If there is an opening parenthesis left of the current parentheses,
+  // look past it as these might be chained casts.
+  if (LeftOfParens->is(tok::r_paren)) {
+if (!LeftOfParens->MatchingParen ||
+!LeftOfParens->MatchingParen->Previous)
+  return false;
+LeftOfParens = LeftOfParens->MatchingParen->Previous;
+  }
+
   // If there is an identifier (or with a few exceptions a keyword) right
   // before the parentheses, this is unlikely to be a cast.
   if (LeftOfParens->Tok.getIdentifierInfo() &&

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=253900=253899=253900=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Nov 23 13:11:45 2015
@@ -5793,6 +5793,7 @@ TEST_F(FormatTest, FormatsCasts) {
   verifyFormat("int a = sizeof(int *) + b;");
   verifyFormat("int a = alignof(int *) + b;", getGoogleStyle());
   verifyFormat("bool b = f(g) && c;");
+  verifyFormat("typedef void (*f)(int i) func;");
 
   verifyFormat(" *foo = (a 
*)\n"
"bbb;");


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


Re: [PATCH] D13731: [Analyzer] Supporting function attributes in .model files.

2015-11-23 Thread pierre gousseau via cfe-commits
pgousseau added a comment.

Ping!


http://reviews.llvm.org/D13731



___
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

2015-11-23 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated restarted after 7 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


r253909 - Make clang_Cursor_getMangling not mangle if the declaration isn't mangled

2015-11-23 Thread Ehsan Akhgari via cfe-commits
Author: ehsan
Date: Mon Nov 23 13:56:46 2015
New Revision: 253909

URL: http://llvm.org/viewvc/llvm-project?rev=253909=rev
Log:
Make clang_Cursor_getMangling not mangle if the declaration isn't mangled

Right now clang_Cursor_getMangling will attempt to mangle any
declaration, even if the declaration isn't mangled (extern C).  This
results in a partially mangled name which isn't useful for much. This
patch makes clang_Cursor_getMangling return an empty string if the
declaration isn't mangled.

Patch by Michael Wu .

Added:
cfe/trunk/test/Index/symbol-visibility.c
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/tools/c-index-test/c-index-test.c
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/libclang.exports

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=253909=253908=253909=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Mon Nov 23 13:56:46 2015
@@ -2461,6 +2461,32 @@ enum CXLinkageKind {
 CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor);
 
 /**
+ * \brief Describe the visibility of the entity referred to by a cursor.
+ *
+ * This returns the default visibility if not explicitly specified by
+ * a visibility attribute. The default visibility may be changed by
+ * commandline arguments.
+ *
+ * \param cursor The cursor to query.
+ *
+ * \returns The visibility of the cursor.
+ */
+enum CXVisibilityKind {
+  /** \brief This value indicates that no visibility information is available
+   * for a provided CXCursor. */
+  CXVisibility_Invalid,
+
+  /** \brief Symbol not seen by the linker. */
+  CXVisibility_Hidden,
+  /** \brief Symbol seen by the linker but resolves to a symbol inside this 
object. */
+  CXVisibility_Protected,
+  /** \brief Symbol seen by the linker and acts like a normal symbol. */
+  CXVisibility_Default,
+};
+
+CINDEX_LINKAGE enum CXVisibilityKind clang_getCursorVisibility(CXCursor 
cursor);
+
+/**
  * \brief Determine the availability of the entity that this cursor refers to,
  * taking the current target platform into account.
  *

Added: cfe/trunk/test/Index/symbol-visibility.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/symbol-visibility.c?rev=253909=auto
==
--- cfe/trunk/test/Index/symbol-visibility.c (added)
+++ cfe/trunk/test/Index/symbol-visibility.c Mon Nov 23 13:56:46 2015
@@ -0,0 +1,7 @@
+// RUN: c-index-test -test-print-visibility %s | FileCheck %s
+
+__attribute__ ((visibility ("default"))) void foo1();
+__attribute__ ((visibility ("hidden"))) void foo2();
+
+// CHECK: FunctionDecl=foo1:3:47visibility=Default
+// CHECK: FunctionDecl=foo2:4:46visibility=Hidden

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=253909=253908=253909=diff
==
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Mon Nov 23 13:56:46 2015
@@ -1248,6 +1248,32 @@ static enum CXChildVisitResult PrintLink
 }
 
 
/**/
+/* Visibility testing.
*/
+/**/
+
+static enum CXChildVisitResult PrintVisibility(CXCursor cursor, CXCursor p,
+   CXClientData d) {
+  const char *visibility = 0;
+
+  if (clang_isInvalid(clang_getCursorKind(cursor)))
+return CXChildVisit_Recurse;
+
+  switch (clang_getCursorVisibility(cursor)) {
+case CXVisibility_Invalid: break;
+case CXVisibility_Hidden: visibility = "Hidden"; break;
+case CXVisibility_Protected: visibility = "Protected"; break;
+case CXVisibility_Default: visibility = "Default"; break;
+  }
+
+  if (visibility) {
+PrintCursor(cursor, NULL);
+printf("visibility=%s\n", visibility);
+  }
+
+  return CXChildVisit_Recurse;
+}
+
+/**/
 /* Typekind testing.  
*/
 
/**/
 
@@ -4084,6 +4110,7 @@ static void print_usage(void) {
 "   c-index-test -test-inclusion-stack-tu \n");
   fprintf(stderr,
 "   c-index-test -test-print-linkage-source {}*\n"
+"   c-index-test -test-print-visibility {}*\n"
 "   c-index-test -test-print-type {}*\n"
 "   c-index-test -test-print-type-size {}*\n"
 "   c-index-test -test-print-bitwidth {}*\n"
@@ -4171,6 +4198,9 @@ int 

Re: [PATCH] D13388: Add support for querying the visibility of a cursor

2015-11-23 Thread Ehsan Akhgari via cfe-commits
ehsan accepted this revision.
ehsan added a reviewer: ehsan.
ehsan added a comment.

Landed in r253909.


http://reviews.llvm.org/D13388



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


Re: [PATCH] D14286: ASTImporter: expressions, pt.1

2015-11-23 Thread Serge Pavlov via cfe-commits
sepavloff added a comment.

Unit test, of course, checks import facility but i would say this is overkill. 
You need to create tests for all nodes you implement in imported, this is huge 
amount of work.

I would propose you to move tests from http://reviews.llvm.org/D14224 for nodes 
that are implemented there, for remaining nodes create short functions, that 
have respective node in the body, similar to what is done in 
http://reviews.llvm.org/D14224. Such test checks that the node is handled in 
Importer. For regression test it must be enough. More rigorous check must can 
be done in runtime, or in constexpr function, for some nodes. Unfortunately it 
looks like constexpr attribute is not preserved correctly by the importer 
class, so we have no choice here.


http://reviews.llvm.org/D14286



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


Re: r253859 - Fix calculation of shifted cursor/code positions. Specifically support

2015-11-23 Thread Renato Golin via cfe-commits
On 23 November 2015 at 10:41, Daniel Jasper  wrote:
> Seen and fixed, I think..

Still looks broken... :)

http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/7684

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/2616

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/3517

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


Re: [PATCH] D13336: [MSVC] 'property' with an empty array in array subscript expression.

2015-11-23 Thread Alexey Bataev via cfe-commits
ABataev updated this revision to Diff 40901.
ABataev marked an inline comment as done.

http://reviews.llvm.org/D13336

Files:
  include/clang/AST/DataRecursiveASTVisitor.h
  include/clang/AST/ExprCXX.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/StmtNodes.td
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/Expr.cpp
  lib/AST/ExprClassification.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/CodeGenCXX/ms-property.cpp
  test/SemaCXX/ms-property-error.cpp
  test/SemaCXX/ms-property.cpp
  tools/libclang/CXCursor.cpp

Index: lib/Serialization/ASTWriterStmt.cpp
===
--- lib/Serialization/ASTWriterStmt.cpp
+++ lib/Serialization/ASTWriterStmt.cpp
@@ -1689,6 +1689,14 @@
   Code = serialization::EXPR_CXX_PROPERTY_REF_EXPR;
 }
 
+void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
+  VisitExpr(E);
+  Writer.AddStmt(E->getBase());
+  Writer.AddStmt(E->getIdx());
+  Writer.AddSourceLocation(E->getRBracketLoc(), Record);
+  Code = serialization::EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR;
+}
+
 void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
   VisitExpr(E);
   Writer.AddSourceRange(E->getSourceRange(), Record);
Index: lib/Serialization/ASTReaderStmt.cpp
===
--- lib/Serialization/ASTReaderStmt.cpp
+++ lib/Serialization/ASTReaderStmt.cpp
@@ -1662,6 +1662,13 @@
   E->TheDecl = ReadDeclAs(Record, Idx);
 }
 
+void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
+  VisitExpr(E);
+  E->setBase(Reader.ReadSubExpr());
+  E->setIdx(Reader.ReadSubExpr());
+  E->setRBracketLoc(ReadSourceLocation(Record, Idx));
+}
+
 void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
   VisitExpr(E);
   E->setSourceRange(ReadSourceRange(Record, Idx));
@@ -3078,6 +3085,9 @@
 case EXPR_CXX_PROPERTY_REF_EXPR:
   S = new (Context) MSPropertyRefExpr(Empty);
   break;
+case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR:
+  S = new (Context) MSPropertySubscriptExpr(Empty);
+  break;
 case EXPR_CXX_UUIDOF_TYPE:
   S = new (Context) CXXUuidofExpr(Empty, false);
   break;
Index: lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -755,6 +755,7 @@
 case Stmt::CXXUuidofExprClass:
 case Stmt::CXXFoldExprClass:
 case Stmt::MSPropertyRefExprClass:
+case Stmt::MSPropertySubscriptExprClass:
 case Stmt::CXXUnresolvedConstructExprClass:
 case Stmt::DependentScopeDeclRefExprClass:
 case Stmt::ArrayTypeTraitExprClass:
Index: lib/AST/Expr.cpp
===
--- lib/AST/Expr.cpp
+++ lib/AST/Expr.cpp
@@ -3004,6 +3004,7 @@
 return true;
 
   case MSPropertyRefExprClass:
+  case MSPropertySubscriptExprClass:
   case CompoundAssignOperatorClass:
   case VAArgExprClass:
   case AtomicExprClass:
Index: lib/AST/StmtProfile.cpp
===
--- lib/AST/StmtProfile.cpp
+++ lib/AST/StmtProfile.cpp
@@ -1126,6 +1126,11 @@
   VisitDecl(S->getPropertyDecl());
 }
 
+void StmtProfiler::VisitMSPropertySubscriptExpr(
+const MSPropertySubscriptExpr *S) {
+  VisitExpr(S);
+}
+
 void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) {
   VisitExpr(S);
   ID.AddBoolean(S->isImplicit());
Index: lib/AST/StmtPrinter.cpp
===
--- lib/AST/StmtPrinter.cpp
+++ lib/AST/StmtPrinter.cpp
@@ -1732,6 +1732,13 @@
   OS << Node->getPropertyDecl()->getDeclName();
 }
 
+void StmtPrinter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *Node) {
+  PrintExpr(Node->getBase());
+  OS << "[";
+  PrintExpr(Node->getIdx());
+  OS << "]";
+}
+
 void StmtPrinter::VisitUserDefinedLiteral(UserDefinedLiteral *Node) {
   switch (Node->getLiteralOperatorKind()) {
   case UserDefinedLiteral::LOK_Raw:
Index: lib/AST/ItaniumMangle.cpp
===
--- lib/AST/ItaniumMangle.cpp
+++ lib/AST/ItaniumMangle.cpp
@@ -2811,6 +2811,7 @@
   case Expr::ParenListExprClass:
   case Expr::LambdaExprClass:
   case Expr::MSPropertyRefExprClass:
+  case Expr::MSPropertySubscriptExprClass:
   case Expr::TypoExprClass:  // This should no longer exist in the AST by now.
   case Expr::OMPArraySectionExprClass:
 llvm_unreachable("unexpected statement kind");
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ 

Re: [PATCH] D13336: [MSVC] 'property' with an empty array in array subscript expression.

2015-11-23 Thread Alexey Bataev via cfe-commits
ABataev marked an inline comment as done.


Comment at: lib/Sema/SemaPseudoObject.cpp:1627
@@ -1579,1 +1626,3 @@
+cast(Base->IgnoreParens())->getBaseExpr());
+return MSPropertyRefRebuilder(S, BaseOVE->getSourceExpr()).rebuild(E);
   } else {

rjmccall wrote:
> Hmm.  Just like the ObjCSubscriptRefExpr case, this will need to strip the 
> OVEs off the index expressions, or else you'll end up stacking OVEs and 
> asserting in IRGen.
> 
> The deeper problem here is that we have too much redundancy in all these 
> places that have to walk over the different pseudo-object expressions.  We 
> can remove some of that by simplifying the design of Rebuilder, which is 
> really over-engineered for its task.  It should be fine to make it 
> non-templated, merge all of the rebuildSpecific cases into it (and therefore 
> remove all of the subclasses), and give it a callback to invoke at all the 
> capture points in source order.
> 
> I think the callback can just be a llvm::function_ref unsigned)>.  The second parameter is the position of the capture point in 
> source order, so for example in your case the base of the MSPropertyRefExpr 
> will be 0, the index of the innermost MSPropertySubscriptExpr will be 1, and 
> so on.  That'll be important for callers that care about which capture point 
> is which.
> 
> The various rebuildAndCaptureObject implementations should use a callback 
> that returns the appropriate captured expression for the position.
> 
> stripOpaqueValuesFromPseudoObjectRef should use a callback that returns 
> cast(e)->getSourceExpr(); it shouldn't need to split out the 
> different cases at all.
John, we don't need to strip the OVEs off the index expressions, because index 
expressions in MSPropertySubscriptExpr are not folded to OVEs. They are folded 
to OVEs only for CallArgs array. But in rebuilded MSPropertySubscriptExpr only 
base MSPropertyRefExpr is folded to OVE (we don't need to put indexes in 
MSPropertySubscriptExpr, because they are not used during codegen and we can 
keep original expressions). So, the code should work as is.
I reworked Rebuilder just like you said.



http://reviews.llvm.org/D13336



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


Re: [PATCH] D14864: [X86] Support for C calling convention only for MCU target.

2015-11-23 Thread Alexey Bataev via cfe-commits
ABataev added a comment.

Ok, extracted all MCU specific changes to separate target class.


http://reviews.llvm.org/D14864



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


r253863 - [OpenCL 2.0] Apply default address space (AS).

2015-11-23 Thread Anastasia Stulova via cfe-commits
Author: stulova
Date: Mon Nov 23 05:14:44 2015
New Revision: 253863

URL: http://llvm.org/viewvc/llvm-project?rev=253863=rev
Log:
[OpenCL 2.0] Apply default address space (AS).

If AS of a variable/parameter declaration is not set by the source,
OpenCL v2.0 s6.5 defines explicit rules for default ASes:

- The AS of global and local static variables defaults to global;
- All pointers point to generic AS.

http://reviews.llvm.org/D13168


Modified:
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/CodeGenOpenCL/address-spaces.cl
cfe/trunk/test/SemaOpenCL/storageclass-cl20.cl

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=253863=253862=253863=diff
==
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Mon Nov 23 05:14:44 2015
@@ -1564,8 +1564,7 @@ static QualType ConvertDeclSpecToType(Ty
   // Apply any type attributes from the decl spec.  This may cause the
   // list of type attributes to be temporarily saved while the type
   // attributes are pushed around.
-  if (AttributeList *attrs = DS.getAttributes().getList())
-processTypeAttrs(state, Result, TAL_DeclSpec, attrs);
+  processTypeAttrs(state, Result, TAL_DeclSpec, DS.getAttributes().getList());
 
   // Apply const/volatile/restrict qualifiers to T.
   if (unsigned TypeQuals = DS.getTypeQualifiers()) {
@@ -2596,8 +2595,8 @@ static QualType GetDeclSpecTypeForDeclar
 // Constructors and destructors don't have return types. Use
 // "void" instead.
 T = SemaRef.Context.VoidTy;
-if (AttributeList *attrs = D.getDeclSpec().getAttributes().getList())
-  processTypeAttrs(state, T, TAL_DeclSpec, attrs);
+processTypeAttrs(state, T, TAL_DeclSpec,
+ D.getDeclSpec().getAttributes().getList());
 break;
 
   case UnqualifiedId::IK_ConversionFunctionId:
@@ -4112,8 +4111,8 @@ static TypeSourceInfo *GetFullTypeForDec
 }
 
 // See if there are any attributes on this declarator chunk.
-if (AttributeList *attrs = const_cast(DeclType.getAttrs()))
-  processTypeAttrs(state, T, TAL_DeclChunk, attrs);
+processTypeAttrs(state, T, TAL_DeclChunk,
+ const_cast(DeclType.getAttrs()));
   }
 
   assert(!T.isNull() && "T must not be null after this point");
@@ -4206,8 +4205,7 @@ static TypeSourceInfo *GetFullTypeForDec
   }
 
   // Apply any undistributed attributes from the declarator.
-  if (AttributeList *attrs = D.getAttributes())
-processTypeAttrs(state, T, TAL_DeclName, attrs);
+  processTypeAttrs(state, T, TAL_DeclName, D.getAttributes());
 
   // Diagnose any ignored type attributes.
   state.diagnoseIgnoredTypeAttrs(T);
@@ -6176,10 +6174,11 @@ static void processTypeAttrs(TypeProcess
   // type, but others can be present in the type specifiers even though they
   // apply to the decl.  Here we apply type attributes and ignore the rest.
 
-  AttributeList *next;
-  do {
+  bool hasOpenCLAddressSpace = false;
+  while (attrs) {
 AttributeList  = *attrs;
-next = attr.getNext();
+attrs = attr.getNext(); // reset to the next here due to early loop 
continue
+// stmts
 
 // Skip attributes that were marked to be invalid.
 if (attr.isInvalid())
@@ -6238,6 +6237,7 @@ static void processTypeAttrs(TypeProcess
 case AttributeList::AT_AddressSpace:
   HandleAddressSpaceTypeAttribute(type, attr, state.getSema());
   attr.setUsedAsTypeAttr();
+  hasOpenCLAddressSpace = true;
   break;
 OBJC_POINTER_TYPE_ATTRS_CASELIST:
   if (!handleObjCPointerTypeAttr(state, attr, type))
@@ -6332,7 +6332,39 @@ static void processTypeAttrs(TypeProcess
 distributeFunctionTypeAttr(state, attr, type);
   break;
 }
-  } while ((attrs = next));
+  }
+
+  // If address space is not set, OpenCL 2.0 defines non private default
+  // address spaces for some cases:
+  // OpenCL 2.0, section 6.5:
+  // The address space for a variable at program scope or a static variable
+  // inside a function can either be __global or __constant, but defaults to
+  // __global if not specified.
+  // (...)
+  // Pointers that are declared without pointing to a named address space point
+  // to the generic address space.
+  if (state.getSema().getLangOpts().OpenCLVersion >= 200 &&
+  !hasOpenCLAddressSpace && type.getAddressSpace() == 0 &&
+  (TAL == TAL_DeclSpec || TAL == TAL_DeclChunk)) {
+Declarator  = state.getDeclarator();
+if (state.getCurrentChunkIndex() > 0 &&
+D.getTypeObject(state.getCurrentChunkIndex() - 1).Kind ==
+DeclaratorChunk::Pointer) {
+  type = state.getSema().Context.getAddrSpaceQualType(
+  type, LangAS::opencl_generic);
+} else if (state.getCurrentChunkIndex() == 0 &&
+   D.getContext() == Declarator::FileContext &&
+   !D.isFunctionDeclarator() 

RE: [Patch][OpenCL] Custom atomic Builtin check ignores address space of a non-atomic pointer

2015-11-23 Thread Anastasia Stulova via cfe-commits
Ping! Re-attaching the final patch.

-Original Message-
From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of 
Anastasia Stulova via cfe-commits
Sent: 21 October 2015 11:49
To: 'Pekka Jääskeläinen'; cfe-commits@lists.llvm.org
Subject: RE: [Patch][OpenCL] Custom atomic Builtin check ignores address space 
of a non-atomic pointer

Hi Pekka,

Are you ok with this change?

Thanks,
Anastasia

-Original Message-
From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of 
Anastasia Stulova via cfe-commits
Sent: 12 October 2015 16:00
To: 'Pekka Jääskeläinen'; cfe-commits@lists.llvm.org
Subject: RE: [Patch][OpenCL] Custom atomic Builtin check ignores address space 
of a non-atomic pointer

I have just made one minor update in the CodeGen test 
(test/CodeGen/atomic-ops.c) that is now checking the IR output rather than only 
making sure frontend doesn't crash.

The final patch is attached here!

Thanks,
Anastasia
 

-Original Message-
From: Pekka Jääskeläinen [mailto:pekka.jaaskelai...@tut.fi]
Sent: 02 October 2015 10:20
To: Anastasia Stulova; cfe-commits@lists.llvm.org
Subject: Re: [Patch][OpenCL] Custom atomic Builtin check ignores address space 
of a non-atomic pointer

LGTM.

Related to it:
There has been so many getPointerTo() issues with multi-AS in the past that I 
wonder if it'd be time to drop the default value from it, and go through all 
the places where it's called with the default AS, thus breaking multi-AS.  
Might be a worthwhile job to do at some point.

On 09/30/2015 01:23 PM, Anastasia Stulova via cfe-commits wrote:
> Hi all,
>
> Address spaces are not handled in custom semantic checks of atomic Builtins.
>
> If there are two pointers passed to the Builtin, it doesn't allow the 
> second
>
> (non-atomic) one to be qualified with an address space.
>
> This patch removed this restriction by recording the address space of 
> the
>
> passed pointers while checking its type correctness.
>
> Currently, the following code:
>
> _Atomic int __attribute__((address_space(1))) *A;
>
> int __attribute__((address_space(2))) *B;
>
> ...
>
> ... = __c11_atomic_compare_exchange_strong(A, B, 1, 
> memory_order_seq_cst, memory_order_seq_cst);
>
> fails to compile with an error:
>
> "passing '__attribute__((address_space(2))) int *' to parameter of 
> type 'int *' changes address space of pointer".
>
> Please, review the attached fix for it!
>
> Cheers,
>
> Anastasia
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>

--
Pekka



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


atomics-builtin-adrspace-v2.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253859 - Fix calculation of shifted cursor/code positions. Specifically support

2015-11-23 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Nov 23 02:33:48 2015
New Revision: 253859

URL: http://llvm.org/viewvc/llvm-project?rev=253859=rev
Log:
Fix calculation of shifted cursor/code positions. Specifically support
the case where a specific range is replaced by new text. Previously,
the calculation would shift any position from within a replaced region
to the first character after the region. This is undersirable, e.g. for
clang-format's include sorting.

Modified:
cfe/trunk/lib/Tooling/Core/Replacement.cpp
cfe/trunk/unittests/Tooling/RefactoringTest.cpp

Modified: cfe/trunk/lib/Tooling/Core/Replacement.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/Replacement.cpp?rev=253859=253858=253859=diff
==
--- cfe/trunk/lib/Tooling/Core/Replacement.cpp (original)
+++ cfe/trunk/lib/Tooling/Core/Replacement.cpp Mon Nov 23 02:33:48 2015
@@ -143,34 +143,32 @@ void Replacement::setFromSourceRange(con
 ReplacementText);
 }
 
-unsigned shiftedCodePosition(const Replacements , unsigned Position) {
-  unsigned NewPosition = Position;
-  for (Replacements::iterator I = Replaces.begin(), E = Replaces.end(); I != E;
-   ++I) {
-if (I->getOffset() >= Position)
-  break;
-if (I->getOffset() + I->getLength() > Position)
-  NewPosition += I->getOffset() + I->getLength() - Position;
-NewPosition += I->getReplacementText().size() - I->getLength();
+template 
+unsigned shiftedCodePositionInternal(const T , unsigned Position) {
+  unsigned Offset = 0;
+  for (const auto& R : Replaces) {
+if (R.getOffset() + R.getLength() <= Position) {
+  Offset += R.getReplacementText().size() - R.getLength();
+  continue;
+}
+if (R.getOffset() < Position &&
+R.getOffset() + R.getReplacementText().size() <= Position) {
+  Position = R.getOffset() + R.getReplacementText().size() - 1;
+}
+break;
   }
-  return NewPosition;
+  return Position + Offset;
+}
+
+unsigned shiftedCodePosition(const Replacements , unsigned Position) {
+  return shiftedCodePositionInternal(Replaces, Position);
 }
 
 // FIXME: Remove this function when Replacements is implemented as std::vector
 // instead of std::set.
 unsigned shiftedCodePosition(const std::vector ,
  unsigned Position) {
-  unsigned NewPosition = Position;
-  for (std::vector::const_iterator I = Replaces.begin(),
-E = Replaces.end();
-   I != E; ++I) {
-if (I->getOffset() >= Position)
-  break;
-if (I->getOffset() + I->getLength() > Position)
-  NewPosition += I->getOffset() + I->getLength() - Position;
-NewPosition += I->getReplacementText().size() - I->getLength();
-  }
-  return NewPosition;
+  return shiftedCodePositionInternal(Replaces, Position);
 }
 
 void deduplicate(std::vector ,

Modified: cfe/trunk/unittests/Tooling/RefactoringTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/RefactoringTest.cpp?rev=253859=253858=253859=diff
==
--- cfe/trunk/unittests/Tooling/RefactoringTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/RefactoringTest.cpp Mon Nov 23 02:33:48 2015
@@ -176,8 +176,8 @@ TEST(ShiftedCodePositionTest, FindsNewCo
   EXPECT_EQ(1u, shiftedCodePosition(Replaces, 2)); //  i|t   i;
   EXPECT_EQ(2u, shiftedCodePosition(Replaces, 3)); //  in|   i;
   EXPECT_EQ(3u, shiftedCodePosition(Replaces, 4)); //  int|  i;
-  EXPECT_EQ(4u, shiftedCodePosition(Replaces, 5)); //  int | i;
-  EXPECT_EQ(4u, shiftedCodePosition(Replaces, 6)); //  int  |i;
+  EXPECT_EQ(3u, shiftedCodePosition(Replaces, 5)); //  int | i;
+  EXPECT_EQ(3u, shiftedCodePosition(Replaces, 6)); //  int  |i;
   EXPECT_EQ(4u, shiftedCodePosition(Replaces, 7)); //  int   |;
   EXPECT_EQ(5u, shiftedCodePosition(Replaces, 8)); //  int   i|
 }
@@ -195,8 +195,8 @@ TEST(ShiftedCodePositionTest, VectorFind
   EXPECT_EQ(1u, shiftedCodePosition(Replaces, 2)); //  i|t   i;
   EXPECT_EQ(2u, shiftedCodePosition(Replaces, 3)); //  in|   i;
   EXPECT_EQ(3u, shiftedCodePosition(Replaces, 4)); //  int|  i;
-  EXPECT_EQ(4u, shiftedCodePosition(Replaces, 5)); //  int | i;
-  EXPECT_EQ(4u, shiftedCodePosition(Replaces, 6)); //  int  |i;
+  EXPECT_EQ(3u, shiftedCodePosition(Replaces, 5)); //  int | i;
+  EXPECT_EQ(3u, shiftedCodePosition(Replaces, 6)); //  int  |i;
   EXPECT_EQ(4u, shiftedCodePosition(Replaces, 7)); //  int   |;
   EXPECT_EQ(5u, shiftedCodePosition(Replaces, 8)); //  int   i|
 }
@@ -205,8 +205,17 @@ TEST(ShiftedCodePositionTest, FindsNewCo
   Replacements Replaces;
   Replaces.insert(Replacement("", 4, 0, "\"\n\""));
   // Assume '"12345678"' is turned into '"1234"\n"5678"'.
-  EXPECT_EQ(4u, shiftedCodePosition(Replaces, 4)); // "123|5678"
-  EXPECT_EQ(8u, shiftedCodePosition(Replaces, 5)); // "1234|678"
+  EXPECT_EQ(3u, shiftedCodePosition(Replaces, 3)); 

Re: [PATCH] D14441: [OpenCL] Pipe types support.

2015-11-23 Thread Anastasia Stulova via cfe-commits
Anastasia added a subscriber: Anastasia.


Comment at: include/clang/AST/Type.h:5018
@@ +5017,3 @@
+/// PipeType - OpenCL20.
+///
+class PipeType : public Type, public llvm::FoldingSetNode {

Any reason for an empty comment line here?


Comment at: lib/AST/ASTContext.cpp:1848
@@ -1841,1 +1847,3 @@
+  }
+  break;
 

Break not needed?


Comment at: lib/AST/ItaniumMangle.cpp:2673
@@ +2672,3 @@
+void CXXNameMangler::mangleType(const PipeType *T) {
+  // Pipe type mangling rules are described in SPIR 2.0 specification.
+  //  ::= 8ocl_pipe

May be a reference to a section in the spec?


Comment at: lib/CodeGen/CGDebugInfo.cpp:2005
@@ +2004,3 @@
+ llvm::DIFile *U) {
+  // Ignore the atomic wrapping
+  // FIXME: What is the correct representation?

what does "atomic wrapping" mean here?


Comment at: lib/CodeGen/CGDebugInfo.cpp:2006
@@ +2005,3 @@
+  // Ignore the atomic wrapping
+  // FIXME: What is the correct representation?
+  return getOrCreateType(Ty->getElementType(), U);

Also I don't get this comment. But I see that it's copied from atomic.


Comment at: lib/Sema/SemaType.cpp:1941
@@ +1940,3 @@
+///
+/// \param Loc The location of the entity whose type involves this pointer type
+/// or, if there is no such entity, the location of the type that will have

Is "pointer type" correct here?


Comment at: lib/Sema/SemaType.cpp:4146
@@ +4145,3 @@
+  break;
+}
+

Why this brace here?


http://reviews.llvm.org/D14441



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


r253861 - Fix clang-format test. I believe that the new behavior is better.

2015-11-23 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Nov 23 02:50:52 2015
New Revision: 253861

URL: http://llvm.org/viewvc/llvm-project?rev=253861=rev
Log:
Fix clang-format test. I believe that the new behavior is better.

Modified:
cfe/trunk/test/Format/cursor.cpp

Modified: cfe/trunk/test/Format/cursor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/cursor.cpp?rev=253861=253860=253861=diff
==
--- cfe/trunk/test/Format/cursor.cpp (original)
+++ cfe/trunk/test/Format/cursor.cpp Mon Nov 23 02:50:52 2015
@@ -1,5 +1,5 @@
 // RUN: grep -Ev "// *[A-Z-]+:" %s | clang-format -style=LLVM -cursor=6 \
 // RUN:   | FileCheck -strict-whitespace %s
-// CHECK: {{^\{ "Cursor": 4, }}
+// CHECK: {{^\{ "Cursor": 3, }}
 // CHECK: {{^int\ \i;$}}
  inti;


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


Re: [PATCH] D14864: [X86] Support for C calling convention only for MCU target.

2015-11-23 Thread Alexey Bataev via cfe-commits
ABataev updated this revision to Diff 40904.

http://reviews.llvm.org/D14864

Files:
  lib/Basic/Targets.cpp
  test/Sema/callingconv-iamcu.c

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -3391,11 +3391,6 @@
   }
   if (CPU >= CK_i586)
 Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
-
-  if (getTriple().isOSIAMCU()) {
-Builder.defineMacro("__iamcu");
-Builder.defineMacro("__iamcu__");
-  }
 }
 
 bool X86TargetInfo::hasFeature(StringRef Feature) const {
@@ -3644,11 +3639,6 @@
 IntPtrType = SignedInt;
 RegParmMax = 3;
 
-if (getTriple().isOSIAMCU()) {
-  LongDoubleWidth = 64;
-  LongDoubleFormat = ::APFloat::IEEEdouble;
-}
-
 // Use fpret for all types.
 RealTypeUsesObjCFPRet = ((1 << TargetInfo::Float) |
  (1 << TargetInfo::Double) |
@@ -3881,6 +3871,27 @@
   }
 };
 
+// X86-32 MCU target
+class MCUI386TargetInfo : public X86_32TargetInfo {
+public:
+  MCUI386TargetInfo(const llvm::Triple ) : X86_32TargetInfo(Triple) {
+LongDoubleWidth = 64;
+LongDoubleFormat = ::APFloat::IEEEdouble;
+  }
+
+  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
+// On MCU we support only C calling convention.
+return CC == CC_C ? CCCR_OK : CCCR_Warning;
+  }
+
+  void getTargetDefines(const LangOptions ,
+MacroBuilder ) const override {
+X86_32TargetInfo::getTargetDefines(Opts, Builder);
+Builder.defineMacro("__iamcu");
+Builder.defineMacro("__iamcu__");
+  }
+};
+
 // RTEMS Target
 template
 class RTEMSTargetInfo : public OSTargetInfo {
@@ -7769,6 +7780,8 @@
   return new RTEMSX86_32TargetInfo(Triple);
 case llvm::Triple::NaCl:
   return new NaClTargetInfo(Triple);
+case llvm::Triple::ELFIAMCU:
+  return new MCUI386TargetInfo(Triple);
 default:
   return new X86_32TargetInfo(Triple);
 }
Index: test/Sema/callingconv-iamcu.c
===
--- test/Sema/callingconv-iamcu.c
+++ test/Sema/callingconv-iamcu.c
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 %s -fsyntax-only -triple i686-intel-elfiamcu -verify
+
+void __attribute__((fastcall)) foo(float *a) { // expected-warning {{calling convention 'fastcall' ignored for this target}}
+}
+
+void __attribute__((stdcall)) bar(float *a) { // expected-warning {{calling convention 'stdcall' ignored for this target}}
+}
+
+void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{'fastcall' attribute takes no arguments}}
+}
+
+void __attribute__((fastcall)) test2(int a, ...) { // expected-warning {{calling convention 'fastcall' ignored for this target}}
+}
+void __attribute__((stdcall)) test3(int a, ...) { // expected-warning {{calling convention 'stdcall' ignored for this target}}
+}
+void __attribute__((thiscall)) test4(int a, ...) { // expected-warning {{calling convention 'thiscall' ignored for this target}}
+}
+
+void __attribute__((cdecl)) ctest0() {}
+
+void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{'cdecl' attribute takes no arguments}}
+
+void (__attribute__((fastcall)) *pfoo)(float*) = foo; // expected-warning {{calling convention 'fastcall' ignored for this target}}
+
+void (__attribute__((stdcall)) *pbar)(float*) = bar; // expected-warning {{calling convention 'stdcall' ignored for this target}}
+
+void (*pctest0)() = ctest0;
+
+void ctest2() {}
+void (__attribute__((cdecl)) *pctest2)() = ctest2;
+
+typedef void (__attribute__((fastcall)) *Handler) (float *); // expected-warning {{calling convention 'fastcall' ignored for this target}}
+Handler H = foo;
+
+int __attribute__((pcs("aapcs", "aapcs"))) pcs1(void); // expected-error {{'pcs' attribute takes one argument}}
+int __attribute__((pcs())) pcs2(void); // expected-error {{'pcs' attribute takes one argument}}
+int __attribute__((pcs(pcs1))) pcs3(void); // expected-error {{'pcs' attribute requires a string}} \
+   // expected-error {{invalid PCS type}}
+int __attribute__((pcs(0))) pcs4(void); // expected-error {{'pcs' attribute requires a string}}
+/* These are ignored because the target is i386 and not ARM */
+int __attribute__((pcs("aapcs"))) pcs5(void); // expected-warning {{calling convention 'pcs' ignored for this target}}
+int __attribute__((pcs("aapcs-vfp"))) pcs6(void); // expected-warning {{calling convention 'pcs' ignored for this target}}
+int __attribute__((pcs("foo"))) pcs7(void); // expected-error {{invalid PCS type}}
+
+void ctest3();
+void __attribute__((cdecl)) ctest3() {}
+
+typedef __attribute__((stdcall)) void (*PROC)(); // expected-warning {{calling convention 'stdcall' ignored for this target}}
+PROC __attribute__((cdecl)) ctest4(const char *x) {}
+
+void __attribute__((intel_ocl_bicc)) inteloclbifunc(float *a) {} // expected-warning {{calling convention 'intel_ocl_bicc' ignored for this 

r253860 - clang-format: Make moving of the Cursor work properly when sorting #includes.

2015-11-23 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Nov 23 02:36:35 2015
New Revision: 253860

URL: http://llvm.org/viewvc/llvm-project?rev=253860=rev
Log:
clang-format: Make moving of the Cursor work properly when sorting #includes.

Modified:
cfe/trunk/include/clang/Format/Format.h
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/tools/clang-format/ClangFormat.cpp
cfe/trunk/unittests/Format/SortIncludesTest.cpp

Modified: cfe/trunk/include/clang/Format/Format.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=253860=253859=253860=diff
==
--- cfe/trunk/include/clang/Format/Format.h (original)
+++ cfe/trunk/include/clang/Format/Format.h Mon Nov 23 02:36:35 2015
@@ -688,7 +688,8 @@ std::string configurationAsText(const Fo
 /// are affected by 'Ranges'.
 tooling::Replacements sortIncludes(const FormatStyle , StringRef Code,
ArrayRef Ranges,
-   StringRef FileName);
+   StringRef FileName,
+   unsigned *Cursor = nullptr);
 
 /// \brief Reformats the given \p Ranges in the file \p ID.
 ///

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=253860=253859=253860=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Mon Nov 23 02:36:35 2015
@@ -1706,7 +1706,7 @@ static bool affectsRange(ArrayRef ,
  ArrayRef Ranges, StringRef FileName,
- tooling::Replacements ) {
+ tooling::Replacements , unsigned *Cursor) {
   if (!affectsRange(Ranges, Includes.front().Offset,
 Includes.back().Offset + Includes.back().Text.size()))
 return;
@@ -1730,10 +1730,21 @@ static void sortIncludes(const FormatSty
   if (!OutOfOrder)
 return;
 
-  std::string result = Includes[Indices[0]].Text;
-  for (unsigned i = 1, e = Indices.size(); i != e; ++i) {
-result += "\n";
-result += Includes[Indices[i]].Text;
+  std::string result;
+  bool CursorMoved = false;
+  for (unsigned Index : Indices) {
+if (!result.empty())
+  result += "\n";
+result += Includes[Index].Text;
+
+if (Cursor && !CursorMoved) {
+  unsigned Start = Includes[Index].Offset;
+  unsigned End = Start + Includes[Index].Text.size();
+  if (*Cursor >= Start && *Cursor < End) {
+*Cursor = Includes.front().Offset + result.size() + *Cursor - End;
+CursorMoved = true;
+  }
+}
   }
 
   // Sorting #includes shouldn't change their total number of characters.
@@ -1748,7 +1759,7 @@ static void sortIncludes(const FormatSty
 
 tooling::Replacements sortIncludes(const FormatStyle , StringRef Code,
ArrayRef Ranges,
-   StringRef FileName) {
+   StringRef FileName, unsigned *Cursor) {
   tooling::Replacements Replaces;
   if (!Style.SortIncludes)
 return Replaces;
@@ -1811,7 +1822,8 @@ tooling::Replacements sortIncludes(const
 LookForMainHeader = false;
 IncludesInBlock.push_back({IncludeName, Line, Prev, Category});
   } else if (!IncludesInBlock.empty()) {
-sortIncludes(Style, IncludesInBlock, Ranges, FileName, Replaces);
+sortIncludes(Style, IncludesInBlock, Ranges, FileName, Replaces,
+ Cursor);
 IncludesInBlock.clear();
   }
   Prev = Pos + 1;
@@ -1821,7 +1833,7 @@ tooling::Replacements sortIncludes(const
 SearchFrom = Pos + 1;
   }
   if (!IncludesInBlock.empty())
-sortIncludes(Style, IncludesInBlock, Ranges, FileName, Replaces);
+sortIncludes(Style, IncludesInBlock, Ranges, FileName, Replaces, Cursor);
   return Replaces;
 }
 

Modified: cfe/trunk/tools/clang-format/ClangFormat.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/ClangFormat.cpp?rev=253860=253859=253860=diff
==
--- cfe/trunk/tools/clang-format/ClangFormat.cpp (original)
+++ cfe/trunk/tools/clang-format/ClangFormat.cpp Mon Nov 23 02:36:35 2015
@@ -140,18 +140,18 @@ static bool fillRanges(MemoryBuffer *Cod
  InMemoryFileSystem.get());
   if (!LineRanges.empty()) {
 if (!Offsets.empty() || !Lengths.empty()) {
-  llvm::errs() << "error: cannot use -lines with -offset/-length\n";
+  errs() << "error: cannot use -lines with -offset/-length\n";
   return true;
 }
 
 for (unsigned i = 0, e = LineRanges.size(); i < e; ++i) {
   unsigned FromLine, ToLine;
   if (parseLineRange(LineRanges[i], FromLine, ToLine)) {
-llvm::errs() << "error: invalid : pair\n";
+errs() << "error: invalid : pair\n";
 

Re: r253859 - Fix calculation of shifted cursor/code positions. Specifically support

2015-11-23 Thread Renato Golin via cfe-commits
On 23 November 2015 at 08:33, Daniel Jasper via cfe-commits
 wrote:
> Author: djasper
> Date: Mon Nov 23 02:33:48 2015
> New Revision: 253859
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253859=rev
> Log:
> Fix calculation of shifted cursor/code positions. Specifically support
> the case where a specific range is replaced by new text. Previously,
> the calculation would shift any position from within a replaced region
> to the first character after the region. This is undersirable, e.g. for
> clang-format's include sorting.

Hi Daniel,

Not sure you've seen, but either this or your other commit broke the bots:

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/3501

http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/2605

http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/7678

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


[PATCH] D14919: Fix IssueHash generation

2015-11-23 Thread Gyorgy Orban via cfe-commits
o.gyorgy created this revision.
o.gyorgy added reviewers: zaks.anna, xazax.hun, dcoughlin, jordan_rose.
o.gyorgy added a subscriber: cfe-commits.

Fixing IssueHash generation.
There were some problems with the current version.

If the Decl *D pointer is nullptr the NormalizeLine would crash while getting 
the LangOptions. The required LangOptions can be provided by the HTML or Plist 
Diagnostics.

It is possible that the column number provided by the find_first_not_of is 0 in 
that case the Lexer reads up a wrong source line (translateLineCol requires 
that column numbering should start at 1).

I think there should be an assert checking the line and col values in the 
sourcemanagers translateLineCol. The same way as in translateFileLineCol which 
does this check.

http://reviews.llvm.org/D14919

Files:
  include/clang/StaticAnalyzer/Core/IssueHash.h
  lib/Basic/SourceManager.cpp
  lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
  lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
  lib/StaticAnalyzer/Core/IssueHash.cpp
  lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
  test/Analysis/bug_hash_test.cpp
  test/Analysis/diagnostics/report-issues-within-main-file.cpp

Index: test/Analysis/diagnostics/report-issues-within-main-file.cpp
===
--- test/Analysis/diagnostics/report-issues-within-main-file.cpp
+++ test/Analysis/diagnostics/report-issues-within-main-file.cpp
@@ -949,7 +949,7 @@
 // CHECK-NEXT:   typeBad deallocator
 // CHECK-NEXT:   check_nameunix.MismatchedDeallocator
 // CHECK-NEXT:   
-// CHECK-NEXT:   issue_hash_content_of_line_in_contextf21ac032efaa3d1459a5ed31f0ad44f0
+// CHECK-NEXT:   issue_hash_content_of_line_in_contextf689fbd54138491e228f0f89bb02bfb2
 // CHECK-NEXT:  issue_context_kindfunction
 // CHECK-NEXT:  issue_contextmainPlusHeader
 // CHECK-NEXT:  issue_hash_function_offset2
Index: test/Analysis/bug_hash_test.cpp
===
--- test/Analysis/bug_hash_test.cpp
+++ test/Analysis/bug_hash_test.cpp
@@ -288,17 +288,17 @@
 // CHECK-NEXT: 
 // CHECK-NEXT: depth0
 // CHECK-NEXT: extended_message
-// CHECK-NEXT: debug.DumpBugHash$int f()$28$namespaceAA{$debug
+// CHECK-NEXT: debug.DumpBugHash$int f()$28$constexprintf(){return5;}$debug
 // CHECK-NEXT: message
-// CHECK-NEXT: debug.DumpBugHash$int f()$28$namespaceAA{$debug
+// CHECK-NEXT: debug.DumpBugHash$int f()$28$constexprintf(){return5;}$debug
 // CHECK-NEXT:
 // CHECK-NEXT:   
-// CHECK-NEXT:   descriptiondebug.DumpBugHash$int f()$28$namespaceAA{$debug
+// CHECK-NEXT:   descriptiondebug.DumpBugHash$int f()$28$constexprintf(){return5;}$debug
 // CHECK-NEXT:   categorydebug
 // CHECK-NEXT:   typeDump hash components
 // CHECK-NEXT:   check_namedebug.DumpBugHash
 // CHECK-NEXT:   
-// CHECK-NEXT:   issue_hash_content_of_line_in_contextf8ee38da3de42e209c4afa886b5531ab
+// CHECK-NEXT:   issue_hash_content_of_line_in_contextf5471f52854dc14167fe96db50c4ba5f
 // CHECK-NEXT:  issue_context_kindfunction
 // CHECK-NEXT:  issue_contextf
 // CHECK-NEXT:  issue_hash_function_offset0
Index: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
===
--- lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
+++ lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
@@ -399,7 +399,7 @@
 *SM);
 const Decl *DeclWithIssue = D->getDeclWithIssue();
 EmitString(o, GetIssueHash(*SM, L, D->getCheckName(), D->getBugType(),
-   DeclWithIssue))
+   DeclWithIssue, LangOpts))
 << '\n';
 
 // Output information about the semantic context where
Index: lib/StaticAnalyzer/Core/IssueHash.cpp
===
--- lib/StaticAnalyzer/Core/IssueHash.cpp
+++ lib/StaticAnalyzer/Core/IssueHash.cpp
@@ -127,14 +127,13 @@
 }
 
 static std::string NormalizeLine(const SourceManager , FullSourceLoc ,
- const Decl *D) {
+ const LangOptions ) {
   static StringRef Whitespaces = " \t\n";
 
-  const LangOptions  = D->getASTContext().getLangOpts();
   StringRef Str = GetNthLineOfFile(SM.getBuffer(L.getFileID(), L),
L.getExpansionLineNumber());
   unsigned col = Str.find_first_not_of(Whitespaces);
-
+  col++;
   SourceLocation StartOfLine =
   SM.translateLineCol(SM.getFileID(L), L.getExpansionLineNumber(), col);
   llvm::MemoryBuffer *Buffer =
@@ -145,7 +144,7 @@
   const char *BufferPos = SM.getCharacterData(StartOfLine);
 
   Token Token;
-  Lexer Lexer(SM.getLocForStartOfFile(SM.getFileID(StartOfLine)), Opts,
+  Lexer Lexer(SM.getLocForStartOfFile(SM.getFileID(StartOfLine)), LangOpts,
   Buffer->getBufferStart(), BufferPos, Buffer->getBufferEnd());
 
   size_t NextStart = 0;
@@ -175,13 +174,14 @@
 std::string clang::GetIssueString(const SourceManager ,
   

Re: [PATCH] D14871: [Power PC] fix calculating address of arguments on stack for variadic functions

2015-11-23 Thread Strahinja Petrovic via cfe-commits
spetrovic updated this revision to Diff 40915.
spetrovic marked an inline comment as done.

http://reviews.llvm.org/D14871

Files:
  lib/CodeGen/TargetInfo.cpp
  test/CodeGen/ppc-varargs-struct.c

Index: test/CodeGen/ppc-varargs-struct.c
===
--- test/CodeGen/ppc-varargs-struct.c
+++ test/CodeGen/ppc-varargs-struct.c
@@ -39,9 +39,13 @@
 // CHECK-PPC:[[USING_OVERFLOW]]
 // CHECK-PPC-NEXT:  [[OVERFLOW_AREA_P:%[0-9]+]] = getelementptr inbounds 
%struct.__va_list_tag, %struct.__va_list_tag* [[ARRAYDECAY]], i32 0, i32 3
 // CHECK-PPC-NEXT:  [[OVERFLOW_AREA:%.+]] = load i8*, i8** 
[[OVERFLOW_AREA_P]], align 4
-// CHECK-PPC-NEXT:  [[MEMADDR:%.+]] = bitcast i8* [[OVERFLOW_AREA]] to 
%struct.x**
-// CHECK-PPC-NEXT:  [[NEW_OVERFLOW_AREA:%[0-9]+]] = getelementptr inbounds i8, 
i8* [[OVERFLOW_AREA]], i32 4
-// CHECK-PPC-NEXT:  store i8* [[NEW_OVERFLOW_AREA]], i8** [[OVERFLOW_AREA_P]]
+// CHECK-PPC-NEXT:  %{{[0-9]+}} = getelementptr i8, i8* %{{[0-9]+}}, i32 7
+// CHECK-PPC-NEXT:  %{{[0-9]+}} = ptrtoint i8* %{{[0-9]+}} to i32
+// CHECK-PPC-NEXT:  %{{[0-9]+}} = and i32 %{{[0-9]+}}, -8
+// CHECK-PPC-NEXT:  %overflow_arg_area.align = inttoptr i32 %{{[0-9]+}} to i8*
+// CHECK-PPC-NEXT:  [[MEMADDR:%.+]] = bitcast i8* %overflow_arg_area.align to 
%struct.x**
+// CHECK-PPC-NEXT:  [[NEW_OVERFLOW_AREA:%[0-9]+]] = getelementptr inbounds i8, 
i8* %overflow_arg_area.align, i32 4
+// CHECK-PPC-NEXT:  store i8* [[NEW_OVERFLOW_AREA:%[0-9]+]], i8** 
[[OVERFLOW_AREA_P]], align 4
 // CHECK-PPC-NEXT:  br label %[[CONT]]
 //
 // CHECK-PPC:[[CONT]]
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -3543,9 +3543,23 @@
   Builder.CreateStructGEP(VAList, 3, CharUnits::fromQuantity(4));
 Address OverflowArea(Builder.CreateLoad(OverflowAreaAddr),
  OverflowAreaAlign);
-
-// The current address is the address of the varargs element.
-// FIXME: do we not need to round up to alignment?
+// Round up address of argument to alignment
+llvm::Value *OverflowArgArea = OverflowArea.getPointer();
+uint32_t Align = CGF.getContext().getTypeAlignInChars(Ty).getQuantity();
+if (Align > 4) {
+  // OverflowArgArea = (OverflowArgArea + Align - 1) & -Align;
+  llvm::Value *Offset = llvm::ConstantInt::get(CGF.Int32Ty, Align - 1);
+  OverflowArgArea = CGF.Builder.CreateGEP(OverflowArgArea, Offset);
+  llvm::Value *AsInt = CGF.Builder.CreatePtrToInt(OverflowArgArea,
+  CGF.Int32Ty);
+  llvm::Value *Mask = llvm::ConstantInt::get(CGF.Int32Ty, 
-(uint32_t)Align);
+  OverflowArgArea =
+CGF.Builder.CreateIntToPtr(CGF.Builder.CreateAnd(AsInt, Mask),
+   OverflowArgArea->getType(),
+   "overflow_arg_area.align");
+}
+ 
+OverflowArea = Address(OverflowArgArea, CharUnits::fromQuantity(Align));
 MemAddr = Builder.CreateElementBitCast(OverflowArea, DirectTy);
 
 // Increase the overflow area.


Index: test/CodeGen/ppc-varargs-struct.c
===
--- test/CodeGen/ppc-varargs-struct.c
+++ test/CodeGen/ppc-varargs-struct.c
@@ -39,9 +39,13 @@
 // CHECK-PPC:[[USING_OVERFLOW]]
 // CHECK-PPC-NEXT:  [[OVERFLOW_AREA_P:%[0-9]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* [[ARRAYDECAY]], i32 0, i32 3
 // CHECK-PPC-NEXT:  [[OVERFLOW_AREA:%.+]] = load i8*, i8** [[OVERFLOW_AREA_P]], align 4
-// CHECK-PPC-NEXT:  [[MEMADDR:%.+]] = bitcast i8* [[OVERFLOW_AREA]] to %struct.x**
-// CHECK-PPC-NEXT:  [[NEW_OVERFLOW_AREA:%[0-9]+]] = getelementptr inbounds i8, i8* [[OVERFLOW_AREA]], i32 4
-// CHECK-PPC-NEXT:  store i8* [[NEW_OVERFLOW_AREA]], i8** [[OVERFLOW_AREA_P]]
+// CHECK-PPC-NEXT:  %{{[0-9]+}} = getelementptr i8, i8* %{{[0-9]+}}, i32 7
+// CHECK-PPC-NEXT:  %{{[0-9]+}} = ptrtoint i8* %{{[0-9]+}} to i32
+// CHECK-PPC-NEXT:  %{{[0-9]+}} = and i32 %{{[0-9]+}}, -8
+// CHECK-PPC-NEXT:  %overflow_arg_area.align = inttoptr i32 %{{[0-9]+}} to i8*
+// CHECK-PPC-NEXT:  [[MEMADDR:%.+]] = bitcast i8* %overflow_arg_area.align to %struct.x**
+// CHECK-PPC-NEXT:  [[NEW_OVERFLOW_AREA:%[0-9]+]] = getelementptr inbounds i8, i8* %overflow_arg_area.align, i32 4
+// CHECK-PPC-NEXT:  store i8* [[NEW_OVERFLOW_AREA:%[0-9]+]], i8** [[OVERFLOW_AREA_P]], align 4
 // CHECK-PPC-NEXT:  br label %[[CONT]]
 //
 // CHECK-PPC:[[CONT]]
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -3543,9 +3543,23 @@
   Builder.CreateStructGEP(VAList, 3, CharUnits::fromQuantity(4));
 Address OverflowArea(Builder.CreateLoad(OverflowAreaAddr),
  OverflowAreaAlign);
-
-// The current address is the address of the 

Re: [PATCH] D14441: [OpenCL] Pipe types support.

2015-11-23 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: include/clang/AST/Type.h:5019
@@ +5018,3 @@
+///
+class PipeType : public Type, public llvm::FoldingSetNode {
+  QualType ElementType;

Not related to this change though, but I was just thinking that it might be 
possible to avoid a lot of code repetition by moving common functionality of 
most special type classes into a base class. For example, AtomicType, 
BlockPointerType, ComplexType, PointerType, PipeType  all share similar 
functionality being some sort of a wrapper/container of another type. 

It will also avoid a lot of code replication in ASTContext (for example 
get{Atomic|BlockPointer|Pointer|Complex|Pipe}Type methods) as we could have 
some common factory pattern like template method for creating these types and 
filling the type caches. It seems they are mostly done in similar way.

Would be a nice refactoring task I think.


http://reviews.llvm.org/D14441



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


Re: [PATCH] D14796: Preserve exceptions information during calls code generation.

2015-11-23 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 40977.
sfantao added a comment.

Fix typo in comment.


http://reviews.llvm.org/D14796

Files:
  include/clang/CodeGen/CGFunctionInfo.h
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGExprComplex.cpp
  lib/CodeGen/CGObjC.cpp
  lib/CodeGen/CGObjCGNU.cpp
  lib/CodeGen/CGObjCMac.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.h
  test/CodeGenCXX/observe-noexcept.cpp

Index: test/CodeGenCXX/observe-noexcept.cpp
===
--- /dev/null
+++ test/CodeGenCXX/observe-noexcept.cpp
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -triple  powerpc64le-unknown-unknown -std=c++11 -fopenmp -fexceptions -fcxx-exceptions -O0 -emit-llvm %s -o - | FileCheck %s
+
+// Check that regions that install a terminate scope in the exception stack can
+// correctly generate complex arithmetic.
+
+// CHECK-LABEL: ffcomplex
+void ffcomplex (int a) {
+  double _Complex dc = (double)a;
+
+  // CHECK: call { double, double } @__muldc3(double %{{.+}}, double %{{.+}}, double %{{.+}}, double %{{.+}})
+  dc *= dc;
+  // CHECK: call {{.+}} @__kmpc_fork_call({{.+}} [[REGNAME1:@.*]] to void (i32*, i32*, ...)*), { double, double }* %{{.+}})
+  #pragma omp parallel
+  {
+dc *= dc;
+  }
+  // CHECK: ret void
+}
+
+// CHECK: define internal {{.+}}[[REGNAME1]](
+// CHECK-NOT: invoke
+// CHECK: call { double, double } @__muldc3(double %{{.+}}, double %{{.+}}, double %{{.+}}, double %{{.+}})
+// CHECK-NOT: invoke
+// CHECK: ret void
+
+// Check if we are observing the function pointer attribute regardless what is
+// in the exception specification of the callees.
+void fnoexcp(void) noexcept;
+
+// CHECK-LABEL: foo
+void foo(int a, int b) {
+
+  void (*fptr)(void) noexcept = fnoexcp;
+
+  // CHECK: call {{.+}} @__kmpc_fork_call({{.+}} [[REGNAME2:@.*]] to void (i32*, i32*, ...)*), void ()** %{{.+}})
+  #pragma omp parallel
+  {
+fptr();
+  }
+  // CHECK: ret void
+}
+
+// CHECK: define internal {{.+}}[[REGNAME2]](
+// CHECK-NOT: invoke
+// CHECK: call void %{{[0-9]+}}()
+// CHECK-NOT: invoke
+// CHECK: ret void
Index: lib/CodeGen/CodeGenModule.h
===
--- lib/CodeGen/CodeGenModule.h
+++ lib/CodeGen/CodeGenModule.h
@@ -968,16 +968,14 @@
   /// function type.
   ///
   /// \param Info - The function type information.
-  /// \param TargetDecl - The decl these attributes are being constructed
-  /// for. If supplied the attributes applied to this decl may contribute to the
-  /// function attributes and calling convention.
+  /// \param CalleeInfo - The callee information these attributes are being
+  /// constructed for. If valid, the attributes applied to this decl may
+  /// contribute to the function attributes and calling convention.
   /// \param PAL [out] - On return, the attribute list to use.
   /// \param CallingConv [out] - On return, the LLVM calling convention to use.
   void ConstructAttributeList(const CGFunctionInfo ,
-  const Decl *TargetDecl,
-  AttributeListType ,
-  unsigned ,
-  bool AttrOnCallSite);
+  CGCalleeInfo CalleeInfo, AttributeListType ,
+  unsigned , bool AttrOnCallSite);
 
   // Fills in the supplied string map with the set of target features for the
   // passed in function.
Index: lib/CodeGen/CodeGenFunction.h
===
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -2624,16 +2624,14 @@
   ///
   /// \param TargetDecl - If given, the decl of the function in a direct call;
   /// used to set attributes on the call (noreturn, etc.).
-  RValue EmitCall(const CGFunctionInfo ,
-  llvm::Value *Callee,
-  ReturnValueSlot ReturnValue,
-  const CallArgList ,
-  const Decl *TargetDecl = nullptr,
+  RValue EmitCall(const CGFunctionInfo , llvm::Value *Callee,
+  ReturnValueSlot ReturnValue, const CallArgList ,
+  CGCalleeInfo CalleeInfo = CGCalleeInfo(),
   llvm::Instruction **callOrInvoke = nullptr);
 
   RValue EmitCall(QualType FnType, llvm::Value *Callee, const CallExpr *E,
   ReturnValueSlot ReturnValue,
-  const Decl *TargetDecl = nullptr,
+  CGCalleeInfo CalleeInfo = CGCalleeInfo(),
   llvm::Value *Chain = nullptr);
   RValue EmitCallExpr(const CallExpr *E,
   ReturnValueSlot ReturnValue = ReturnValueSlot());
Index: lib/CodeGen/CGObjCMac.cpp
===
--- lib/CodeGen/CGObjCMac.cpp
+++ lib/CodeGen/CGObjCMac.cpp
@@ -1947,7 +1947,7 @@
   llvm::Instruction *CallSite;
   Fn = llvm::ConstantExpr::getBitCast(Fn, MSI.MessengerType);
   RValue rvalue = 

Re: [PATCH] D14796: Preserve exceptions information during calls code generation.

2015-11-23 Thread Samuel Antao via cfe-commits
sfantao added a comment.

Committed in r253926!

Thanks,
Samuel



Comment at: lib/CodeGen/CGCall.cpp:1420
@@ +1419,3 @@
+  // If we have information about the function prototype, we can learn
+  // attributes form there.
+  AddAttributesFromFunctionProtoType(getContext(), FuncAttrs,

Done!


http://reviews.llvm.org/D14796



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


[clang-tools-extra] r253929 - Fix test failure introduced by r253859. I believe that the new behavior

2015-11-23 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Nov 23 16:28:56 2015
New Revision: 253929

URL: http://llvm.org/viewvc/llvm-project?rev=253929=rev
Log:
Fix test failure introduced by r253859. I believe that the new behavior
in r253859 makes sense in many cases and thus, I have fixed the
implementation of calculateChangedRanges instead. It had a FIXME anyway
saying that it was unecessarily using shiftedCodePosition which
resulted in O(N^2) runtime.

Modified:

clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp

Modified: 
clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp?rev=253929=253928=253929=diff
==
--- 
clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
 (original)
+++ 
clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
 Mon Nov 23 16:28:56 2015
@@ -209,14 +209,11 @@ RangeVector calculateChangedRanges(
   RangeVector ChangedRanges;
 
   // Generate the new ranges from the replacements.
-  //
-  // NOTE: This is O(n^2) in the number of replacements. If this starts to
-  // become a problem inline shiftedCodePosition() here and do shifts in a
-  // single run through this loop.
+  int Shift = 0;
   for (const tooling::Replacement  : Replaces) {
-unsigned Offset = tooling::shiftedCodePosition(Replaces, R.getOffset());
+unsigned Offset = R.getOffset() + Shift;
 unsigned Length = R.getReplacementText().size();
-
+Shift += Length - R.getLength();
 ChangedRanges.push_back(tooling::Range(Offset, Length));
   }
 


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


Re: r253859 - Fix calculation of shifted cursor/code positions. Specifically support

2015-11-23 Thread Daniel Jasper via cfe-commits
Fixed in r253929.

On Mon, Nov 23, 2015 at 10:59 PM, Daniel Jasper  wrote:

> Oh, that is a different one. Looking into it.
>
>
> On Mon, Nov 23, 2015 at 9:14 PM, Renato Golin 
> wrote:
>
>> On 23 November 2015 at 10:41, Daniel Jasper  wrote:
>> > Seen and fixed, I think..
>>
>> Still looks broken... :)
>>
>> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/7684
>>
>> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/2616
>>
>> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/3517
>>
>> --renato
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253932 - clang-c/Index.h: Move \brief. [-Wdocumentation]

2015-11-23 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Mon Nov 23 16:51:26 2015
New Revision: 253932

URL: http://llvm.org/viewvc/llvm-project?rev=253932=rev
Log:
clang-c/Index.h: Move \brief. [-Wdocumentation]

Modified:
cfe/trunk/include/clang-c/Index.h

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=253932=253931=253932=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Mon Nov 23 16:51:26 2015
@@ -2460,17 +2460,6 @@ enum CXLinkageKind {
  */
 CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor);
 
-/**
- * \brief Describe the visibility of the entity referred to by a cursor.
- *
- * This returns the default visibility if not explicitly specified by
- * a visibility attribute. The default visibility may be changed by
- * commandline arguments.
- *
- * \param cursor The cursor to query.
- *
- * \returns The visibility of the cursor.
- */
 enum CXVisibilityKind {
   /** \brief This value indicates that no visibility information is available
* for a provided CXCursor. */
@@ -2484,6 +2473,17 @@ enum CXVisibilityKind {
   CXVisibility_Default
 };
 
+/**
+ * \brief Describe the visibility of the entity referred to by a cursor.
+ *
+ * This returns the default visibility if not explicitly specified by
+ * a visibility attribute. The default visibility may be changed by
+ * commandline arguments.
+ *
+ * \param cursor The cursor to query.
+ *
+ * \returns The visibility of the cursor.
+ */
 CINDEX_LINKAGE enum CXVisibilityKind clang_getCursorVisibility(CXCursor 
cursor);
 
 /**


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


Re: r253859 - Fix calculation of shifted cursor/code positions. Specifically support

2015-11-23 Thread Daniel Jasper via cfe-commits
Oh, that is a different one. Looking into it.


On Mon, Nov 23, 2015 at 9:14 PM, Renato Golin 
wrote:

> On 23 November 2015 at 10:41, Daniel Jasper  wrote:
> > Seen and fixed, I think..
>
> Still looks broken... :)
>
> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/7684
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/2616
>
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/3517
>
> --renato
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253926 - Preserve exceptions information during calls code generation.

2015-11-23 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Mon Nov 23 16:04:44 2015
New Revision: 253926

URL: http://llvm.org/viewvc/llvm-project?rev=253926=rev
Log:
Preserve exceptions information during calls code generation.

This patch changes the generation of CGFunctionInfo to contain 
the FunctionProtoType if it is available. This enables the code 
generation for call instructions to look into this type for 
exception information and therefore generate better quality 
IR - it will not create invoke instructions for functions that 
are know not to throw.


Added:
cfe/trunk/test/CodeGenCXX/observe-noexcept.cpp
Modified:
cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGExprComplex.cpp
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/lib/CodeGen/CodeGenModule.h

Modified: cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h?rev=253926=253925=253926=diff
==
--- cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h (original)
+++ cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h Mon Nov 23 16:04:44 2015
@@ -509,6 +509,29 @@ public:
   }
 };
 
+/// CGCalleeInfo - Class to encapsulate the information about a callee to be
+/// used during the generation of call/invoke instructions.
+class CGCalleeInfo {
+  /// \brief The function proto type of the callee.
+  const FunctionProtoType *CalleeProtoTy;
+  /// \brief The function declaration of the callee.
+  const Decl *CalleeDecl;
+
+public:
+  explicit CGCalleeInfo() : CalleeProtoTy(nullptr), CalleeDecl(nullptr) {}
+  CGCalleeInfo(const FunctionProtoType *calleeProtoTy, const Decl *calleeDecl)
+  : CalleeProtoTy(calleeProtoTy), CalleeDecl(calleeDecl) {}
+  CGCalleeInfo(const FunctionProtoType *calleeProtoTy)
+  : CalleeProtoTy(calleeProtoTy), CalleeDecl(nullptr) {}
+  CGCalleeInfo(const Decl *calleeDecl)
+  : CalleeProtoTy(nullptr), CalleeDecl(calleeDecl) {}
+
+  const FunctionProtoType *getCalleeFunctionProtoType() {
+return CalleeProtoTy;
+  }
+  const Decl *getCalleeDecl() { return CalleeDecl; }
+};
+
 }  // end namespace CodeGen
 }  // end namespace clang
 

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=253926=253925=253926=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Nov 23 16:04:44 2015
@@ -1391,8 +1391,19 @@ llvm::Type *CodeGenTypes::GetFunctionTyp
   return GetFunctionType(*Info);
 }
 
+static void AddAttributesFromFunctionProtoType(ASTContext ,
+   llvm::AttrBuilder ,
+   const FunctionProtoType *FPT) {
+  if (!FPT)
+return;
+
+  if (!isUnresolvedExceptionSpec(FPT->getExceptionSpecType()) &&
+  FPT->isNothrow(Ctx))
+FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
+}
+
 void CodeGenModule::ConstructAttributeList(const CGFunctionInfo ,
-   const Decl *TargetDecl,
+   CGCalleeInfo CalleeInfo,
AttributeListType ,
unsigned ,
bool AttrOnCallSite) {
@@ -1405,6 +1416,13 @@ void CodeGenModule::ConstructAttributeLi
   if (FI.isNoReturn())
 FuncAttrs.addAttribute(llvm::Attribute::NoReturn);
 
+  // If we have information about the function prototype, we can learn
+  // attributes form there.
+  AddAttributesFromFunctionProtoType(getContext(), FuncAttrs,
+ CalleeInfo.getCalleeFunctionProtoType());
+
+  const Decl *TargetDecl = CalleeInfo.getCalleeDecl();
+
   // FIXME: handle sseregparm someday...
   if (TargetDecl) {
 if (TargetDecl->hasAttr())
@@ -1417,10 +1435,8 @@ void CodeGenModule::ConstructAttributeLi
   FuncAttrs.addAttribute(llvm::Attribute::NoDuplicate);
 
 if (const FunctionDecl *Fn = dyn_cast(TargetDecl)) {
-  const FunctionProtoType *FPT = Fn->getType()->getAs();
-  if (FPT && !isUnresolvedExceptionSpec(FPT->getExceptionSpecType()) &&
-  FPT->isNothrow(getContext()))
-FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
+  AddAttributesFromFunctionProtoType(
+  getContext(), FuncAttrs, Fn->getType()->getAs());
   // Don't use [[noreturn]] or _Noreturn for a call to a virtual function.
   // These attributes are not inherited by overloads.
   const CXXMethodDecl *MD = dyn_cast(Fn);
@@ -3077,7 +3093,7 @@ RValue CodeGenFunction::EmitCall(const C
  

r253950 - [modules] Add -cc1 flag -fmodules-embed-all-files.

2015-11-23 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Nov 23 22:22:21 2015
New Revision: 253950

URL: http://llvm.org/viewvc/llvm-project?rev=253950=rev
Log:
[modules] Add -cc1 flag -fmodules-embed-all-files.

This flag causes all files that were read by the compilation to be embedded
into a produced module file. This is useful for distributed build systems that
use an include scanning system to determine which files are "needed" by a
compilation, and only provide those files to remote compilation workers. Since
using a module can require any file that is part of that module (or anything it
transitively includes), files that are not found by an include scanner can be
required in a regular build using explicit modules. With this flag, only files
that are actually referenced by transitively-#included files are required to be
present on the build machine.

Modified:
cfe/trunk/include/clang/Basic/SourceManager.h
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/FrontendOptions.h
cfe/trunk/lib/Basic/SourceManager.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/FrontendActions.cpp
cfe/trunk/test/Modules/explicit-build-missing-files.cpp

Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=253950=253949=253950=diff
==
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Mon Nov 23 22:22:21 2015
@@ -566,6 +566,11 @@ class SourceManager : public RefCountedB
   /// (likely to change while trying to use them). Defaults to false.
   bool UserFilesAreVolatile;
 
+  /// \brief True if all files read during this compilation should be treated
+  /// as transient (may not be present in later compilations using a module
+  /// file created from this compilation). Defaults to false.
+  bool FilesAreTransient;
+
   struct OverriddenFilesInfoTy {
 /// \brief Files that have been overridden with the contents from another
 /// file.
@@ -864,6 +869,12 @@ public:
   /// the module is used).
   void embedFileContentsInModule(const FileEntry *SourceFile);
 
+  /// \brief Request that all files that are read during this compilation be
+  /// written to any created module file.
+  void setEmbedAllFileContentsInModule(bool Embed) {
+FilesAreTransient = Embed;
+  }
+
   
//======//
   // FileID manipulation methods.
   
//======//

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=253950=253949=253950=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Nov 23 22:22:21 2015
@@ -381,6 +381,9 @@ def fmodules_embed_file_EQ : Joined<["-"
   MetaVarName<"">,
   HelpText<"Embed the contents of the specified file into the module file "
"being compiled.">;
+def fmodules_embed_all_files : Joined<["-"], "fmodules-embed-all-files">,
+  HelpText<"Embed the contents of all files read by this compilation into "
+   "the produced module file.">;
 def fmodules_local_submodule_visibility :
   Flag<["-"], "fmodules-local-submodule-visibility">,
   HelpText<"Enforce name visibility rules across submodules of the same "

Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=253950=253949=253950=diff
==
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Mon Nov 23 22:22:21 2015
@@ -150,6 +150,8 @@ public:
///< dumps in AST dumps.
   unsigned BuildingImplicitModule : 1; ///< Whether we are performing an
///< implicit module build.
+  unsigned ModulesEmbedAllFiles : 1;   ///< Whether we should embed all 
used
+   ///< files into the PCM file.
 
   CodeCompleteOptions CodeCompleteOpts;
 
@@ -272,7 +274,7 @@ public:
 FixToTemporaries(false), ARCMTMigrateEmitARCErrors(false),
 SkipFunctionBodies(false), UseGlobalModuleIndex(true),
 GenerateGlobalModuleIndex(true), ASTDumpDecls(false), 
ASTDumpLookups(false),
-BuildingImplicitModule(false),
+BuildingImplicitModule(false), ModulesEmbedAllFiles(false),
 ARCMTAction(ARCMT_None), ObjCMTAction(ObjCMT_None),
 ProgramAction(frontend::ParseSyntaxOnly)
   {}

Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: 

Re: r253721 - [CMake] Add support for specifying arguments to the bootstrap build.

2015-11-23 Thread Chris Bieneman via cfe-commits
Good to know my spelling is at least consistently wrong :-).

I’ll fix this shortly.

-Chris

> On Nov 20, 2015, at 8:12 PM, Sean Silva  wrote:
> 
> 
> 
> On Fri, Nov 20, 2015 at 2:09 PM, Chris Bieneman via cfe-commits 
> > wrote:
> Author: cbieneman
> Date: Fri Nov 20 16:09:06 2015
> New Revision: 253721
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=253721=rev 
> 
> Log:
> [CMake] Add support for specifying arguments to the bootstrap build.
> 
> This adds support for three types of argument specifications for bootstrap 
> builds:
> 
> (1) Arguments prefixed with BOOTSTRAP_* will be passed through with the 
> leading BOOTSTRAP_ removed.
> (2) CLANG_BOOTSTRAP_PASSTHROUGH can specify a list of variables to be passed 
> through as they are set.
> (3) BOOTSTRAP_DEFAULT_PASSTHROUGH is a list of some default passthrough 
> variables that are always passed through. Those variables include the version 
> string and should only specify variables that are always expected to be the 
> same between the stage1 and stage2
> 
> Modified:
> cfe/trunk/CMakeLists.txt
> 
> Modified: cfe/trunk/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=253721=253720=253721=diff
>  
> 
> ==
> --- cfe/trunk/CMakeLists.txt (original)
> +++ cfe/trunk/CMakeLists.txt Fri Nov 20 16:09:06 2015
> @@ -652,6 +652,36 @@ if (CLANG_ENABLE_BOOTSTRAP)
>  set(verbose -DCMAKE_VERBOSE_MAKEFILE=On)
>endif()
> 
> +  set(BOOTSTRAP_DEFAULT_PASSTHROUGH
> +PACKAGE_VERSION
> +LLVM_VERSION_MAJOR
> +LLVM_VERSION_MINOR
> +LLVM_VERSION_PATCH
> +LLVM_VERSION_SUFFIX
> +CLANG_REPOSITORY_STRING
> +CMAKE_MAKE_PROGRAM)
> +
> +  # Find all variables that start with BOOTSTRAP_ and populate a variable 
> with
> +  # them.
> +  get_cmake_property(variableNames VARIABLES)
> +  foreach(varaibleName ${variableNames})
> +if(varaibleName MATCHES "^BOOTSTRAP_")
> +  string(SUBSTRING ${varaibleName} 10 -1 varName)
> +  string(REPLACE ";" "\;" value "${${varaibleName}}")
> +  list(APPEND PASSTHROUGH_VARIABLES
> +-D${varName}=${value})
> +endif()
> +  endforeach()
> +
> +  # Populate the passthrough variables
> +  foreach(varaibleName ${CLANG_BOOTSTRAP_PASSTHROUGH} 
> ${BOOTSTRAP_DEFAULT_PASSTHROUGH})
> +if(${varaibleName})
> 
> typo: "varaibleName".
> 
> I saw one in r253720 as well.
> 
> -- Sean Silva
>  
> +  string(REPLACE ";" "\;" value ${${varaibleName}})
> +  list(APPEND PASSTHROUGH_VARIABLES
> +-D${varaibleName}=${value})
> +endif()
> +  endforeach()
> +
>ExternalProject_Add(bootstrap
>  DEPENDS clang ${LTO_DEP}
>  PREFIX bootstrap
> @@ -664,6 +694,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
>  # seem to work, so instead I'm passing this through
>  -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
>  ${CLANG_BOOTSTRAP_CMAKE_ARGS}
> +${PASSTHROUGH_VARIABLES}
>  -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
>  -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
>  -DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
> 
> 
> ___
> 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] D13351: [Power PC] add soft float support for ppc32

2015-11-23 Thread hfin...@anl.gov via cfe-commits
hfinkel added inline comments.


Comment at: lib/CodeGen/TargetInfo.cpp:3421
@@ -3419,3 +3420,3 @@
 public:
-  PPC32_SVR4_ABIInfo(CodeGen::CodeGenTypes ) : DefaultABIInfo(CGT) {}
+  PPC32_SVR4_ABIInfo(CodeGen::CodeGenTypes , bool SoftFloatABI) : 
DefaultABIInfo(CGT), IsSoftFloatABI(SoftFloatABI) {}
 

Line too long.


Comment at: lib/Driver/Tools.cpp:1353
@@ -1351,1 +1352,3 @@
 
+  // FIXME: Remove error for ppc64 when soft-float support is added.
+  ppc::FloatABI FloatABI = ppc::getPPCFloatABI(D, Args);

Remove this FIXME. It is not clear this will ever be supported (is there 
actually ppc64 hardware without an FP unit)?


Comment at: lib/Driver/Tools.cpp:1362
@@ +1361,3 @@
+Triple.getArch() == llvm::Triple::ppc64le))
+D.Diag(diag::err_drv_ppc64_softfloat_not_supported);
+

Don't introduce a new error for this. Just reuse the 
diag::err_drv_invalid_mfloat_abi error.


http://reviews.llvm.org/D13351



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


Re: [PATCH] D13336: [MSVC] 'property' with an empty array in array subscript expression.

2015-11-23 Thread John McCall via cfe-commits
rjmccall added inline comments.


Comment at: lib/Sema/SemaPseudoObject.cpp:57
@@ +56,3 @@
+  // with a base limits the number of cases here.
+  assert(refExpr->isObjectReceiver());
+

Well, it should be okay to call this on something that doesn't have a base; it 
just doesn't need to do anything and can just return refExpr.


Comment at: lib/Sema/SemaPseudoObject.cpp:1591
@@ +1590,3 @@
+  return baseOVE->getSourceExpr();
+} else if (ObjCSubscriptRefExpr *refExpr =
+   dyn_cast(opaqueRef)) {

That's what I'm saying, though: the capture process should be building the 
syntactic MSPropertySubscriptExpr using the captured OVEs for the index 
expressions as well as the recursively-captured base, and Rebuilder will then 
need to undo that.

We want to consistently replace all the captured sub-trees with their OVEs so 
that clients can easily recover the relationship between the syntactic and 
semantic forms.


Comment at: lib/Sema/SemaPseudoObject.cpp:1621
@@ -1582,1 +1620,3 @@
+  };
+  return Rebuilder(S, Callback).rebuild(E);
 }

My hope is that you'll be able to get this whole function down to just this 
last line and won't need to split out any of the cases here.


http://reviews.llvm.org/D13336



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


r253938 - CodeGenFunction.h: Prune a \param in r253926. [-Wdocumentation]

2015-11-23 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Mon Nov 23 17:38:13 2015
New Revision: 253938

URL: http://llvm.org/viewvc/llvm-project?rev=253938=rev
Log:
CodeGenFunction.h: Prune a \param in r253926. [-Wdocumentation]

Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=253938=253937=253938=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Mon Nov 23 17:38:13 2015
@@ -2621,9 +2621,6 @@ public:
   /// EmitCall - Generate a call of the given function, expecting the given
   /// result type, and using the given argument list which specifies both the
   /// LLVM arguments and the types they were derived from.
-  ///
-  /// \param TargetDecl - If given, the decl of the function in a direct call;
-  /// used to set attributes on the call (noreturn, etc.).
   RValue EmitCall(const CGFunctionInfo , llvm::Value *Callee,
   ReturnValueSlot ReturnValue, const CallArgList ,
   CGCalleeInfo CalleeInfo = CGCalleeInfo(),


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


Re: [PATCH] D14871: [Power PC] fix calculating address of arguments on stack for variadic functions

2015-11-23 Thread John McCall via cfe-commits
rjmccall added inline comments.


Comment at: lib/CodeGen/TargetInfo.cpp:3548
@@ +3547,3 @@
+llvm::Value *OverflowArgArea = OverflowArea.getPointer();
+uint32_t Align = CGF.getContext().getTypeAlignInChars(Ty).getQuantity();
+if (Align > 4) {

This patch applies to more types than just double.  You should probably add 
tests for some of the other cases, but if not, please at least make your commit 
message convey the intended generality.


Comment at: lib/CodeGen/TargetInfo.cpp:3549
@@ +3548,3 @@
+uint32_t Align = CGF.getContext().getTypeAlignInChars(Ty).getQuantity();
+if (Align > 4) {
+  // OverflowArgArea = (OverflowArgArea + Align - 1) & -Align;

if (Align > OverflowAreaAlign)


Comment at: lib/CodeGen/TargetInfo.cpp:3559
@@ +3558,3 @@
+   OverflowArgArea->getType(),
+   "overflow_arg_area.align");
+}

Would you mind extracting a function to do this realignment?  There are 3-4 
other places in this file that do exactly this.  Using the existing code 
pattern from emitVoidPtrDirectVAArg — i.e. using an add instead of a 
non-inbounds GEP — seems reasonable.

I think this is a sensible prototype:
  static Address emitRoundPointerUpToAlignment(CodeGenFunction , 
llvm::Value *Ptr, CharUnits Align, const llvm::Twine );


Comment at: lib/CodeGen/TargetInfo.cpp:3562
@@ -3549,1 +3561,3 @@
+ 
+OverflowArea = Address(OverflowArgArea, CharUnits::fromQuantity(Align));
 MemAddr = Builder.CreateElementBitCast(OverflowArea, DirectTy);

This code will be more readable if you keep Align as a CharUnits.


http://reviews.llvm.org/D14871



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


Re: [PATCH] D9888: [OPENMP] Driver support for OpenMP offloading

2015-11-23 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 41001.
sfantao added a comment.

Rebase.


http://reviews.llvm.org/D9888

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Driver/Action.h
  include/clang/Driver/CC1Options.td
  include/clang/Driver/Driver.h
  include/clang/Driver/Options.td
  include/clang/Driver/ToolChain.h
  include/clang/Driver/Types.h
  lib/Driver/Action.cpp
  lib/Driver/Compilation.cpp
  lib/Driver/Driver.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  lib/Driver/Types.cpp
  test/OpenMP/target_driver.c

Index: test/OpenMP/target_driver.c
===
--- /dev/null
+++ test/OpenMP/target_driver.c
@@ -0,0 +1,195 @@
+///
+/// Perform several driver tests for OpenMP offloading
+///
+
+/// ###
+
+/// Check whether an invalid OpenMP target is specified:
+// RUN:   %clang -### -fopenmp=libomp -omptargets=aaa-bbb-ccc-ddd %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-INVALID-TARGET %s
+// CHK-INVALID-TARGET: error: OpenMP target is invalid: 'aaa-bbb-ccc-ddd'
+
+/// ###
+
+/// Check warning for empty -omptargets
+// RUN:   %clang -### -fopenmp=libomp -omptargets=  %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-EMPTY-OMPTARGETS %s
+// CHK-EMPTY-OMPTARGETS: warning: joined argument expects additional value: '-omptargets='
+
+/// ###
+
+/// Check the phases graph when using a single target, different from the host.
+/// The actions should be exactly the same as if not offloading was being used.
+// RUN:   %clang -ccc-print-phases -fopenmp=libomp -target powerpc64-ibm-linux-gnu -omptargets=x86_64-pc-linux-gnu %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-PHASES %s
+
+// CHK-PHASES-DAG: {{.*}}: linker, {[[A0:[0-9]+]]}, image
+// CHK-PHASES-DAG: [[A0]]: assembler, {[[A1:[0-9]+]]}, object
+// CHK-PHASES-DAG: [[A1]]: backend, {[[A2:[0-9]+]]}, assembler
+// CHK-PHASES-DAG: [[A2]]: compiler, {[[A3:[0-9]+]]}, ir
+// CHK-PHASES-DAG: [[A3]]: preprocessor, {[[I:[0-9]+]]}, cpp-output
+// CHK-PHASES-DAG: [[I]]: input, {{.*}}, c
+
+/// ###
+
+/// Check the phases when using multiple targets. Again, the actions are the
+/// same as if no offloading was being used. Here we also add a library to make
+/// sure it is not treated as input.
+// RUN:   %clang -ccc-print-phases -lm -fopenmp=libomp -target powerpc64-ibm-linux-gnu -omptargets=x86_64-pc-linux-gnu,powerpc64-ibm-linux-gnu %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-PHASES-LIB %s
+
+// CHK-PHASES-LIB-DAG: {{.*}}: linker, {[[L0:[0-9]+]], [[A0:[0-9]+]]}, image
+// CHK-PHASES-LIB-DAG: [[A0]]: assembler, {[[A1:[0-9]+]]}, object
+// CHK-PHASES-LIB-DAG: [[A1]]: backend, {[[A2:[0-9]+]]}, assembler
+// CHK-PHASES-LIB-DAG: [[A2]]: compiler, {[[A3:[0-9]+]]}, ir
+// CHK-PHASES-LIB-DAG: [[A3]]: preprocessor, {[[I:[0-9]+]]}, cpp-output
+// CHK-PHASES-LIB-DAG: [[I]]: input, {{.*}}, c
+// CHK-PHASES-LIB-DAG: [[L0]]: input, "m", object
+
+/// ###
+
+/// Check the phases when using multiple targets and passing an object file as
+/// input. An unbundling action has to be created.
+// RUN:   echo 'bla' > %t.o
+// RUN:   %clang -ccc-print-phases -lm -fopenmp=libomp -target powerpc64-ibm-linux-gnu -omptargets=x86_64-pc-linux-gnu,powerpc64-ibm-linux-gnu %s %t.o 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-PHASES-OBJ %s
+
+// CHK-PHASES-OBJ-DAG: {{.*}}: linker, {[[L0:[0-9]+]], [[A0:[0-9]+]], [[B0:[0-9]+]]}, image
+// CHK-PHASES-OBJ-DAG: [[A0]]: assembler, {[[A1:[0-9]+]]}, object
+// CHK-PHASES-OBJ-DAG: [[A1]]: backend, {[[A2:[0-9]+]]}, assembler
+// CHK-PHASES-OBJ-DAG: [[A2]]: compiler, {[[A3:[0-9]+]]}, ir
+// CHK-PHASES-OBJ-DAG: [[A3]]: preprocessor, {[[I:[0-9]+]]}, cpp-output
+// CHK-PHASES-OBJ-DAG: [[I]]: input, {{.*}}, c
+// CHK-PHASES-OBJ-DAG: [[L0]]: input, "m", object
+// CHK-PHASES-OBJ-DAG: [[B0]]: clang-offload-unbundler, {[[B1:[0-9]+]]}, object
+// CHK-PHASES-OBJ-DAG: [[B1]]: input, "{{.*}}.o", object
+
+/// ###
+
+/// Check the phases when using multiple targets and separate compilation.
+// RUN:   echo 'bla' > %t.s
+// RUN:   %clang -ccc-print-phases -c -lm -fopenmp=libomp -target powerpc64-ibm-linux-gnu -omptargets=x86_64-pc-linux-gnu,powerpc64-ibm-linux-gnu %t.s -x cpp-output %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-PHASES-SEP %s
+
+// CHK-PHASES-SEP-DAG: [[A:[0-9]+]]: input, "{{.*}}.c", cpp-output
+// CHK-PHASES-SEP-DAG: [[A1:[0-9]+]]: clang-offload-unbundler, {[[A]]}, cpp-output
+// CHK-PHASES-SEP-DAG: [[A2:[0-9]+]]: compiler, {[[A1]]}, ir
+// CHK-PHASES-SEP-DAG: 

Re: [PATCH] D12614: [OpenMP] Offloading descriptor registration and device codegen.

2015-11-23 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 40992.
sfantao added a comment.

Rebase.


http://reviews.llvm.org/D12614

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Basic/LangOptions.def
  include/clang/Basic/LangOptions.h
  include/clang/Driver/CC1Options.td
  include/clang/Driver/Options.td
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp
  test/OpenMP/target_codegen.cpp
  test/OpenMP/target_codegen_global_capture.cpp
  test/OpenMP/target_codegen_registration.cpp
  test/OpenMP/target_codegen_registration_naming.cpp
  test/OpenMP/target_messages.cpp

Index: test/OpenMP/target_messages.cpp
===
--- test/OpenMP/target_messages.cpp
+++ test/OpenMP/target_messages.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -verify -fopenmp -std=c++11 -o - %s
+// RUN: not %clang_cc1 -fopenmp -std=c++11 -omptargets=aaa-bbb-ccc-ddd -o - %s 2>&1 | FileCheck %s
+// CHECK: error: OpenMP target is invalid: 'aaa-bbb-ccc-ddd'
 
 void foo() {
 }
Index: test/OpenMP/target_codegen_registration_naming.cpp
===
--- /dev/null
+++ test/OpenMP/target_codegen_registration_naming.cpp
@@ -0,0 +1,66 @@
+// Test host codegen.
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
+
+// Test target codegen - host bc file has to be created first.
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm %s -fopenmp-is-device -omp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s -check-prefix=TCHECK
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -std=c++11 -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-pch -fopenmp-is-device -omp-host-ir-file-path %t-ppc-host.bc -o %t %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -fopenmp-is-device -omp-host-ir-file-path %t-ppc-host.bc -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s -check-prefix=TCHECK
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-llvm-bc %s -o %t-x86-host.bc
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-llvm %s -fopenmp-is-device -omp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s -check-prefix=TCHECK
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-pch -fopenmp-is-device -omp-host-ir-file-path %t-x86-host.bc -o %t %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -fopenmp-is-device -omp-host-ir-file-path %t-x86-host.bc -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s -check-prefix=TCHECK
+
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+// CHECK: [[CA:%.+]] = type { i32* }
+
+// CHECK: define {{.*}}i32 @[[NNAME:.+]](i32 {{.*}}%{{.+}})
+int nested(int a){
+  // CHECK: call void @.omp_offloading.[[FILEID:[0-9a-f]+\.[0-9a-f]+]].[[NNAME]].l[[T1L:[0-9]+]].c[[T1C:[0-9]+]](
+  #pragma omp target
+++a;
+
+  // CHECK: call void @"[[LNAME:.+]]"([[CA]]*
+  auto F = [&](){
+#pragma omp parallel
+{
+  #pragma omp target
+  ++a;
+}
+  };
+
+  F();
+
+  return a;
+}
+
+// CHECK: define {{.*}}void @.omp_offloading.[[FILEID]].[[NNAME]].l[[T1L]].c[[T1C]](
+// TCHECK: define {{.*}}void @.omp_offloading.[[FILEID:[0-9a-f]+\.[0-9a-f]+]].[[NNAME:.+]].l[[T1L:[0-9]+]].c[[T1C:[0-9]+]](
+
+// CHECK: define {{.*}}void @"[[LNAME]]"(
+// CHECK: call void {{.*}}@__kmpc_fork_call{{.+}}[[PNAME:@.+]] to
+
+// CHECK: define {{.*}}void [[PNAME]](
+// CHECK: call void 

Some buildbot statistics for week of 11/15/2015 - 11/21/2015

2015-11-23 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 11/15/2015 -
11/21/2015.

Thanks

Galina



Number of commits by project:

 project   |   commits
---+---
 llvm  |   265
 cfe   |   110
 lldb  |58
 compiler-rt   |54
 lld   |26
 libcxx|10
 clang-tools-extra | 8
 openmp| 3
 polly | 1
 libcxxabi | 1
---+---
   536


Number of completed builds, failed builds and average build time for
successful builds per active builder:

 buildername   | completed  |
failed | time
-
 clang-aarch64-lnt | 53
|  6 | 02:40:15.18
 clang-atom-d525-fedora| 21
|| 07:14:59.173913
 clang-atom-d525-fedora-rel| 65
|  4 | 02:02:15.887097
 clang-bpf-build   |305
|  8 | 00:03:16.44
 clang-cmake-aarch64-42vma |280
| 25 | 00:17:52.3125
 clang-cmake-aarch64-quick |213
| 24 | 00:26:25.294737
 clang-cmake-armv7-a15 |214
|  5 | 00:27:35.090047
 clang-cmake-armv7-a15-full|148
|  5 | 00:50:27.543624
 clang-cmake-armv7-a15-selfhost| 32
|| 04:35:18.815789
 clang-cmake-armv7-a15-selfhost-neon   | 25
|| 05:55:48.655172
 clang-cmake-mips  |166
| 49 | 00:34:56.016807
 clang-cmake-thumbv7-a15   |194
|  5 | 00:33:18.020942
 clang-cmake-thumbv7-a15-full-sh   | 20
|| 07:05:34.65625
 clang-hexagon-elf |178
| 17 | 00:15:15.339506
 clang-native-aarch64-full | 10
|  4 | 11:35:13.428572
 clang-native-arm-lnt  |102
|| 01:19:37.824074
 clang-native-arm-lnt-perf | 15
|| 09:36:24.67
 clang-ppc64-elf-linux |124
|  3 | 01:01:54.130081
 clang-ppc64-elf-linux2| 86
|  7 | 01:35:15.481481
 clang-sphinx-docs | 79
|| 00:00:20.690476
 clang-x64-ninja-win7  |206
| 80 | 00:25:13.716535
 clang-x86-win2008-selfhost|150
| 14 | 00:41:25.621429
 clang-x86_64-darwin13-cross-arm   |240
|  2 | 00:19:46.411765
 clang-x86_64-darwin13-cross-mingw32   |226
|  3 | 00:23:14.026906
 clang-x86_64-debian-fast  | 99
| 11 | 00:10:49.21
 clang-x86_64-linux-abi-test   |307
| 11 | 00:18:46.837838
 clang-x86_64-linux-selfhost-modules   |267
| 23 | 00:15:56.662602
 clang-x86_64-ubuntu-gdb-75|138
|  5 | 00:52:25.182482
 libcxx-libcxxabi-arm-linux| 11
|  1 | 01:09:49.6
 libcxx-libcxxabi-singlethreaded-x86_64-linux-debian   |  3
|| 00:08:16.33
 libcxx-libcxxabi-x86_64-linux-debian  |  3
|| 00:08:41.33
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions |  3
|| 00:08:18.33
 libcxx-libcxxabi-x86_64-linux-ubuntu-asan | 10
|  1 | 00:07:25.56
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03| 10
|  1 | 00:04:56.33
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11| 11
|  1 | 00:05:11.5
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx14| 11
|  1 | 00:05:25.3
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx1z| 10
|  1 | 00:05:45.11
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan | 11
|  1 | 00:14:27.2
 libcxx-libcxxabi-x86_64-linux-ubuntu-tsan | 11
|  1 | 00:11:57.5
 

Re: [PATCH] D13909: clang-offload-bundler - offload files bundling/unbundling tool

2015-11-23 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 40999.
sfantao updated the summary for this revision.
sfantao added a comment.

Rebase.


http://reviews.llvm.org/D13909

Files:
  tools/CMakeLists.txt
  tools/Makefile
  tools/clang-offload-bundler/CMakeLists.txt
  tools/clang-offload-bundler/ClangOffloadBundler.cpp
  tools/clang-offload-bundler/Makefile

Index: tools/clang-offload-bundler/Makefile
===
--- /dev/null
+++ tools/clang-offload-bundler/Makefile
@@ -0,0 +1,21 @@
+##===- clang-offload-bundler/Makefile --*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===--===##
+
+CLANG_LEVEL := ../..
+
+TOOLNAME = clang-offload-bundler
+
+# No plugins, optimize startup time.
+TOOL_NO_EXPORTS = 1
+
+include $(CLANG_LEVEL)/../../Makefile.config
+LINK_COMPONENTS := $(TARGETS_TO_BUILD) support option
+USEDLIBS = clangBasic.a
+
+include $(CLANG_LEVEL)/Makefile
Index: tools/clang-offload-bundler/ClangOffloadBundler.cpp
===
--- /dev/null
+++ tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -0,0 +1,548 @@
+//===-- clang-offload-bundler/ClangOffloadBundler.cpp - Clang format tool -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+///
+/// \file
+/// \brief This file implements a clang-offload-bundler that bundles different
+/// files that relate with the same source code but different targets into a
+/// single one. Also the implements the opposite functionality, i.e. unbundle
+/// files previous created by this tool.
+///
+//===--===//
+
+#include "clang/Basic/FileManager.h"
+#include "clang/Basic/Version.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Signals.h"
+
+using namespace llvm;
+
+static cl::opt Help("h", cl::desc("Alias for -help"), cl::Hidden);
+
+// Mark all our options with this category, everything else (except for -version
+// and -help) will be hidden.
+static cl::OptionCategory
+ClangOffloadBundlerCategory("clang-offload-bundler options");
+
+static cl::list
+InputFileNames("inputs", cl::CommaSeparated, cl::OneOrMore,
+   cl::desc("[,...]"),
+   cl::cat(ClangOffloadBundlerCategory));
+static cl::list
+OutputFileNames("outputs", cl::CommaSeparated, cl::OneOrMore,
+cl::desc("[,...]"),
+cl::cat(ClangOffloadBundlerCategory));
+static cl::list TargetNames("targets", cl::CommaSeparated,
+ cl::OneOrMore,
+ cl::desc("[,...]"),
+ cl::cat(ClangOffloadBundlerCategory));
+static cl::opt
+FilesType("type", cl::Required,
+  cl::desc("Type of the files to be bundled/unbundled.\n"
+   "Current supported types are:\n"
+   "  i   - cpp-output\n"
+   "  ii  - c++-cpp-output\n"
+   "  ll  - llvm\n"
+   "  bc  - llvm-bc\n"
+   "  s   - assembler\n"
+   "  o   - object\n"
+   "  gch - precompiled-header"),
+  cl::cat(ClangOffloadBundlerCategory));
+static cl::opt
+Unbundle("unbundle",
+ cl::desc("Unbundle bundled file into several output files.\n"),
+ cl::init(false), cl::cat(ClangOffloadBundlerCategory));
+
+/// \brief Magic string that marks the existence of offloading data.
+#define OFFLOAD_BUNDLER_MAGIC_STR "__CLANG_OFFLOAD_BUNDLE__"
+
+/// \brief Generic file handler interface.
+class FileHandler {
+protected:
+  /// \brief Update the file handler with information from the header of the
+  /// bundled file
+  virtual void ReadHeader(MemoryBuffer ) = 0;
+  /// \brief Read the marker of the next bundled to be read in the file. The
+  /// triple of the target associated with that bundled is returned. An empty
+  /// string is returned if there are no more bundles to be read.
+  virtual StringRef ReadBundleStart(MemoryBuffer ) = 0;
+  /// \brief Read the marker that closes the current bundle.
+  virtual void ReadBundleEnd(MemoryBuffer ) = 0;
+  /// \brief Read the current bundle and write the result into the stream \a OS.
+  virtual void ReadBundle(raw_fd_ostream , MemoryBuffer ) = 0;
+
+  /// \brief Write the header of the bundled file to \a 

Re: [libcxx] Reinstate and fix overload sets to be const-correct wherever possible

2015-11-23 Thread Richard Smith via cfe-commits
Ping.

On Thu, Nov 5, 2015 at 6:32 PM, Richard Smith  wrote:

> Ping.
>
> On Thu, Oct 29, 2015 at 5:21 PM, Richard Smith 
> wrote:
>
>> Hi,
>>
>> The attached patch undoes the revert of r249929, and adds an extension to
>> allow  (and ) to work properly even in environments such
>> as iOS where the underlying libc does not provide C++'s const-correct
>> overloads of strchr and friends.
>>
>> This works as follows:
>>
>>  * The macro _LIBCPP_PREFERRED_OVERLOAD is, where possible, defined by
>> <__config> to an attribute that provides the following semantics:
>>- A function declaration with the attribute declares a different
>> function from a function declaration without the attribute.
>>- Overload resolution prefers a function with the attribute over a
>> function without.
>>  * For each of the functions that has a "broken" signature in C, if we
>> don't believe that the C library provided the C++ signatures, and we have a
>> _LIBCPP_PREFERRED_OVERLOAD, then we add the C++ declarations and mark them
>> as preferred over the C overloads.
>>  * The overloads provided in namespace std always exactly match those in
>> ::.
>>
>>
>> This results in the following changes in cases where the underlying libc
>> provides the C signature not the C++ one, compared to the status quo:
>>
>>
>> :
>>
>>   char *strchr(const char*, int) // #1
>>   char *strchr(char*, int) // #2
>>   const char *strchr(const char*, int) // #3
>>
>> We used to provide #1 and #2 in namespace std (in ) and only #1
>> in global namespace (in ).
>>
>> For a very old clang or non-clang compiler, we now have only #1 in both
>> places (note that #2 is essentially useless). This is unlikely to be a
>> visible change in real code, but it's slightly broken either way and we
>> can't fix it.
>>
>> For newer clang (3.6 onwards?), we now have correct signatures (#2 and
>> #3) in :: and std (depending on header). Taking address of strchr requires
>> ~trunk clang (but it didn't work before either, so this is not really a
>> regression).
>>
>>
>> :
>>
>>   wchar_t *wcschr(const wchar_t *, wchar_t) // #1
>>   const wchar_t *wcschr(const wchar_t *, wchar_t) // #2
>>   wchar_t *wcschr(wchar_t *, wchar_t) // #3
>>
>> We used to provide #1 in global namespace, and #2 and #3 in namespace
>> std. This broke code that uses 'using namespace std;'.
>>
>> For a very old clang or non-clang compiler, we now have #1 in global
>> namespace and namespace std. This fixes the ambiguity errors, but decreases
>> const-correctness in this case. On the whole, this seems like an
>> improvement to me.
>>
>> For newer clang, we now have correct signatures (#2 and #3) in :: and std
>> (depending on header). As above, taking address doesn't work unless you're
>> using very recent Clang (this is not a regression in ::, but is a
>> regression in namespace std).
>>
>>
>> To summarize, we previously had ad-hoc, inconsistent, slightly broken
>> rules for  and , and with this patch we fix the overload
>> set to give the exact C++ semantics where possible (for all recent versions
>> of Clang), and otherwise leave the C signatures alone.
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10834: Added functions to retrieve information about whether a vardecl is local in libclang and its python bindings.

2015-11-23 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 added a comment.

Ping


http://reviews.llvm.org/D10834



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


Re: [PATCH] D14864: [X86] Support for C calling convention only for MCU target.

2015-11-23 Thread Alexey Bataev via cfe-commits
ABataev updated this revision to Diff 41004.
ABataev added a comment.

Renamed MCU target class


http://reviews.llvm.org/D14864

Files:
  lib/Basic/Targets.cpp
  test/Sema/callingconv-iamcu.c

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -3391,11 +3391,6 @@
   }
   if (CPU >= CK_i586)
 Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
-
-  if (getTriple().isOSIAMCU()) {
-Builder.defineMacro("__iamcu");
-Builder.defineMacro("__iamcu__");
-  }
 }
 
 bool X86TargetInfo::hasFeature(StringRef Feature) const {
@@ -3644,11 +3639,6 @@
 IntPtrType = SignedInt;
 RegParmMax = 3;
 
-if (getTriple().isOSIAMCU()) {
-  LongDoubleWidth = 64;
-  LongDoubleFormat = ::APFloat::IEEEdouble;
-}
-
 // Use fpret for all types.
 RealTypeUsesObjCFPRet = ((1 << TargetInfo::Float) |
  (1 << TargetInfo::Double) |
@@ -3881,6 +3871,27 @@
   }
 };
 
+// X86-32 MCU target
+class MCUX86_32TargetInfo : public X86_32TargetInfo {
+public:
+  MCUX86_32TargetInfo(const llvm::Triple ) : X86_32TargetInfo(Triple) {
+LongDoubleWidth = 64;
+LongDoubleFormat = ::APFloat::IEEEdouble;
+  }
+
+  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
+// On MCU we support only C calling convention.
+return CC == CC_C ? CCCR_OK : CCCR_Warning;
+  }
+
+  void getTargetDefines(const LangOptions ,
+MacroBuilder ) const override {
+X86_32TargetInfo::getTargetDefines(Opts, Builder);
+Builder.defineMacro("__iamcu");
+Builder.defineMacro("__iamcu__");
+  }
+};
+
 // RTEMS Target
 template
 class RTEMSTargetInfo : public OSTargetInfo {
@@ -7769,6 +7780,8 @@
   return new RTEMSX86_32TargetInfo(Triple);
 case llvm::Triple::NaCl:
   return new NaClTargetInfo(Triple);
+case llvm::Triple::ELFIAMCU:
+  return new MCUX86_32TargetInfo(Triple);
 default:
   return new X86_32TargetInfo(Triple);
 }
Index: test/Sema/callingconv-iamcu.c
===
--- test/Sema/callingconv-iamcu.c
+++ test/Sema/callingconv-iamcu.c
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 %s -fsyntax-only -triple i686-intel-elfiamcu -verify
+
+void __attribute__((fastcall)) foo(float *a) { // expected-warning {{calling convention 'fastcall' ignored for this target}}
+}
+
+void __attribute__((stdcall)) bar(float *a) { // expected-warning {{calling convention 'stdcall' ignored for this target}}
+}
+
+void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{'fastcall' attribute takes no arguments}}
+}
+
+void __attribute__((fastcall)) test2(int a, ...) { // expected-warning {{calling convention 'fastcall' ignored for this target}}
+}
+void __attribute__((stdcall)) test3(int a, ...) { // expected-warning {{calling convention 'stdcall' ignored for this target}}
+}
+void __attribute__((thiscall)) test4(int a, ...) { // expected-warning {{calling convention 'thiscall' ignored for this target}}
+}
+
+void __attribute__((cdecl)) ctest0() {}
+
+void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{'cdecl' attribute takes no arguments}}
+
+void (__attribute__((fastcall)) *pfoo)(float*) = foo; // expected-warning {{calling convention 'fastcall' ignored for this target}}
+
+void (__attribute__((stdcall)) *pbar)(float*) = bar; // expected-warning {{calling convention 'stdcall' ignored for this target}}
+
+void (*pctest0)() = ctest0;
+
+void ctest2() {}
+void (__attribute__((cdecl)) *pctest2)() = ctest2;
+
+typedef void (__attribute__((fastcall)) *Handler) (float *); // expected-warning {{calling convention 'fastcall' ignored for this target}}
+Handler H = foo;
+
+int __attribute__((pcs("aapcs", "aapcs"))) pcs1(void); // expected-error {{'pcs' attribute takes one argument}}
+int __attribute__((pcs())) pcs2(void); // expected-error {{'pcs' attribute takes one argument}}
+int __attribute__((pcs(pcs1))) pcs3(void); // expected-error {{'pcs' attribute requires a string}} \
+   // expected-error {{invalid PCS type}}
+int __attribute__((pcs(0))) pcs4(void); // expected-error {{'pcs' attribute requires a string}}
+/* These are ignored because the target is i386 and not ARM */
+int __attribute__((pcs("aapcs"))) pcs5(void); // expected-warning {{calling convention 'pcs' ignored for this target}}
+int __attribute__((pcs("aapcs-vfp"))) pcs6(void); // expected-warning {{calling convention 'pcs' ignored for this target}}
+int __attribute__((pcs("foo"))) pcs7(void); // expected-error {{invalid PCS type}}
+
+void ctest3();
+void __attribute__((cdecl)) ctest3() {}
+
+typedef __attribute__((stdcall)) void (*PROC)(); // expected-warning {{calling convention 'stdcall' ignored for this target}}
+PROC __attribute__((cdecl)) ctest4(const char *x) {}
+
+void __attribute__((intel_ocl_bicc)) inteloclbifunc(float *a) {} // 

r253949 - Remove DataRecursiveASTVisitor; it no longer serves any purpose, since it's just an alias for RecursiveASTVisitor.

2015-11-23 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Nov 23 21:55:01 2015
New Revision: 253949

URL: http://llvm.org/viewvc/llvm-project?rev=253949=rev
Log:
Remove DataRecursiveASTVisitor; it no longer serves any purpose, since it's 
just an alias for RecursiveASTVisitor.

Removed:
cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
Modified:
cfe/trunk/docs/InternalsManual.rst
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
cfe/trunk/tools/libclang/IndexBody.cpp
cfe/trunk/tools/libclang/IndexTypeSourceInfo.cpp

Modified: cfe/trunk/docs/InternalsManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/InternalsManual.rst?rev=253949=253948=253949=diff
==
--- cfe/trunk/docs/InternalsManual.rst (original)
+++ cfe/trunk/docs/InternalsManual.rst Mon Nov 23 21:55:01 2015
@@ -1995,7 +1995,7 @@ are similar.
* Make sure that ``children()`` visits all of the subexpressions.  This is
  important for a number of features (e.g., IDE support, C++ variadic
  templates).  If you have sub-types, you'll also need to visit those
- sub-types in ``RecursiveASTVisitor`` and ``DataRecursiveASTVisitor``.
+ sub-types in ``RecursiveASTVisitor``.
* Add printing support (``StmtPrinter.cpp``) for your expression.
* Add profiling support (``StmtProfile.cpp``) for your AST node, noting the
  distinguishing (non-source location) characteristics of an instance of

Removed: cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h?rev=253948=auto
==
--- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (removed)
@@ -1,22 +0,0 @@
-//===--- DataRecursiveASTVisitor.h - Data-Recursive AST Visitor -*- C++ 
-*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-//
-//  This file provides a legacy name for the RecursiveASTVisitor.
-//
-//===--===//
-#ifndef LLVM_CLANG_AST_DATARECURSIVEASTVISITOR_H
-#define LLVM_CLANG_AST_DATARECURSIVEASTVISITOR_H
-
-#include "clang/AST/RecursiveASTVisitor.h"
-
-namespace clang {
-template struct DataRecursiveASTVisitor : RecursiveASTVisitor 
{};
-} // end namespace clang
-
-#endif // LLVM_CLANG_LIBCLANG_RECURSIVEASTVISITOR_H

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=253949=253948=253949=diff
==
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Nov 23 21:55:01 2015
@@ -15,7 +15,7 @@
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTMutationListener.h"
-#include "clang/AST/DataRecursiveASTVisitor.h"
+#include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprObjC.h"
@@ -4566,7 +4566,7 @@ namespace {
   /// Used by Sema::DiagnoseUnusedBackingIvarInAccessor to check if a property
   /// accessor references the backing ivar.
   class UnusedBackingIvarChecker :
-  public DataRecursiveASTVisitor {
+  public RecursiveASTVisitor {
   public:
 Sema 
 const ObjCMethodDecl *Method;

Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=253949=253948=253949=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Mon Nov 23 
21:55:01 2015
@@ -14,7 +14,7 @@
 #include "clang/StaticAnalyzer/Frontend/AnalysisConsumer.h"
 #include "ModelInjector.h"
 #include "clang/AST/ASTConsumer.h"
-#include "clang/AST/DataRecursiveASTVisitor.h"
+#include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclObjC.h"
@@ -141,7 +141,7 @@ public:
 namespace {
 
 class AnalysisConsumer : public AnalysisASTConsumer,
- public DataRecursiveASTVisitor {
+ public RecursiveASTVisitor {
   enum {
 AM_None = 0,
 AM_Syntax = 0x1,

Modified: cfe/trunk/tools/libclang/IndexBody.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexBody.cpp?rev=253949=253948=253949=diff

r253958 - Reduce the stack usage per recursive step when RecursiveASTVisitor cannot perform data recursion.

2015-11-23 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Nov 24 01:13:06 2015
New Revision: 253958

URL: http://llvm.org/viewvc/llvm-project?rev=253958=rev
Log:
Reduce the stack usage per recursive step when RecursiveASTVisitor cannot 
perform data recursion.

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

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=253958=253957=253958=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 01:13:06 2015
@@ -471,28 +471,10 @@ private:
   /// \brief Process clauses with list of variables.
   template  bool VisitOMPClauseList(T *Node);
 
-  bool dataTraverse(Stmt *S);
   bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue);
 };
 
 template 
-bool RecursiveASTVisitor::dataTraverse(Stmt *S) {
-  SmallVector Queue;
-  Queue.push_back(S);
-
-  while (!Queue.empty()) {
-Stmt *CurrS = Queue.pop_back_val();
-
-size_t N = Queue.size();
-TRY_TO(dataTraverseNode(CurrS, ));
-// Process new children in the order they were added.
-std::reverse(Queue.begin() + N, Queue.end());
-  }
-
-  return true;
-}
-
-template 
 bool RecursiveASTVisitor::dataTraverseNode(Stmt *S,
 DataRecursionQueue *Queue) 
{
 #define DISPATCH_STMT(NAME, CLASS, VAR)
\
@@ -561,10 +543,23 @@ bool RecursiveASTVisitor::Trave
   ::TraverseStmt>::value)
 return dataTraverseNode(S, nullptr);
 
-  if (!Queue)
-return dataTraverse(S);
+  if (Queue) {
+Queue->push_back(S);
+return true;
+  }
+
+  SmallVector LocalQueue;
+  LocalQueue.push_back(S);
+
+  while (!LocalQueue.empty()) {
+Stmt *CurrS = LocalQueue.pop_back_val();
+
+size_t N = LocalQueue.size();
+TRY_TO(dataTraverseNode(CurrS, ));
+// Process new children in the order they were added.
+std::reverse(LocalQueue.begin() + N, LocalQueue.end());
+  }
 
-  Queue->push_back(S);
   return true;
 }
 


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


Re: [PATCH] D14919: Fix IssueHash generation

2015-11-23 Thread Gyorgy Orban via cfe-commits
o.gyorgy updated this revision to Diff 40920.
o.gyorgy added a comment.

Regenerate patch with context and clang format HTMLDiagnostics.cpp.


http://reviews.llvm.org/D14919

Files:
  include/clang/StaticAnalyzer/Core/IssueHash.h
  lib/Basic/SourceManager.cpp
  lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
  lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
  lib/StaticAnalyzer/Core/IssueHash.cpp
  lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
  test/Analysis/bug_hash_test.cpp
  test/Analysis/diagnostics/report-issues-within-main-file.cpp

Index: test/Analysis/diagnostics/report-issues-within-main-file.cpp
===
--- test/Analysis/diagnostics/report-issues-within-main-file.cpp
+++ test/Analysis/diagnostics/report-issues-within-main-file.cpp
@@ -949,7 +949,7 @@
 // CHECK-NEXT:   typeBad deallocator
 // CHECK-NEXT:   check_nameunix.MismatchedDeallocator
 // CHECK-NEXT:   
-// CHECK-NEXT:   issue_hash_content_of_line_in_contextf21ac032efaa3d1459a5ed31f0ad44f0
+// CHECK-NEXT:   issue_hash_content_of_line_in_contextf689fbd54138491e228f0f89bb02bfb2
 // CHECK-NEXT:  issue_context_kindfunction
 // CHECK-NEXT:  issue_contextmainPlusHeader
 // CHECK-NEXT:  issue_hash_function_offset2
Index: test/Analysis/bug_hash_test.cpp
===
--- test/Analysis/bug_hash_test.cpp
+++ test/Analysis/bug_hash_test.cpp
@@ -288,17 +288,17 @@
 // CHECK-NEXT: 
 // CHECK-NEXT: depth0
 // CHECK-NEXT: extended_message
-// CHECK-NEXT: debug.DumpBugHash$int f()$28$namespaceAA{$debug
+// CHECK-NEXT: debug.DumpBugHash$int f()$28$constexprintf(){return5;}$debug
 // CHECK-NEXT: message
-// CHECK-NEXT: debug.DumpBugHash$int f()$28$namespaceAA{$debug
+// CHECK-NEXT: debug.DumpBugHash$int f()$28$constexprintf(){return5;}$debug
 // CHECK-NEXT:
 // CHECK-NEXT:   
-// CHECK-NEXT:   descriptiondebug.DumpBugHash$int f()$28$namespaceAA{$debug
+// CHECK-NEXT:   descriptiondebug.DumpBugHash$int f()$28$constexprintf(){return5;}$debug
 // CHECK-NEXT:   categorydebug
 // CHECK-NEXT:   typeDump hash components
 // CHECK-NEXT:   check_namedebug.DumpBugHash
 // CHECK-NEXT:   
-// CHECK-NEXT:   issue_hash_content_of_line_in_contextf8ee38da3de42e209c4afa886b5531ab
+// CHECK-NEXT:   issue_hash_content_of_line_in_contextf5471f52854dc14167fe96db50c4ba5f
 // CHECK-NEXT:  issue_context_kindfunction
 // CHECK-NEXT:  issue_contextf
 // CHECK-NEXT:  issue_hash_function_offset0
Index: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
===
--- lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
+++ lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
@@ -399,7 +399,7 @@
 *SM);
 const Decl *DeclWithIssue = D->getDeclWithIssue();
 EmitString(o, GetIssueHash(*SM, L, D->getCheckName(), D->getBugType(),
-   DeclWithIssue))
+   DeclWithIssue, LangOpts))
 << '\n';
 
 // Output information about the semantic context where
Index: lib/StaticAnalyzer/Core/IssueHash.cpp
===
--- lib/StaticAnalyzer/Core/IssueHash.cpp
+++ lib/StaticAnalyzer/Core/IssueHash.cpp
@@ -127,14 +127,13 @@
 }
 
 static std::string NormalizeLine(const SourceManager , FullSourceLoc ,
- const Decl *D) {
+ const LangOptions ) {
   static StringRef Whitespaces = " \t\n";
 
-  const LangOptions  = D->getASTContext().getLangOpts();
   StringRef Str = GetNthLineOfFile(SM.getBuffer(L.getFileID(), L),
L.getExpansionLineNumber());
   unsigned col = Str.find_first_not_of(Whitespaces);
-
+  col++;
   SourceLocation StartOfLine =
   SM.translateLineCol(SM.getFileID(L), L.getExpansionLineNumber(), col);
   llvm::MemoryBuffer *Buffer =
@@ -145,7 +144,7 @@
   const char *BufferPos = SM.getCharacterData(StartOfLine);
 
   Token Token;
-  Lexer Lexer(SM.getLocForStartOfFile(SM.getFileID(StartOfLine)), Opts,
+  Lexer Lexer(SM.getLocForStartOfFile(SM.getFileID(StartOfLine)), LangOpts,
   Buffer->getBufferStart(), BufferPos, Buffer->getBufferEnd());
 
   size_t NextStart = 0;
@@ -175,20 +174,23 @@
 std::string clang::GetIssueString(const SourceManager ,
   FullSourceLoc ,
   StringRef CheckerName, StringRef BugType,
-  const Decl *D) {
+  const Decl *D,
+  const LangOptions ) {
   static StringRef Delimiter = "$";
 
   return (llvm::Twine(CheckerName) + Delimiter +
   GetEnclosingDeclContextSignature(D) + Delimiter +
   llvm::utostr(IssueLoc.getExpansionColumnNumber()) + Delimiter +
-  NormalizeLine(SM, IssueLoc, D) + Delimiter + BugType)
+  NormalizeLine(SM, IssueLoc, LangOpts) + 

[PATCH] D14927: clang-format: Add SpaceBeforeTemplateParameterList option

2015-11-23 Thread Nico Rieck via cfe-commits
nrieck created this revision.
nrieck added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

Adds an option to control whether a space is inserted between "template" and 
"<". Currently a space is always inserted (as the LLVM style requires), but to 
me this seems like the less popular option.

Looking at a few files from Mozilla and Chromium they seem to also skip the 
space. Should this option be disabled for their styles?

http://reviews.llvm.org/D14927

Files:
  include/clang/Format/Format.h
  lib/Format/Format.cpp
  lib/Format/TokenAnnotator.cpp

Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -1826,9 +1826,10 @@
: Style.SpacesInParentheses;
   if (Right.isOneOf(tok::semi, tok::comma))
 return false;
+  if (Right.is(tok::less) && Left.is(tok::kw_template))
+return Style.SpaceBeforeTemplateParameterList;
   if (Right.is(tok::less) &&
-  (Left.is(tok::kw_template) ||
-   (Line.Type == LT_ObjCDecl && Style.ObjCSpaceBeforeProtocolList)))
+  (Line.Type == LT_ObjCDecl && Style.ObjCSpaceBeforeProtocolList))
 return true;
   if (Left.isOneOf(tok::exclaim, tok::tilde))
 return false;
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -290,6 +290,8 @@
 IO.mapOptional("SpaceBeforeAssignmentOperators",
Style.SpaceBeforeAssignmentOperators);
 IO.mapOptional("SpaceBeforeParens", Style.SpaceBeforeParens);
+IO.mapOptional("SpaceBeforeTemplateParameterList",
+   Style.SpaceBeforeTemplateParameterList);
 IO.mapOptional("SpaceInEmptyParentheses", Style.SpaceInEmptyParentheses);
 IO.mapOptional("SpacesBeforeTrailingComments",
Style.SpacesBeforeTrailingComments);
@@ -497,6 +499,7 @@
   LLVMStyle.SpacesInCStyleCastParentheses = false;
   LLVMStyle.SpaceAfterCStyleCast = false;
   LLVMStyle.SpaceBeforeParens = FormatStyle::SBPO_ControlStatements;
+  LLVMStyle.SpaceBeforeTemplateParameterList = true;
   LLVMStyle.SpaceBeforeAssignmentOperators = true;
   LLVMStyle.SpacesInAngles = false;
 
Index: include/clang/Format/Format.h
===
--- include/clang/Format/Format.h
+++ include/clang/Format/Format.h
@@ -495,6 +495,10 @@
   /// \brief Defines in which cases to put a space before opening parentheses.
   SpaceBeforeParensOptions SpaceBeforeParens;
 
+  /// If \c true, a space is inserted between 'template' and the opening angle
+  /// bracket of a template parameter list.
+  bool SpaceBeforeTemplateParameterList;
+
   /// \brief If \c true, spaces may be inserted into '()'.
   bool SpaceInEmptyParentheses;
 
@@ -622,6 +626,8 @@
SpaceAfterCStyleCast == R.SpaceAfterCStyleCast &&
SpaceBeforeAssignmentOperators == R.SpaceBeforeAssignmentOperators 
&&
SpaceBeforeParens == R.SpaceBeforeParens &&
+   SpaceBeforeTemplateParameterList ==
+   R.SpaceBeforeTemplateParameterList &&
SpaceInEmptyParentheses == R.SpaceInEmptyParentheses &&
SpacesBeforeTrailingComments == R.SpacesBeforeTrailingComments &&
SpacesInAngles == R.SpacesInAngles &&


Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -1826,9 +1826,10 @@
: Style.SpacesInParentheses;
   if (Right.isOneOf(tok::semi, tok::comma))
 return false;
+  if (Right.is(tok::less) && Left.is(tok::kw_template))
+return Style.SpaceBeforeTemplateParameterList;
   if (Right.is(tok::less) &&
-  (Left.is(tok::kw_template) ||
-   (Line.Type == LT_ObjCDecl && Style.ObjCSpaceBeforeProtocolList)))
+  (Line.Type == LT_ObjCDecl && Style.ObjCSpaceBeforeProtocolList))
 return true;
   if (Left.isOneOf(tok::exclaim, tok::tilde))
 return false;
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -290,6 +290,8 @@
 IO.mapOptional("SpaceBeforeAssignmentOperators",
Style.SpaceBeforeAssignmentOperators);
 IO.mapOptional("SpaceBeforeParens", Style.SpaceBeforeParens);
+IO.mapOptional("SpaceBeforeTemplateParameterList",
+   Style.SpaceBeforeTemplateParameterList);
 IO.mapOptional("SpaceInEmptyParentheses", Style.SpaceInEmptyParentheses);
 IO.mapOptional("SpacesBeforeTrailingComments",
Style.SpacesBeforeTrailingComments);
@@ -497,6 +499,7 @@
   LLVMStyle.SpacesInCStyleCastParentheses = false;
   LLVMStyle.SpaceAfterCStyleCast = false;
   LLVMStyle.SpaceBeforeParens = FormatStyle::SBPO_ControlStatements;
+  LLVMStyle.SpaceBeforeTemplateParameterList = true;
   

r253873 - clang-format: Signficantly refactor the cast detection.

2015-11-23 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Nov 23 09:55:55 2015
New Revision: 253873

URL: http://llvm.org/viewvc/llvm-project?rev=253873=rev
Log:
clang-format: Signficantly refactor the cast detection.

No functional changes intended.

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

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=253873=253872=253873=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Nov 23 09:55:55 2015
@@ -1057,74 +1057,85 @@ private:
 
   /// \brief Determine whether ')' is ending a cast.
   bool rParenEndsCast(const FormatToken ) {
-FormatToken *LeftOfParens = nullptr;
-if (Tok.MatchingParen)
-  LeftOfParens = Tok.MatchingParen->getPreviousNonComment();
+// C-style casts are only used in C++ and Java.
+if (Style.Language != FormatStyle::LK_Cpp &&
+Style.Language != FormatStyle::LK_Java)
+  return false;
 
+// Empty parens aren't casts and there are no casts at the end of the line.
+if (Tok.Previous == Tok.MatchingParen || !Tok.Next || !Tok.MatchingParen)
+  return false;
+
+FormatToken *LeftOfParens = Tok.MatchingParen->getPreviousNonComment();
 if (LeftOfParens) {
+  // If there is an identifier (or with a few exceptions a keyword) right
+  // before the parentheses, this is unlikely to be a cast.
   if (LeftOfParens->Tok.getIdentifierInfo() &&
   !LeftOfParens->isOneOf(Keywords.kw_in, tok::kw_return, tok::kw_case,
  tok::kw_delete))
 return false;
-  if (LeftOfParens->isOneOf(tok::kw_sizeof, tok::kw_alignof, tok::at,
-tok::r_square, TT_OverloadedOperator,
+
+  // Certain other tokens right before the parentheses are also signals 
that
+  // this cannot be a cast.
+  if (LeftOfParens->isOneOf(tok::at, tok::r_square, TT_OverloadedOperator,
 TT_TemplateCloser))
 return false;
-  if (LeftOfParens->is(tok::r_paren) && LeftOfParens->MatchingParen)
-LeftOfParens = LeftOfParens->MatchingParen->Previous;
 }
-if (Tok.Next) {
-  if (Tok.Next->is(tok::question))
-return false;
-  if (Style.Language == FormatStyle::LK_JavaScript &&
-  Tok.Next->is(Keywords.kw_in))
-return false;
-  if (Style.Language == FormatStyle::LK_Java && Tok.Next->is(tok::l_paren))
-return true;
-}
-bool IsCast = false;
-bool ParensAreEmpty = Tok.Previous == Tok.MatchingParen;
+
+if (Tok.Next->is(tok::question))
+  return false;
+
+// As Java has no function types, a "(" after the ")" likely means that 
this
+// is a cast.
+if (Style.Language == FormatStyle::LK_Java && Tok.Next->is(tok::l_paren))
+  return true;
+
+// If a (non-string) literal follows, this is likely a cast.
+if (Tok.Next->isNot(tok::string_literal) &&
+(Tok.Next->Tok.isLiteral() ||
+ Tok.Next->isOneOf(tok::kw_sizeof, tok::kw_alignof)))
+  return true;
+
+// Heuristically try to determine whether the parentheses contain a type.
 bool ParensAreType =
 !Tok.Previous ||
 Tok.Previous->isOneOf(TT_PointerOrReference, TT_TemplateCloser) ||
 Tok.Previous->isSimpleTypeSpecifier();
 bool ParensCouldEndDecl =
-Tok.Next &&
 Tok.Next->isOneOf(tok::equal, tok::semi, tok::l_brace, tok::greater);
 if (ParensAreType && !ParensCouldEndDecl &&
 (Contexts.size() > 1 && Contexts[Contexts.size() - 2].IsExpression))
-  IsCast = true;
-else if (Tok.Next && Tok.Next->isNot(tok::string_literal) &&
- (Tok.Next->Tok.isLiteral() ||
-  Tok.Next->isOneOf(tok::kw_sizeof, tok::kw_alignof)))
-  IsCast = true;
-else if (LeftOfParens && Tok.Next) {
-  if (Tok.Next->isOneOf(tok::identifier, tok::numeric_constant)) {
-IsCast = true;
-  } else {
-// Use heuristics to recognize c style casting.
-FormatToken *Prev = Tok.Previous;
-if (Prev && Prev->isOneOf(tok::amp, tok::star))
-  Prev = Prev->Previous;
-
-if (Prev && Tok.Next && Tok.Next->Next) {
-  bool NextIsUnary = Tok.Next->isUnaryOperator() ||
- Tok.Next->isOneOf(tok::amp, tok::star);
-  IsCast =
-  NextIsUnary && !Tok.Next->is(tok::plus) &&
-  Tok.Next->Next->isOneOf(tok::identifier, tok::numeric_constant);
-}
-
-for (; Prev != Tok.MatchingParen; Prev = Prev->Previous) {
-  if (!Prev ||
-  !Prev->isOneOf(tok::kw_const, tok::identifier, tok::coloncolon)) 
{
-IsCast = false;
-break;
-  }
-}
-  }
+  return true;
+
+// At this point, we heuristically assume that there are no casts at the
+// 

r253874 - Revert part of r253813

2015-11-23 Thread Martell Malone via cfe-commits
Author: martell
Date: Mon Nov 23 10:04:55 2015
New Revision: 253874

URL: http://llvm.org/viewvc/llvm-project?rev=253874=rev
Log:
Revert part of r253813
The new lld gnu frontend does not support the -target option

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

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253874=253873=253874=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Nov 23 10:04:55 2015
@@ -9479,13 +9479,6 @@ void MinGW::Linker::ConstructJob(Compila
   if (LinkerName.equals_lower("lld")) {
 CmdArgs.push_back("-flavor");
 CmdArgs.push_back("gnu");
-CmdArgs.push_back("-target");
-if (TC.getArch() == llvm::Triple::x86)
-  CmdArgs.push_back("i686--windows-gnu");
-if (TC.getArch() == llvm::Triple::x86_64)
-  CmdArgs.push_back("x86_64--windows-gnu");
-if (TC.getArch() == llvm::Triple::arm)
-  CmdArgs.push_back("armv7--windows-gnu");
   } else if (!LinkerName.equals_lower("ld")) {
 D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
   }


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


Re: r253813 - Driver: Specifically tell the linker the target for mingw-w64

2015-11-23 Thread Martell Malone via cfe-commits
>
> This changes the linker from old-gnu to gnu. Are you sure you want to
> that?

Originally I didn't actually mean to commit that. I had been working on
some stuff locally.
Pointing to the new one should be fine as neither work for COFF atm anyway
so no point in having it point to the old one.
I'll make lld more verbose about this when it receives this emulation
target.

> I don't think the new linker takes a -target option. In any
> case, it needs a test.

You are correct the new linker does not support -target. I reverted this in
rL253874.


On Mon, Nov 23, 2015 at 7:05 AM, Rafael Espíndola <
rafael.espind...@gmail.com> wrote:

> This changes the linker from old-gnu to gnu. Are you sure you want to
> that? I don't think the new linker takes a -target option. In any
> case, it needs a test.
>
> Cheers,
> Rafael
>
>
> On 22 November 2015 at 00:40, Martell Malone via cfe-commits
>  wrote:
> > Author: martell
> > Date: Sat Nov 21 23:40:06 2015
> > New Revision: 253813
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=253813=rev
> > Log:
> > Driver: Specifically tell the linker the target for mingw-w64
> >
> > Cross compiling from linux and OSX results in Error: Exec format.
> > This is because the linker is expecting ELF formated objects.
> > By passing the target we can explicitly tell the linker that
> > it should be linking COFF objects regardless of the host.
> >
> > Modified:
> > cfe/trunk/lib/Driver/Tools.cpp
> >
> > Modified: cfe/trunk/lib/Driver/Tools.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253813=253812=253813=diff
> >
> ==
> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
> > +++ cfe/trunk/lib/Driver/Tools.cpp Sat Nov 21 23:40:06 2015
> > @@ -9478,7 +9478,14 @@ void MinGW::Linker::ConstructJob(Compila
> >StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ,
> "ld");
> >if (LinkerName.equals_lower("lld")) {
> >  CmdArgs.push_back("-flavor");
> > -CmdArgs.push_back("old-gnu");
> > +CmdArgs.push_back("gnu");
> > +CmdArgs.push_back("-target");
> > +if (TC.getArch() == llvm::Triple::x86)
> > +  CmdArgs.push_back("i686--windows-gnu");
> > +if (TC.getArch() == llvm::Triple::x86_64)
> > +  CmdArgs.push_back("x86_64--windows-gnu");
> > +if (TC.getArch() == llvm::Triple::arm)
> > +  CmdArgs.push_back("armv7--windows-gnu");
> >} else if (!LinkerName.equals_lower("ld")) {
> >  D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
> >}
> >
> >
> > ___
> > 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


[PATCH] D14926: Use libcxx's default rune table with the Musl C library.

2015-11-23 Thread Vasileios Kalintiris via cfe-commits
vkalintiris created this revision.
vkalintiris added reviewers: mclow.lists, jroelofs, EricWF, dalias.
vkalintiris added a subscriber: cfe-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

Also, there are no exported character type tables from Musl so we have to
Fallback to the standard functions. This reduces the number of libcxx's
test-suite failures down to ~130 for MIPS. Most of the remaining failures
come from the atomics (due to the lack of 8-byte atomic-ops in MIPS32) and
thread tests.

http://reviews.llvm.org/D14926

Files:
  include/__config
  include/__locale
  src/locale.cpp

Index: src/locale.cpp
===
--- src/locale.cpp
+++ src/locale.cpp
@@ -813,7 +813,7 @@
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 return isascii(c) ? ctype::__classic_upper_table()[c] : c;
 #else
 return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c;
@@ -827,7 +827,7 @@
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 *low = isascii(*low) ? ctype::__classic_upper_table()[*low]
  : *low;
 #else
@@ -842,7 +842,7 @@
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 return isascii(c) ? ctype::__classic_lower_table()[c] : c;
 #else
 return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
@@ -856,7 +856,7 @@
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 *low = isascii(*low) ? ctype::__classic_lower_table()[*low]
  : *low;
 #else
@@ -925,7 +925,7 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_upper_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
 return isascii(c) ?
   static_cast(__classic_upper_table()[static_cast(c)]) : c;
 #else
@@ -942,7 +942,7 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_upper_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
 *low = isascii(*low) ?
   static_cast(__classic_upper_table()[static_cast(*low)]) : *low;
 #else
@@ -959,7 +959,7 @@
   static_cast(_DefaultRuneLocale.__maplower[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_lower_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
 return isascii(c) ?
   static_cast(__classic_lower_table()[static_cast(c)]) : c;
 #else
@@ -975,7 +975,7 @@
 *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_lower_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
 *low = isascii(*low) ? static_cast(__classic_lower_table()[static_cast(*low)]) : *low;
 #else
 *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'A'+'a' : *low;
@@ -1016,7 +1016,7 @@
 return low;
 }
 
-#if defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#if defined(__EMSCRIPTEN__)
 extern "C" const unsigned short ** __ctype_b_loc();
 extern "C" const int ** __ctype_tolower_loc();
 extern "C" const int ** __ctype_toupper_loc();
@@ -1118,7 +1118,7 @@
 return _ctype+1; // internal ctype mask table defined in msvcrt.dll
 // This is assumed to be safe, which is a nonsense assumption because we're
 // going to end up dereferencing it later...
-#elif defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__EMSCRIPTEN__)
 return *__ctype_b_loc();
 #elif defined(_NEWLIB_VERSION)
 // Newlib has a 257-entry table in ctype_.c, where (char)0 starts at [1].
@@ -1161,7 +1161,7 @@
 

Re: [PATCH] D14926: Use libcxx's default rune table with the Musl C library.

2015-11-23 Thread Jonathan Roelofs via cfe-commits
jroelofs accepted this revision.
jroelofs added a comment.
This revision is now accepted and ready to land.

LGTM



Comment at: include/__locale:411-415
@@ -410,7 +410,3 @@
 #else
-#if defined(_LIBCPP_HAS_MUSL_LIBC)
-typedef unsigned short mask;
-#else
 typedef unsigned long mask;
-#endif
 static const mask space  = 1<<0;

vkalintiris wrote:
> Which typedef should we choose for mask?
If you're using libcxx's table, you should use `typedef unsigned long mask`.


http://reviews.llvm.org/D14926



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


Re: [PATCH] D14926: Use libcxx's default rune table with the Musl C library.

2015-11-23 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a comment.

@dalias: Can you take a correctness-look at this patch?



Comment at: include/__locale:411-415
@@ -410,7 +410,3 @@
 #else
-#if defined(_LIBCPP_HAS_MUSL_LIBC)
-typedef unsigned short mask;
-#else
 typedef unsigned long mask;
-#endif
 static const mask space  = 1<<0;

Which typedef should we choose for mask?


http://reviews.llvm.org/D14926



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


Re: [PATCH] D14927: clang-format: Add SpaceBeforeTemplateParameterList option

2015-11-23 Thread Daniel Jasper via cfe-commits
djasper added a subscriber: djasper.
djasper added a comment.

This has come up before (read up on the list) and the decision is not to 
support it. In short, this is so un-important, that it is not worth a 
configuration option.


http://reviews.llvm.org/D14927



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


r253871 - clang-format: If the template list of a variable declaration spans

2015-11-23 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Nov 23 09:55:45 2015
New Revision: 253871

URL: http://llvm.org/viewvc/llvm-project?rev=253871=rev
Log:
clang-format: If the template list of a variable declaration spans
multiple lines, also break before the variable name.

Before:
  std::vector aaa;

After:
  std::vector
  aaa;

Modified:
cfe/trunk/lib/Format/ContinuationIndenter.cpp
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=253871=253870=253871=diff
==
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original)
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Mon Nov 23 09:55:45 2015
@@ -144,6 +144,7 @@ bool ContinuationIndenter::mustBreak(con
   if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
 return true;
   if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) ||
+   (Previous.is(TT_TemplateCloser) && Current.is(TT_StartOfName)) ||
(Style.BreakBeforeTernaryOperators && Current.is(TT_ConditionalExpr) &&
 Previous.isNot(tok::question)) ||
(!Style.BreakBeforeTernaryOperators &&

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=253871=253870=253871=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Nov 23 09:55:45 2015
@@ -4080,7 +4080,8 @@ TEST_F(FormatTest, FormatsOneParameterPe
 
   verifyFormat("std::vector aa;",
+   "aaa>\n"
+   "aa;",
NoBinPacking);
   verifyFormat("a(\"a\"\n"
"  \"a\",\n"


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


Re: r253813 - Driver: Specifically tell the linker the target for mingw-w64

2015-11-23 Thread Rafael Espíndola via cfe-commits
This changes the linker from old-gnu to gnu. Are you sure you want to
that? I don't think the new linker takes a -target option. In any
case, it needs a test.

Cheers,
Rafael


On 22 November 2015 at 00:40, Martell Malone via cfe-commits
 wrote:
> Author: martell
> Date: Sat Nov 21 23:40:06 2015
> New Revision: 253813
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253813=rev
> Log:
> Driver: Specifically tell the linker the target for mingw-w64
>
> Cross compiling from linux and OSX results in Error: Exec format.
> This is because the linker is expecting ELF formated objects.
> By passing the target we can explicitly tell the linker that
> it should be linking COFF objects regardless of the host.
>
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253813=253812=253813=diff
> ==
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Sat Nov 21 23:40:06 2015
> @@ -9478,7 +9478,14 @@ void MinGW::Linker::ConstructJob(Compila
>StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
>if (LinkerName.equals_lower("lld")) {
>  CmdArgs.push_back("-flavor");
> -CmdArgs.push_back("old-gnu");
> +CmdArgs.push_back("gnu");
> +CmdArgs.push_back("-target");
> +if (TC.getArch() == llvm::Triple::x86)
> +  CmdArgs.push_back("i686--windows-gnu");
> +if (TC.getArch() == llvm::Triple::x86_64)
> +  CmdArgs.push_back("x86_64--windows-gnu");
> +if (TC.getArch() == llvm::Triple::arm)
> +  CmdArgs.push_back("armv7--windows-gnu");
>} else if (!LinkerName.equals_lower("ld")) {
>  D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
>}
>
>
> ___
> 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] D14872: PR25575: Make GCC 4.4+ comatible layout for packed bit-fileds of char type

2015-11-23 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin added a comment.

It seems that check for type alignment <= 8 was there practically forever 
http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?r1=47197=47196=47197
 and there is no good explanation why it was implemented. Subsequent changes 
only add more condition to exclude cases when it shouldn't be reported.


http://reviews.llvm.org/D14872



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


Re: [PATCH] D14215: Disable frame pointer elimination when using -pg

2015-11-23 Thread Stefan Kempf via cfe-commits
sisnkemp updated this revision to Diff 40933.

http://reviews.llvm.org/D14215

Files:
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/x86_64-profiling-keep-fp.c

Index: test/CodeGen/x86_64-profiling-keep-fp.c
===
--- /dev/null
+++ test/CodeGen/x86_64-profiling-keep-fp.c
@@ -0,0 +1,14 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -pg -S -o - %s | \
+// RUN:   FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 
-momit-leaf-frame-pointer -pg -S -o - %s | \
+// RUN:   FileCheck %s
+
+// Test that the frame pointer is kept when compiling with
+// profiling.
+
+//CHECK: pushq %rbp
+int main(void)
+{
+  return 0;
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -453,7 +453,8 @@
   Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
   Opts.CodeModel = getCodeModel(Args, Diags);
   Opts.DebugPass = Args.getLastArgValue(OPT_mdebug_pass);
-  Opts.DisableFPElim = Args.hasArg(OPT_mdisable_fp_elim);
+  Opts.DisableFPElim =
+  (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg));
   Opts.DisableFree = Args.hasArg(OPT_disable_free);
   Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
   Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2794,6 +2794,8 @@
   if (Arg *A = Args.getLastArg(options::OPT_fno_omit_frame_pointer,
options::OPT_fomit_frame_pointer))
 return A->getOption().matches(options::OPT_fno_omit_frame_pointer);
+  if (Args.hasArg(options::OPT_pg))
+return true;
 
   return shouldUseFramePointerForTarget(Args, Triple);
 }
@@ -2803,6 +2805,8 @@
   if (Arg *A = Args.getLastArg(options::OPT_mno_omit_leaf_frame_pointer,
options::OPT_momit_leaf_frame_pointer))
 return A->getOption().matches(options::OPT_mno_omit_leaf_frame_pointer);
+  if (Args.hasArg(options::OPT_pg))
+return true;
 
   if (Triple.isPS4CPU())
 return false;


Index: test/CodeGen/x86_64-profiling-keep-fp.c
===
--- /dev/null
+++ test/CodeGen/x86_64-profiling-keep-fp.c
@@ -0,0 +1,14 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -pg -S -o - %s | \
+// RUN:   FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -momit-leaf-frame-pointer -pg -S -o - %s | \
+// RUN:   FileCheck %s
+
+// Test that the frame pointer is kept when compiling with
+// profiling.
+
+//CHECK: pushq %rbp
+int main(void)
+{
+  return 0;
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -453,7 +453,8 @@
   Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
   Opts.CodeModel = getCodeModel(Args, Diags);
   Opts.DebugPass = Args.getLastArgValue(OPT_mdebug_pass);
-  Opts.DisableFPElim = Args.hasArg(OPT_mdisable_fp_elim);
+  Opts.DisableFPElim =
+  (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg));
   Opts.DisableFree = Args.hasArg(OPT_disable_free);
   Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
   Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2794,6 +2794,8 @@
   if (Arg *A = Args.getLastArg(options::OPT_fno_omit_frame_pointer,
options::OPT_fomit_frame_pointer))
 return A->getOption().matches(options::OPT_fno_omit_frame_pointer);
+  if (Args.hasArg(options::OPT_pg))
+return true;
 
   return shouldUseFramePointerForTarget(Args, Triple);
 }
@@ -2803,6 +2805,8 @@
   if (Arg *A = Args.getLastArg(options::OPT_mno_omit_leaf_frame_pointer,
options::OPT_momit_leaf_frame_pointer))
 return A->getOption().matches(options::OPT_mno_omit_leaf_frame_pointer);
+  if (Args.hasArg(options::OPT_pg))
+return true;
 
   if (Triple.isPS4CPU())
 return false;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253898 - Driver: fallback to the location of clang if no sysroot,

2015-11-23 Thread Martell Malone via cfe-commits
Author: martell
Date: Mon Nov 23 12:59:48 2015
New Revision: 253898

URL: http://llvm.org/viewvc/llvm-project?rev=253898=rev
Log:
Driver: fallback to the location of clang if no sysroot,

hard coding /usr makes little sense for mingw-w64.
If we have portable toolchains having /usr breaks that.
If the clang we use is in /usr/bin or /usr/sbin etc this will
still detect as though it was hard coded to /usr

This makes the most sense going forward for mingw-w64 toolchains
on both linux and mac

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

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

Modified: cfe/trunk/lib/Driver/MinGWToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MinGWToolChain.cpp?rev=253898=253897=253898=diff
==
--- cfe/trunk/lib/Driver/MinGWToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/MinGWToolChain.cpp Mon Nov 23 12:59:48 2015
@@ -66,24 +66,20 @@ MinGW::MinGW(const Driver , const llvm
 : ToolChain(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());
 
-// In Windows there aren't any standard install locations, we search
-// for gcc on the PATH. In Linux the base is always /usr.
+// On Windows if there is no sysroot we search for gcc on the PATH.
+
+if (getDriver().SysRoot.size())
+  Base = getDriver().SysRoot;
 #ifdef LLVM_ON_WIN32
-  if (getDriver().SysRoot.size())
-Base = getDriver().SysRoot;
-  else if (llvm::ErrorOr GPPName =
-   llvm::sys::findProgramByName("gcc"))
-Base = llvm::sys::path::parent_path(
-llvm::sys::path::parent_path(GPPName.get()));
-  else
-Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
-#else
-  if (getDriver().SysRoot.size())
-Base = getDriver().SysRoot;
-  else
-Base = "/usr";
+else if (llvm::ErrorOr GPPName =
+ llvm::sys::findProgramByName("gcc"))
+  Base = llvm::sys::path::parent_path(
+  llvm::sys::path::parent_path(GPPName.get()));
 #endif
 
+if (!Base.size())
+  Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
+
   Base += llvm::sys::path::get_separator();
   findGccLibDir();
   // GccLibDir must precede Base/lib so that the


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


Re: r253874 - Revert part of r253813

2015-11-23 Thread Rafael Espíndola via cfe-commits
This still needs a testcase.

On 23 November 2015 at 11:04, Martell Malone via cfe-commits
 wrote:
> Author: martell
> Date: Mon Nov 23 10:04:55 2015
> New Revision: 253874
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253874=rev
> Log:
> Revert part of r253813
> The new lld gnu frontend does not support the -target option
>
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253874=253873=253874=diff
> ==
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Mon Nov 23 10:04:55 2015
> @@ -9479,13 +9479,6 @@ void MinGW::Linker::ConstructJob(Compila
>if (LinkerName.equals_lower("lld")) {
>  CmdArgs.push_back("-flavor");
>  CmdArgs.push_back("gnu");
> -CmdArgs.push_back("-target");
> -if (TC.getArch() == llvm::Triple::x86)
> -  CmdArgs.push_back("i686--windows-gnu");
> -if (TC.getArch() == llvm::Triple::x86_64)
> -  CmdArgs.push_back("x86_64--windows-gnu");
> -if (TC.getArch() == llvm::Triple::arm)
> -  CmdArgs.push_back("armv7--windows-gnu");
>} else if (!LinkerName.equals_lower("ld")) {
>  D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
>}
>
>
> ___
> 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: r253813 - Driver: Specifically tell the linker the target for mingw-w64

2015-11-23 Thread Rafael Espíndola via cfe-commits
On 23 November 2015 at 11:15, Martell Malone  wrote:
>> This changes the linker from old-gnu to gnu. Are you sure you want to
>> that?
>
> Originally I didn't actually mean to commit that. I had been working on some
> stuff locally.
> Pointing to the new one should be fine as neither work for COFF atm anyway
> so no point in having it point to the old one.
> I'll make lld more verbose about this when it receives this emulation
> target.


The new "gnu" is just ELF.

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


Re: r253815 - Test: Update mingw-useld.c to reflect r253813

2015-11-23 Thread Rafael Espíndola via cfe-commits
This (and all the patches in this series) look odd.

The new "gnu" is ELF only. What exactly are you trying to do?

Cheers,
Rafael


On 22 November 2015 at 00:45, Martell Malone via cfe-commits
 wrote:
> Author: martell
> Date: Sat Nov 21 23:45:03 2015
> New Revision: 253815
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253815=rev
> Log:
> Test: Update mingw-useld.c to reflect r253813
>
> Modified:
> cfe/trunk/test/Driver/mingw-useld.c
>
> Modified: cfe/trunk/test/Driver/mingw-useld.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=253815=253814=253815=diff
> ==
> --- cfe/trunk/test/Driver/mingw-useld.c (original)
> +++ cfe/trunk/test/Driver/mingw-useld.c Sat Nov 21 23:45:03 2015
> @@ -1,19 +1,19 @@
>  // RUN: %clang -### -target i686-pc-windows-gnu 
> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
> -check-prefix=CHECK_LD_32 %s
>  // CHECK_LD_32: {{ld|ld.exe}}"
>  // CHECK_LD_32: "i386pe"
> -// CHECK_LD_32-NOT: "-flavor" "old-gnu"
> +// CHECK_LD_32-NOT: "-flavor" "gnu"
>
>  // RUN: %clang -### -target i686-pc-windows-gnu 
> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
> -check-prefix=CHECK_LLD_32 %s
>  // CHECK_LLD_32-NOT: invalid linker name in argument
> -// CHECK_LLD_32: lld" "-flavor" "old-gnu"
> +// CHECK_LLD_32: lld" "-flavor" "gnu"
>  // CHECK_LLD_32: "i386pe"
>
>  // RUN: %clang -### -target x86_64-pc-windows-gnu 
> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
> -check-prefix=CHECK_LLD_64 %s
>  // CHECK_LLD_64-NOT: invalid linker name in argument
> -// CHECK_LLD_64: lld" "-flavor" "old-gnu"
> +// CHECK_LLD_64: lld" "-flavor" "gnu"
>  // CHECK_LLD_64: "i386pep"
>
>  // RUN: %clang -### -target arm-pc-windows-gnu 
> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
> -check-prefix=CHECK_LLD_ARM %s
>  // CHECK_LLD_ARM-NOT: invalid linker name in argument
> -// CHECK_LLD_ARM: lld" "-flavor" "old-gnu"
> +// CHECK_LLD_ARM: lld" "-flavor" "gnu"
>  // CHECK_LLD_ARM: "thumb2pe"
>
>
> ___
> 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] D14686: Protect against overloaded comma in random_shuffle and improve tests

2015-11-23 Thread Marshall Clow via cfe-commits
mclow.lists added inline comments.


Comment at: 
test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp:35
@@ -30,1 +34,3 @@
 }
+
+template 

gribozavr wrote:
> gribozavr wrote:
> > mclow.lists wrote:
> > > This is not how I would rewrite this test.
> > > I would write a routine that took two "iterators", and called 
> > > `random_shuffle`, and then checked for the desired results.
> > > 
> > > Then call it with pointers. and RA iters, etc.
> > > for example:
> > > 
> > > template 
> > > void test(Iter first, Iter last, Iter resFirst, Iter resLast);
> > > 
> > > test(nullptr, nullptr, nullptr, nullptr);
> > > int source[] = {1, 2, 3, 4};
> > > int res  [] = {1, 2, 3, 4};
> > > const unsigned size = sizeof(source)/sizeof(source[0]);
> > > 
> > > test(source, source + size, res, res+size); 
> > > test(random_access_iterator(source)  );
> > > 
> > > 
> > I actually thought about this, and it is hard to rewrite it like that for 
> > two reasons.  First, `random_shuffle` mutates the elements, so one needs to 
> > restore the original sequence between calls to `test()` (otherwise it is 
> > not obvious that it was mutated).  Second, this overload of 
> > `random_shuffle` takes randomness from global state, so one can't just 
> > specify one expected result in the test.  That's why I first check for the 
> > initial shuffle exactly, and then only check that the output is a 
> > permutation of input.
> > 
> Ping?
Which is why I think that your use of `is_permutation` is good below.

What do we want to know after calling `random_shuffle`?
1) The same items are in the range, only in a different order. (right? Can it 
ever "do nothing")
2) Nothing else is changed.

If you have two collections with the same contents, you should be able to 
shuffle one over and over, and call `is_permutation` to compare the two after 
each call.

Tests that have duplicates are good, too.
[ Yes, I know that your bug report (and fix!) are very localized, but these 
tests are really lacking ]

If you don't want to do this, I'll rewrite these tests sometime in the next 
couple weeks, and then we can revisit your patch.



Repository:
  rL LLVM

http://reviews.llvm.org/D14686



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


r253886 - Disable frame pointer elimination when using -pg

2015-11-23 Thread Xinliang David Li via cfe-commits
Author: davidxl
Date: Mon Nov 23 11:30:31 2015
New Revision: 253886

URL: http://llvm.org/viewvc/llvm-project?rev=253886=rev
Log:
Disable frame pointer elimination when using -pg 

(Re-apply patch after bug fixing)

This diff makes sure that the driver does not pass
-fomit-frame-pointer or -momit-leaf-frame-pointer to
the frontend when -pg is used. Currently, clang gives 
an error if -fomit-frame-pointer is used in combination 
with -pg, but -momit-leaf-frame-pointer was forgotten.
Also, disable frame pointer elimination in the frontend 
when -pg is set.

Patch by Stefan Kempf.

Added:
cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253886=253885=253886=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Nov 23 11:30:31 2015
@@ -2794,6 +2794,8 @@ static bool shouldUseFramePointer(const
   if (Arg *A = Args.getLastArg(options::OPT_fno_omit_frame_pointer,
options::OPT_fomit_frame_pointer))
 return A->getOption().matches(options::OPT_fno_omit_frame_pointer);
+  if (Args.hasArg(options::OPT_pg))
+return true;
 
   return shouldUseFramePointerForTarget(Args, Triple);
 }
@@ -2803,6 +2805,8 @@ static bool shouldUseLeafFramePointer(co
   if (Arg *A = Args.getLastArg(options::OPT_mno_omit_leaf_frame_pointer,
options::OPT_momit_leaf_frame_pointer))
 return A->getOption().matches(options::OPT_mno_omit_leaf_frame_pointer);
+  if (Args.hasArg(options::OPT_pg))
+return true;
 
   if (Triple.isPS4CPU())
 return false;

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=253886=253885=253886=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Nov 23 11:30:31 2015
@@ -453,7 +453,8 @@ static bool ParseCodeGenArgs(CodeGenOpti
   Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
   Opts.CodeModel = getCodeModel(Args, Diags);
   Opts.DebugPass = Args.getLastArgValue(OPT_mdebug_pass);
-  Opts.DisableFPElim = Args.hasArg(OPT_mdisable_fp_elim);
+  Opts.DisableFPElim =
+  (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg));
   Opts.DisableFree = Args.hasArg(OPT_disable_free);
   Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
   Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);

Added: cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c?rev=253886=auto
==
--- cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c (added)
+++ cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c Mon Nov 23 11:30:31 2015
@@ -0,0 +1,14 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -pg -S -o - %s | \
+// RUN:   FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 
-momit-leaf-frame-pointer -pg -S -o - %s | \
+// RUN:   FileCheck %s
+
+// Test that the frame pointer is kept when compiling with
+// profiling.
+
+//CHECK: pushq %rbp
+int main(void)
+{
+  return 0;
+}


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


Re: [PATCH] D14887: Make tbm-builtins.c as X86 specific unit test

2015-11-23 Thread Sumanth Gundapaneni via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253887: Make tbm-builtins.c as X86 specific unit test 
(authored by sgundapa).

Changed prior to commit:
  http://reviews.llvm.org/D14887?vs=40824=40940#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14887

Files:
  cfe/trunk/test/CodeGen/tbm-builtins.c

Index: cfe/trunk/test/CodeGen/tbm-builtins.c
===
--- cfe/trunk/test/CodeGen/tbm-builtins.c
+++ cfe/trunk/test/CodeGen/tbm-builtins.c
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 %s -O3 -triple=x86_64-unknown-unknown -target-feature +tbm 
-emit-llvm -o - | FileCheck %s
 // FIXME: The code generation checks for add/sub and/or are depending on the 
optimizer.
+// The REQUIRES keyword will be removed when the FIXME is complete.
+// REQUIRES: x86-registered-target
 
 // Don't include mm_malloc.h, it's system specific.
 #define __MM_MALLOC_H


Index: cfe/trunk/test/CodeGen/tbm-builtins.c
===
--- cfe/trunk/test/CodeGen/tbm-builtins.c
+++ cfe/trunk/test/CodeGen/tbm-builtins.c
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 %s -O3 -triple=x86_64-unknown-unknown -target-feature +tbm -emit-llvm -o - | FileCheck %s
 // FIXME: The code generation checks for add/sub and/or are depending on the optimizer.
+// The REQUIRES keyword will be removed when the FIXME is complete.
+// REQUIRES: x86-registered-target
 
 // Don't include mm_malloc.h, it's system specific.
 #define __MM_MALLOC_H
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14887: Make tbm-builtins.c as X86 specific unit test

2015-11-23 Thread Sumanth Gundapaneni via cfe-commits
sgundapa added a comment.

Merged this as r253887


Repository:
  rL LLVM

http://reviews.llvm.org/D14887



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


r253887 - Make tbm-builtins.c as X86 specific unit test

2015-11-23 Thread Sumanth Gundapaneni via cfe-commits
Author: sgundapa
Date: Mon Nov 23 11:33:49 2015
New Revision: 253887

URL: http://llvm.org/viewvc/llvm-project?rev=253887=rev
Log:
Make tbm-builtins.c as X86 specific unit test

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

Modified:
cfe/trunk/test/CodeGen/tbm-builtins.c

Modified: cfe/trunk/test/CodeGen/tbm-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/tbm-builtins.c?rev=253887=253886=253887=diff
==
--- cfe/trunk/test/CodeGen/tbm-builtins.c (original)
+++ cfe/trunk/test/CodeGen/tbm-builtins.c Mon Nov 23 11:33:49 2015
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 %s -O3 -triple=x86_64-unknown-unknown -target-feature +tbm 
-emit-llvm -o - | FileCheck %s
 // FIXME: The code generation checks for add/sub and/or are depending on the 
optimizer.
+// The REQUIRES keyword will be removed when the FIXME is complete.
+// REQUIRES: x86-registered-target
 
 // Don't include mm_malloc.h, it's system specific.
 #define __MM_MALLOC_H


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


Re: r253886 - Disable frame pointer elimination when using -pg

2015-11-23 Thread David Blaikie via cfe-commits
On Mon, Nov 23, 2015 at 9:30 AM, Xinliang David Li via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: davidxl
> Date: Mon Nov 23 11:30:31 2015
> New Revision: 253886
>
> URL: http://llvm.org/viewvc/llvm-project?rev=253886=rev
> Log:
> Disable frame pointer elimination when using -pg
>
> (Re-apply patch after bug fixing)
>

It's helpful to describe what the bug fixing was (& test changes to ensure
it's covered (if it fails only on some subset of buildbots usually a test
case can be added so it would fail on any buildbot/locally, which is a good
idea to help proactively avoid regressions in the future)) when
recommitting a patch.


>
> This diff makes sure that the driver does not pass
> -fomit-frame-pointer or -momit-leaf-frame-pointer to
> the frontend when -pg is used. Currently, clang gives
> an error if -fomit-frame-pointer is used in combination
> with -pg, but -momit-leaf-frame-pointer was forgotten.
> Also, disable frame pointer elimination in the frontend
> when -pg is set.
>
> Patch by Stefan Kempf.
>
> Added:
> cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253886=253885=253886=diff
>
> ==
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Mon Nov 23 11:30:31 2015
> @@ -2794,6 +2794,8 @@ static bool shouldUseFramePointer(const
>if (Arg *A = Args.getLastArg(options::OPT_fno_omit_frame_pointer,
> options::OPT_fomit_frame_pointer))
>  return A->getOption().matches(options::OPT_fno_omit_frame_pointer);
> +  if (Args.hasArg(options::OPT_pg))
> +return true;
>
>return shouldUseFramePointerForTarget(Args, Triple);
>  }
> @@ -2803,6 +2805,8 @@ static bool shouldUseLeafFramePointer(co
>if (Arg *A = Args.getLastArg(options::OPT_mno_omit_leaf_frame_pointer,
> options::OPT_momit_leaf_frame_pointer))
>  return
> A->getOption().matches(options::OPT_mno_omit_leaf_frame_pointer);
> +  if (Args.hasArg(options::OPT_pg))
> +return true;
>
>if (Triple.isPS4CPU())
>  return false;
>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=253886=253885=253886=diff
>
> ==
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Nov 23 11:30:31 2015
> @@ -453,7 +453,8 @@ static bool ParseCodeGenArgs(CodeGenOpti
>Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
>Opts.CodeModel = getCodeModel(Args, Diags);
>Opts.DebugPass = Args.getLastArgValue(OPT_mdebug_pass);
> -  Opts.DisableFPElim = Args.hasArg(OPT_mdisable_fp_elim);
> +  Opts.DisableFPElim =
> +  (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg));
>Opts.DisableFree = Args.hasArg(OPT_disable_free);
>Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
>Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
>
> Added: cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c?rev=253886=auto
>
> ==
> --- cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c (added)
> +++ cfe/trunk/test/CodeGen/x86_64-profiling-keep-fp.c Mon Nov 23 11:30:31
> 2015
> @@ -0,0 +1,14 @@
> +// REQUIRES: x86-registered-target
> +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -pg -S -o - %s | \
> +// RUN:   FileCheck %s
> +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3
> -momit-leaf-frame-pointer -pg -S -o - %s | \
> +// RUN:   FileCheck %s
> +
> +// Test that the frame pointer is kept when compiling with
> +// profiling.
> +
> +//CHECK: pushq %rbp
> +int main(void)
> +{
> +  return 0;
> +}
>
>
> ___
> 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: r253815 - Test: Update mingw-useld.c to reflect r253813

2015-11-23 Thread Martell Malone via cfe-commits
>
> The new "gnu" is ELF only. What exactly are you trying to do?

Yes and so was the old-gnu linker.
I maintained patches in msys2 so that mingw-w64 could be able to use gnu
with COFF.
https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-clang/0034-GNU-add-support-for-linking-PECOFF.patch
I just wanted to update head to maintain a similar patch like I did for the
new ELF linker like I did for the old one.
Please see http://reviews.llvm.org/D11088

On Mon, Nov 23, 2015 at 8:43 AM, Rafael Espíndola <
rafael.espind...@gmail.com> wrote:

> This (and all the patches in this series) look odd.
>
> The new "gnu" is ELF only. What exactly are you trying to do?
>
> Cheers,
> Rafael
>
>
> On 22 November 2015 at 00:45, Martell Malone via cfe-commits
>  wrote:
> > Author: martell
> > Date: Sat Nov 21 23:45:03 2015
> > New Revision: 253815
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=253815=rev
> > Log:
> > Test: Update mingw-useld.c to reflect r253813
> >
> > Modified:
> > cfe/trunk/test/Driver/mingw-useld.c
> >
> > Modified: cfe/trunk/test/Driver/mingw-useld.c
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=253815=253814=253815=diff
> >
> ==
> > --- cfe/trunk/test/Driver/mingw-useld.c (original)
> > +++ cfe/trunk/test/Driver/mingw-useld.c Sat Nov 21 23:45:03 2015
> > @@ -1,19 +1,19 @@
> >  // RUN: %clang -### -target i686-pc-windows-gnu
> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck
> -check-prefix=CHECK_LD_32 %s
> >  // CHECK_LD_32: {{ld|ld.exe}}"
> >  // CHECK_LD_32: "i386pe"
> > -// CHECK_LD_32-NOT: "-flavor" "old-gnu"
> > +// CHECK_LD_32-NOT: "-flavor" "gnu"
> >
> >  // RUN: %clang -### -target i686-pc-windows-gnu
> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 |
> FileCheck -check-prefix=CHECK_LLD_32 %s
> >  // CHECK_LLD_32-NOT: invalid linker name in argument
> > -// CHECK_LLD_32: lld" "-flavor" "old-gnu"
> > +// CHECK_LLD_32: lld" "-flavor" "gnu"
> >  // CHECK_LLD_32: "i386pe"
> >
> >  // RUN: %clang -### -target x86_64-pc-windows-gnu
> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 |
> FileCheck -check-prefix=CHECK_LLD_64 %s
> >  // CHECK_LLD_64-NOT: invalid linker name in argument
> > -// CHECK_LLD_64: lld" "-flavor" "old-gnu"
> > +// CHECK_LLD_64: lld" "-flavor" "gnu"
> >  // CHECK_LLD_64: "i386pep"
> >
> >  // RUN: %clang -### -target arm-pc-windows-gnu
> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 |
> FileCheck -check-prefix=CHECK_LLD_ARM %s
> >  // CHECK_LLD_ARM-NOT: invalid linker name in argument
> > -// CHECK_LLD_ARM: lld" "-flavor" "old-gnu"
> > +// CHECK_LLD_ARM: lld" "-flavor" "gnu"
> >  // CHECK_LLD_ARM: "thumb2pe"
> >
> >
> > ___
> > 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


r253872 - clang-format: Fix incorrect cast detection.

2015-11-23 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Nov 23 09:55:50 2015
New Revision: 253872

URL: http://llvm.org/viewvc/llvm-project?rev=253872=rev
Log:
clang-format: Fix incorrect cast detection.

Before:
  bool b = f(g)&

After:
  bool b = f(g) && c;

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

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=253872=253871=253872=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Nov 23 09:55:50 2015
@@ -1060,13 +1060,19 @@ private:
 FormatToken *LeftOfParens = nullptr;
 if (Tok.MatchingParen)
   LeftOfParens = Tok.MatchingParen->getPreviousNonComment();
-if (LeftOfParens && LeftOfParens->is(tok::r_paren) &&
-LeftOfParens->MatchingParen)
-  LeftOfParens = LeftOfParens->MatchingParen->Previous;
-if (LeftOfParens && LeftOfParens->is(tok::r_square) &&
-LeftOfParens->MatchingParen &&
-LeftOfParens->MatchingParen->is(TT_LambdaLSquare))
-  return false;
+
+if (LeftOfParens) {
+  if (LeftOfParens->Tok.getIdentifierInfo() &&
+  !LeftOfParens->isOneOf(Keywords.kw_in, tok::kw_return, tok::kw_case,
+ tok::kw_delete))
+return false;
+  if (LeftOfParens->isOneOf(tok::kw_sizeof, tok::kw_alignof, tok::at,
+tok::r_square, TT_OverloadedOperator,
+TT_TemplateCloser))
+return false;
+  if (LeftOfParens->is(tok::r_paren) && LeftOfParens->MatchingParen)
+LeftOfParens = LeftOfParens->MatchingParen->Previous;
+}
 if (Tok.Next) {
   if (Tok.Next->is(tok::question))
 return false;
@@ -1085,22 +1091,14 @@ private:
 bool ParensCouldEndDecl =
 Tok.Next &&
 Tok.Next->isOneOf(tok::equal, tok::semi, tok::l_brace, tok::greater);
-bool IsSizeOfOrAlignOf =
-LeftOfParens && LeftOfParens->isOneOf(tok::kw_sizeof, tok::kw_alignof);
-if (ParensAreType && !ParensCouldEndDecl && !IsSizeOfOrAlignOf &&
+if (ParensAreType && !ParensCouldEndDecl &&
 (Contexts.size() > 1 && Contexts[Contexts.size() - 2].IsExpression))
   IsCast = true;
 else if (Tok.Next && Tok.Next->isNot(tok::string_literal) &&
  (Tok.Next->Tok.isLiteral() ||
   Tok.Next->isOneOf(tok::kw_sizeof, tok::kw_alignof)))
   IsCast = true;
-// If there is an identifier after the (), it is likely a cast, unless
-// there is also an identifier before the ().
-else if (LeftOfParens && Tok.Next &&
- (LeftOfParens->Tok.getIdentifierInfo() == nullptr ||
-  LeftOfParens->isOneOf(tok::kw_return, tok::kw_case)) &&
- !LeftOfParens->isOneOf(TT_OverloadedOperator, tok::at,
-TT_TemplateCloser)) {
+else if (LeftOfParens && Tok.Next) {
   if (Tok.Next->isOneOf(tok::identifier, tok::numeric_constant)) {
 IsCast = true;
   } else {

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=253872=253871=253872=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Nov 23 09:55:50 2015
@@ -5792,6 +5792,7 @@ TEST_F(FormatTest, FormatsCasts) {
   verifyFormat("virtual void foo(int *a, char *) const;");
   verifyFormat("int a = sizeof(int *) + b;");
   verifyFormat("int a = alignof(int *) + b;", getGoogleStyle());
+  verifyFormat("bool b = f(g) && c;");
 
   verifyFormat(" *foo = (a 
*)\n"
"bbb;");


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


Re: r253874 - Revert part of r253813

2015-11-23 Thread Martell Malone via cfe-commits
Yes the test case was updated in r253815 to reflect the change of old-gnu
to gnu

On Mon, Nov 23, 2015 at 8:37 AM, Rafael Espíndola <
rafael.espind...@gmail.com> wrote:

> This still needs a testcase.
>
> On 23 November 2015 at 11:04, Martell Malone via cfe-commits
>  wrote:
> > Author: martell
> > Date: Mon Nov 23 10:04:55 2015
> > New Revision: 253874
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=253874=rev
> > Log:
> > Revert part of r253813
> > The new lld gnu frontend does not support the -target option
> >
> > Modified:
> > cfe/trunk/lib/Driver/Tools.cpp
> >
> > Modified: cfe/trunk/lib/Driver/Tools.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253874=253873=253874=diff
> >
> ==
> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
> > +++ cfe/trunk/lib/Driver/Tools.cpp Mon Nov 23 10:04:55 2015
> > @@ -9479,13 +9479,6 @@ void MinGW::Linker::ConstructJob(Compila
> >if (LinkerName.equals_lower("lld")) {
> >  CmdArgs.push_back("-flavor");
> >  CmdArgs.push_back("gnu");
> > -CmdArgs.push_back("-target");
> > -if (TC.getArch() == llvm::Triple::x86)
> > -  CmdArgs.push_back("i686--windows-gnu");
> > -if (TC.getArch() == llvm::Triple::x86_64)
> > -  CmdArgs.push_back("x86_64--windows-gnu");
> > -if (TC.getArch() == llvm::Triple::arm)
> > -  CmdArgs.push_back("armv7--windows-gnu");
> >} else if (!LinkerName.equals_lower("ld")) {
> >  D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
> >}
> >
> >
> > ___
> > 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] D14864: [X86] Support for C calling convention only for MCU target.

2015-11-23 Thread David Kreitzer via cfe-commits
DavidKreitzer added a comment.

Thanks, Alexey! I think this is an improvement.

I don't know if anyone else has an opinion on the name of the new class, but I 
would prefer X86 over I386, possibly even MCUX86_32TargetInfo.

Thanks,

- Dave


http://reviews.llvm.org/D14864



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


r253914 - Fix a warning about commas at the end of enumerator lists.

2015-11-23 Thread Chad Rosier via cfe-commits
Author: mcrosier
Date: Mon Nov 23 15:05:04 2015
New Revision: 253914

URL: http://llvm.org/viewvc/llvm-project?rev=253914=rev
Log:
Fix a warning about commas at the end of enumerator lists.

Modified:
cfe/trunk/include/clang-c/Index.h

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=253914=253913=253914=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Mon Nov 23 15:05:04 2015
@@ -2481,7 +2481,7 @@ enum CXVisibilityKind {
   /** \brief Symbol seen by the linker but resolves to a symbol inside this 
object. */
   CXVisibility_Protected,
   /** \brief Symbol seen by the linker and acts like a normal symbol. */
-  CXVisibility_Default,
+  CXVisibility_Default
 };
 
 CINDEX_LINKAGE enum CXVisibilityKind clang_getCursorVisibility(CXCursor 
cursor);


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