Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-11-04 Thread Kevin Funk via cfe-commits
kfunk added inline comments.


Comment at: bindings/python/clang/cindex.py:1589
@@ +1588,3 @@
+def is_assignment(self):
+return BinaryOperator.Assign.value <= self.value < 
BinaryOperator.Comma.value
+

TIL chaining comparisons in Python is OK... :)

I first though this expression gives the wrong result and you need `min <= val 
and val < max`. But indeed your expression does exactly this...


Comment at: bindings/python/tests/cindex/test_cursor.py:333
@@ +332,3 @@
+# not exposed yet
+# ".*" : BinaryOperator.PtrMemD,
+"->*" : BinaryOperator.PtrMemI,

What about this? How is it not exposed? 

This works in the C++ test apparently(?)


Comment at: tools/libclang/CIndex.cpp:6749
@@ -6743,1 +6748,3 @@
 
+enum CX_BinaryOperatorKind clang_Cursor_getBinaryOpCode(CXCursor C) {
+   if (C.kind != CXCursor_BinaryOperator &&

I'd rename to `getBinaryOpcode` (note the casing, more consistent).

Same below, rename to `getBinaryOpcodeString` (casing + full words)


Comment at: tools/libclang/CIndex.cpp:6763
@@ +6762,3 @@
+
+CXString clang_Cursor_getBinaryOpCodeStr(CXCursor C) {
+   if (C.kind != CXCursor_BinaryOperator &&

I think this should have a `enum CX_BinaryOperatorKind` as parameter instead.

There's `BinaryOperator::getOpcode(Opcode)` you can use.


http://reviews.llvm.org/D10833



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


[PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-04 Thread Beren Minor via cfe-commits
berenm created this revision.
berenm added a reviewer: djasper.
berenm added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

This fixes bug #25329, as well as misalignments like the following:

int a, b = 2;
int c= 3;

http://reviews.llvm.org/D14325

Files:
  lib/Format/WhitespaceManager.cpp
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -8703,6 +8703,16 @@
   "  loongParameterB);\n"
   "int j = 2;",
   Alignment);
+
+  verifyFormat("template \n"
+   "auto foo() {}\n",
+   Alignment);
+  verifyFormat("int a, b = 1;\n"
+   "int c  = 2;\n"
+   "int dd = 3;\n",
+   Alignment);
 }
 
 TEST_F(FormatTest, AlignConsecutiveDeclarations) {
@@ -8903,6 +8913,23 @@
"int  myvar = 1;",
Alignment);
   Alignment.ColumnLimit = 80;
+  Alignment.AlignConsecutiveAssignments = false;
+
+  verifyFormat(
+  "template \n"
+  "auto foo() {}\n",
+  Alignment);
+  verifyFormat("float a, b = 1;\n"
+   "int   c = 2;\n"
+   "int   dd = 3;\n",
+   Alignment);
+  Alignment.AlignConsecutiveAssignments = true;
+  verifyFormat("float a, b = 1;\n"
+   "int   c  = 2;\n"
+   "int   dd = 3;\n",
+   Alignment);
+  Alignment.AlignConsecutiveAssignments = false;
 }
 
 TEST_F(FormatTest, LinuxBraceBreaking) {
Index: lib/Format/WhitespaceManager.cpp
===
--- lib/Format/WhitespaceManager.cpp
+++ lib/Format/WhitespaceManager.cpp
@@ -167,6 +167,8 @@
   bool FoundAssignmentOnLine = false;
   bool FoundLeftBraceOnLine = false;
   bool FoundLeftParenOnLine = false;
+  unsigned CommasOnPrevLine = 0;
+  unsigned CommasOnLine = 0;
 
   // Aligns a sequence of assignment tokens, on the MinColumn column.
   //
@@ -186,6 +188,8 @@
 
   for (unsigned i = 0, e = Changes.size(); i != e; ++i) {
 if (Changes[i].NewlinesBefore != 0) {
+  CommasOnPrevLine = CommasOnLine;
+  CommasOnLine = 0;
   EndOfSequence = i;
   // If there is a blank line, if the last line didn't contain any
   // assignment, or if we found an open brace or paren, the sequence ends
@@ -225,6 +229,9 @@
   FoundLeftParenOnLine = true;
   if (!FoundAssignmentOnLine)
 AlignSequence();
+} else if (Changes[i].Kind == tok::comma) {
+  if (!FoundAssignmentOnLine)
+CommasOnLine++;
 } else if (!FoundAssignmentOnLine && !FoundLeftBraceOnLine &&
!FoundLeftParenOnLine && Changes[i].Kind == tok::equal) {
   FoundAssignmentOnLine = true;
@@ -237,7 +244,8 @@
 LineLengthAfter += Changes[j].Spaces + Changes[j].TokenLength;
   unsigned ChangeMaxColumn = Style.ColumnLimit - LineLengthAfter;
 
-  if (ChangeMinColumn > MaxColumn || ChangeMaxColumn < MinColumn) {
+  if (ChangeMinColumn > MaxColumn || ChangeMaxColumn < MinColumn ||
+  CommasOnPrevLine != CommasOnLine) {
 AlignSequence();
 StartOfSequence = i;
   }
@@ -298,6 +306,8 @@
   bool FoundDeclarationOnLine = false;
   bool FoundLeftBraceOnLine = false;
   bool FoundLeftParenOnLine = false;
+  unsigned CommasOnPrevLine = 0;
+  unsigned CommasOnLine = 0;
 
   auto AlignSequence = [&] {
 if (StartOfSequence > 0 && StartOfSequence < EndOfSequence)
@@ -310,6 +320,8 @@
 
   for (unsigned i = 0, e = Changes.size(); i != e; ++i) {
 if (Changes[i].NewlinesBefore != 0) {
+  CommasOnPrevLine = CommasOnLine;
+  CommasOnLine = 0;
   EndOfSequence = i;
   if (Changes[i].NewlinesBefore > 1 || !FoundDeclarationOnLine ||
   FoundLeftBraceOnLine || FoundLeftParenOnLine)
@@ -335,6 +347,9 @@
   FoundLeftParenOnLine = true;
   if (!FoundDeclarationOnLine)
 AlignSequence();
+} else if (Changes[i].Kind == tok::comma) {
+  if (!FoundDeclarationOnLine)
+CommasOnLine++;
 } else if (!FoundDeclarationOnLine && !FoundLeftBraceOnLine &&
!FoundLeftParenOnLine && Changes[i].IsStartOfDeclName) {
   FoundDeclarationOnLine = true;
@@ -347,7 +362,8 @@
 LineLengthAfter += Changes[j].Spaces + Changes[j].TokenLength;
   unsigned ChangeMaxColumn = Style.ColumnLimit - LineLengthAfter;
 
-  if (ChangeMinColumn > MaxColumn || ChangeMaxColumn < MinColumn) {
+  if (ChangeMinColumn > MaxColumn || ChangeMaxColumn < MinColumn ||
+  CommasOnPrevLine != CommasOnLine) {
 AlignSequence();
 StartOfSequence = i;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r252041 - Improve modernize-make-unique matcher.

2015-11-04 Thread Angel Garcia Gomez via cfe-commits
Author: angelgarcia
Date: Wed Nov  4 04:27:51 2015
New Revision: 252041

URL: http://llvm.org/viewvc/llvm-project?rev=252041&view=rev
Log:
Improve modernize-make-unique matcher.

Summary: "std::unique_ptr" is not the same type as "std::unique_ptr>", unless we insert a "hasCanonicalType" in the 
middle. Probably it also happens in other cases related to default template 
argument.

Reviewers: klimek

Subscribers: alexfh, cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-make-unique.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.cpp?rev=252041&r1=252040&r2=252041&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/MakeUniqueCheck.cpp Wed Nov  4 
04:27:51 2015
@@ -42,9 +42,10 @@ void MakeUniqueCheck::registerMatchers(M
   qualType(equalsBoundNode(
   PointerType))),
 argumentCountIs(1),
-hasArgument(0, cxxNewExpr(hasType(pointsTo(qualType(
-  equalsBoundNode(PointerType)
-   .bind(NewExpression)))
+hasArgument(
+0, cxxNewExpr(hasType(pointsTo(qualType(hasCanonicalType(
+  equalsBoundNode(PointerType))
+   .bind(NewExpression)))
 .bind(ConstructorCall))),
 this);
   }

Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-make-unique.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-make-unique.cpp?rev=252041&r1=252040&r2=252041&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/modernize-make-unique.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-make-unique.cpp Wed Nov  
4 04:27:51 2015
@@ -195,3 +195,9 @@ void whitespaces() {
   // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: use std::make_unique instead
   // CHECK-FIXES: auto Spaces = std::make_unique();
 }
+
+void nesting() {
+  auto Nest = std::unique_ptr>(new 
std::unique_ptr(new int));
+  // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: use std::make_unique instead
+  // CHECK-FIXES: auto Nest = std::make_unique>(new int);
+}


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


[PATCH] D14326: ASTImporter: expressions, pt.2

2015-11-04 Thread Aleksei Sidorin via cfe-commits
a.sidorin created this revision.
a.sidorin added a reviewer: sepavloff.
a.sidorin added a subscriber: cfe-commits.
a.sidorin set the repository for this revision to rL LLVM.

This patch implements some expression-related AST node import (patch #2).

Supported nodes:
ArrayTypeTraitExpr
ExpressionTraitExpr
OpaqueValueExpr
ArraySubscriptExpr
ExplicitCastExpr
ImplicitValueInitExpr
OffsetOfExpr
CXXThisExpr
CXXThrowExpr
CXXNoexceptExpr
CXXDefaultArgExpr
CXXScalarValueInitExpr
CXXBindTemporaryExpr
CXXTemporaryObjectExpr
MaterializeTemporaryExpr


Repository:
  rL LLVM

http://reviews.llvm.org/D14326

Files:
  include/clang/AST/ASTImporter.h
  lib/AST/ASTImporter.cpp

Index: lib/AST/ASTImporter.cpp
===
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -109,6 +109,8 @@
   DeclarationNameInfo& To);
 void ImportDeclContext(DeclContext *FromDC, bool ForceImport = false);
 
+bool ImportCastPath(CastExpr *E, CXXCastPath &Path);
+
 typedef DesignatedInitExpr::Designator Designator;
 Designator ImportDesignator(const Designator &D);
 
@@ -261,9 +263,23 @@
 Expr *VisitBinaryOperator(BinaryOperator *E);
 Expr *VisitConditionalOperator(ConditionalOperator *E);
 Expr *VisitBinaryConditionalOperator(BinaryConditionalOperator *E);
+Expr *VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E);
+Expr *VisitExpressionTraitExpr(ExpressionTraitExpr *E);
+Expr *VisitOpaqueValueExpr(OpaqueValueExpr *E);
+Expr *VisitArraySubscriptExpr(ArraySubscriptExpr *E);
 Expr *VisitCompoundAssignOperator(CompoundAssignOperator *E);
 Expr *VisitImplicitCastExpr(ImplicitCastExpr *E);
-Expr *VisitCStyleCastExpr(CStyleCastExpr *E);
+Expr *VisitExplicitCastExpr(ExplicitCastExpr *E);
+Expr *VisitImplicitValueInitExpr(ImplicitValueInitExpr *E);
+Expr *VisitOffsetOfExpr(OffsetOfExpr *E);
+Expr *VisitCXXThisExpr(CXXThisExpr *E);
+Expr *VisitCXXThrowExpr(CXXThrowExpr *E);
+Expr *VisitCXXNoexceptExpr(CXXNoexceptExpr *E);
+Expr *VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E);
+Expr *VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E);
+Expr *VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E);
+Expr *VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *CE);
+Expr *VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E);
 Expr *VisitCXXConstructExpr(CXXConstructExpr *E);
 Expr *VisitMemberExpr(MemberExpr *E);
 Expr *VisitCallExpr(CallExpr *E);
@@ -5581,6 +5597,70 @@
 T, E->getValueKind(), E->getObjectKind());
 }
 
+Expr *ASTNodeImporter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {
+  QualType T = Importer.Import(E->getType());
+  if (T.isNull())
+return nullptr;
+
+  TypeSourceInfo *ToQueried = Importer.Import(E->getQueriedTypeSourceInfo());
+  if (!ToQueried)
+return nullptr;
+
+  Expr *Dim = Importer.Import(E->getDimensionExpression());
+  if (!Dim && E->getDimensionExpression())
+return nullptr;
+
+  return new (Importer.getToContext()) ArrayTypeTraitExpr(
+Importer.Import(E->getExprLoc()), E->getTrait(), ToQueried,
+E->getValue(), Dim, Importer.Import(E->getLocEnd()), T);
+}
+
+Expr *ASTNodeImporter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {
+  QualType T = Importer.Import(E->getType());
+  if (T.isNull())
+return nullptr;
+
+  Expr *ToQueried = Importer.Import(E->getQueriedExpression());
+  if (!ToQueried)
+return nullptr;
+
+  return new (Importer.getToContext()) ExpressionTraitExpr(
+Importer.Import(E->getExprLoc()), E->getTrait(), ToQueried,
+E->getValue(), Importer.Import(E->getLocEnd()), T);
+}
+
+Expr *ASTNodeImporter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {
+  QualType T = Importer.Import(E->getType());
+  if (T.isNull())
+return nullptr;
+
+  Expr *SourceExpr = Importer.Import(E->getSourceExpr());
+  if (!SourceExpr && E->getSourceExpr())
+return nullptr;
+
+  return new (Importer.getToContext()) OpaqueValueExpr(
+Importer.Import(E->getExprLoc()), T, E->getValueKind(),
+E->getObjectKind(), SourceExpr);
+}
+
+Expr *ASTNodeImporter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
+  QualType T = Importer.Import(E->getType());
+  if (T.isNull())
+return nullptr;
+
+  Expr *ToLHS = Importer.Import(E->getLHS());
+  if (!ToLHS)
+return nullptr;
+
+  Expr *ToRHS = Importer.Import(E->getRHS());
+  if (!ToRHS)
+return nullptr;
+
+  return new (Importer.getToContext()) ArraySubscriptExpr(
+ToLHS, ToRHS, T, E->getValueKind(), E->getObjectKind(),
+Importer.Import(E->getRBracketLoc()));
+}
+
 Expr *ASTNodeImporter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
   QualType T = Importer.Import(E->getType());
   if (T.isNull())
@@ -5611,11 +5691,14 @@
E->isFPContractable());
 }
 
-static bool ImportCastPath(CastExpr *E, CXXCastPath &Path) {
-  if (E->path_empty()) return

Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-11-04 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 marked 2 inline comments as done.


Comment at: bindings/python/tests/cindex/test_cursor.py:333
@@ +332,3 @@
+# not exposed yet
+# ".*" : BinaryOperator.PtrMemD,
+"->*" : BinaryOperator.PtrMemI,

kfunk wrote:
> What about this? How is it not exposed? 
> 
> This works in the C++ test apparently(?)
Yeah, I was surprised too. I have no idea why one is exposed and the other 
not...

But i don't feel like investigating it as I don't need it and this operator is 
not used often.


http://reviews.llvm.org/D10833



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


Re: [PATCH] D10833: Retrieve BinaryOperator::getOpcode and BinaryOperator::getOpcodeStr via libclang and its python interface

2015-11-04 Thread guibufolo+l...@gmail.com via cfe-commits
RedX2501 updated this revision to Diff 39176.
RedX2501 added a comment.

Changed points raised during review.


http://reviews.llvm.org/D10833

Files:
  bindings/python/clang/cindex.py
  bindings/python/tests/cindex/test_cursor.py
  include/clang-c/Index.h
  include/clang/AST/OperationKinds.h
  test/Index/binop.cpp
  tools/c-index-test/c-index-test.c
  tools/libclang/CIndex.cpp

Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -3725,6 +3725,11 @@
   return cxstring::createDup(OS.str());
 }
 
+if (C.kind == CXCursor_BinaryOperator ||
+C.kind == CXCursor_CompoundAssignOperator) {
+  return clang_Cursor_getBinaryOpcodeStr(clang_Cursor_getBinaryOpcode(C));
+}
+
 const Decl *D = getDeclFromExpr(getCursorExpr(C));
 if (D)
   return getDeclSpelling(D);
@@ -6741,6 +6746,29 @@
   return 0;
 }
 
+enum CX_BinaryOperatorKind clang_Cursor_getBinaryOpcode(CXCursor C) {
+	if (C.kind != CXCursor_BinaryOperator &&
+		C.kind != CXCursor_CompoundAssignOperator) {
+		return CX_BO_Invalid;
+	}
+
+	const Expr *D = getCursorExpr(C);
+	if (const BinaryOperator *BinOp = dyn_cast(D)) {
+		return static_cast(BinOp->getOpcode() + 1);
+	}
+
+	return CX_BO_Invalid;
+}
+
+CXString clang_Cursor_getBinaryOpcodeStr(enum CX_BinaryOperatorKind Op) {
+	if (Op > CX_BO_LAST) {
+		return cxstring::createEmpty();
+	}
+
+	return cxstring::createDup(
+			BinaryOperator::getOpcodeStr(static_cast(Op - 1)));
+}
+
 CXSourceRange clang_Cursor_getCommentRange(CXCursor C) {
   if (!clang_isDeclaration(C.kind))
 return clang_getNullRange();
Index: tools/c-index-test/c-index-test.c
===
--- tools/c-index-test/c-index-test.c
+++ tools/c-index-test/c-index-test.c
@@ -1425,6 +1425,21 @@
   return CXChildVisit_Recurse;
 }
 
+static enum CXChildVisitResult PrintBinOps(CXCursor C, CXCursor p,
+   CXClientData d){
+  enum CXCursorKind ck = clang_getCursorKind(C);
+  if (ck != CXCursor_BinaryOperator && ck != CXCursor_CompoundAssignOperator)
+return CXChildVisit_Recurse;
+
+  PrintCursor(C, NULL);
+  enum CX_BinaryOperatorKind bok = clang_Cursor_getBinaryOpcode(C);
+  CXString opstr = clang_Cursor_getBinaryOpcodeStr(bok);
+  printf(" BinOp=%s %d\n", clang_getCString(opstr), bok);
+
+  return CXChildVisit_Recurse;
+}
+
+
 /**/
 /* Mangling testing.  */
 /**/
@@ -4068,6 +4083,7 @@
 "   c-index-test -test-print-type {}*\n"
 "   c-index-test -test-print-type-size {}*\n"
 "   c-index-test -test-print-bitwidth {}*\n"
+"   c-index-test -test-print-binops {}*\n"
 "   c-index-test -print-usr [ {}]*\n"
 "   c-index-test -print-usr-file \n"
 "   c-index-test -write-pch  \n");
@@ -4161,6 +4177,9 @@
   else if (argc > 2 && strcmp(argv[1], "-test-print-bitwidth") == 0)
 return perform_test_load_source(argc - 2, argv + 2, "all",
 PrintBitWidth, 0);
+  else if (argc > 2 && strcmp(argv[1], "-test-print-binops") == 0)
+return perform_test_load_source(argc - 2, argv + 2, "all",
+PrintBinOps, 0);
   else if (argc > 2 && strcmp(argv[1], "-test-print-mangle") == 0)
 return perform_test_load_tu(argv[2], "all", NULL, PrintMangledName, NULL);
   else if (argc > 1 && strcmp(argv[1], "-print-usr") == 0) {
Index: test/Index/binop.cpp
===
--- /dev/null
+++ test/Index/binop.cpp
@@ -0,0 +1,90 @@
+// RUN: c-index-test -test-print-binops %s | FileCheck %s
+
+struct C {
+  int m;
+};
+
+void func(void){
+	int a, b;
+  int C::* p = &C::m;
+
+	C c;
+	c.*p;
+
+	C* pc;
+	pc->*p;
+
+	a * b;
+	a / b;
+	a % b;
+	a + b;
+	a - b;
+
+	a << b;
+	a >> b;
+
+	a < b;
+	a > b;
+
+	a <= b;
+	a >= b;
+	a == b;
+	a != b;
+	
+	a & b;
+	a ^ b;
+	a | b;
+
+	a && b;
+	a || b;
+
+	a = b;
+
+	a *= b;
+	a /= b;
+	a %= b;
+	a += b;
+	a -= b;
+	
+	a <<= b;
+	a >>= b;
+
+	a &= b;
+	a ^= b;
+	a |= b;
+	a , b;
+
+}
+
+// CHECK: BinaryOperator=.* BinOp=.* 1
+// CHECK: BinaryOperator=->* BinOp=->* 2
+// CHECK: BinaryOperator=* BinOp=* 3
+// CHECK: BinaryOperator=/ BinOp=/ 4
+// CHECK: BinaryOperator=% BinOp=% 5
+// CHECK: BinaryOperator=+ BinOp=+ 6
+// CHECK: BinaryOperator=- BinOp=- 7
+// CHECK: BinaryOperator=<< BinOp=<< 8
+// CHECK: BinaryOperator=>> BinOp=>> 9
+// CHECK: BinaryOperator=< BinOp=< 10
+// CHECK: BinaryOperator=> BinOp=> 11
+// CHECK: BinaryOperator=<= BinOp=<= 12
+// CHECK: BinaryOperator=>= BinOp=>= 13
+// CHECK: BinaryOperator=== BinOp=== 14
+// CHECK: BinaryOperator=!= BinOp=!= 15
+// CHECK: BinaryOperator=& BinOp=& 16
+// CHECK: BinaryOperator

Re: [PATCH] D14293: [libcxx] Add -fno-exceptions libcxx builders to zorg

2015-11-04 Thread Renato Golin via cfe-commits
rengolin added a comment.

Hi Asiri,

Can I propose a different approach?

We now have a silent buildbot, which will never email people about breakages, 
but can be publicly monitored by you, me and others. I'm assuming you have 
access to at least one x86 and one ARM machines, so that you could set up a 
local buildbot, reporting to the buildmaster, without upsetting anyone else, 
but where I, Jon, Marshall can also see the progress of all tests being fixed, 
thus helping approving the patches for future fixes.

You don't need to share any information on the board, just connect to the 
master and start building...

Once the bot is green, we can add the builds on our own public hardware, 
avoiding the need for disabling the tests.

cheers,
--renato


http://reviews.llvm.org/D14293



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


Re: [PATCH] D11752: [X86] Pre-define __MOVBE__ when the target supports it.

2015-11-04 Thread Erik Verbruggen via cfe-commits
erikjv added a comment.

GCC doesn't define this, but icc does. Just like e.g. __AVX512CD__, it can be 
used to conditionally enable code that uses the instruction as a fast 
implementation for an algorithm.


http://reviews.llvm.org/D11752



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


[PATCH] D14329: Show inclusions from a preamble in clang_getInclusions.

2015-11-04 Thread Erik Verbruggen via cfe-commits
erikjv created this revision.
erikjv added a reviewer: klimek.
erikjv added a subscriber: cfe-commits.

When reparsing a translation unit with preamble generation turned on,
no includes are found. This is due to the fact that all SLocs from
AST/PCH files are skipped as they are 'loaded', and inclusions from a
preamble are also 'loaded'. So, in case a file has a preamble, it first
needs to process those loaded inclusions, and then check for any local
inclusions. This latter one is for any includes that are not part of the
preamble, like includes half-way through a file.

http://reviews.llvm.org/D14329

Files:
  test/Index/cindex-test-inclusions.c
  tools/c-index-test/c-index-test.c
  tools/libclang/CIndexInclusionStack.cpp

Index: tools/libclang/CIndexInclusionStack.cpp
===
--- tools/libclang/CIndexInclusionStack.cpp
+++ tools/libclang/CIndexInclusionStack.cpp
@@ -21,56 +21,81 @@
 #include "llvm/Support/raw_ostream.h"
 using namespace clang;
 
-extern "C" {
-void clang_getInclusions(CXTranslationUnit TU, CXInclusionVisitor CB,
- CXClientData clientData) {
-  if (cxtu::isNotUsableTU(TU)) {
-LOG_BAD_TU(TU);
-return;
-  }
-
+static void getInclusions(const SrcMgr::SLocEntry &(SourceManager::*Getter)(unsigned, bool*) const, unsigned n,
+  CXTranslationUnit TU, CXInclusionVisitor CB,
+  CXClientData clientData)
+{
   ASTUnit *CXXUnit = cxtu::getASTUnit(TU);
   SourceManager &SM = CXXUnit->getSourceManager();
   ASTContext &Ctx = CXXUnit->getASTContext();
-
   SmallVector InclusionStack;
-  unsigned n =  SM.local_sloc_entry_size();
-
-  // In the case where all the SLocEntries are in an external source, traverse
-  // those SLocEntries as well.  This is the case where we are looking
-  // at the inclusion stack of an AST/PCH file.
-  const SrcMgr::SLocEntry &(SourceManager::*Getter)(unsigned, bool*) const;
-  if (n == 1) {
-Getter = &SourceManager::getLoadedSLocEntry;
-n = SM.loaded_sloc_entry_size();
-  } else
-Getter = &SourceManager::getLocalSLocEntry;
+  const bool hasPreamble = SM.getPreambleFileID().isValid();
 
   for (unsigned i = 0 ; i < n ; ++i) {
 bool Invalid = false;
 const SrcMgr::SLocEntry &SL = (SM.*Getter)(i, &Invalid);
-
+
 if (!SL.isFile() || Invalid)
   continue;
 
 const SrcMgr::FileInfo &FI = SL.getFile();
 if (!FI.getContentCache()->OrigEntry)
   continue;
-
-// Build the inclusion stack.
+
+// If this is the main file, and there is a preamble, skip this SLoc. The
+// inclusions of the preamble already showed it.
 SourceLocation L = FI.getIncludeLoc();
+if (hasPreamble && CXXUnit->isInMainFileID(L))
+  continue;
+
+// Build the inclusion stack.
 InclusionStack.clear();
 while (L.isValid()) {
   PresumedLoc PLoc = SM.getPresumedLoc(L);
   InclusionStack.push_back(cxloc::translateSourceLocation(Ctx, L));
   L = PLoc.isValid()? PLoc.getIncludeLoc() : SourceLocation();
 }
-
+
+// If there is a preamble, the last entry is the "inclusion" of that
+// preamble into the main file, which has the bogus entry of main.c:1:1
+if (hasPreamble && !InclusionStack.empty())
+  InclusionStack.pop_back();
+
 // Callback to the client.
 // FIXME: We should have a function to construct CXFiles.
 CB(static_cast(
- const_cast(FI.getContentCache()->OrigEntry)), 
+ const_cast(FI.getContentCache()->OrigEntry)),
InclusionStack.data(), InclusionStack.size(), clientData);
-  }
+  }
+}
+
+
+extern "C" {
+void clang_getInclusions(CXTranslationUnit TU, CXInclusionVisitor CB,
+ CXClientData clientData) {
+  if (cxtu::isNotUsableTU(TU)) {
+LOG_BAD_TU(TU);
+return;
+  }
+
+  SourceManager &SM = cxtu::getASTUnit(TU)->getSourceManager();
+  const unsigned n =  SM.local_sloc_entry_size();
+
+  // In the case where all the SLocEntries are in an external source, traverse
+  // those SLocEntries as well.  This is the case where we are looking
+  // at the inclusion stack of an AST/PCH file. Also, if we are not looking at
+  // a AST/PCH file, but this file has a pre-compiled preamble, we also need
+  // to look in that file.
+  if (n == 1 || SM.getPreambleFileID().isValid()) {
+getInclusions(&SourceManager::getLoadedSLocEntry,
+  SM.loaded_sloc_entry_size(), TU, CB, clientData);
+  }
+
+  // Not a PCH/AST file. Note, if there is a preamble, it could still be that
+  // there are #includes in this file (e.g. for any include after the first
+  // declaration).
+  if (n != 1)
+getInclusions(&SourceManager::getLocalSLocEntry, n, TU, CB, clientData);
+
 }
 } // end extern C
Index: tools/c-index-test/c-index-test.c
===
--- tools/c-index-test/c-index-test.c
+++ tools/c-index-test/c-index-test.c
@@ -1546,6 +1546,8 @

Re: [PATCH] D14293: [libcxx] Add -fno-exceptions libcxx builders to zorg

2015-11-04 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In http://reviews.llvm.org/D14293#280982, @rengolin wrote:

> Hi Asiri,
>
> Can I propose a different approach?
>
> We now have a silent buildbot, which will never email people about breakages, 
> but can be publicly monitored by you, me and others. I'm assuming you have 
> access to at least one x86 and one ARM machines, so that you could set up a 
> local buildbot, reporting to the buildmaster, without upsetting anyone else, 
> but where I, Jon, Marshall can also see the progress of all tests being 
> fixed, thus helping approving the patches for future fixes.
>
> You don't need to share any information on the board, just connect to the 
> master and start building...
>
> Once the bot is green, we can add the builds on our own public hardware, 
> avoiding the need for disabling the tests.
>
> cheers,
> --renato


Counter proposal, we mark all the currently failing (-fno-exceptions) test 
cases with:

  // XFAIL: libcpp-no-exceptions

This has the following advantages:

- No need to change buildbots to skip tests
- The bots will catch any regressions in those tests that are already passing 
under -fno-exceptions
- You will be able to monitor my progress with the test fixes using the public 
(-fno-exceptions) buildbots
- I don't have to setup local buildbots (this is very difficult for us, 
infrastructure / legal problems)

What do you think?

- Asiri


http://reviews.llvm.org/D14293



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


Re: [PATCH] D14316: [Concepts] Add diagnostics which fall under [dcl.spec.concept]p1

2015-11-04 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.

LGTM!


http://reviews.llvm.org/D14316



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


r252045 - Initialize member field.

2015-11-04 Thread Erik Verbruggen via cfe-commits
Author: erikjv
Date: Wed Nov  4 08:34:43 2015
New Revision: 252045

URL: http://llvm.org/viewvc/llvm-project?rev=252045&view=rev
Log:
Initialize member field.

Modified:
cfe/trunk/include/clang/Frontend/FrontendOptions.h

Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=252045&r1=252044&r2=252045&view=diff
==
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Wed Nov  4 08:34:43 2015
@@ -92,7 +92,7 @@ class FrontendInputFile {
   bool IsSystem;
 
 public:
-  FrontendInputFile() : Buffer(nullptr), Kind(IK_None) { }
+  FrontendInputFile() : Buffer(nullptr), Kind(IK_None), IsSystem(false) { }
   FrontendInputFile(StringRef File, InputKind Kind, bool IsSystem = false)
 : File(File.str()), Buffer(nullptr), Kind(Kind), IsSystem(IsSystem) { }
   FrontendInputFile(llvm::MemoryBuffer *buffer, InputKind Kind,


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


Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-11-04 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

I would like to see one more test, just to make sure that a Var subject doesn't 
also allow it on a parameter:

  void f(int a [[clang::internal_linkage]]);

Aside from that, LGTM!


Repository:
  rL LLVM

http://reviews.llvm.org/D13925



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


r252047 - Silence "enumeral and non-enumeral type in conditional expression" warning; NFC.

2015-11-04 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Nov  4 08:43:43 2015
New Revision: 252047

URL: http://llvm.org/viewvc/llvm-project?rev=252047&view=rev
Log:
Silence "enumeral and non-enumeral type in conditional expression" warning; NFC.

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=252047&r1=252046&r2=252047&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Nov  4 08:43:43 2015
@@ -6244,7 +6244,7 @@ StringRef arm::getLLVMArchSuffixForARM(S
 // FIXME: horrible hack to get around the fact that Cortex-A7 is only an
 // armv7k triple if it's actually been specified via "-arch armv7k".
 ArchKind = (Arch == "armv7k" || Arch == "thumbv7k")
-  ? llvm::ARM::AK_ARMV7K
+  ? (unsigned)llvm::ARM::AK_ARMV7K
   : llvm::ARM::parseCPUArch(CPU);
   }
   if (ArchKind == llvm::ARM::AK_INVALID)


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


Re: [PATCH] D14277: [Analyzer] Make referenced SymbolMetadata live even if its region is dead

2015-11-04 Thread Aleksei Sidorin via cfe-commits
a.sidorin updated this revision to Diff 39198.
a.sidorin added a comment.

Thank you for you reply!

This version contains more radical solution. Also, I took an another look at 
the CStringChecker and its way of handling checkDeadSymbols.


Repository:
  rL LLVM

http://reviews.llvm.org/D14277

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
  lib/StaticAnalyzer/Checkers/CStringChecker.cpp
  lib/StaticAnalyzer/Core/SymbolManager.cpp
  test/Analysis/string.c

Index: test/Analysis/string.c
===
--- test/Analysis/string.c
+++ test/Analysis/string.c
@@ -414,6 +414,12 @@
   clang_analyzer_eval(strlen(dst) >= 4); // expected-warning{{TRUE}}
 }
 
+void strcat_symbolic_src_length(char *src) {
+  char dst[8] = "1234";
+  strcat(dst, src);
+  clang_analyzer_eval(strlen(dst) >= 4); // expected-warning{{TRUE}}
+}
+
 void strcat_symbolic_dst_length_taint(char *dst) {
   scanf("%s", dst); // Taint data.
   strcat(dst, "1234");
@@ -520,6 +526,17 @@
   clang_analyzer_eval(strlen(x) > 4); // expected-warning{{UNKNOWN}}
 }
 
+void strncpy_exactly_matching_buffer2(char *y) {
+if (strlen(y) >= 4)
+return;
+
+char x[4];
+strncpy(x, y, 4); // no-warning
+
+// This time, we know that y fits in x anyway.
+  clang_analyzer_eval(strlen(x) <= 3); // expected-warning{{TRUE}}
+}
+
 void strncpy_zero(char *src) {
   char dst[] = "123";
   strncpy(dst, src, 0); // no-warning
@@ -1079,30 +1096,3 @@
   // character. For now, we just model the invalidation.
   clang_analyzer_eval(str[1] == 'b'); // expected-warning{{UNKNOWN}}
 }
-
-//===--===
-// FIXMEs
-//===--===
-
-// The analyzer_eval call below should evaluate to true. We are being too 
-// aggressive in marking the (length of) src symbol dead. The length of dst 
-// depends on src. This could be explicitely specified in the checker or the 
-// logic for handling MetadataSymbol in SymbolManager needs to change.
-void strcat_symbolic_src_length(char *src) {
-	char dst[8] = "1234";
-	strcat(dst, src);
-  clang_analyzer_eval(strlen(dst) >= 4); // expected-warning{{UNKNOWN}}
-}
-
-// The analyzer_eval call below should evaluate to true. Most likely the same
-// issue as the test above.
-void strncpy_exactly_matching_buffer2(char *y) {
-	if (strlen(y) >= 4)
-		return;
-
-	char x[4];
-	strncpy(x, y, 4); // no-warning
-
-	// This time, we know that y fits in x anyway.
-  clang_analyzer_eval(strlen(x) <= 3); // expected-warning{{UNKNOWN}}
-}
Index: lib/StaticAnalyzer/Core/SymbolManager.cpp
===
--- lib/StaticAnalyzer/Core/SymbolManager.cpp
+++ lib/StaticAnalyzer/Core/SymbolManager.cpp
@@ -393,11 +393,6 @@
   RegionRoots.insert(region);
 }
 
-void SymbolReaper::markInUse(SymbolRef sym) {
-  if (isa(sym))
-MetadataInUse.insert(sym);
-}
-
 bool SymbolReaper::maybeDead(SymbolRef sym) {
   if (isLive(sym))
 return false;
@@ -459,10 +454,7 @@
 KnownLive = isLiveRegion(cast(sym)->getRegion());
 break;
   case SymExpr::MetadataKind:
-KnownLive = MetadataInUse.count(sym) &&
-isLiveRegion(cast(sym)->getRegion());
-if (KnownLive)
-  MetadataInUse.erase(sym);
+KnownLive = isLiveRegion(cast(sym)->getRegion());
 break;
   case SymExpr::SymIntKind:
 KnownLive = isLive(cast(sym)->getLHS());
Index: lib/StaticAnalyzer/Checkers/CStringChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -2123,28 +2123,22 @@
 
 for (SymExpr::symbol_iterator si = Len.symbol_begin(),
   se = Len.symbol_end(); si != se; ++si)
-  SR.markInUse(*si);
+  SR.markLive(*si);
   }
 }
 
 void CStringChecker::checkDeadSymbols(SymbolReaper &SR,
   CheckerContext &C) const {
-  if (!SR.hasDeadSymbols())
-return;
-
-  ProgramStateRef state = C.getState();
-  CStringLengthTy Entries = state->get();
+  auto state = C.getState();
+  auto Entries = state->get();
   if (Entries.isEmpty())
 return;
 
-  CStringLengthTy::Factory &F = state->get_context();
-  for (CStringLengthTy::iterator I = Entries.begin(), E = Entries.end();
-   I != E; ++I) {
-SVal Len = I.getData();
-if (SymbolRef Sym = Len.getAsSymbol()) {
-  if (SR.isDead(Sym))
-Entries = F.remove(Entries, I.getKey());
-}
+  auto &F = state->get_context();
+  for (auto I = Entries.begin(), E = Entries.end(); I != E; ++I) {
+const MemRegion *MR = I.getKey();
+if (!SR.isLiveRegion(MR))
+  Entries = F.remove(Entries, MR);
   }
 
   state = state->set(Entries);
Index: include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h

Re: [PATCH] D14277: [Analyzer] Make referenced SymbolMetadata live even if its region is dead

2015-11-04 Thread Aleksei Sidorin via cfe-commits
a.sidorin added inline comments.


Comment at: lib/StaticAnalyzer/Core/SymbolManager.cpp:457
@@ -461,6 +456,3 @@
   case SymExpr::MetadataKind:
-KnownLive = MetadataInUse.count(sym) &&
-isLiveRegion(cast(sym)->getRegion());
-if (KnownLive)
-  MetadataInUse.erase(sym);
+KnownLive = isLiveRegion(cast(sym)->getRegion());
 break;

Maybe we should just return false here?


Repository:
  rL LLVM

http://reviews.llvm.org/D14277



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


Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-04 Thread Beren Minor via cfe-commits
berenm updated this revision to Diff 39201.
berenm added a comment.

[clang-format] Count the number of braces and parens on the line instead of 
remembering only one.


http://reviews.llvm.org/D14325

Files:
  lib/Format/WhitespaceManager.cpp
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -8703,6 +8703,19 @@
   "  loongParameterB);\n"
   "int j = 2;",
   Alignment);
+
+  verifyFormat("template \n"
+   "auto foo() {}\n",
+   Alignment);
+  verifyFormat("int a, b = 1;\n"
+   "int c  = 2;\n"
+   "int dd = 3;\n",
+   Alignment);
+  verifyFormat("int aa   = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
 }
 
 TEST_F(FormatTest, AlignConsecutiveDeclarations) {
@@ -8903,6 +8916,29 @@
"int  myvar = 1;",
Alignment);
   Alignment.ColumnLimit = 80;
+  Alignment.AlignConsecutiveAssignments = false;
+
+  verifyFormat(
+  "template \n"
+  "auto foo() {}\n",
+  Alignment);
+  verifyFormat("float a, b = 1;\n"
+   "int   c = 2;\n"
+   "int   dd = 3;\n",
+   Alignment);
+  verifyFormat("int   aa = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
+  Alignment.AlignConsecutiveAssignments = true;
+  verifyFormat("float a, b = 1;\n"
+   "int   c  = 2;\n"
+   "int   dd = 3;\n",
+   Alignment);
+  verifyFormat("int   aa = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
+  Alignment.AlignConsecutiveAssignments = false;
 }
 
 TEST_F(FormatTest, LinuxBraceBreaking) {
Index: lib/Format/WhitespaceManager.cpp
===
--- lib/Format/WhitespaceManager.cpp
+++ lib/Format/WhitespaceManager.cpp
@@ -165,8 +165,10 @@
   unsigned StartOfSequence = 0;
   unsigned EndOfSequence = 0;
   bool FoundAssignmentOnLine = false;
-  bool FoundLeftBraceOnLine = false;
-  bool FoundLeftParenOnLine = false;
+  unsigned LeftBracesOnLine = 0;
+  unsigned LeftParensOnLine = 0;
+  unsigned CommasOnPrevLine = 0;
+  unsigned CommasOnLine = 0;
 
   // Aligns a sequence of assignment tokens, on the MinColumn column.
   //
@@ -186,21 +188,23 @@
 
   for (unsigned i = 0, e = Changes.size(); i != e; ++i) {
 if (Changes[i].NewlinesBefore != 0) {
+  CommasOnPrevLine = CommasOnLine;
+  CommasOnLine = 0;
   EndOfSequence = i;
   // If there is a blank line, if the last line didn't contain any
   // assignment, or if we found an open brace or paren, the sequence ends
   // here.
   if (Changes[i].NewlinesBefore > 1 || !FoundAssignmentOnLine ||
-  FoundLeftBraceOnLine || FoundLeftParenOnLine) {
+  LeftBracesOnLine > 0 || LeftParensOnLine > 0) {
 // NB: In the latter case, the sequence should end at the beggining of
 // the previous line, but it doesn't really matter as there is no
 // assignment on it
 AlignSequence();
   }
 
   FoundAssignmentOnLine = false;
-  FoundLeftBraceOnLine = false;
-  FoundLeftParenOnLine = false;
+  LeftBracesOnLine = 0;
+  LeftParensOnLine = 0;
 }
 
 // If there is more than one "=" per line, or if the "=" appears first on
@@ -210,23 +214,28 @@
  Changes[i + 1].NewlinesBefore > 0)) {
   AlignSequence();
 } else if (Changes[i].Kind == tok::r_brace) {
-  if (!FoundLeftBraceOnLine)
+  if (LeftBracesOnLine == 0)
 AlignSequence();
-  FoundLeftBraceOnLine = false;
+  else
+LeftBracesOnLine--;
 } else if (Changes[i].Kind == tok::l_brace) {
-  FoundLeftBraceOnLine = true;
+  LeftBracesOnLine++;
   if (!FoundAssignmentOnLine)
 AlignSequence();
 } else if (Changes[i].Kind == tok::r_paren) {
-  if (!FoundLeftParenOnLine)
+  if (LeftParensOnLine == 0)
 AlignSequence();
-  FoundLeftParenOnLine = false;
+  else
+LeftParensOnLine--;
 } else if (Changes[i].Kind == tok::l_paren) {
-  FoundLeftParenOnLine = true;
+  LeftParensOnLine++;
   if (!FoundAssignmentOnLine)
 AlignSequence();
-} else if (!FoundAssignmentOnLine && !FoundLeftBraceOnLine &&
-   !FoundLeftParenOnLine && Changes[i].Kind == tok::equal) {
+} else if (Changes[i].Kind == tok::comma) {
+  if (!FoundAssignmentOnLine)
+CommasOnLine++;
+} else if (!FoundAssignmentOnLine && LeftBracesOnLine == 0 &&
+   LeftParensOnLine == 0 && Changes[i].Kind == tok::equal) {
   FoundAssignmentOnLine = true;
   if (StartOfSequence == 0)
 StartOfSequence = i;
@@ -237,7 +246,8 @@
 LineLengthAfter +=

Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-04 Thread Beren Minor via cfe-commits
berenm added a comment.

I've also added a fix for the other issue reported on the same bug. I could 
split the two reviews if necessary.


http://reviews.llvm.org/D14325



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


Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-04 Thread Daniel Jasper via cfe-commits
djasper added inline comments.


Comment at: lib/Format/WhitespaceManager.cpp:163-171
@@ -162,9 +162,11 @@
 
   unsigned MinColumn = 0;
   unsigned MaxColumn = UINT_MAX;
   unsigned StartOfSequence = 0;
   unsigned EndOfSequence = 0;
   bool FoundAssignmentOnLine = false;
-  bool FoundLeftBraceOnLine = false;
-  bool FoundLeftParenOnLine = false;
+  unsigned LeftBracesOnLine = 0;
+  unsigned LeftParensOnLine = 0;
+  unsigned CommasOnPrevLine = 0;
+  unsigned CommasOnLine = 0;
 

Hm. So many lokal variables. I think it might make sense to wrap these in a 
class/struct? That could be a first step to re-using code in 
alignConsecutiveDeclarations.

Also, a comment would help here. Specifically, a comment explaining why you 
count commas, braces and parentheses (not explaining that this variables count 
them ;-) )


Comment at: lib/Format/WhitespaceManager.cpp:220
@@ -216,1 +219,3 @@
+  else
+LeftBracesOnLine--;
 } else if (Changes[i].Kind == tok::l_brace) {

Use (here and everywhere else):

  --LeftBracesOnLine;


http://reviews.llvm.org/D14325



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


Re: [PATCH] D13304: Avoid inlining in throw statement

2015-11-04 Thread Jun Bum Lim via cfe-commits
junbuml added a comment.

If we want to add a check for CallSites in EHRs in inliner, we may be able to 
borrow things done in BranchProbabilityInfo::calcColdCallHeuristics, but for 
exception handing intrinsics, not for cold,  and make getInlineThreshold() 
return a lower threshold so that we can be conservative for calls in EHR.

Considering that inliner will be hooked with BPI / BFI with the new pass 
manager, as Hal mentioned above we may need to mark the exception handling 
intrinsics as cold so that we can allow 
BranchProbabilityInfo::calcColdCallHeuristics to set weight properly for blocks 
that branch to exception regions. I believe we can do this at prune-eh if 
front-end don’t do that, but it could be done later.


http://reviews.llvm.org/D13304



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


r252050 - Allow compound assignment expressions to be contracted when licensed by the language or pragma.

2015-11-04 Thread Stephen Canon via cfe-commits
Author: scanon
Date: Wed Nov  4 09:25:38 2015
New Revision: 252050

URL: http://llvm.org/viewvc/llvm-project?rev=252050&view=rev
Log:
Allow compound assignment expressions to be contracted when licensed by the 
language or pragma.

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

Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=252050&r1=252049&r2=252050&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Nov  4 09:25:38 2015
@@ -2116,7 +2116,7 @@ LValue ScalarExprEmitter::EmitCompoundAs
   OpInfo.RHS = Visit(E->getRHS());
   OpInfo.Ty = E->getComputationResultType();
   OpInfo.Opcode = E->getOpcode();
-  OpInfo.FPContractable = false;
+  OpInfo.FPContractable = E->isFPContractable();
   OpInfo.E = E;
   // Load/convert the LHS.
   LValue LHSLV = EmitCheckedLValue(E->getLHS(), CodeGenFunction::TCK_Store);


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


Re: [PATCH] D14200: Make FP_CONTRACT ON default.

2015-11-04 Thread Steve Canon via cfe-commits
scanon updated this revision to Diff 39205.
scanon added a comment.

Additionally test contraction of compound assignment expressions.


http://reviews.llvm.org/D14200

Files:
  include/clang/Basic/LangOptions.def
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/aarch64-neon-fma.c
  test/CodeGen/aarch64-scalar-fma.c
  test/CodeGen/fp-contract-pragma.cpp
  test/Driver/clang_f_opts.c

Index: test/Driver/clang_f_opts.c
===
--- test/Driver/clang_f_opts.c
+++ test/Driver/clang_f_opts.c
@@ -36,8 +36,10 @@
 // RUN: %clang -### -S -ffp-contract=fast %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
 // RUN: %clang -### -S -ffast-math %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
 // RUN: %clang -### -S -ffp-contract=off %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK %s
+// RUN: %clang -### -S -ffp-contract=on %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-ON-CHECK %s
 // FP-CONTRACT-FAST-CHECK: -ffp-contract=fast
 // FP-CONTRACT-OFF-CHECK: -ffp-contract=off
+// FP-CONTRACT-ON-CHECK: -ffp-contract=on
 
 // RUN: %clang -### -S -funroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-UNROLL-LOOPS %s
 // RUN: %clang -### -S -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-UNROLL-LOOPS %s
Index: test/CodeGen/fp-contract-pragma.cpp
===
--- test/CodeGen/fp-contract-pragma.cpp
+++ test/CodeGen/fp-contract-pragma.cpp
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 -O3 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
 
+#pragma STDC FP_CONTRACT OFF
+
 // Is FP_CONTRACT is honored in a simple case?
 float fp_contract_1(float a, float b, float c) {
 // CHECK: _Z13fp_contract_1fff
Index: test/CodeGen/aarch64-scalar-fma.c
===
--- test/CodeGen/aarch64-scalar-fma.c
+++ test/CodeGen/aarch64-scalar-fma.c
@@ -0,0 +1,177 @@
+// RUN: %clang_cc1 -triple=aarch64-unknown -Os -ffp-contract=fast -S -o - %s | FileCheck -check-prefix=CHECK-FAST -check-prefix=CHECK-ALL %s
+// RUN: %clang_cc1 -triple=aarch64-unknown -Os -ffp-contract=on -S -o - %s | FileCheck -check-prefix=CHECK-ON -check-prefix=CHECK-ALL %s
+// RUN: %clang_cc1 -triple=aarch64-unknown -Os -ffp-contract=off -S -o - %s | FileCheck -check-prefix=CHECK-OFF -check-prefix=CHECK-ALL %s
+// RUN: %clang_cc1 -triple=aarch64-unknown -Os -S -o - %s | FileCheck -check-prefix=CHECK-ON -check-prefix=CHECK-ALL %s
+// REQUIRES: aarch64-registered-target
+
+float test1(float x, float y, float z) {
+  return x*y + z;
+  // CHECK-ALL-LABEL: test1:
+  // CHECK-FAST: fmadd
+  // CHECK-ON: fmadd
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fadd
+}
+
+double test2(double x, double y, double z) {
+  z -= x*y;
+  return z;
+  // CHECK-ALL-LABEL: test2:
+  // CHECK-FAST: fmsub
+  // CHECK-ON: fmsub
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fsub
+}
+
+float test3(float x, float y, float z) {
+  float tmp = x*y;
+  return tmp + z;
+  // CHECK-ALL-LABEL: test3:
+  // CHECK-FAST: fmadd
+  // CHECK-ON: fmul
+  // CHECK-ON-NEXT: fadd
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fadd
+}
+
+double test4(double x, double y, double z) {
+  double tmp = x*y;
+  return tmp - z;
+  // CHECK-ALL-LABEL: test4:
+  // CHECK-FAST: fnmsub
+  // CHECK-ON: fmul
+  // CHECK-ON-NEXT: fsub
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fsub
+}
+
+#pragma STDC FP_CONTRACT ON
+
+float test5(float x, float y, float z) {
+  return x*y + z;
+  // CHECK-ALL-LABEL: test5:
+  // CHECK-FAST: fmadd
+  // CHECK-ON: fmadd
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fadd
+}
+
+double test6(double x, double y, double z) {
+  z -= x*y;
+  return z;
+  // CHECK-ALL-LABEL: test6:
+  // CHECK-FAST: fmsub
+  // CHECK-ON: fmsub
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fsub
+}
+
+float test7(float x, float y, float z) {
+  float tmp = x*y;
+  return tmp + z;
+  // CHECK-ALL-LABEL: test7:
+  // CHECK-FAST: fmadd
+  // CHECK-ON: fmul
+  // CHECK-ON-NEXT: fadd
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fadd
+}
+
+double test8(double x, double y, double z) {
+  double tmp = x*y;
+  return tmp - z;
+  // CHECK-ALL-LABEL: test8:
+  // CHECK-FAST: fnmsub
+  // CHECK-ON: fmul
+  // CHECK-ON-NEXT: fsub
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fsub
+}
+
+#pragma STDC FP_CONTRACT OFF
+
+float test9(float x, float y, float z) {
+  return x*y + z;
+  // CHECK-ALL-LABEL: test9:
+  // CHECK-FAST: fmadd
+  // CHECK-ON: fmul
+  // CHECK-ON-NEXT: fadd
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fadd
+}
+
+double test10(double x, double y, double z) {
+  z -= x*y;
+  return z;
+  // CHECK-ALL-LABEL: test10:
+  // CHECK-FAST: fmsub
+  // CHECK-ON: fmul
+  // CHECK-ON-NEXT: fsub
+  // CHECK-OFF: fmul
+  // CHECK-OFF-NEXT: fsub
+}
+
+float test11(float x, float y, float z) {
+  float tmp = x*y;
+  return tmp + z;
+  // CHECK-ALL-LABEL: test11:
+  // CHECK-FAST: fmadd
+  // CHECK-ON: fmul
+  // CHECK-ON-NEXT: fadd
+  // CHECK-OFF: 

r252055 - Improving the diagnostic for cases where the attribute only appertains to a function with a prototype.

2015-11-04 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Nov  4 10:09:04 2015
New Revision: 252055

URL: http://llvm.org/viewvc/llvm-project?rev=252055&view=rev
Log:
Improving the diagnostic for cases where the attribute only appertains to a 
function with a prototype.

Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/AttributeList.h
cfe/trunk/test/Sema/attr-ownership.c
cfe/trunk/test/SemaObjC/format-arg-attribute.m

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=252055&r1=252054&r2=252055&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Wed Nov  4 10:09:04 2015
@@ -769,7 +769,7 @@ def Format : InheritableAttr {
   let Args = [IdentifierArgument<"Type">, IntArgument<"FormatIdx">,
   IntArgument<"FirstArg">];
   let Subjects = SubjectList<[ObjCMethod, Block, HasFunctionProto], WarnDiag,
- "ExpectedFunction">;
+ "ExpectedFunctionWithProtoType">;
   let Documentation = [FormatDocs];
 }
 
@@ -777,7 +777,7 @@ def FormatArg : InheritableAttr {
   let Spellings = [GCC<"format_arg">];
   let Args = [IntArgument<"FormatIdx">];
   let Subjects = SubjectList<[ObjCMethod, HasFunctionProto], WarnDiag,
- "ExpectedFunction">;
+ "ExpectedFunctionWithProtoType">;
   let Documentation = [Undocumented];
 }
 
@@ -1203,7 +1203,8 @@ def Ownership : InheritableAttr {
 }
   }];
   let Args = [IdentifierArgument<"Module">, VariadicUnsignedArgument<"Args">];
-  let Subjects = SubjectList<[HasFunctionProto], WarnDiag, "ExpectedFunction">;
+  let Subjects = SubjectList<[HasFunctionProto], WarnDiag,
+ "ExpectedFunctionWithProtoType">;
   let Documentation = [Undocumented];
 }
 

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=252055&r1=252054&r2=252055&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov  4 10:09:04 
2015
@@ -2354,7 +2354,7 @@ def warn_attribute_wrong_decl_type : War
   "Objective-C instance methods|init methods of interface or class extension 
declarations|"
   "variables, functions and classes|Objective-C protocols|"
   "functions and global variables|structs, unions, and typedefs|structs and 
typedefs|"
-  "interface or protocol declarations|kernel functions}1">,
+  "interface or protocol declarations|kernel functions|non-K&R-style 
functions}1">,
   InGroup;
 def err_attribute_wrong_decl_type : Error;
 def warn_type_attribute_wrong_type : Warning<

Modified: cfe/trunk/include/clang/Sema/AttributeList.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/AttributeList.h?rev=252055&r1=252054&r2=252055&view=diff
==
--- cfe/trunk/include/clang/Sema/AttributeList.h (original)
+++ cfe/trunk/include/clang/Sema/AttributeList.h Wed Nov  4 10:09:04 2015
@@ -852,7 +852,8 @@ enum AttributeDeclKind {
   ExpectedStructOrUnionOrTypedef,
   ExpectedStructOrTypedef,
   ExpectedObjectiveCInterfaceOrProtocol,
-  ExpectedKernelFunction
+  ExpectedKernelFunction,
+  ExpectedFunctionWithProtoType
 };
 
 }  // end namespace clang

Modified: cfe/trunk/test/Sema/attr-ownership.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-ownership.c?rev=252055&r1=252054&r2=252055&view=diff
==
--- cfe/trunk/test/Sema/attr-ownership.c (original)
+++ cfe/trunk/test/Sema/attr-ownership.c Wed Nov  4 10:09:04 2015
@@ -9,7 +9,7 @@ void f6(void) __attribute__((ownership_h
 void f7(void) __attribute__((ownership_takes(foo)));  // expected-error 
{{'ownership_takes' attribute takes at least 2 arguments}}
 void f8(int *i, int *j, int k) __attribute__((ownership_holds(foo, 1, 2, 4))); 
 // expected-error {{'ownership_holds' attribute parameter 3 is out of bounds}}
 
-int f9 __attribute__((ownership_takes(foo, 1)));  // expected-warning 
{{'ownership_takes' attribute only applies to functions}}
+int f9 __attribute__((ownership_takes(foo, 1)));  // expected-warning 
{{'ownership_takes' attribute only applies to non-K&R-style functions}}
 
 void f10(int i) __attribute__((ownership_holds(foo, 1)));  // expected-error 
{{'ownership_holds' attribute only applies to pointer arguments}}
 void *f11(float i) __attribute__((ownership_returns(foo, 1)));  // 
expected-error {{'ownership_returns' attribute only applies to integer 
arguments}}
@@ -23,3 +23,4 @@ void f15(

Re: r249721 - When mapping no_sanitize_* attributes to no_sanitize attributes, handle GNU-style formatting that involves prefix and suffix underscores. Cleans up other usages of similar functionality.

2015-11-04 Thread Aaron Ballman via cfe-commits
On Fri, Oct 9, 2015 at 10:37 AM, Aaron Ballman  wrote:
> On Fri, Oct 9, 2015 at 8:53 AM, Aaron Ballman  wrote:
>> On Thu, Oct 8, 2015 at 6:10 PM, Richard Smith  wrote:
>>> On Thu, Oct 8, 2015 at 2:59 PM, Adrian Zgorzalek  wrote:

 Same story:
  warning: 'ownership_takes' attribute only applies to functions
 [-Wignored-attributes]
 __attribute__((ownership_takes(__))) void f();
^
>>>
>>>
>>> Oh, I see, you're building in C, and the diagnostic here is broken (we give
>>> the "only applies to functions" diagnostic when it's applied to a function
>>> without a prototype). =( Aaron, can I tempt you to fix that? ;)
>>
>> I'll look into that one. :-)
>
> I've corrected the issue, but am not overly enamored with the
> diagnostic wording. If you can think of something better, please let
> me know.

I've commit in r252055; if we think of better wording, we can modify it later.

~Aaron

>
> ~Aaron
>
>>
>> ~Aaron
>>
>>>
>>> Try this one:
>>>
>>> __attribute__((ownership_takes(__, 1))) void f(void*);

 On Oct 8, 2015, at 2:52 PM, Richard Smith  wrote:

 On Thu, Oct 8, 2015 at 2:45 PM, Adrian Zgorzalek  wrote:
>
>
> On Oct 8, 2015, at 2:17 PM, Richard Smith  wrote:
>
> On Thu, Oct 8, 2015 at 2:10 PM, Adrian Zgorzalek via cfe-commits
>  wrote:
>>
>> You are right, my bad, I thought this if covers all the cases, but 
>> part could be empty.
>>
>> Here is the fix
>
>
> Please add a testcase ("__attribute__((ownership_takes(__))) void f();"
> maybe?).
>
> I tried different attributes but none of them triggers the assert though.
> They all spit out warning:
> warning: 'ownership_takes' attribute only applies to functions
> [-Wignored-attributes]
> __attribute__((ownership_takes(__))) f();
>^


 You missed the 'void'.

>
> Do you have some other idea?
>
>
>
> The '&&' should go at the end of the previous line.
>
>> Adrian
>> > On Oct 8, 2015, at 1:52 PM, Aaron Ballman 
>> > wrote:
>> >
>> > On Thu, Oct 8, 2015 at 4:49 PM, Richard Smith 
>> > wrote:
>> >> On Thu, Oct 8, 2015 at 1:21 PM, Aaron Ballman
>> >> 
>> >> wrote:
>> >>>
>> >>> On Thu, Oct 8, 2015 at 4:16 PM, Richard Smith
>> >>> 
>> >>> wrote:
>>  On Thu, Oct 8, 2015 at 12:24 PM, Aaron Ballman via cfe-commits
>>   wrote:
>> >
>> > Author: aaronballman
>> > Date: Thu Oct  8 14:24:08 2015
>> > New Revision: 249721
>> >
>> > URL:
>> > https://urldefense.proofpoint.com/v1/url?u=http://llvm.org/viewvc/llvm-project?rev%3D249721%26view%3Drev&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=ZpIyPFH5RmN0EBF%2B6Om2Hg%3D%3D%0A&m=kMsJztGqfQof%2FUicfGEXM78GJV6jd7CTOxlypvgU10A%3D%0A&s=8862f3210cdb7661e90a0d8588334d3e1cf64e92851d05bbcd2b159daf05c7dd
>> > Log:
>> > When mapping no_sanitize_* attributes to no_sanitize attributes,
>> > handle
>> > GNU-style formatting that involves prefix and suffix underscores.
>> > Cleans up
>> > other usages of similar functionality.
>> >
>> > Patch by Adrian Zgorzalek!
>> >
>> > Modified:
>> >cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>> >cfe/trunk/test/SemaCXX/attr-no-sanitize-address.cpp
>> >cfe/trunk/test/SemaCXX/attr-no-sanitize-memory.cpp
>> >cfe/trunk/test/SemaCXX/attr-no-sanitize-thread.cpp
>> >
>> > Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>> > URL:
>> >
>> >
>> > https://urldefense.proofpoint.com/v1/url?u=http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev%3D249721%26r1%3D249720%26r2%3D249721%26view%3Ddiff&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=ZpIyPFH5RmN0EBF%2B6Om2Hg%3D%3D%0A&m=kMsJztGqfQof%2FUicfGEXM78GJV6jd7CTOxlypvgU10A%3D%0A&s=7dae8eb5cffae4493f0a6c26033810564fd7b688297fc93106a3b980f76cdd9f
>> >
>> >
>> >
>> > ==
>> > --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
>> > +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Thu Oct  8 14:24:08 2015
>> > @@ -1308,6 +1308,17 @@ void Sema::AddAssumeAlignedAttr(SourceRa
>> > AssumeAlignedAttr(AttrRange, Context, E, OE,
>> > SpellingListIndex));
>> > }
>> >
>> > +/// Normalize the attribute, __foo__ becomes foo.
>> > +/// Returns true if normalization was applied.
>> > +static bool normalizeName(StringRef &AttrName) {
>> > +  if (AttrName.startswith("__") && AttrName.endswith("__")) {
>> > +assert(AttrName.size() > 4 && "Name too short");
>> 
>> 
>>  This assert will fire on the strings __, ___, and , which are
>>  valid
>>  in

r252056 - clang-cl: Parse the /guard:cf[-] flag (PR25400)

2015-11-04 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Nov  4 10:11:56 2015
New Revision: 252056

URL: http://llvm.org/viewvc/llvm-project?rev=252056&view=rev
Log:
clang-cl: Parse the /guard:cf[-] flag (PR25400)

Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=252056&r1=252055&r2=252056&view=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Wed Nov  4 10:11:56 2015
@@ -299,6 +299,7 @@ def _SLASH_Gm_ : CLFlag<"Gm-">;
 def _SLASH_Gr : CLFlag<"Gr">;
 def _SLASH_GS : CLFlag<"GS">;
 def _SLASH_GT : CLFlag<"GT">;
+def _SLASH_Guard : CLJoined<"guard:">;
 def _SLASH_GX : CLFlag<"GX">;
 def _SLASH_Gv : CLFlag<"Gv">;
 def _SLASH_Gz : CLFlag<"Gz">;

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=252056&r1=252055&r2=252056&view=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Wed Nov  4 10:11:56 2015
@@ -301,6 +301,8 @@
 // RUN: /Gr \
 // RUN: /GS \
 // RUN: /GT \
+// RUN: /guard:cf \
+// RUN: /guard:cf- \
 // RUN: /GX \
 // RUN: /Gv \
 // RUN: /Gz \


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


Re: [PATCH] D14293: [libcxx] Add -fno-exceptions libcxx builders to zorg

2015-11-04 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.



> Counter proposal, we mark all the currently failing (-fno-exceptions) test 
> cases with:

> 

>   // XFAIL: libcpp-no-exceptions

> 

> 

> This has the following advantages:

> 

> - No need to change buildbots to skip tests

> - The bots will catch any regressions in those tests that are already passing 
> under -fno-exceptions

> - You will be able to monitor my progress with the test fixes using the 
> public (-fno-exceptions) buildbots

> - I don't have to setup local buildbots (this is very difficult for us, 
> infrastructure / legal problems)

> 

>   What do you think?


I think this ^ is a reasonable solution.

Jon

> 

> 

> - Asiri





http://reviews.llvm.org/D14293



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


Re: [PATCH] D14293: [libcxx] Add -fno-exceptions libcxx builders to zorg

2015-11-04 Thread Renato Golin via cfe-commits
rengolin added a comment.

In http://reviews.llvm.org/D14293#281176, @jroelofs wrote:

> I think this ^ is a reasonable solution.


I'm fine with that, as long as everyone's happy.

160 XFAILs are ok (as long as you're fixing them), disabling the tests makes no 
sense. :)

cheers,
--renato


http://reviews.llvm.org/D14293



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


Re: [PATCH] D14293: [libcxx] Add -fno-exceptions libcxx builders to zorg

2015-11-04 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In http://reviews.llvm.org/D14293#281183, @rengolin wrote:

> In http://reviews.llvm.org/D14293#281176, @jroelofs wrote:
>
> > I think this ^ is a reasonable solution.
>
>
> I'm fine with that, as long as everyone's happy.
>
> 160 XFAILs are ok (as long as you're fixing them), disabling the tests makes 
> no sense. :)
>
> cheers,
> --renato


Great! I will update the patch http://reviews.llvm.org/D14292 to include the 
X-FAILS and then update the current patch to remove the hack which prevents the 
tests being run.

Thanks.

- Asiri


http://reviews.llvm.org/D14293



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


Re: [PATCH] D12922: Add support for function attribute "notail"

2015-11-04 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!



Comment at: lib/Sema/SemaDecl.cpp:5374
@@ +5373,3 @@
+
+  // Virtual functions cannot be marked as 'notail'.
+  if (auto *Attr = ND.getAttr())

ahatanak wrote:
> aaron.ballman wrote:
> > I am not home yet, and so I don't have the source code to try this out, but 
> > I have a sneaking suspicion there's a way to tell whether a function is an 
> > override. IIRC, it's something like overridden_methods() on a CXXMethodDecl.
> > 
> > I will do some poking when I am back in front of the source. Otherwise, I 
> > would guess you can look at some of the diagnostics in 
> > DiagnosticSemaKinds.td for the override keyword itself, because I bet we 
> > warn when you specify override on something that isn't a virtual function 
> > override, and that should have a code example.
> It's possible to tell a method is a virtual function if either an overridden 
> method is added to its declaration (which will cause isVirtual() to return 
> true) or an OverrideAttr attribute is added. Currently, processDeclAttributes 
> is called before these methods or attributes are added, and that is why I 
> think it isn't possible to tell if the method is virtual when the attributes 
> are being checked.
Ugh, that is really unfortunate, but I think you're right. At some point, we 
may have to find a way to handle this, but I don't think that should hold up 
your patch.


http://reviews.llvm.org/D12922



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


Re: [PATCH] D11752: [X86] Pre-define __MOVBE__ when the target supports it.

2015-11-04 Thread Craig Topper via cfe-commits
craig.topper added a comment.

Does icc have an intrinsic for it?


http://reviews.llvm.org/D11752



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


r252061 - [Concepts] Add diagnostics which fall under [dcl.spec.concept]p1

2015-11-04 Thread Nathan Wilson via cfe-commits
Author: nwilson
Date: Wed Nov  4 12:18:35 2015
New Revision: 252061

URL: http://llvm.org/viewvc/llvm-project?rev=252061&view=rev
Log:
[Concepts] Add diagnostics which fall under [dcl.spec.concept]p1

Summary: Diagnose when the 'concept' specifier is used on a typedef or function 
parameter.

Reviewers: rsmith, hubert.reinterpretcast, aaron.ballman, faisalv

Subscribers: cfe-commits

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

Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=252061&r1=252060&r2=252061&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Nov  4 12:18:35 2015
@@ -5119,6 +5119,9 @@ Sema::ActOnTypedefDeclarator(Scope* S, D
   if (D.getDeclSpec().isConstexprSpecified())
 Diag(D.getDeclSpec().getConstexprSpecLoc(), diag::err_invalid_constexpr)
   << 1;
+  if (D.getDeclSpec().isConceptSpecified())
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_wrong_decl_kind);
 
   if (D.getName().Kind != UnqualifiedId::IK_Identifier) {
 Diag(D.getName().StartLocation, diag::err_typedef_not_identifier)
@@ -10277,6 +10280,8 @@ Decl *Sema::ActOnParamDeclarator(Scope *
   if (DS.isConstexprSpecified())
 Diag(DS.getConstexprSpecLoc(), diag::err_invalid_constexpr)
   << 0;
+  if (DS.isConceptSpecified())
+Diag(DS.getConceptSpecLoc(), diag::err_concept_wrong_decl_kind);
 
   DiagnoseFunctionSpecifiers(DS);
 

Modified: 
cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp?rev=252061&r1=252060&r2=252061&view=diff
==
--- cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp 
(original)
+++ cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp Wed 
Nov  4 12:18:35 2015
@@ -37,5 +37,7 @@ concept enum CE1 {}; // expected-error {
 template  concept class TCC1 {}; // expected-error {{'concept' can 
only appear on the definition of a function template or variable template}}
 template  concept struct TCS1 {}; // expected-error {{'concept' 
can only appear on the definition of a function template or variable template}}
 template  concept union TCU1 {}; // expected-error {{'concept' can 
only appear on the definition of a function template or variable template}}
+typedef concept int CI; // expected-error {{'concept' can only appear on the 
definition of a function template or variable template}}
+void fpc(concept int i) {} // expected-error {{'concept' can only appear on 
the definition of a function template or variable template}}
 
 concept bool; // expected-error {{'concept' can only appear on the definition 
of a function template or variable template}}


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


Re: [PATCH] D14316: [Concepts] Add diagnostics which fall under [dcl.spec.concept]p1

2015-11-04 Thread Nathan Wilson via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL252061: [Concepts] Add diagnostics which fall under 
[dcl.spec.concept]p1 (authored by nwilson).

Changed prior to commit:
  http://reviews.llvm.org/D14316?vs=39151&id=39215#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14316

Files:
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp

Index: cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
===
--- cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
+++ cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
@@ -37,5 +37,7 @@
 template  concept class TCC1 {}; // expected-error {{'concept' can 
only appear on the definition of a function template or variable template}}
 template  concept struct TCS1 {}; // expected-error {{'concept' 
can only appear on the definition of a function template or variable template}}
 template  concept union TCU1 {}; // expected-error {{'concept' can 
only appear on the definition of a function template or variable template}}
+typedef concept int CI; // expected-error {{'concept' can only appear on the 
definition of a function template or variable template}}
+void fpc(concept int i) {} // expected-error {{'concept' can only appear on 
the definition of a function template or variable template}}
 
 concept bool; // expected-error {{'concept' can only appear on the definition 
of a function template or variable template}}
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -5119,6 +5119,9 @@
   if (D.getDeclSpec().isConstexprSpecified())
 Diag(D.getDeclSpec().getConstexprSpecLoc(), diag::err_invalid_constexpr)
   << 1;
+  if (D.getDeclSpec().isConceptSpecified())
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_wrong_decl_kind);
 
   if (D.getName().Kind != UnqualifiedId::IK_Identifier) {
 Diag(D.getName().StartLocation, diag::err_typedef_not_identifier)
@@ -10277,6 +10280,8 @@
   if (DS.isConstexprSpecified())
 Diag(DS.getConstexprSpecLoc(), diag::err_invalid_constexpr)
   << 0;
+  if (DS.isConceptSpecified())
+Diag(DS.getConceptSpecLoc(), diag::err_concept_wrong_decl_kind);
 
   DiagnoseFunctionSpecifiers(DS);
 


Index: cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
===
--- cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
+++ cfe/trunk/test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p1.cpp
@@ -37,5 +37,7 @@
 template  concept class TCC1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
 template  concept struct TCS1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
 template  concept union TCU1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
+typedef concept int CI; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
+void fpc(concept int i) {} // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
 
 concept bool; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -5119,6 +5119,9 @@
   if (D.getDeclSpec().isConstexprSpecified())
 Diag(D.getDeclSpec().getConstexprSpecLoc(), diag::err_invalid_constexpr)
   << 1;
+  if (D.getDeclSpec().isConceptSpecified())
+Diag(D.getDeclSpec().getConceptSpecLoc(),
+ diag::err_concept_wrong_decl_kind);
 
   if (D.getName().Kind != UnqualifiedId::IK_Identifier) {
 Diag(D.getName().StartLocation, diag::err_typedef_not_identifier)
@@ -10277,6 +10280,8 @@
   if (DS.isConstexprSpecified())
 Diag(DS.getConstexprSpecLoc(), diag::err_invalid_constexpr)
   << 0;
+  if (DS.isConceptSpecified())
+Diag(DS.getConceptSpecLoc(), diag::err_concept_wrong_decl_kind);
 
   DiagnoseFunctionSpecifiers(DS);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10677: Allow deque to handle incomplete types

2015-11-04 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

Hi Eric,

could you please clarify what exactly you are looking for here?


Repository:
  rL LLVM

http://reviews.llvm.org/D10677



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


Re: [Diffusion] rL251335: MismatchingNewDeleteDetector uses incorrect field, and finds no initializer

2015-11-04 Thread Richard Smith via cfe-commits
rsmith accepted this commit.

Users:
  ismailp (Author)
  rsmith (Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)

http://reviews.llvm.org/rL251335



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


Re: [Diffusion] rL250657: Support linking against OpenMP runtime on FreeBSD.

2015-11-04 Thread Richard Smith via cfe-commits
rsmith accepted this commit.

Users:
  dim (Author)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  joerg (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL250657



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


Re: [Diffusion] rL248426: Support linking against OpenMP runtime on NetBSD.

2015-11-04 Thread Richard Smith via cfe-commits
rsmith accepted this commit.

Users:
  joerg (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL248426



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


Re: [Diffusion] rL248379: Refactor library decision for -fopenmp support from Darwin into a

2015-11-04 Thread Richard Smith via cfe-commits
rsmith accepted this commit.

Users:
  joerg (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL248379



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


Re: [Diffusion] rL248424: Push OpenMP linker flags after linker input on Darwin. Don't add any

2015-11-04 Thread Richard Smith via cfe-commits
rsmith accepted this commit.

Users:
  joerg (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL248424



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


Re: [PATCH] D14164: Driver: fallback to parent directory of clang if no sysroot for mingw-w64 target

2015-11-04 Thread Yaron Keren via cfe-commits
yaron.keren accepted this revision.
yaron.keren added a reviewer: yaron.keren.
yaron.keren added a comment.
This revision is now accepted and ready to land.

The formatting is wrong, aligned to the right, clang-format the new code.

Can we control getInstalledDir() when running under LIT so this could be 
tested? if possible, add a test before committing.

LGTM.


http://reviews.llvm.org/D14164



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


Re: [PATCH] D14303: [analyzer] Add 'optin' checker package and move localizability checkers into it.

2015-11-04 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

See the comment below, otherwise, LGTM.



Comment at: lib/StaticAnalyzer/Checkers/Checkers.td:23
@@ +22,3 @@
+
+def OptIn : Package<"optin">;
+

Please, add a comment describing for how this package should be used as you do 
in the commit message.
As you are at it, feel free to update the comment for alpha as well.


http://reviews.llvm.org/D14303



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


Re: [Diffusion] rL244063: Add missing atomic libcall support.

2015-11-04 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith.
rsmith raised a concern with this commit.

/cfe/trunk/lib/CodeGen/CGAtomic.cpp:941-943 According to the GCC documentation 
for libatomic:

> for i = __atomic_add_fetch (ptr, j, model) the code generated will be
>
>tmp = __atomic_fetch_add (ptr, j, model);
>i = tmp + j;

We shouldn't be using an undocumented part of GCC's libatomic here -- GCC 
doesn't use these functions, and compiler-rt's atomic.c does not provide them.

Users:
  jyknight (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  compnerd (Auditor)
  majnemer (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL244063



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


Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-11-04 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: test/CodeGenCXX/attribute_internal_linkage.cpp:34-35
@@ +33,4 @@
+
+__attribute__((internal_linkage)) void A::f3() {
+}
+

We should reject this. We're just causing problems for ourselves if we allow 
the linkage to change on a redeclaration.


Repository:
  rL LLVM

http://reviews.llvm.org/D13925



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


Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-11-04 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

Hm, the current implementation allows all of the following:

void f(int a [[clang::internal_linkage]]) {  // 1

  int b [[clang::internal_linkage]];   // 2
  static int c [[clang::internal_linkage]];  // 3

}

I'll fix (1). Is it OK to allow (2) and (3)? The attribute has no effect 
because the declarations already have internal linkage, so I'd say it behaves 
as documented.


Repository:
  rL LLVM

http://reviews.llvm.org/D13925



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


Re: [PATCH] D14170: Fix false positive warning about memory leak for QApplication::postEvent

2015-11-04 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Test cases need to be small and self contained. 
You might be having a problem with reproducing with a simple test case, where 
you define QCoreApplication::postEvent in the test file because it is not 
considered to be in the system header.  You can use special pragmas for that. 
See ./test/Analysis/Inputs, where we have a bunch of .h files declaring system 
APIs. Please add another file for QT there.



Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2516
@@ +2515,3 @@
+return true;
+  }
+

http://llvm.org/docs/CodingStandards.html#id16


http://reviews.llvm.org/D14170



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


[PATCH] Allow pointer decay and qual stripping for _Generic

2015-11-04 Thread Aaron Ballman via cfe-commits
The control expression for a _Generic selection expression should have
its type decayed and qualifiers stripped when determining which
selection it matches. e.g., the following should compile:

  _Generic("test", char *: 1);
  const int i = 12;
  _Generic(i, int: 1);

This patch fixes PR16340.

~Aaron


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


Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-11-04 Thread Aaron Ballman via cfe-commits
On Wed, Nov 4, 2015 at 2:20 PM, Evgeniy Stepanov  wrote:
> eugenis added a comment.
>
> Hm, the current implementation allows all of the following:
>
> void f(int a [[clang::internal_linkage]]) {  // 1
>
>   int b [[clang::internal_linkage]];   // 2
>   static int c [[clang::internal_linkage]];  // 3
>
> }
>
> I'll fix (1). Is it OK to allow (2) and (3)? The attribute has no effect 
> because the declarations already have internal linkage, so I'd say it behaves 
> as documented.

I would prefer (2) and (3) to at least warn that the attribute has no
effect (and not attach the attribute to the decl). This is consistent
with the way other attributes behave.

~Aaron

>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D13925
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r252063 - [modules] Generalize the workaround for multiple ambiguous definitions of

2015-11-04 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Nov  4 13:26:32 2015
New Revision: 252063

URL: http://llvm.org/viewvc/llvm-project?rev=252063&view=rev
Log:
[modules] Generalize the workaround for multiple ambiguous definitions of
internal linkage entities in different modules from r250884 to apply to all
names, not just function names.

This is really awkward: we don't want to merge internal-linkage symbols from
separate modules, because they might not actually be defining the same entity.
But we don't want to reject programs that use such an ambiguous symbol if those
internal-linkage symbols are in fact equivalent. For now, we're resolving the
ambiguity by picking one of the equivalent definitions as an extension.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/Modules/Inputs/libstdcxx-ambiguous-internal/a.h
cfe/trunk/test/Modules/Inputs/libstdcxx-ambiguous-internal/d.h
cfe/trunk/test/Modules/libstdcxx-ambiguous-internal.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=252063&r1=252062&r2=252063&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov  4 13:26:32 
2015
@@ -2986,9 +2986,6 @@ def note_ovl_candidate : Note<"candidate
 "%select{none|const|restrict|const and restrict|volatile|const and 
volatile"
 "|volatile and restrict|const, volatile, and restrict}4)"
 "| made ineligible by enable_if}2">;
-def ext_ovl_equivalent_internal_linkage_functions_in_modules : ExtWarn<
-  "ambiguous use of internal linkage function %0 defined in multiple modules">,
-  InGroup>;
 
 def note_ovl_candidate_inherited_constructor : Note<"inherited from here">;
 def note_ovl_candidate_illegal_constructor : Note<
@@ -7869,6 +7866,12 @@ def err_module_self_import : Error<
   "import of module '%0' appears within same top-level module '%1'">;
 def err_module_import_in_implementation : Error<
   "@import of module '%0' in implementation of '%1'; use #import">;
+
+def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
+  "ambiguous use of internal linkage declaration %0 defined in multiple 
modules">,
+  InGroup>;
+def note_equivalent_internal_linkage_decl : Note<
+  "declared here%select{ in module '%1'|}0">;
 }
 
 let CategoryName = "Coroutines Issue" in {

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=252063&r1=252062&r2=252063&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Wed Nov  4 13:26:32 2015
@@ -1386,6 +1386,15 @@ public:
   hasVisibleDefaultArgument(const NamedDecl *D,
 llvm::SmallVectorImpl *Modules = 
nullptr);
 
+  /// Determine if \p A and \p B are equivalent internal linkage declarations
+  /// from different modules, and thus an ambiguity error can be downgraded to
+  /// an extension warning.
+  bool isEquivalentInternalLinkageDeclaration(const NamedDecl *A,
+  const NamedDecl *B);
+  void diagnoseEquivalentInternalLinkageDeclarations(
+  SourceLocation Loc, const NamedDecl *D,
+  ArrayRef Equiv);
+
   bool RequireCompleteType(SourceLocation Loc, QualType T,
TypeDiagnoser &Diagnoser);
   bool RequireCompleteType(SourceLocation Loc, QualType T,

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=252063&r1=252062&r2=252063&view=diff
==
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Wed Nov  4 13:26:32 2015
@@ -463,8 +463,11 @@ void LookupResult::resolveKind() {
   llvm::SmallDenseMap UniqueTypes;
 
   bool Ambiguous = false;
-  bool HasTag = false, HasFunction = false, HasNonFunction = false;
+  bool HasTag = false, HasFunction = false;
   bool HasFunctionTemplate = false, HasUnresolved = false;
+  NamedDecl *HasNonFunction = nullptr;
+
+  llvm::SmallVector EquivalentNonFunctions;
 
   unsigned UniqueTagIndex = 0;
 
@@ -533,9 +536,21 @@ void LookupResult::resolveKind() {
 } else if (isa(D)) {
   HasFunction = true;
 } else {
-  if (HasNonFunction)
+  if (HasNonFunction) {
+// If we're about to create an ambiguity between two declarations that
+// are equivalent, but one is an internal linkage declaration from one
+// module and the other is an internal linkage declaration from another
+// module, just skip it.
+i

[PATCH] D14345: [analyzer] Update SATestBuild.py to enable a 'download and patch' model for projects.

2015-11-04 Thread Devin Coughlin via cfe-commits
dcoughlin created this revision.
dcoughlin added reviewers: zaks.anna, krememek.
dcoughlin added a subscriber: cfe-commits.

Currently the SATestBuild.py and SATestAdd.py buildbot scripts expect project
sources to be checked into the project repository. This patch changes these
scripts to additionally support a model where project sources are downloaded
rather than checked into the repository. Sometimes projects may need to be
modified (for example, to support a newer versions of clang), so the updated 
scripts
also allow for an optional patch file that will be applied to the downloaded
project source before analysis.

To support this workflow, this patch changes the expected layout of
a project in the repository. The project-specific helper scripts will stay
in the root of each project directory, but the benchmark source itself (if
checked into the repo) should now be stored in a subdirectory named
'CachedSource':

project_name/
  cleanup_run_static_analyzer.sh [optional]
  run_static_analyzer.cmd [required]
  download_project.sh [optional]
  CachedSource/ [optional]
  changes_for_analyzer.patch [optional]

If the 'CachedSource' source directory is not present, the download script will
be executed. This script should download the project source into 'CachedSource'.
Then, if 'changes_for_analyzer.patch' is present its changes will
be applied to a copy of 'CachedSource' before analysis.


http://reviews.llvm.org/D14345

Files:
  utils/analyzer/SATestAdd.py
  utils/analyzer/SATestBuild.py

Index: utils/analyzer/SATestBuild.py
===
--- utils/analyzer/SATestBuild.py
+++ utils/analyzer/SATestBuild.py
@@ -154,6 +154,8 @@
 ProjectMapFile = "projectMap.csv"
 
 # Names of the project specific scripts.
+# The script that downloads the project.
+DownloadScript = "download_project.sh"
 # The script that needs to be executed before the build can start.
 CleanupScript = "cleanup_run_static_analyzer.sh"
 # This is a file containing commands for scan-build.
@@ -173,6 +175,21 @@
 SBOutputDirName = "ScanBuildResults"
 SBOutputDirReferencePrefix = "Ref"
 
+# The name of the directory storing the cached project source. If this directory
+# does not exist, the download script will be executed. That script should
+# create the "CachedSource" directory and download the project source into it.
+CachedSourceDirName = "CachedSource"
+
+# The name of the directory containing the source code that will be analyzed.
+# Each time a project is analyzed, a fresh copy of its CachedSource directory
+# will be copied to the PatchedSource directory and then the local patches
+# in PatchfileName will be applied (if PatchfileName exists).
+PatchedSourceDirName = "PatchedSource"
+
+# The name of the patchfile specifying any changes that should be applied
+# to the CachedSource before analyzing.
+PatchfileName = "changes_for_analyzer.patch"
+
 # The list of checkers used during analyzes.
 # Currently, consists of all the non-experimental checkers, plus a few alpha
 # checkers we don't want to regress on.
@@ -186,23 +203,73 @@
 
 # Run pre-processing script if any.
 def runCleanupScript(Dir, PBuildLogFile):
+Cwd = os.path.join(Dir, PatchedSourceDirName)
 ScriptPath = os.path.join(Dir, CleanupScript)
+runScript(ScriptPath, PBuildLogFile, Cwd)
+
+# Run the script to download the project, if it exists.
+def runDownloadScript(Dir, PBuildLogFile):
+ScriptPath = os.path.join(Dir, DownloadScript)
+runScript(ScriptPath, PBuildLogFile, Dir)
+
+# Run the provided script if it exists.
+def runScript(ScriptPath, PBuildLogFile, Cwd):
 if os.path.exists(ScriptPath):
 try:
 if Verbose == 1:
 print "  Executing: %s" % (ScriptPath,)
-check_call("chmod +x %s" % ScriptPath, cwd = Dir,
+check_call("chmod +x %s" % ScriptPath, cwd = Cwd,
   stderr=PBuildLogFile,
   stdout=PBuildLogFile,
   shell=True)
-check_call(ScriptPath, cwd = Dir, stderr=PBuildLogFile,
+check_call(ScriptPath, cwd = Cwd, stderr=PBuildLogFile,
   stdout=PBuildLogFile,
   shell=True)
 except:
-print "Error: The pre-processing step failed. See ", \
-  PBuildLogFile.name, " for details."
+print "Error: Running %s failed. See %s for details." % (ScriptPath,
+PBuildLogFile.name)
 sys.exit(-1)
 
+# Download the project and apply the local patchfile if it exists.
+def downloadAndPatch(Dir, PBuildLogFile):
+CachedSourceDirPath = os.path.join(Dir, CachedSourceDirName)
+
+# If the we don't already have the cached source, run the project's
+# download script to download it.
+if not os.path.exists(CachedSourceDirPath):
+  runDownload

Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-04 Thread Beren Minor via cfe-commits
berenm updated this revision to Diff 39232.
berenm added a comment.

[clang-format] Alignment code factorization.


http://reviews.llvm.org/D14325

Files:
  lib/Format/WhitespaceManager.cpp
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -8703,6 +8703,19 @@
   "  loongParameterB);\n"
   "int j = 2;",
   Alignment);
+
+  verifyFormat("template \n"
+   "auto foo() {}\n",
+   Alignment);
+  verifyFormat("int a, b = 1;\n"
+   "int c  = 2;\n"
+   "int dd = 3;\n",
+   Alignment);
+  verifyFormat("int aa   = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
 }
 
 TEST_F(FormatTest, AlignConsecutiveDeclarations) {
@@ -8903,6 +8916,29 @@
"int  myvar = 1;",
Alignment);
   Alignment.ColumnLimit = 80;
+  Alignment.AlignConsecutiveAssignments = false;
+
+  verifyFormat(
+  "template \n"
+  "auto foo() {}\n",
+  Alignment);
+  verifyFormat("float a, b = 1;\n"
+   "int   c = 2;\n"
+   "int   dd = 3;\n",
+   Alignment);
+  verifyFormat("int   aa = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
+  Alignment.AlignConsecutiveAssignments = true;
+  verifyFormat("float a, b = 1;\n"
+   "int   c  = 2;\n"
+   "int   dd = 3;\n",
+   Alignment);
+  verifyFormat("int   aa = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
+  Alignment.AlignConsecutiveAssignments = false;
 }
 
 TEST_F(FormatTest, LinuxBraceBreaking) {
Index: lib/Format/WhitespaceManager.cpp
===
--- lib/Format/WhitespaceManager.cpp
+++ lib/Format/WhitespaceManager.cpp
@@ -148,86 +148,108 @@
   }
 }
 
-// Walk through all of the changes and find sequences of "=" to align.  To do
-// so, keep track of the lines and whether or not an "=" was found on align. If
-// a "=" is found on a line, extend the current sequence. If the current line
-// cannot be part of a sequence, e.g. because there is an empty line before it
-// or it contains non-assignments, finalize the previous sequence.
-//
-// FIXME: The code between assignment and declaration alignment is mostly
-// duplicated and would benefit from factorization.
-void WhitespaceManager::alignConsecutiveAssignments() {
-  if (!Style.AlignConsecutiveAssignments)
-return;
-
+struct TokenSequenceAligner {
+  template 
+  void align(const FormatStyle &Style, F &&Matches,
+ SmallVector &Changes);
+
+  template 
+  void alignSequence(unsigned Start, unsigned End, unsigned Column, F &&Matches,
+ SmallVector &Changes);
+};
+
+// Walk through all of the changes and find sequences of matching tokens to
+// align. To do so, keep track of the lines and whether or not a matching token
+// was found on a line. If a matching token is found, extend the current
+// sequence. If the current line cannot be part of a sequence, e.g. because
+// there is an empty line before it or it contains only non-matching tokens,
+// finalize the previous sequence.
+template 
+void TokenSequenceAligner::align(
+const FormatStyle &Style, F &&Matches,
+SmallVector &Changes) {
   unsigned MinColumn = 0;
   unsigned MaxColumn = UINT_MAX;
+
+  // Line number of the start and the end of the current token sequence.
   unsigned StartOfSequence = 0;
   unsigned EndOfSequence = 0;
-  bool FoundAssignmentOnLine = false;
-  bool FoundLeftBraceOnLine = false;
-  bool FoundLeftParenOnLine = false;
 
-  // Aligns a sequence of assignment tokens, on the MinColumn column.
+  // Keep track of the number of braces and parentheses on the current line. If
+  // they aren't balanced, we will end the sequence.
+  unsigned LeftBracesOnLine = 0;
+  unsigned LeftParensOnLine = 0;
+
+  // Keep track of the number of commas on the line, we will only align a
+  // sequence of matching tokens if they are preceded by the same number of
+  // commas.
+  unsigned CommasOnPrevLine = 0;
+  unsigned CommasOnLine = 0;
+
+  // Whether a matching token has been found on the current line.
+  bool FoundOnLine = false;
+
+  // Aligns a sequence of matching tokens, on the MinColumn column.
   //
-  // Sequences start from the first assignment token to align, and end at the
+  // Sequences start from the first matching token to align, and end at the
   // first token of the first line that doesn't need to be aligned.
   //
   // We need to adjust the StartOfTokenColumn of each Change that is on a line
-  // containing any assignment to be aligned and located after such assignment
-  auto AlignSequence = [&] {
+  // containing any matching tok

r252066 - Removed mentions of clang-modernize, added a short description of clang-tidy.

2015-11-04 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Nov  4 13:34:55 2015
New Revision: 252066

URL: http://llvm.org/viewvc/llvm-project?rev=252066&view=rev
Log:
Removed mentions of clang-modernize, added a short description of clang-tidy.

Modified:
cfe/trunk/docs/ClangTools.rst

Modified: cfe/trunk/docs/ClangTools.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangTools.rst?rev=252066&r1=252065&r2=252066&view=diff
==
--- cfe/trunk/docs/ClangTools.rst (original)
+++ cfe/trunk/docs/ClangTools.rst Wed Nov  4 13:34:55 2015
@@ -93,18 +93,6 @@ as a user tool (ideally with powerful ID
 refactoring tools, e.g. to do a reformatting of all the lines changed during a
 renaming.
 
-``clang-modernize``
-~~~
-``clang-modernize`` migrates C++ code to use C++11 features where appropriate.
-Currently it can:
-
-* convert loops to range-based for loops;
-
-* convert null pointer constants (like ``NULL`` or ``0``) to C++11 ``nullptr``;
-
-* replace the type specifier in variable declarations with the ``auto`` type 
specifier;
-
-* add the ``override`` specifier to applicable member functions.
 
 Extra Clang Tools
 =
@@ -114,6 +102,15 @@ they'll be tracked here. The focus of th
 and features of the tools for other tool developers; each tool should
 provide its own user-focused documentation.
 
+``clang-tidy``
+~~
+
+`clang-tidy ` is a clang-based C++
+linter tool. It provides an extensible framework for building compiler-based
+static analyses detecting and fixing bug-prone patterns, performance,
+portability and maintainability issues.
+
+
 Ideas for new Tools
 ===
 
@@ -124,27 +121,6 @@ Ideas for new Tools
   ``foo.begin()`` into ``begin(foo)`` and similarly for ``end()``, where
   ``foo`` is a standard container.  We could also detect similar patterns for
   arrays.
-* ``make_shared`` / ``make_unique`` conversion.  Part of this transformation
-  can be incorporated into the ``auto`` transformation.  Will convert
-
-  .. code-block:: c++
-
-std::shared_ptr sp(new Foo);
-std::unique_ptr up(new Foo);
-
-func(std::shared_ptr(new Foo), bar());
-
-  into:
-
-  .. code-block:: c++
-
-auto sp = std::make_shared();
-auto up = std::make_unique(); // In C++14 mode.
-
-// This also affects correctness.  For the cases where bar() throws,
-// make_shared() is safe and the original code may leak.
-func(std::make_shared(), bar());
-
 * ``tr1`` removal tool.  Will migrate source code from using TR1 library
   features to C++11 library.  For example:
 


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


Re: [Diffusion] rL244063: Add missing atomic libcall support.

2015-11-04 Thread James Y Knight via cfe-commits
jyknight added inline comments.

/cfe/trunk/lib/CodeGen/CGAtomic.cpp:941-943 Looks like GCC's behavior does 
actually follow that spec.

I'm not sure why the library exposes these entry-points when you're not 
supposed to use them. Oop. Sorry that I failed to notice that.

Users:
  jyknight (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)
  compnerd (Auditor)
  majnemer (Auditor)
  rsmith (Auditor)

http://reviews.llvm.org/rL244063



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


Re: [Diffusion] rL244063: Add missing atomic libcall support.

2015-11-04 Thread Richard Smith via cfe-commits
On Wed, Nov 4, 2015 at 11:36 AM, James Y Knight via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> jyknight added inline comments.
>
> /cfe/trunk/lib/CodeGen/CGAtomic.cpp:941-943 Looks like GCC's behavior does
> actually follow that spec.
>
> I'm not sure why the library exposes these entry-points when you're not
> supposed to use them. Oop. Sorry that I failed to notice that.


*shrug* I'd guess either a miscommunication or that the spec changed at
some point.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-04 Thread Beren Minor via cfe-commits
berenm updated this revision to Diff 39233.
berenm added a comment.

[clang-format] Remove deleted methods declaration.


http://reviews.llvm.org/D14325

Files:
  lib/Format/WhitespaceManager.cpp
  lib/Format/WhitespaceManager.h
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -8703,6 +8703,19 @@
   "  loongParameterB);\n"
   "int j = 2;",
   Alignment);
+
+  verifyFormat("template \n"
+   "auto foo() {}\n",
+   Alignment);
+  verifyFormat("int a, b = 1;\n"
+   "int c  = 2;\n"
+   "int dd = 3;\n",
+   Alignment);
+  verifyFormat("int aa   = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
 }
 
 TEST_F(FormatTest, AlignConsecutiveDeclarations) {
@@ -8903,6 +8916,29 @@
"int  myvar = 1;",
Alignment);
   Alignment.ColumnLimit = 80;
+  Alignment.AlignConsecutiveAssignments = false;
+
+  verifyFormat(
+  "template \n"
+  "auto foo() {}\n",
+  Alignment);
+  verifyFormat("float a, b = 1;\n"
+   "int   c = 2;\n"
+   "int   dd = 3;\n",
+   Alignment);
+  verifyFormat("int   aa = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
+  Alignment.AlignConsecutiveAssignments = true;
+  verifyFormat("float a, b = 1;\n"
+   "int   c  = 2;\n"
+   "int   dd = 3;\n",
+   Alignment);
+  verifyFormat("int   aa = ((1 > 2) ? 3 : 4);\n"
+   "float b[1][] = {{3.f}};\n",
+   Alignment);
+  Alignment.AlignConsecutiveAssignments = false;
 }
 
 TEST_F(FormatTest, LinuxBraceBreaking) {
Index: lib/Format/WhitespaceManager.h
===
--- lib/Format/WhitespaceManager.h
+++ lib/Format/WhitespaceManager.h
@@ -168,20 +168,9 @@
   /// \brief Align consecutive assignments over all \c Changes.
   void alignConsecutiveAssignments();
 
-  /// \brief Align consecutive assignments from change \p Start to change \p End
-  /// at
-  /// the specified \p Column.
-  void alignConsecutiveAssignments(unsigned Start, unsigned End,
-   unsigned Column);
-
   /// \brief Align consecutive declarations over all \c Changes.
   void alignConsecutiveDeclarations();
 
-  /// \brief Align consecutive declarations from change \p Start to change \p
-  /// End at the specified \p Column.
-  void alignConsecutiveDeclarations(unsigned Start, unsigned End,
-unsigned Column);
-
   /// \brief Align trailing comments over all \c Changes.
   void alignTrailingComments();
 
Index: lib/Format/WhitespaceManager.cpp
===
--- lib/Format/WhitespaceManager.cpp
+++ lib/Format/WhitespaceManager.cpp
@@ -148,86 +148,108 @@
   }
 }
 
-// Walk through all of the changes and find sequences of "=" to align.  To do
-// so, keep track of the lines and whether or not an "=" was found on align. If
-// a "=" is found on a line, extend the current sequence. If the current line
-// cannot be part of a sequence, e.g. because there is an empty line before it
-// or it contains non-assignments, finalize the previous sequence.
-//
-// FIXME: The code between assignment and declaration alignment is mostly
-// duplicated and would benefit from factorization.
-void WhitespaceManager::alignConsecutiveAssignments() {
-  if (!Style.AlignConsecutiveAssignments)
-return;
-
+struct TokenSequenceAligner {
+  template 
+  void align(const FormatStyle &Style, F &&Matches,
+ SmallVector &Changes);
+
+  template 
+  void alignSequence(unsigned Start, unsigned End, unsigned Column, F &&Matches,
+ SmallVector &Changes);
+};
+
+// Walk through all of the changes and find sequences of matching tokens to
+// align. To do so, keep track of the lines and whether or not a matching token
+// was found on a line. If a matching token is found, extend the current
+// sequence. If the current line cannot be part of a sequence, e.g. because
+// there is an empty line before it or it contains only non-matching tokens,
+// finalize the previous sequence.
+template 
+void TokenSequenceAligner::align(
+const FormatStyle &Style, F &&Matches,
+SmallVector &Changes) {
   unsigned MinColumn = 0;
   unsigned MaxColumn = UINT_MAX;
+
+  // Line number of the start and the end of the current token sequence.
   unsigned StartOfSequence = 0;
   unsigned EndOfSequence = 0;
-  bool FoundAssignmentOnLine = false;
-  bool FoundLeftBraceOnLine = false;
-  bool FoundLeftParenOnLine = false;
 
-  // Aligns a sequence of assignment tokens, on the MinColumn column.
+  // Keep track of the number o

Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-11-04 Thread Reid Kleckner via cfe-commits
rnk added a comment.

This is an interesting test case, though:

  inline int foo() {
static int __attribute__((internal_linkage)) x;
return x++;
  }

If foo gets inlined, those call sites will use and update 'x'. If foo is not 
inlined, one definition of foo will win, and every caller will use its version 
of 'x'.

We could emit a warning, but I kind of don't care. If you're using 
internal_linkage, you are operating outside the rules of C++. You're expecting 
multiple copies of these things to be emitted.


Repository:
  rL LLVM

http://reviews.llvm.org/D13925



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


r252068 - Fixed header levels.

2015-11-04 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Nov  4 13:40:05 2015
New Revision: 252068

URL: http://llvm.org/viewvc/llvm-project?rev=252068&view=rev
Log:
Fixed header levels.

Modified:
cfe/trunk/docs/ClangTools.rst

Modified: cfe/trunk/docs/ClangTools.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangTools.rst?rev=252068&r1=252067&r2=252068&view=diff
==
--- cfe/trunk/docs/ClangTools.rst (original)
+++ cfe/trunk/docs/ClangTools.rst Wed Nov  4 13:40:05 2015
@@ -82,7 +82,7 @@ fixit-hints offered by clang. See :doc:`
 instructions on how to setup and used `clang-check`.
 
 ``clang-format``
-
+
 
 Clang-format is both a :doc:`library ` and a :doc:`stand-alone tool
 ` with the goal of automatically reformatting C++ sources files
@@ -103,7 +103,7 @@ and features of the tools for other tool
 provide its own user-focused documentation.
 
 ``clang-tidy``
-~~
+--
 
 `clang-tidy ` is a clang-based C++
 linter tool. It provides an extensible framework for building compiler-based


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


r252069 - Fixed a link.

2015-11-04 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Nov  4 13:42:17 2015
New Revision: 252069

URL: http://llvm.org/viewvc/llvm-project?rev=252069&view=rev
Log:
Fixed a link.

Modified:
cfe/trunk/docs/ClangTools.rst

Modified: cfe/trunk/docs/ClangTools.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangTools.rst?rev=252069&r1=252068&r2=252069&view=diff
==
--- cfe/trunk/docs/ClangTools.rst (original)
+++ cfe/trunk/docs/ClangTools.rst Wed Nov  4 13:42:17 2015
@@ -105,7 +105,7 @@ provide its own user-focused documentati
 ``clang-tidy``
 --
 
-`clang-tidy ` is a clang-based C++
+`clang-tidy `_ is a clang-based C++
 linter tool. It provides an extensible framework for building compiler-based
 static analyses detecting and fixing bug-prone patterns, performance,
 portability and maintainability issues.


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


Re: [PATCH] D12359: New warning -Wnonconst-parameter when a pointer parameter can be const

2015-11-04 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: lib/Parse/ParseStmt.cpp:376
@@ -375,3 +375,3 @@
 /// \brief Parse an expression statement.
 StmtResult Parser::ParseExprStatement() {
   // If a case keyword is missing, this is where it should be inserted.

> I don't know what this "serialized AST" is that you are talking about. All I 
> know is the -ast-dump and that flag is only intended as a debugging aid as 
> far as I know. If I just run "clang -cc1 -Wnonconst-parameter somefile.c" 
> then it does not serialize does it? So what flags do I use to serialize etc?

Anything using PCH or modules will use a serialized AST. 
http://clang.llvm.org/docs/PCHInternals.html

The basic idea is that these serialize the AST to a file to be later read back 
in with an ASTReader to represent the same semantic state (entirely skipping 
the parser).


Comment at: lib/Parse/ParseStmt.cpp:392
@@ -391,1 +391,3 @@
 
+  // Mark pointers in the expression as nonconstused.
+  Sema::MarkRNonConstUse(Expr.get());

non-const-used instead?


Comment at: lib/Parse/ParseStmt.cpp:960
@@ -956,1 +959,3 @@
   R = ParseStatementOrDeclaration(Stmts, false);
+  if (!R.isInvalid() && R.get()) {
+if (ReturnStmt *RS = dyn_cast(R.get())) {

I think you want isUsable() here instead. Or remove the R.get() and use 
dyn_cast_or_null below.


http://reviews.llvm.org/D12359



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


Re: [PATCH] D14014: Checker of proper vfork usage

2015-11-04 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

> > What is needed to turn this into a non-alpha checker?

> 

> 

> I guess that's question for maintainers) We have to consider that vfork is 
> used rarely enough.


Please, make this into a non-alpha, turned on by default.

Thank you!
Anna.


http://reviews.llvm.org/D14014



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


Re: [PATCH] D14345: [analyzer] Update SATestBuild.py to enable a 'download and patch' model for projects.

2015-11-04 Thread Gábor Horváth via cfe-commits
xazax.hun added a comment.

Hi!

I think it is great to support this model in these scripts. Do you plan to 
check the list of the project urls in to the repository as well? I think it 
would be great to do so, so one can easily reproduce a buildbot error locally, 
or even run the whole testsuit. It also makes it easier to setup alternative 
build bots and to contribute projects to the official one.

What do you think?

I have one minor high level note about the handling of patches. I think it in 
case a project would need more modifications, it is cleaner to have a separate 
patch file for each kind of them. Maybe it would be worth to support patching 
the project with multiple patches? E.g. applying all patches with a name prefix.


http://reviews.llvm.org/D14345



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


Re: [PATCH] D12922: Add support for function attribute "notail"

2015-11-04 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

Thanks, I'll see how the review for the llvm-side patch goes and commit both 
patches after it is approved.


http://reviews.llvm.org/D12922



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


Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-11-04 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

How do I check if a Var is a local variable?



Comment at: test/CodeGenCXX/attribute_internal_linkage.cpp:35-36
@@ +34,4 @@
+__attribute__((internal_linkage)) void A::f3() {
+}
+
+// Forward declaration w/o an attribute.

OK, done. Still allowing forward declaration of a class w/o the attribute 
though, it looks harmless.



Repository:
  rL LLVM

http://reviews.llvm.org/D13925



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


Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-11-04 Thread Evgeniy Stepanov via cfe-commits
eugenis updated this revision to Diff 39245.

Repository:
  rL LLVM

http://reviews.llvm.org/D13925

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/AST/Decl.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGenCXX/attribute_internal_linkage.cpp
  test/Sema/attr-coldhot.c
  test/Sema/internal_linkage.c
  test/SemaCXX/internal_linkage.cpp

Index: test/SemaCXX/internal_linkage.cpp
===
--- /dev/null
+++ test/SemaCXX/internal_linkage.cpp
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+int f() __attribute__((internal_linkage));
+
+class A;
+class __attribute__((internal_linkage)) A {
+public:
+  int x __attribute__((internal_linkage)); // expected-warning{{'internal_linkage' attribute only applies to variables, functions and classes}}
+  static int y __attribute__((internal_linkage));
+  void f1() __attribute__((internal_linkage));
+  void f2() __attribute__((internal_linkage)) {}
+  static void f3() __attribute__((internal_linkage)) {}
+  void f4(); // expected-note{{previous definition is here}}
+  static int zz; // expected-note{{previous definition is here}}
+  A() __attribute__((internal_linkage)) {}
+  ~A() __attribute__((internal_linkage)) {}
+  A& operator=(const A&) __attribute__((internal_linkage)) { return *this; }
+  struct {
+int z  __attribute__((internal_linkage)); // expected-warning{{'internal_linkage' attribute only applies to variables, functions and classes}}
+  };
+};
+
+__attribute__((internal_linkage)) void A::f4() {} // expected-error{{internal_linkage attribute does not appear on the first declaration of 'f4'}}
+
+__attribute__((internal_linkage)) int A::zz; // expected-error{{internal_linkage attribute does not appear on the first declaration of 'zz'}}
+
+namespace Z __attribute__((internal_linkage)) { // expected-warning{{'internal_linkage' attribute only applies to variables, functions and classes}}
+}
+
+__attribute__((internal_linkage("foo"))) int g() {} // expected-error{{'internal_linkage' attribute takes no arguments}}
+
+[[clang::internal_linkage]] int h() {}
+
+int hh(int a [[clang::internal_linkage]]) {}
+
+enum struct __attribute__((internal_linkage)) E { // expected-warning{{'internal_linkage' attribute only applies to variables, functions and classes}}
+  a = 1,
+  b = 2
+};
+
+int A::y;
+
+void A::f1() {
+}
Index: test/Sema/internal_linkage.c
===
--- /dev/null
+++ test/Sema/internal_linkage.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int var __attribute__((internal_linkage));
+int var2 __attribute__((internal_linkage,common)); // expected-error{{'internal_linkage' and 'common' attributes are not compatible}} \
+   // expected-note{{conflicting attribute is here}}
+int var3 __attribute__((common,internal_linkage)); // expected-error{{'common' and 'internal_linkage' attributes are not compatible}} \
+   // expected-note{{conflicting attribute is here}}
+
+int var4 __attribute__((common)); // expected-error{{'common' and 'internal_linkage' attributes are not compatible}} \
+// expected-note{{previous definition is here}}
+int var4 __attribute__((internal_linkage)); // expected-note{{conflicting attribute is here}} \
+// expected-error{{internal_linkage attribute does not appear on the first declaration of 'var4'}}
+
+int var5 __attribute__((internal_linkage)); // expected-error{{'internal_linkage' and 'common' attributes are not compatible}}
+int var5 __attribute__((common)); // expected-note{{conflicting attribute is here}}
+
+__attribute__((internal_linkage)) int f() {}
+struct __attribute__((internal_linkage)) S { // expected-warning{{'internal_linkage' attribute only applies to variables and functions}}
+};
+
+__attribute__((internal_linkage("foo"))) int g() {} // expected-error{{'internal_linkage' attribute takes no arguments}}
Index: test/Sema/attr-coldhot.c
===
--- test/Sema/attr-coldhot.c
+++ test/Sema/attr-coldhot.c
@@ -6,5 +6,7 @@
 int var1 __attribute__((__cold__)); // expected-warning{{'__cold__' attribute only applies to functions}}
 int var2 __attribute__((__hot__)); // expected-warning{{'__hot__' attribute only applies to functions}}
 
-int qux() __attribute__((__hot__)) __attribute__((__cold__)); // expected-error{{'__hot__' and 'cold' attributes are not compatible}}
-int baz() __attribute__((__cold__)) __attribute__((__hot__)); // expected-error{{'__cold__' and 'hot' attributes are not compatible}}
+int qux() __attribute__((__hot__)) __attribute__((__cold__)); // expected-error{{'__hot__' and 'cold' attributes are not compatible}} \
+// expected-note{{conflicting attribute is here}}
+int baz() __attribute

Re: r250577 - [modules] Allow the error when explicitly loading an incompatible module file

2015-11-04 Thread Richard Smith via cfe-commits
On Sun, Nov 1, 2015 at 10:20 AM, Manuel Klimek  wrote:

> On Fri, Oct 23, 2015 at 9:31 PM Sean Silva  wrote:
>
>> On Tue, Oct 20, 2015 at 1:52 AM, Manuel Klimek  wrote:
>>
>>> On Tue, Oct 20, 2015 at 10:41 AM Sean Silva 
>>> wrote:
>>>
 On Tue, Oct 20, 2015 at 1:38 AM, Manuel Klimek 
 wrote:

> On Tue, Oct 20, 2015 at 5:52 AM Sean Silva 
> wrote:
>
>> On Mon, Oct 19, 2015 at 2:10 AM, Manuel Klimek 
>> wrote:
>>
>>> On Sat, Oct 17, 2015 at 3:41 AM Richard Smith via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 On Fri, Oct 16, 2015 at 6:30 PM, Sean Silva 
 wrote:

> On Fri, Oct 16, 2015 at 6:26 PM, Richard Smith <
> rich...@metafoo.co.uk> wrote:
>
>> On Fri, Oct 16, 2015 at 6:25 PM, Sean Silva <
>> chisophu...@gmail.com> wrote:
>>
>>> On Fri, Oct 16, 2015 at 6:12 PM, Richard Smith <
>>> rich...@metafoo.co.uk> wrote:
>>>
 On Fri, Oct 16, 2015 at 4:43 PM, Sean Silva <
 chisophu...@gmail.com> wrote:

> On Fri, Oct 16, 2015 at 4:20 PM, Richard Smith via cfe-commits
>  wrote:
>
>> Author: rsmith
>> Date: Fri Oct 16 18:20:19 2015
>> New Revision: 250577
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=250577&view=rev
>> Log:
>> [modules] Allow the error when explicitly loading an
>> incompatible module file
>> via -fmodule-file= to be turned off; in that case, just
>> include the relevant
>> files textually. This allows module files to be
>> unconditionally passed to all
>> compile actions via CXXFLAGS, and to be ignored for rules
>> that specify custom
>> incompatible flags.
>>
>
> What direction are you trying to go with this? Are you
> thinking something like having CMake build a bunch of modules up 
> front?
>

 That's certainly one thing you can do with this. Another is
 that you can make cmake automatically and explicitly build a 
 module for
 each library, and then provide that for all the dependencies of 
 that
 library,

>>>
>>> How does CMake know which headers are part of which library?
>>> Strategically named top-level modules in the module map?
>>>
>>
>> The idea would be for CMake to generate the module map itself
>> based on the build rules.
>>
>
> How would it know which headers to include? Do
> our ADDITIONAL_HEADER_DIRS things in our CMakeLists.txt have enough
> information for this?
>

 Some additional information may need to be added to the CMakeLists
 to enable this. Some build systems already model the headers for a 
 library,
 and so already have the requisite information.

>>>
>>> CMake supports specifying headers for libraries (mainly used for MS
>>> VS). If we need this for modules, we'll probably need to update our 
>>> build
>>> rules (which will probably make sense anyway, for a better experience 
>>> for
>>> VS users ;)
>>>
>>
>> Nice.
>>
>> Brad, do you have any idea how hard it would be to get cmake to
>> generate clang module map files and add explicit module build steps?
>> Basically, the requirements (off the top of my head) are:
>> - for each library, generate a module map which is essentially just a
>> list of the headers in that library (it's not just a flat list, but 
>> that's
>> the gist of it).
>> - for each module map, add a build step that invokes clang on it to
>> say "build the module corresponding to this module map" (it's basically
>> `clang++ path/to/foo.modulemap -o foo.pcm` with a little bit of fluff
>> around it). There is also a dependency from foo.pcm on each of the
>> libraries that library "foo" depends on.
>> - for each library $Dep that library $Lib depends on, add $Dep's .pcm
>> file as a dependency of the .o build steps for $Lib. $Dep's .pcm file 
>> also
>> needs to be passed on the command line of the .o build steps for $Lib.
>>
>> It seems like similar requirements are going to be common in the
>> standardized modules feature (except for the module map I think? 
>> Richard?).
>> Basically, in order to avoid redundantly parsing textual headers, you 
>> need
>> to run a build step on headers that turns them into some form that can be
>> processed more efficiently than just parsing it. E.g. the build step on
>> slide 36 of this cppcon presentation about the Microsoft experimental
>> modules imp

Re: [PATCH] D14311: [Clang] Fix some Clang-tidy modernize warnings, other minor fixes

2015-11-04 Thread Hans Wennborg via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rL LLVM

http://reviews.llvm.org/D14311



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


Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-11-04 Thread Evgeniy Stepanov via cfe-commits
eugenis updated this revision to Diff 39249.

Repository:
  rL LLVM

http://reviews.llvm.org/D13925

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/AST/Decl.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGenCXX/attribute_internal_linkage.cpp
  test/Sema/attr-coldhot.c
  test/Sema/internal_linkage.c
  test/SemaCXX/internal_linkage.cpp

Index: test/SemaCXX/internal_linkage.cpp
===
--- /dev/null
+++ test/SemaCXX/internal_linkage.cpp
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+int f() __attribute__((internal_linkage));
+
+class A;
+class __attribute__((internal_linkage)) A {
+public:
+  int x __attribute__((internal_linkage)); // expected-warning{{'internal_linkage' attribute only applies to variables, functions and classes}}
+  static int y __attribute__((internal_linkage));
+  void f1() __attribute__((internal_linkage));
+  void f2() __attribute__((internal_linkage)) {}
+  static void f3() __attribute__((internal_linkage)) {}
+  void f4(); // expected-note{{previous definition is here}}
+  static int zz; // expected-note{{previous definition is here}}
+  A() __attribute__((internal_linkage)) {}
+  ~A() __attribute__((internal_linkage)) {}
+  A& operator=(const A&) __attribute__((internal_linkage)) { return *this; }
+  struct {
+int z  __attribute__((internal_linkage)); // expected-warning{{'internal_linkage' attribute only applies to variables, functions and classes}}
+  };
+};
+
+__attribute__((internal_linkage)) void A::f4() {} // expected-error{{'internal_linkage' attribute does not appear on the first declaration of 'f4'}}
+
+__attribute__((internal_linkage)) int A::zz; // expected-error{{'internal_linkage' attribute does not appear on the first declaration of 'zz'}}
+
+namespace Z __attribute__((internal_linkage)) { // expected-warning{{'internal_linkage' attribute only applies to variables, functions and classes}}
+}
+
+__attribute__((internal_linkage("foo"))) int g() {} // expected-error{{'internal_linkage' attribute takes no arguments}}
+
+[[clang::internal_linkage]] int h() {}
+
+enum struct __attribute__((internal_linkage)) E { // expected-warning{{'internal_linkage' attribute only applies to variables, functions and classes}}
+  a = 1,
+  b = 2
+};
+
+int A::y;
+
+void A::f1() {
+}
+
+void g(int a [[clang::internal_linkage]]) { // expected-warning{{'internal_linkage' attribute only applies to variables, functions and classes}}
+  int x [[clang::internal_linkage]]; // expected-warning{{'internal_linkage' attribute on a non-static local variable is ignored}}
+  static int y [[clang::internal_linkage]];
+}
Index: test/Sema/internal_linkage.c
===
--- /dev/null
+++ test/Sema/internal_linkage.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int var __attribute__((internal_linkage));
+int var2 __attribute__((internal_linkage,common)); // expected-error{{'internal_linkage' and 'common' attributes are not compatible}} \
+   // expected-note{{conflicting attribute is here}}
+int var3 __attribute__((common,internal_linkage)); // expected-error{{'common' and 'internal_linkage' attributes are not compatible}} \
+   // expected-note{{conflicting attribute is here}}
+
+int var4 __attribute__((common)); // expected-error{{'common' and 'internal_linkage' attributes are not compatible}} \
+// expected-note{{previous definition is here}}
+int var4 __attribute__((internal_linkage)); // expected-note{{conflicting attribute is here}} \
+// expected-error{{'internal_linkage' attribute does not appear on the first declaration of 'var4'}}
+
+int var5 __attribute__((internal_linkage)); // expected-error{{'internal_linkage' and 'common' attributes are not compatible}}
+int var5 __attribute__((common)); // expected-note{{conflicting attribute is here}}
+
+__attribute__((internal_linkage)) int f() {}
+struct __attribute__((internal_linkage)) S { // expected-warning{{'internal_linkage' attribute only applies to variables and functions}}
+};
+
+__attribute__((internal_linkage("foo"))) int g() {} // expected-error{{'internal_linkage' attribute takes no arguments}}
Index: test/Sema/attr-coldhot.c
===
--- test/Sema/attr-coldhot.c
+++ test/Sema/attr-coldhot.c
@@ -6,5 +6,7 @@
 int var1 __attribute__((__cold__)); // expected-warning{{'__cold__' attribute only applies to functions}}
 int var2 __attribute__((__hot__)); // expected-warning{{'__hot__' attribute only applies to functions}}
 
-int qux() __attribute__((__hot__)) __attribute__((__cold__)); // expected-error{{'__hot__' and 'cold' attributes are not compatible}}
-int baz() __attribute__((__cold__)) __attribute__((__hot__

Re: [PATCH] D13925: Implement __attribute__((internal_linkage))

2015-11-04 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

In http://reviews.llvm.org/D13925#281349, @eugenis wrote:

> Hm, the current implementation allows all of the following:
>
> void f(int a [[clang::internal_linkage]]) {  // 1
>
>   int b [[clang::internal_linkage]];   // 2
>   static int c [[clang::internal_linkage]];  // 3
>
> }
>
> I'll fix (1). Is it OK to allow (2) and (3)? The attribute has no effect 
> because the declarations already have internal linkage, so I'd say it behaves 
> as documented.


Done. Warning on (1) and (2), silently accepting (3).


Repository:
  rL LLVM

http://reviews.llvm.org/D13925



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


Re: [PATCH] D14303: [analyzer] Add 'optin' checker package and move localizability checkers into it.

2015-11-04 Thread Devin Coughlin via cfe-commits
dcoughlin marked an inline comment as done.
dcoughlin added a comment.

http://reviews.llvm.org/D14303



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


r252080 - [analyzer] Add 'optin' checker package and move localizability checkers into it.

2015-11-04 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Wed Nov  4 15:33:41 2015
New Revision: 252080

URL: http://llvm.org/viewvc/llvm-project?rev=252080&view=rev
Log:
[analyzer] Add 'optin' checker package and move localizability checkers into it.

This commit creates a new 'optin' top-level checker package and moves several of
the localizability checkers into it.

This package is for checkers that are not alpha and that would normally be on by
default but where the driver does not have enough information to determine when
they are applicable. The localizability checkers fit this criterion because the
driver cannot determine whether a project is localized or not -- this is best
determined at the IDE or build-system level.

This new package is *not* intended for checkers that are too noisy to be on by
default.

The hierarchy under 'optin' mirrors that in 'alpha': checkers under 'optin'
should be organized in the hierarchy they would have had if they were truly top
level (e.g., optin.osx.cocoa.MyOptInChecker).

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

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td
cfe/trunk/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
cfe/trunk/test/Analysis/localization-aggressive.m
cfe/trunk/test/Analysis/localization.m

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td?rev=252080&r1=252079&r2=252080&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td Wed Nov  4 15:33:41 2015
@@ -13,12 +13,31 @@ include "clang/StaticAnalyzer/Checkers/C
 // Packages.
 
//===--===//
 
+// The Alpha package is for checkers that have too many false positives to be
+// turned on by default. The hierarchy under Alpha should be organized in the
+// hierarchy checkers would have had if they were truly at the top level.
+// (For example, a Cocoa-specific checker that is alpha should be in
+// alpha.osx.cocoa).
 def Alpha : Package<"alpha">;
 
 def Core : Package<"core">;
 def CoreBuiltin : Package<"builtin">, InPackage;
 def CoreUninitialized  : Package<"uninitialized">, InPackage;
 def CoreAlpha : Package<"core">, InPackage, Hidden;
+
+// The OptIn package is for checkers that are not alpha and that would normally
+// be on by default but where the driver does not have enough information to
+// determine when they are applicable. For example, localizability checkers fit
+// this criterion because the driver cannot determine whether a project is
+// localized or not -- this is best determined at the IDE or build-system 
level.
+//
+// The checker hierarchy under OptIn should mirror that in Alpha: checkers
+// should be organized as if they were at the top level.
+//
+// Note: OptIn is *not* intended for checkers that are too noisy to be on by
+// default. Such checkers belong in the alpha package.
+def OptIn : Package<"optin">;
+
 def Nullability : Package<"nullability">;
 
 def Cplusplus : Package<"cplusplus">;
@@ -39,11 +58,18 @@ def CStringAlpha : Package<"cstring">, I
 
 def OSX : Package<"osx">;
 def OSXAlpha : Package<"osx">, InPackage, Hidden;
+def OSXOptIn : Package<"osx">, InPackage;
+
 def Cocoa : Package<"cocoa">, InPackage;
 def CocoaAlpha : Package<"cocoa">, InPackage, Hidden;
+def CocoaOptIn : Package<"cocoa">, InPackage;
+
 def CoreFoundation : Package<"coreFoundation">, InPackage;
 def Containers : Package<"containers">, InPackage;
 
+def LocalizabilityAlpha : Package<"localizability">, InPackage;
+def LocalizabilityOptIn : Package<"localizability">, InPackage;
+
 def LLVM : Package<"llvm">;
 def Debug : Package<"debug">;
 
@@ -485,18 +511,6 @@ def DirectIvarAssignmentForAnnotatedFunc
   HelpText<"Check for direct assignments to instance variables in the methods 
annotated with objc_no_direct_instance_variable_assignment">,
   DescFile<"DirectIvarAssignment.cpp">;
 
-def NonLocalizedStringChecker : Checker<"NonLocalizedStringChecker">,
-  HelpText<"Warns about uses of non-localized NSStrings passed to UI methods 
expecting localized NSStrings">,
-  DescFile<"LocalizationChecker.cpp">;
-
-def EmptyLocalizationContextChecker : 
Checker<"EmptyLocalizationContextChecker">,
-  HelpText<"Check that NSLocalizedString macros include a comment for 
context">,
-  DescFile<"LocalizationChecker.cpp">;
-
-def PluralMisuseChecker : Checker<"PluralMisuseChecker">,
-  HelpText<"Warns against using one vs. many plural pattern in code when 
generating localized strings.">,
-  DescFile<"LocalizationChecker.cpp">;
-
 } // end "alpha.osx.cocoa"
 
 let ParentPackage = CoreFoundation in {
@@ -524,6 +538,23 @@ def ObjCContainersChecker : Checker<"Out
   DescFile<"ObjCContainersChecker.cpp">;
 
 }
+
+let ParentPackage = LocalizabilityOptIn in {
+def NonLocalizedStringChecker : Checker

Re: [PATCH] D14303: [analyzer] Add 'optin' checker package and move localizability checkers into it.

2015-11-04 Thread Devin Coughlin via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL252080: [analyzer] Add 'optin' checker package and move 
localizability checkers into it. (authored by dcoughlin).

Changed prior to commit:
  http://reviews.llvm.org/D14303?vs=39102&id=39251#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14303

Files:
  cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td
  cfe/trunk/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
  cfe/trunk/test/Analysis/localization-aggressive.m
  cfe/trunk/test/Analysis/localization.m

Index: cfe/trunk/test/Analysis/localization.m
===
--- cfe/trunk/test/Analysis/localization.m
+++ cfe/trunk/test/Analysis/localization.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -fblocks -analyzer-store=region -analyzer-checker=alpha.osx.cocoa.NonLocalizedStringChecker -analyzer-checker=alpha.osx.cocoa.PluralMisuseChecker -verify  %s
+// RUN: %clang_cc1 -analyze -fblocks -analyzer-store=region -analyzer-checker=optin.osx.cocoa.localizability.NonLocalizedStringChecker -analyzer-checker=alpha.osx.cocoa.localizability.PluralMisuseChecker -verify  %s
 
 // The larger set of tests in located in localization.m. These are tests
 // specific for non-aggressive reporting.
Index: cfe/trunk/test/Analysis/localization-aggressive.m
===
--- cfe/trunk/test/Analysis/localization-aggressive.m
+++ cfe/trunk/test/Analysis/localization-aggressive.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -fblocks -analyzer-store=region  -analyzer-checker=alpha.osx.cocoa.NonLocalizedStringChecker -analyzer-checker=alpha.osx.cocoa.EmptyLocalizationContextChecker -verify  -analyzer-config AggressiveReport=true %s
+// RUN: %clang_cc1 -analyze -fblocks -analyzer-store=region  -analyzer-checker=optin.osx.cocoa.localizability.NonLocalizedStringChecker -analyzer-checker=optin.osx.cocoa.localizability.EmptyLocalizationContextChecker -verify  -analyzer-config AggressiveReport=true %s
 
 // These declarations were reduced using Delta-Debugging from Foundation.h
 // on Mac OS X.
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/Checkers.td
@@ -13,12 +13,31 @@
 // Packages.
 //===--===//
 
+// The Alpha package is for checkers that have too many false positives to be
+// turned on by default. The hierarchy under Alpha should be organized in the
+// hierarchy checkers would have had if they were truly at the top level.
+// (For example, a Cocoa-specific checker that is alpha should be in
+// alpha.osx.cocoa).
 def Alpha : Package<"alpha">;
 
 def Core : Package<"core">;
 def CoreBuiltin : Package<"builtin">, InPackage;
 def CoreUninitialized  : Package<"uninitialized">, InPackage;
 def CoreAlpha : Package<"core">, InPackage, Hidden;
+
+// The OptIn package is for checkers that are not alpha and that would normally
+// be on by default but where the driver does not have enough information to
+// determine when they are applicable. For example, localizability checkers fit
+// this criterion because the driver cannot determine whether a project is
+// localized or not -- this is best determined at the IDE or build-system level.
+//
+// The checker hierarchy under OptIn should mirror that in Alpha: checkers
+// should be organized as if they were at the top level.
+//
+// Note: OptIn is *not* intended for checkers that are too noisy to be on by
+// default. Such checkers belong in the alpha package.
+def OptIn : Package<"optin">;
+
 def Nullability : Package<"nullability">;
 
 def Cplusplus : Package<"cplusplus">;
@@ -39,11 +58,18 @@
 
 def OSX : Package<"osx">;
 def OSXAlpha : Package<"osx">, InPackage, Hidden;
+def OSXOptIn : Package<"osx">, InPackage;
+
 def Cocoa : Package<"cocoa">, InPackage;
 def CocoaAlpha : Package<"cocoa">, InPackage, Hidden;
+def CocoaOptIn : Package<"cocoa">, InPackage;
+
 def CoreFoundation : Package<"coreFoundation">, InPackage;
 def Containers : Package<"containers">, InPackage;
 
+def LocalizabilityAlpha : Package<"localizability">, InPackage;
+def LocalizabilityOptIn : Package<"localizability">, InPackage;
+
 def LLVM : Package<"llvm">;
 def Debug : Package<"debug">;
 
@@ -485,18 +511,6 @@
   HelpText<"Check for direct assignments to instance variables in the methods annotated with objc_no_direct_instance_variable_assignment">,
   DescFile<"DirectIvarAssignment.cpp">;
 
-def NonLocalizedStringChecker : Checker<"NonLocalizedStringChecker">,
-  HelpText<"Warns about uses of non-localized NSStrings passed to UI methods expecting localized NSStrings">,
-  DescFile<"LocalizationChecker.cpp">;
-
-def EmptyLocalizationContextChecker : Checker<"EmptyLocalizationContextChecker">,
-  HelpText<"Check that NSLocalizedStr

Re: [PATCH] D14311: [Clang] Fix some Clang-tidy modernize warnings, other minor fixes

2015-11-04 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL252081: Fix some Clang-tidy modernize warnings, other minor 
fixes. (authored by eugenezelenko).

Changed prior to commit:
  http://reviews.llvm.org/D14311?vs=39134&id=39252#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14311

Files:
  cfe/trunk/lib/AST/ASTContext.cpp
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/lib/Driver/Tools.h
  cfe/trunk/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/LoopWidening.cpp

Index: cfe/trunk/lib/StaticAnalyzer/Core/LoopWidening.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/LoopWidening.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/LoopWidening.cpp
@@ -23,7 +23,7 @@
 static const Expr *getLoopCondition(const Stmt *LoopStmt) {
   switch (LoopStmt->getStmtClass()) {
   default:
-return NULL;
+return nullptr;
   case Stmt::ForStmtClass:
 return cast(LoopStmt)->getCond();
   case Stmt::WhileStmtClass:
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
@@ -32,9 +32,9 @@
   LockState(Kind K) : K(K) {}
 
 public:
-  static LockState getLocked(void) { return LockState(Locked); }
-  static LockState getUnlocked(void) { return LockState(Unlocked); }
-  static LockState getDestroyed(void) { return LockState(Destroyed); }
+  static LockState getLocked() { return LockState(Locked); }
+  static LockState getUnlocked() { return LockState(Unlocked); }
+  static LockState getDestroyed() { return LockState(Destroyed); }
 
   bool operator==(const LockState &X) const {
 return K == X.K;
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -1,4 +1,4 @@
-//===--- Tools.cpp - Tools Implementations ===//
+//===--- Tools.cpp - Tools Implementations --*- C++ -*-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -10107,7 +10107,7 @@
 
   if (!Args.hasArg(options::OPT_nostdlib) &&
   !Args.hasArg(options::OPT_nostartfiles)) {
-const char *crt1 = NULL;
+const char *crt1 = nullptr;
 if (!Args.hasArg(options::OPT_shared)) {
   if (Args.hasArg(options::OPT_pg))
 crt1 = "gcrt1.o";
@@ -10121,7 +10121,7 @@
 
 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
 
-const char *crtbegin = NULL;
+const char *crtbegin = nullptr;
 if (Args.hasArg(options::OPT_static))
   crtbegin = "crtbeginT.o";
 else if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))
Index: cfe/trunk/lib/Driver/Tools.h
===
--- cfe/trunk/lib/Driver/Tools.h
+++ cfe/trunk/lib/Driver/Tools.h
@@ -255,7 +255,7 @@
 
 void appendEBLinkFlags(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs,
const llvm::Triple &Triple);
-}
+} // end namespace arm
 
 namespace mips {
 typedef enum { NanLegacy = 1, Nan2008 = 2 } NanEncoding;
@@ -278,11 +278,11 @@
 bool shouldUseFPXX(const llvm::opt::ArgList &Args, const llvm::Triple &Triple,
StringRef CPUName, StringRef ABIName,
mips::FloatABI FloatABI);
-}
+} // end namespace mips
 
 namespace ppc {
 bool hasPPCAbiArg(const llvm::opt::ArgList &Args, const char *Value);
-}
+} // end namespace ppc
 
 /// cloudabi -- Directly call GNU Binutils linker
 namespace cloudabi {
@@ -396,7 +396,7 @@
 const llvm::opt::ArgList &TCArgs,
 const char *LinkingOutput) const override;
 };
-}
+} // end namespace darwin
 
 /// openbsd -- Directly call GNU Binutils assembler and linker
 namespace openbsd {
@@ -412,6 +412,7 @@
 const llvm::opt::ArgList &TCArgs,
 const char *LinkingOutput) const override;
 };
+
 class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
 public:
   Linker(const ToolChain &TC) : GnuTool("openbsd::Linker", "linker", TC) {}
@@ -440,6 +441,7 @@
 const llvm::opt::ArgList &TCArgs,
 const char *LinkingOutput) const override;
 };
+
 class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
 public:
   Linker(const ToolChain &TC) : GnuTool("bitrig::Linker", "linker", TC) {}
@@ -468,6 +470,7 @@
 const llvm::opt::ArgList &TCArgs,
 const char *LinkingOutput) const override;
 };
+
 class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
 public:
   Linker(const ToolChain &TC) : GnuTool("freebsd::Linker", "linker", TC) {}
@@ -485,7 +488,6 @@
 /// netbsd -- Directly call GNU Binutils assembler and linker
 namespace netbsd {
 class LLVM

r252081 - Fix some Clang-tidy modernize warnings, other minor fixes.

2015-11-04 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Wed Nov  4 15:37:17 2015
New Revision: 252081

URL: http://llvm.org/viewvc/llvm-project?rev=252081&view=rev
Log:
Fix some Clang-tidy modernize warnings, other minor fixes.

Differential revision: http://reviews.llvm.org/D14311

Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h
cfe/trunk/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/LoopWidening.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=252081&r1=252080&r2=252081&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Nov  4 15:37:17 2015
@@ -327,7 +327,7 @@ const Decl *adjustDeclToTemplate(const D
   // FIXME: Adjust alias templates?
   return D;
 }
-} // unnamed namespace
+} // anonymous namespace
 
 const RawComment *ASTContext::getRawCommentForAnyRedecl(
 const Decl *D,
@@ -430,7 +430,6 @@ comments::FullComment *ASTContext::clone
 new (*this) comments::FullComment(FC->getBlocks(),
   ThisDeclInfo);
   return CFC;
-  
 }
 
 comments::FullComment *ASTContext::getLocalCommentForDeclUncached(const Decl 
*D) const {
@@ -1921,7 +1920,7 @@ unsigned ASTContext::getPreferredTypeAli
 /// getTargetDefaultAlignForAttributeAligned - Return the default alignment
 /// for __attribute__((aligned)) on this target, to be used if no alignment
 /// value is specified.
-unsigned ASTContext::getTargetDefaultAlignForAttributeAligned(void) const {
+unsigned ASTContext::getTargetDefaultAlignForAttributeAligned() const {
   return getTargetInfo().getDefaultAlignForAttributeAligned();
 }
 
@@ -3234,7 +3233,6 @@ QualType ASTContext::getAttributedType(A
   return QualType(type, 0);
 }
 
-
 /// \brief Retrieve a substitution-result type.
 QualType
 ASTContext::getSubstTemplateTypeParmType(const TemplateTypeParmType *Parm,
@@ -3934,7 +3932,6 @@ QualType ASTContext::getTypeOfType(QualT
   return QualType(tot, 0);
 }
 
-
 /// \brief Unlike many "get" functions, we don't unique DecltypeType
 /// nodes. This would never be helpful, since each such type has its own
 /// expression, and would not give a significant memory saving, since there
@@ -4439,7 +4436,6 @@ ASTContext::getCanonicalNestedNameSpecif
   llvm_unreachable("Invalid NestedNameSpecifier::Kind!");
 }
 
-
 const ArrayType *ASTContext::getAsArrayType(QualType T) const {
   // Handle the non-qualified case efficiently.
   if (!T.hasLocalQualifiers()) {
@@ -5853,7 +5849,6 @@ void ASTContext::getObjCEncodingForTypeI
   // Just ignore it.
   case Type::Auto:
 return;
-  
 
 #define ABSTRACT_TYPE(KIND, BASE)
 #define TYPE(KIND, BASE)
@@ -8851,7 +8846,7 @@ createDynTypedNode(const NestedNameSpeci
 friend class RecursiveASTVisitor;
   };
 
-} // end namespace
+} // anonymous namespace
 
 template 
 static ASTContext::DynTypedNodeList getDynNodeFromMap(const NodeTy &Node,

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=252081&r1=252080&r2=252081&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Nov  4 15:37:17 2015
@@ -1,4 +1,4 @@
-//===--- Tools.cpp - Tools Implementations 
===//
+//===--- Tools.cpp - Tools Implementations --*- C++ 
-*-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -10107,7 +10107,7 @@ static void ConstructGoldLinkJob(const T
 
   if (!Args.hasArg(options::OPT_nostdlib) &&
   !Args.hasArg(options::OPT_nostartfiles)) {
-const char *crt1 = NULL;
+const char *crt1 = nullptr;
 if (!Args.hasArg(options::OPT_shared)) {
   if (Args.hasArg(options::OPT_pg))
 crt1 = "gcrt1.o";
@@ -10121,7 +10121,7 @@ static void ConstructGoldLinkJob(const T
 
 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
 
-const char *crtbegin = NULL;
+const char *crtbegin = nullptr;
 if (Args.hasArg(options::OPT_static))
   crtbegin = "crtbeginT.o";
 else if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))

Modified: cfe/trunk/lib/Driver/Tools.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=252081&r1=252080&r2=252081&view=diff
==
--- cfe/trunk/lib/Driver/Tools.h (original)
+++ cfe/trunk/lib/Driver/Tools.h Wed Nov  4 15:37:17 2015
@@ -255,7 +255,7 @@ StringRef getLLVMArchSuffixForARM(String
 
 void appendEBLinkFlags(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs,
const llvm::Triple &Triple);
-}
+} // end namespace arm
 
 name

Re: [PATCH] D14345: [analyzer] Update SATestBuild.py to enable a 'download and patch' model for projects.

2015-11-04 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

In http://reviews.llvm.org/D14345#281475, @xazax.hun wrote:

> Hi!
>
> I think it is great to support this model in these scripts. Do you plan to 
> check the list of the project urls in to the repository as well?


The project URLs are implicitly included in the download script (which is 
checked into the repository). So, for example, here is a sample script to 
download the OmniGroup project from github:

  curl -L -O 
https://github.com/omnigroup/OmniGroup/archive/c9074bc24c46516687acf44824ad8b00c2146ad6.zip
  unzip c9074bc24c46516687acf44824ad8b00c2146ad6.zip
  mv OmniGroup-c9074bc24c46516687acf44824ad8b00c2146ad6 CachedSource



> I have one minor high level note about the handling of patches. I think it in 
> case a project would need more modifications, it is cleaner to have a 
> separate patch file for each kind of them. Maybe it would be worth to support 
> patching the project with multiple patches? E.g. applying all patches with a 
> name prefix.


I originally did it this way but I found that became cumbersome.  In order to 
fix an issue I had to copy the original pristine source, apply all previous 
patches to that copy, then copy the patched tree, then fix the issue in the 
second copy and the diff first copy with the second to generate the incremental 
patch.

With the single-patch approach the workflow is: copy the pristine source, apply 
the patch to the copy, fix the issue in the copy, and diff the pristine and the 
(now fixed) copy.

Since these patches are checked into the repo, they can always be differed with 
older versions of the patch to see what has changed.


http://reviews.llvm.org/D14345



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


Re: [PATCH] D14191: Make ArgumentAdjuster aware of the current file being processed.

2015-11-04 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Ping.


http://reviews.llvm.org/D14191



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


Re: [PATCH] D14192: Add ExtraArgs and ExtraArgsBefore options to enable clang warnings via configuration files.

2015-11-04 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Ping.


http://reviews.llvm.org/D14192



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


[PATCH] D14349: [Lex] Add __has_builtin support for __make_integer_seq

2015-11-04 Thread David Majnemer via cfe-commits
majnemer created this revision.
majnemer added a reviewer: rsmith.
majnemer added a subscriber: cfe-commits.

http://reviews.llvm.org/D14349

Files:
  lib/Lex/PPMacroExpansion.cpp
  test/SemaCXX/make_integer_seq.cpp

Index: test/SemaCXX/make_integer_seq.cpp
===
--- test/SemaCXX/make_integer_seq.cpp
+++ test/SemaCXX/make_integer_seq.cpp
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 
+static_assert(__has_builtin(__make_integer_seq), "");
+
 template 
 struct Seq {
   static constexpr T PackSize = sizeof...(I);
Index: lib/Lex/PPMacroExpansion.cpp
===
--- lib/Lex/PPMacroExpansion.cpp
+++ lib/Lex/PPMacroExpansion.cpp
@@ -1636,7 +1636,15 @@
   Value = FeatureII->getTokenID() == tok::identifier;
 else if (II == Ident__has_builtin) {
   // Check for a builtin is trivial.
-  Value = FeatureII->getBuiltinID() != 0;
+  if (FeatureII->getBuiltinID() != 0) {
+Value = true;
+  } else {
+const LangOptions &LangOpts = PP.getLangOpts();
+StringRef Feature = FeatureII->getName();
+Value = llvm::StringSwitch(Feature)
+.Case("__make_integer_seq", LangOpts.CPlusPlus)
+.Default(false);
+  }
 } else if (II == Ident__has_attribute)
   Value = hasAttribute(AttrSyntax::GNU, nullptr, FeatureII,
getTargetInfo(), getLangOpts());


Index: test/SemaCXX/make_integer_seq.cpp
===
--- test/SemaCXX/make_integer_seq.cpp
+++ test/SemaCXX/make_integer_seq.cpp
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
 
+static_assert(__has_builtin(__make_integer_seq), "");
+
 template 
 struct Seq {
   static constexpr T PackSize = sizeof...(I);
Index: lib/Lex/PPMacroExpansion.cpp
===
--- lib/Lex/PPMacroExpansion.cpp
+++ lib/Lex/PPMacroExpansion.cpp
@@ -1636,7 +1636,15 @@
   Value = FeatureII->getTokenID() == tok::identifier;
 else if (II == Ident__has_builtin) {
   // Check for a builtin is trivial.
-  Value = FeatureII->getBuiltinID() != 0;
+  if (FeatureII->getBuiltinID() != 0) {
+Value = true;
+  } else {
+const LangOptions &LangOpts = PP.getLangOpts();
+StringRef Feature = FeatureII->getName();
+Value = llvm::StringSwitch(Feature)
+.Case("__make_integer_seq", LangOpts.CPlusPlus)
+.Default(false);
+  }
 } else if (II == Ident__has_attribute)
   Value = hasAttribute(AttrSyntax::GNU, nullptr, FeatureII,
getTargetInfo(), getLangOpts());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] Allow pointer decay and qual stripping for _Generic

2015-11-04 Thread Richard Smith via cfe-commits
It'd be simpler and would more directly match the C specification (and
would handle a few other cases better, such as placeholder types and atomic
types) if you instead passed the operand through DefaultLvalueConversion
rather than matching against the decayed form of the type.

On Wed, Nov 4, 2015 at 11:23 AM, Aaron Ballman 
wrote:

> The control expression for a _Generic selection expression should have
> its type decayed and qualifiers stripped when determining which
> selection it matches. e.g., the following should compile:
>
>   _Generic("test", char *: 1);
>   const int i = 12;
>   _Generic(i, int: 1);
>
> This patch fixes PR16340.
>
> ~Aaron
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] Allow pointer decay and qual stripping for _Generic

2015-11-04 Thread Richard Smith via cfe-commits
On Wed, Nov 4, 2015 at 2:45 PM, Richard Smith  wrote:

> It'd be simpler and would more directly match the C specification (and
> would handle a few other cases better, such as placeholder types and atomic
> types) if you instead passed the operand through DefaultLvalueConversion
>

or rather, DefaultFunctionArrayLvalueConversion =)


> rather than matching against the decayed form of the type.
>
> On Wed, Nov 4, 2015 at 11:23 AM, Aaron Ballman 
> wrote:
>
>> The control expression for a _Generic selection expression should have
>> its type decayed and qualifiers stripped when determining which
>> selection it matches. e.g., the following should compile:
>>
>>   _Generic("test", char *: 1);
>>   const int i = 12;
>>   _Generic(i, int: 1);
>>
>> This patch fixes PR16340.
>>
>> ~Aaron
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r252089 - clang-format: Turn on wrapping before "else" for WebKit style.

2015-11-04 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Wed Nov  4 16:49:32 2015
New Revision: 252089

URL: http://llvm.org/viewvc/llvm-project?rev=252089&view=rev
Log:
clang-format: Turn on wrapping before "else" for WebKit style.

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

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=252089&r1=252088&r2=252089&view=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed Nov  4 16:49:32 2015
@@ -425,6 +425,7 @@ static FormatStyle expandPresets(const F
 break;
   case FormatStyle::BS_WebKit:
 Expanded.BraceWrapping.AfterFunction = true;
+Expanded.BraceWrapping.BeforeElse = true;
 break;
   default:
 break;


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


Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-04 Thread Daniel Jasper via cfe-commits
djasper added a comment.

I like it :-)



Comment at: lib/Format/WhitespaceManager.cpp:151
@@ -150,13 +150,3 @@
 
-// Walk through all of the changes and find sequences of "=" to align.  To do
-// so, keep track of the lines and whether or not an "=" was found on align. If
-// a "=" is found on a line, extend the current sequence. If the current line
-// cannot be part of a sequence, e.g. because there is an empty line before it
-// or it contains non-assignments, finalize the previous sequence.
-//
-// FIXME: The code between assignment and declaration alignment is mostly
-// duplicated and would benefit from factorization.
-void WhitespaceManager::alignConsecutiveAssignments() {
-  if (!Style.AlignConsecutiveAssignments)
-return;
-
+struct TokenSequenceAligner {
+  template 

Why is this a class/struct? It doesn't seem to have any state.


http://reviews.llvm.org/D14325



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


[PATCH] D14352: Add diagnostics which fall under [dcl.spec.concept]p5

2015-11-04 Thread Nathan Wilson via cfe-commits
nwilson created this revision.
nwilson added reviewers: rsmith, faisalv, hubert.reinterpretcast, aaron.ballman.
nwilson added a subscriber: cfe-commits.

Diagnose when a function concept declaration has parameter(s)

http://reviews.llvm.org/D14352

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDecl.cpp
  test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp

Index: test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp
===
--- /dev/null
+++ test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp
@@ -0,0 +1,7 @@
+// RUN:  %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s
+
+template
+concept bool fcpv(void) { return true; }
+
+template
+concept bool fcpi(int i = 0) { return true; } // expected-error {{function 
concept cannot have any parameters}}
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -7569,6 +7569,13 @@
 } else {
   Context.adjustExceptionSpec(NewFD, EST_BasicNoexcept);
 }
+
+// C++ Concepts TS [dcl.spec.concept]p5: A function concept has the
+// following restrictions:
+// — The declaration’s parameter list shall be equivalent to an empty
+//   parameter list.
+if (FPT->getNumParams() > 0)
+  Diag(NewFD->getLocation(), diag::err_function_concept_with_params);
   }
 
   // C++ Concepts TS [dcl.spec.concept]p2: Every concept definition is
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -1990,6 +1990,8 @@
 def err_concept_decl_invalid_specifiers : Error<
   "%select{variable|function}0 concept cannot be declared "
   "'%select{thread_local|inline|friend|constexpr}1'">;
+def err_function_concept_with_params : Error<
+  "function concept cannot have any parameters">;
 
 // C++11 char16_t/char32_t
 def warn_cxx98_compat_unicode_type : Warning<


Index: test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp
===
--- /dev/null
+++ test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp
@@ -0,0 +1,7 @@
+// RUN:  %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s
+
+template
+concept bool fcpv(void) { return true; }
+
+template
+concept bool fcpi(int i = 0) { return true; } // expected-error {{function concept cannot have any parameters}}
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -7569,6 +7569,13 @@
 } else {
   Context.adjustExceptionSpec(NewFD, EST_BasicNoexcept);
 }
+
+// C++ Concepts TS [dcl.spec.concept]p5: A function concept has the
+// following restrictions:
+// — The declaration’s parameter list shall be equivalent to an empty
+//   parameter list.
+if (FPT->getNumParams() > 0)
+  Diag(NewFD->getLocation(), diag::err_function_concept_with_params);
   }
 
   // C++ Concepts TS [dcl.spec.concept]p2: Every concept definition is
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -1990,6 +1990,8 @@
 def err_concept_decl_invalid_specifiers : Error<
   "%select{variable|function}0 concept cannot be declared "
   "'%select{thread_local|inline|friend|constexpr}1'">;
+def err_function_concept_with_params : Error<
+  "function concept cannot have any parameters">;
 
 // C++11 char16_t/char32_t
 def warn_cxx98_compat_unicode_type : Warning<
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [Diffusion] rL246882: Don't crash on a self-alias declaration

2015-11-04 Thread Dimitry Andric via cfe-commits
dim added a subscriber: dim.
dim added auditors: 3.7-release, cfe-commits, tstellarAMD, hfinkel.
dim added a comment.

This got reported again in PR25397, and occurs during compilation of mpich.  
Looks like a good candidate for 3.7.1.


Users:
  hfinkel (Author, Auditor)
  3.7-release (Auditor)
  cfe-commits (Auditor)
  tstellarAMD (Auditor)

http://reviews.llvm.org/rL246882



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


Re: [PATCH] D14325: [clang-format] Do not align assignments that aren't after the same number of commas. (Closes: 25329)

2015-11-04 Thread Beren Minor via cfe-commits
berenm marked an inline comment as done.


Comment at: lib/Format/WhitespaceManager.cpp:150-151
@@ -149,109 +149,4 @@
 }
 
-// Walk through all of the changes and find sequences of "=" to align.  To do
-// so, keep track of the lines and whether or not an "=" was found on align. If
-// a "=" is found on a line, extend the current sequence. If the current line
-// cannot be part of a sequence, e.g. because there is an empty line before it
-// or it contains non-assignments, finalize the previous sequence.
-//
-// FIXME: The code between assignment and declaration alignment is mostly
-// duplicated and would benefit from factorization.
-void WhitespaceManager::alignConsecutiveAssignments() {
-  if (!Style.AlignConsecutiveAssignments)
-return;
-
-  unsigned MinColumn = 0;
-  unsigned MaxColumn = UINT_MAX;
-  unsigned StartOfSequence = 0;
-  unsigned EndOfSequence = 0;
-  bool FoundAssignmentOnLine = false;
-  bool FoundLeftBraceOnLine = false;
-  bool FoundLeftParenOnLine = false;
-
-  // Aligns a sequence of assignment tokens, on the MinColumn column.
-  //
-  // Sequences start from the first assignment token to align, and end at the
-  // first token of the first line that doesn't need to be aligned.
-  //
-  // We need to adjust the StartOfTokenColumn of each Change that is on a line
-  // containing any assignment to be aligned and located after such assignment
-  auto AlignSequence = [&] {
-if (StartOfSequence > 0 && StartOfSequence < EndOfSequence)
-  alignConsecutiveAssignments(StartOfSequence, EndOfSequence, MinColumn);
-MinColumn = 0;
-MaxColumn = UINT_MAX;
-StartOfSequence = 0;
-EndOfSequence = 0;
-  };
-
-  for (unsigned i = 0, e = Changes.size(); i != e; ++i) {
-if (Changes[i].NewlinesBefore != 0) {
-  EndOfSequence = i;
-  // If there is a blank line, if the last line didn't contain any
-  // assignment, or if we found an open brace or paren, the sequence ends
-  // here.
-  if (Changes[i].NewlinesBefore > 1 || !FoundAssignmentOnLine ||
-  FoundLeftBraceOnLine || FoundLeftParenOnLine) {
-// NB: In the latter case, the sequence should end at the beggining of
-// the previous line, but it doesn't really matter as there is no
-// assignment on it
-AlignSequence();
-  }
-
-  FoundAssignmentOnLine = false;
-  FoundLeftBraceOnLine = false;
-  FoundLeftParenOnLine = false;
-}
-
-// If there is more than one "=" per line, or if the "=" appears first on
-// the line of if it appears last, end the sequence
-if (Changes[i].Kind == tok::equal &&
-(FoundAssignmentOnLine || Changes[i].NewlinesBefore > 0 ||
- Changes[i + 1].NewlinesBefore > 0)) {
-  AlignSequence();
-} else if (Changes[i].Kind == tok::r_brace) {
-  if (!FoundLeftBraceOnLine)
-AlignSequence();
-  FoundLeftBraceOnLine = false;
-} else if (Changes[i].Kind == tok::l_brace) {
-  FoundLeftBraceOnLine = true;
-  if (!FoundAssignmentOnLine)
-AlignSequence();
-} else if (Changes[i].Kind == tok::r_paren) {
-  if (!FoundLeftParenOnLine)
-AlignSequence();
-  FoundLeftParenOnLine = false;
-} else if (Changes[i].Kind == tok::l_paren) {
-  FoundLeftParenOnLine = true;
-  if (!FoundAssignmentOnLine)
-AlignSequence();
-} else if (!FoundAssignmentOnLine && !FoundLeftBraceOnLine &&
-   !FoundLeftParenOnLine && Changes[i].Kind == tok::equal) {
-  FoundAssignmentOnLine = true;
-  if (StartOfSequence == 0)
-StartOfSequence = i;
-
-  unsigned ChangeMinColumn = Changes[i].StartOfTokenColumn;
-  int LineLengthAfter = -Changes[i].Spaces;
-  for (unsigned j = i; j != e && Changes[j].NewlinesBefore == 0; ++j)
-LineLengthAfter += Changes[j].Spaces + Changes[j].TokenLength;
-  unsigned ChangeMaxColumn = Style.ColumnLimit - LineLengthAfter;
-
-  if (ChangeMinColumn > MaxColumn || ChangeMaxColumn < MinColumn) {
-AlignSequence();
-StartOfSequence = i;
-  }
-
-  MinColumn = std::max(MinColumn, ChangeMinColumn);
-  MaxColumn = std::min(MaxColumn, ChangeMaxColumn);
-}
-  }
-
-  EndOfSequence = Changes.size();
-  AlignSequence();
-}
-
-void WhitespaceManager::alignConsecutiveAssignments(unsigned Start,
-unsigned End,
-unsigned Column) {
-  bool FoundAssignmentOnLine = false;
+// Align a single sequence of tokens, see AlignTokens below.
+template 

Haha, good question. I initially moved the variable there, but then it didn't 
looked really better, so I moved the variables back into the function...


http://reviews.llvm.org/D14325



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


Re: [PATCH] D13834: Produce a better diagnostic for global register variables

2015-11-04 Thread Akira Hatanaka via cfe-commits
ping

On Fri, Oct 16, 2015 at 2:51 PM, Akira Hatanaka  wrote:

> ahatanak created this revision.
> ahatanak added a subscriber: cfe-commits.
>
> clang doesn't print a very user-friendly message when an invalid register
> is used for a global register variable:
>
> For example, when the following code is compiled,
>
> $ cat f1.c
> volatile register long long A asm ("rdi");
>
> void foo1() {
>   A = 1;
> }
>
> clang prints this error message:
>
> $ clang -c f1.c
> fatal error: error in backend: Invalid register name global variable
>
> The code fails to compile because "rdi" isn't a valid register for global
> register variables on x86 (rsp, rbp, esp, and ebp are the only registers
> that are currently valid), but the diagnostic doesn't give much detail on
> why it is an error or which line of the source code is not correct because
> the error is detected in the backend.
>
> This patch makes changes in Sema to catch this kind of error earlier. In
> addition, it errors out if the size of the register doesn't match the
> declared variable size.
>
> e.g., volatile register int B asm ("rbp");
>
> http://reviews.llvm.org/D13834
>
> Files:
>   include/clang/Basic/DiagnosticSemaKinds.td
>   include/clang/Basic/TargetInfo.h
>   lib/Basic/Targets.cpp
>   lib/Sema/SemaDecl.cpp
>   test/CodeGen/named_reg_global.c
>   test/OpenMP/atomic_capture_codegen.cpp
>   test/OpenMP/atomic_read_codegen.c
>   test/OpenMP/atomic_update_codegen.cpp
>   test/OpenMP/atomic_write_codegen.c
>   test/OpenMP/for_loop_messages.cpp
>   test/OpenMP/threadprivate_messages.cpp
>   test/Sema/asm.c
>   test/SemaCUDA/asm-constraints-mixed.cu
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14180: enable -fms-extensions by default on the mingw-w64 target

2015-11-04 Thread Reid Kleckner via cfe-commits
rnk added a comment.

> ! In http://reviews.llvm.org/D14180#280193, @martell wrote:

> 

> > You can then change the mingw headers to use 
> > `__has_builtin(_InterlockedCompareExchange)` to provide compatibility with 
> > either mode.

> 

> 

> Yes I could do this but this still won't work with the the existing mingw 
> toolchains that don't have this in their headers right?

>  I can update head to support both though yes


I'm suggesting that we can make the builtins available in an MSVC environment, 
rather than making them available in an MS extensions environment. This should 
be compatible with old mingw headers, and then we can flip this default.


http://reviews.llvm.org/D14180



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


Re: [PATCH] D14352: Add diagnostics which fall under [dcl.spec.concept]p5

2015-11-04 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added inline comments.


Comment at: lib/Sema/SemaDecl.cpp:7575
@@ +7574,3 @@
+// following restrictions:
+// — The declaration’s parameter list shall be equivalent to an empty
+//   parameter list.

I think the U+2014 should be replaced by the ASCII-friendly U+002D.


Comment at: test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp:7
@@ +6,2 @@
+template
+concept bool fcpi(int i = 0) { return true; } // expected-error {{function 
concept cannot have any parameters}}

Do we diagnose for the following?
template
concept bool fcpp(T ...t) { return true; }

This is ill-formed as well since either [dcl.spec.concept]p5 is violated or 
[temp.res]p8 (same paragraph reference in C++14 as in N4527) is.


http://reviews.llvm.org/D14352



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


[PATCH] D14353: Allow use of private headers in different sub-modules.

2015-11-04 Thread Manuel Klimek via cfe-commits
klimek created this revision.
klimek added a reviewer: rsmith.
klimek added a subscriber: cfe-commits.

http://reviews.llvm.org/D14353

Files:
  lib/Lex/ModuleMap.cpp
  test/Modules/Inputs/private3/private.h
  test/Modules/Inputs/private3/public.h
  test/Modules/private.modulemap

Index: test/Modules/private.modulemap
===
--- /dev/null
+++ test/Modules/private.modulemap
@@ -0,0 +1,35 @@
+// RUN: rm -rf %t
+// RUN: cd %S
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=A -o %t/m.pcm %s
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=B -o %t/m.pcm %s
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=C -o %t/m.pcm %s
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=D -o %t/m.pcm %s
+
+module A {
+  header "Inputs/private3/public.h"
+  private header "Inputs/private3/private.h"
+}
+module B {
+  header "Inputs/private3/public.h"
+  module "private.h" {
+private header "Inputs/private3/private.h"
+  }
+}
+module C {
+  module "public.h" {
+header "Inputs/private3/public.h"
+  }
+  private header "Inputs/private3/private.h"
+}
+module D {
+  module "public.h" {
+header "Inputs/private3/public.h"
+  }
+  module "private.h" {
+private header "Inputs/private3/private.h"
+  }
+}
Index: test/Modules/Inputs/private3/public.h
===
--- /dev/null
+++ test/Modules/Inputs/private3/public.h
@@ -0,0 +1,11 @@
+#ifndef PUBLIC_H
+#define PUBLIC_H
+
+#include "private.h"
+
+void pub() {
+  priv();
+}
+
+#endif
+
Index: test/Modules/Inputs/private3/private.h
===
--- /dev/null
+++ test/Modules/Inputs/private3/private.h
@@ -0,0 +1,7 @@
+#ifndef PRIVATE_H
+#define PRIVATE_H
+
+void priv();
+
+#endif
+
Index: lib/Lex/ModuleMap.cpp
===
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -232,10 +232,8 @@
   }
 #endif
   return IsPrivateRole &&
- // FIXME: Should we map RequestingModule to its top-level module here
- //too? This check is redundant with the isSubModuleOf check in
- //diagnoseHeaderInclusion.
- RequestedModule->getTopLevelModule() != RequestingModule;
+ RequestedModule->getTopLevelModule() !=
+ RequestingModule->getTopLevelModule();
 }
 
 static Module *getTopLevelOrNull(Module *M) {


Index: test/Modules/private.modulemap
===
--- /dev/null
+++ test/Modules/private.modulemap
@@ -0,0 +1,35 @@
+// RUN: rm -rf %t
+// RUN: cd %S
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=A -o %t/m.pcm %s
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=B -o %t/m.pcm %s
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=C -o %t/m.pcm %s
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=D -o %t/m.pcm %s
+
+module A {
+  header "Inputs/private3/public.h"
+  private header "Inputs/private3/private.h"
+}
+module B {
+  header "Inputs/private3/public.h"
+  module "private.h" {
+private header "Inputs/private3/private.h"
+  }
+}
+module C {
+  module "public.h" {
+header "Inputs/private3/public.h"
+  }
+  private header "Inputs/private3/private.h"
+}
+module D {
+  module "public.h" {
+header "Inputs/private3/public.h"
+  }
+  module "private.h" {
+private header "Inputs/private3/private.h"
+  }
+}
Index: test/Modules/Inputs/private3/public.h
===
--- /dev/null
+++ test/Modules/Inputs/private3/public.h
@@ -0,0 +1,11 @@
+#ifndef PUBLIC_H
+#define PUBLIC_H
+
+#include "private.h"
+
+void pub() {
+  priv();
+}
+
+#endif
+
Index: test/Modules/Inputs/private3/private.h
===
--- /dev/null
+++ test/Modules/Inputs/private3/private.h
@@ -0,0 +1,7 @@
+#ifndef PRIVATE_H
+#define PRIVATE_H
+
+void priv();
+
+#endif
+
Index: lib/Lex/ModuleMap.cpp
===
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -232,10 +232,8 @@
   }
 #endif
   return IsPrivateRole &&
- // FIXME: Should we map RequestingModule to its top-level module here
- //too? This check is redundant with the is

Re: [PATCH] D14352: Add diagnostics which fall under [dcl.spec.concept]p5

2015-11-04 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added inline comments.


Comment at: test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp:7
@@ +6,2 @@
+template
+concept bool fcpi(int i = 0) { return true; } // expected-error {{function 
concept cannot have any parameters}}

hubert.reinterpretcast wrote:
> Do we diagnose for the following?
> template
> concept bool fcpp(T ...t) { return true; }
> 
> This is ill-formed as well since either [dcl.spec.concept]p5 is violated or 
> [temp.res]p8 (same paragraph reference in C++14 as in N4527) is.
Also test:
template
concept bool fcpva(...) { return true; }


http://reviews.llvm.org/D14352



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


Re: [PATCH] D14170: Fix false positive warning about memory leak for QApplication::postEvent

2015-11-04 Thread Evgeniy Dushistov via cfe-commits
Dushistov updated this revision to Diff 39265.
Dushistov added a comment.

Fix line length issue


http://reviews.llvm.org/D14170

Files:
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  test/Analysis/Inputs/qt-simulator.h
  test/Analysis/qt_malloc.cpp

Index: test/Analysis/qt_malloc.cpp
===
--- test/Analysis/qt_malloc.cpp
+++ test/Analysis/qt_malloc.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -analyze 
-analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,cplusplus
 -analyzer-store=region -verify %s
+// expected-no-diagnostics
+#include "Inputs/qt-simulator.h"
+
+void send(QObject *obj)
+{
+  QEvent *event = new QEvent(QEvent::None);
+  static_cast(QCoreApplication::instance())->postEvent(obj, 
event);
+}
Index: test/Analysis/Inputs/qt-simulator.h
===
--- test/Analysis/Inputs/qt-simulator.h
+++ test/Analysis/Inputs/qt-simulator.h
@@ -0,0 +1,16 @@
+#pragma clang system_header
+
+struct QObject {
+};
+
+struct QEvent {
+  enum Type { None };
+  QEvent(Type) {}
+};
+
+struct QCoreApplication : public QObject {
+  static void postEvent(QObject *receiver, QEvent *event);
+  static QCoreApplication *instance();
+};
+
+struct QApplication : public QCoreApplication {};
Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2511,6 +2511,11 @@
 return true;
   }
 
+  if (FName.endswith("postEvent") ||
+  FD->getQualifiedNameAsString() == "QCoreApplication::postEvent") {
+return true;
+  }
+
   // Handle cases where we know a buffer's /address/ can escape.
   // Note that the above checks handle some special cases where we know that
   // even though the address escapes, it's still our responsibility to free the


Index: test/Analysis/qt_malloc.cpp
===
--- test/Analysis/qt_malloc.cpp
+++ test/Analysis/qt_malloc.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,cplusplus -analyzer-store=region -verify %s
+// expected-no-diagnostics
+#include "Inputs/qt-simulator.h"
+
+void send(QObject *obj)
+{
+  QEvent *event = new QEvent(QEvent::None);
+  static_cast(QCoreApplication::instance())->postEvent(obj, event);
+}
Index: test/Analysis/Inputs/qt-simulator.h
===
--- test/Analysis/Inputs/qt-simulator.h
+++ test/Analysis/Inputs/qt-simulator.h
@@ -0,0 +1,16 @@
+#pragma clang system_header
+
+struct QObject {
+};
+
+struct QEvent {
+  enum Type { None };
+  QEvent(Type) {}
+};
+
+struct QCoreApplication : public QObject {
+  static void postEvent(QObject *receiver, QEvent *event);
+  static QCoreApplication *instance();
+};
+
+struct QApplication : public QCoreApplication {};
Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2511,6 +2511,11 @@
 return true;
   }
 
+  if (FName.endswith("postEvent") ||
+  FD->getQualifiedNameAsString() == "QCoreApplication::postEvent") {
+return true;
+  }
+
   // Handle cases where we know a buffer's /address/ can escape.
   // Note that the above checks handle some special cases where we know that
   // even though the address escapes, it's still our responsibility to free the
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14170: Fix false positive warning about memory leak for QApplication::postEvent

2015-11-04 Thread Evgeniy Dushistov via cfe-commits
Dushistov updated this revision to Diff 39264.
Dushistov added a comment.

I reduce testcase to almost minimal variant.


http://reviews.llvm.org/D14170

Files:
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  test/Analysis/Inputs/qt-simulator.h
  test/Analysis/qt_malloc.cpp

Index: test/Analysis/qt_malloc.cpp
===
--- test/Analysis/qt_malloc.cpp
+++ test/Analysis/qt_malloc.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -analyze 
-analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,cplusplus
 -analyzer-store=region -verify %s
+// expected-no-diagnostics
+#include "Inputs/qt-simulator.h"
+
+void send(QObject *obj)
+{
+  QEvent *event = new QEvent(QEvent::None);
+  static_cast(QCoreApplication::instance())->postEvent(obj, 
event);
+}
Index: test/Analysis/Inputs/qt-simulator.h
===
--- test/Analysis/Inputs/qt-simulator.h
+++ test/Analysis/Inputs/qt-simulator.h
@@ -0,0 +1,16 @@
+#pragma clang system_header
+
+struct QObject {
+};
+
+struct QEvent {
+  enum Type { None };
+  QEvent(Type) {}
+};
+
+struct QCoreApplication : public QObject {
+  static void postEvent(QObject *receiver, QEvent *event);
+  static QCoreApplication *instance();
+};
+
+struct QApplication : public QCoreApplication {};
Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2511,6 +2511,10 @@
 return true;
   }
 
+  if (FName.endswith("postEvent") || FD->getQualifiedNameAsString() == 
"QCoreApplication::postEvent") {
+return true;
+  }
+
   // Handle cases where we know a buffer's /address/ can escape.
   // Note that the above checks handle some special cases where we know that
   // even though the address escapes, it's still our responsibility to free the


Index: test/Analysis/qt_malloc.cpp
===
--- test/Analysis/qt_malloc.cpp
+++ test/Analysis/qt_malloc.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.deadcode.UnreachableCode,alpha.core.CastSize,unix.Malloc,cplusplus -analyzer-store=region -verify %s
+// expected-no-diagnostics
+#include "Inputs/qt-simulator.h"
+
+void send(QObject *obj)
+{
+  QEvent *event = new QEvent(QEvent::None);
+  static_cast(QCoreApplication::instance())->postEvent(obj, event);
+}
Index: test/Analysis/Inputs/qt-simulator.h
===
--- test/Analysis/Inputs/qt-simulator.h
+++ test/Analysis/Inputs/qt-simulator.h
@@ -0,0 +1,16 @@
+#pragma clang system_header
+
+struct QObject {
+};
+
+struct QEvent {
+  enum Type { None };
+  QEvent(Type) {}
+};
+
+struct QCoreApplication : public QObject {
+  static void postEvent(QObject *receiver, QEvent *event);
+  static QCoreApplication *instance();
+};
+
+struct QApplication : public QCoreApplication {};
Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2511,6 +2511,10 @@
 return true;
   }
 
+  if (FName.endswith("postEvent") || FD->getQualifiedNameAsString() == "QCoreApplication::postEvent") {
+return true;
+  }
+
   // Handle cases where we know a buffer's /address/ can escape.
   // Note that the above checks handle some special cases where we know that
   // even though the address escapes, it's still our responsibility to free the
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D14354: Add new compiler flag to enable the generation of dwarf accelerator tables

2015-11-04 Thread Tamas Berghammer via cfe-commits
tberghammer created this revision.
tberghammer added a reviewer: echristo.
tberghammer added a subscriber: cfe-commits.

Add new compiler flag to enable the generation of dwarf accelerator tables

The dwarf accelerator tables already generated on darwin platforms. This CL 
ands a new flag to clang to make it possible to enable the generation of these 
tables on other platforms also.

Note: Currently the accelerator table generation code isn't working when split 
dwarf is enabled for several reasons (accelerator tables aren't copied to dwo 
file, they contain relocation entries for the .debug_str.dwo sections). These 
issues should be addressed separately.

http://reviews.llvm.org/D14354

Files:
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3876,6 +3876,14 @@
 CmdArgs.push_back("-split-dwarf=Enable");
   }
 
+  // -gdwarf-accel-tables should turn on -g and enable the genereation of the
+  // dwarf acceleration tables in the backend.
+  if (Args.hasArg(options::OPT_gdwarf_accel_tables)) {
+DebugInfoKind = CodeGenOptions::LimitedDebugInfo;
+CmdArgs.push_back("-backend-option");
+CmdArgs.push_back("-dwarf-accel-tables=Enable");
+  }
+
   // After we've dealt with all combinations of things that could
   // make DebugInfoKind be other than None or DebugLineTablesOnly,
   // figure out if we need to "upgrade" it to standalone debug info.
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1161,6 +1161,7 @@
 def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group;
 def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group;
 def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group;
+def gdwarf_accel_tables : Flag<["-"], "gdwarf-accel-tables">, 
Group;
 def gmodules : Flag <["-"], "gmodules">, Group,
   HelpText<"Generate debug info with external references to clang modules"
" or precompiled headers">;


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3876,6 +3876,14 @@
 CmdArgs.push_back("-split-dwarf=Enable");
   }
 
+  // -gdwarf-accel-tables should turn on -g and enable the genereation of the
+  // dwarf acceleration tables in the backend.
+  if (Args.hasArg(options::OPT_gdwarf_accel_tables)) {
+DebugInfoKind = CodeGenOptions::LimitedDebugInfo;
+CmdArgs.push_back("-backend-option");
+CmdArgs.push_back("-dwarf-accel-tables=Enable");
+  }
+
   // After we've dealt with all combinations of things that could
   // make DebugInfoKind be other than None or DebugLineTablesOnly,
   // figure out if we need to "upgrade" it to standalone debug info.
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1161,6 +1161,7 @@
 def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group;
 def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group;
 def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group;
+def gdwarf_accel_tables : Flag<["-"], "gdwarf-accel-tables">, Group;
 def gmodules : Flag <["-"], "gmodules">, Group,
   HelpText<"Generate debug info with external references to clang modules"
" or precompiled headers">;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] Allow pointer decay and qual stripping for _Generic

2015-11-04 Thread Aaron Ballman via cfe-commits
On Wed, Nov 4, 2015 at 5:46 PM, Richard Smith  wrote:
> On Wed, Nov 4, 2015 at 2:45 PM, Richard Smith  wrote:
>>
>> It'd be simpler and would more directly match the C specification (and
>> would handle a few other cases better, such as placeholder types and atomic
>> types) if you instead passed the operand through DefaultLvalueConversion
>
>
> or rather, DefaultFunctionArrayLvalueConversion =)

That was the magic incantation I didn't find before; thank you for
pointing it out! Updated patch attached.

~Aaron


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


Re: [PATCH] Allow pointer decay and qual stripping for _Generic

2015-11-04 Thread Richard Smith via cfe-commits
LGTM, thanks!

On Wed, Nov 4, 2015 at 4:00 PM, Aaron Ballman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Wed, Nov 4, 2015 at 5:46 PM, Richard Smith 
> wrote:
> > On Wed, Nov 4, 2015 at 2:45 PM, Richard Smith 
> wrote:
> >>
> >> It'd be simpler and would more directly match the C specification (and
> >> would handle a few other cases better, such as placeholder types and
> atomic
> >> types) if you instead passed the operand through DefaultLvalueConversion
> >
> >
> > or rather, DefaultFunctionArrayLvalueConversion =)
>
> That was the magic incantation I didn't find before; thank you for
> pointing it out! Updated patch attached.
>
> ~Aaron
>
> ___
> 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


r252104 - The control expression for a _Generic selection expression should have

2015-11-04 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Nov  4 18:06:05 2015
New Revision: 252104

URL: http://llvm.org/viewvc/llvm-project?rev=252104&view=rev
Log:
The control expression for a _Generic selection expression should have
its type decayed and qualifiers stripped when determining which
selection it matches. Fixes PR16340.

Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/generic-selection.c

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=252104&r1=252103&r2=252104&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Nov  4 18:06:05 2015
@@ -1354,11 +1354,13 @@ Sema::CreateGenericSelectionExpr(SourceL
  ArrayRef Exprs) {
   unsigned NumAssocs = Types.size();
   assert(NumAssocs == Exprs.size());
-  if (ControllingExpr->getType()->isPlaceholderType()) {
-ExprResult result = CheckPlaceholderExpr(ControllingExpr);
-if (result.isInvalid()) return ExprError();
-ControllingExpr = result.get();
-  }
+
+  // Decay and strip qualifiers for the controlling expression type, and handle
+  // placeholder type replacement. See committee discussion from WG14 DR423.
+  ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr);
+  if (R.isInvalid())
+return ExprError();
+  ControllingExpr = R.get();
 
   // The controlling expression is an unevaluated operand, so side effects are
   // likely unintended.

Modified: cfe/trunk/test/Sema/generic-selection.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/generic-selection.c?rev=252104&r1=252103&r2=252104&view=diff
==
--- cfe/trunk/test/Sema/generic-selection.c (original)
+++ cfe/trunk/test/Sema/generic-selection.c Wed Nov  4 18:06:05 2015
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 -std=c1x -fsyntax-only -verify %s
 
+void g(void);
+
 void foo(int n) {
   (void) _Generic(0,
   struct A: 0, // expected-error {{type 'struct A' in generic association 
incomplete}}
@@ -23,4 +25,10 @@ void foo(int n) {
   int a4[_Generic(0L, default: 1, short: 2, float: 3, int: 4) == 1 ? 1 : -1];
   int a5[_Generic(0, int: 1, short: 2, float: 3) == 1 ? 1 : -1];
   int a6[_Generic(0, short: 1, float: 2, int: 3) == 3 ? 1 : -1];
+
+  int a7[_Generic("test", char *: 1, default: 2) == 1 ? 1 : -1];
+  int a8[_Generic(g, void (*)(void): 1, default: 2) == 1 ? 1 : -1];
+
+  const int i = 12;
+  int a9[_Generic(i, int: 1, default: 2) == 1 ? 1 : -1];
 }


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


Re: [PATCH] D14353: Allow use of private headers in different sub-modules.

2015-11-04 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Lex/ModuleMap.cpp:235-237
@@ -234,5 +234,1 @@
   return IsPrivateRole &&
- // FIXME: Should we map RequestingModule to its top-level module here
- //too? This check is redundant with the isSubModuleOf check in
- //diagnoseHeaderInclusion.
- RequestedModule->getTopLevelModule() != RequestingModule;

We still have some duplication between this check...


Comment at: lib/Lex/ModuleMap.cpp:264-267
@@ -263,6 +261,6 @@
 for (const KnownHeader &Header : Known->second) {
   // If 'File' is part of 'RequestingModule' we can definitely include it.
   if (Header.getModule() &&
   Header.getModule()->isSubModuleOf(RequestingModule))
 return;
 

... and this one. I don't think we need both.


http://reviews.llvm.org/D14353



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


Re: [PATCH] Allow pointer decay and qual stripping for _Generic

2015-11-04 Thread Aaron Ballman via cfe-commits
Thanks! Commit in r252104.

~Aaron

On Wed, Nov 4, 2015 at 7:05 PM, Richard Smith  wrote:
> LGTM, thanks!
>
> On Wed, Nov 4, 2015 at 4:00 PM, Aaron Ballman via cfe-commits
>  wrote:
>>
>> On Wed, Nov 4, 2015 at 5:46 PM, Richard Smith 
>> wrote:
>> > On Wed, Nov 4, 2015 at 2:45 PM, Richard Smith 
>> > wrote:
>> >>
>> >> It'd be simpler and would more directly match the C specification (and
>> >> would handle a few other cases better, such as placeholder types and
>> >> atomic
>> >> types) if you instead passed the operand through
>> >> DefaultLvalueConversion
>> >
>> >
>> > or rather, DefaultFunctionArrayLvalueConversion =)
>>
>> That was the magic incantation I didn't find before; thank you for
>> pointing it out! Updated patch attached.
>>
>> ~Aaron
>>
>> ___
>> 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] D14353: Allow use of private headers in different sub-modules.

2015-11-04 Thread Manuel Klimek via cfe-commits
klimek updated this revision to Diff 39287.
klimek added a comment.

Remove unnecessary if and fix segfault.


http://reviews.llvm.org/D14353

Files:
  lib/Lex/ModuleMap.cpp
  test/Modules/Inputs/private3/private.h
  test/Modules/Inputs/private3/public.h
  test/Modules/private.modulemap

Index: test/Modules/private.modulemap
===
--- /dev/null
+++ test/Modules/private.modulemap
@@ -0,0 +1,35 @@
+// RUN: rm -rf %t
+// RUN: cd %S
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=A -o %t/m.pcm %s
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=B -o %t/m.pcm %s
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=C -o %t/m.pcm %s
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=D -o %t/m.pcm %s
+
+module A {
+  header "Inputs/private3/public.h"
+  private header "Inputs/private3/private.h"
+}
+module B {
+  header "Inputs/private3/public.h"
+  module "private.h" {
+private header "Inputs/private3/private.h"
+  }
+}
+module C {
+  module "public.h" {
+header "Inputs/private3/public.h"
+  }
+  private header "Inputs/private3/private.h"
+}
+module D {
+  module "public.h" {
+header "Inputs/private3/public.h"
+  }
+  module "private.h" {
+private header "Inputs/private3/private.h"
+  }
+}
Index: test/Modules/Inputs/private3/public.h
===
--- /dev/null
+++ test/Modules/Inputs/private3/public.h
@@ -0,0 +1,11 @@
+#ifndef PUBLIC_H
+#define PUBLIC_H
+
+#include "private.h"
+
+void pub() {
+  priv();
+}
+
+#endif
+
Index: test/Modules/Inputs/private3/private.h
===
--- /dev/null
+++ test/Modules/Inputs/private3/private.h
@@ -0,0 +1,7 @@
+#ifndef PRIVATE_H
+#define PRIVATE_H
+
+void priv();
+
+#endif
+
Index: lib/Lex/ModuleMap.cpp
===
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -231,11 +231,9 @@
 assert((!IsPrivateRole || IsPrivate) && "inconsistent headers and roles");
   }
 #endif
-  return IsPrivateRole &&
- // FIXME: Should we map RequestingModule to its top-level module here
- //too? This check is redundant with the isSubModuleOf check in
- //diagnoseHeaderInclusion.
- RequestedModule->getTopLevelModule() != RequestingModule;
+  return IsPrivateRole && (!RequestingModule ||
+   RequestedModule->getTopLevelModule() !=
+   RequestingModule->getTopLevelModule());
 }
 
 static Module *getTopLevelOrNull(Module *M) {
@@ -261,11 +259,6 @@
   HeadersMap::iterator Known = findKnownHeader(File);
   if (Known != Headers.end()) {
 for (const KnownHeader &Header : Known->second) {
-  // If 'File' is part of 'RequestingModule' we can definitely include it.
-  if (Header.getModule() &&
-  Header.getModule()->isSubModuleOf(RequestingModule))
-return;
-
   // Remember private headers for later printing of a diagnostic.
   if (violatesPrivateInclude(RequestingModule, File, Header.getRole(),
  Header.getModule())) {


Index: test/Modules/private.modulemap
===
--- /dev/null
+++ test/Modules/private.modulemap
@@ -0,0 +1,35 @@
+// RUN: rm -rf %t
+// RUN: cd %S
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=A -o %t/m.pcm %s
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=B -o %t/m.pcm %s
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=C -o %t/m.pcm %s
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 -fmodules-cache-path=%t \
+// RUN:   -I%S/Inputs/private3 -emit-module -fmodule-name=D -o %t/m.pcm %s
+
+module A {
+  header "Inputs/private3/public.h"
+  private header "Inputs/private3/private.h"
+}
+module B {
+  header "Inputs/private3/public.h"
+  module "private.h" {
+private header "Inputs/private3/private.h"
+  }
+}
+module C {
+  module "public.h" {
+header "Inputs/private3/public.h"
+  }
+  private header "Inputs/private3/private.h"
+}
+module D {
+  module "public.h" {
+header "Inputs/private3/public.h"
+  }
+  module "private.h" {
+private header "Inputs/private3/private.h"
+  }
+}
Index: test/Modules/Inputs/private3/public.h
===
--- /dev/null
+++ test/Modules/Inputs/pri

Re: [PATCH] D14353: Allow use of private headers in different sub-modules.

2015-11-04 Thread Manuel Klimek via cfe-commits
klimek marked 2 inline comments as done.
klimek added a comment.

Addressed comments.


http://reviews.llvm.org/D14353



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


[PATCH] D14358: DWARF's forward decl of a template should have template parameters.

2015-11-04 Thread Paul Robinson via cfe-commits
probinson created this revision.
probinson added reviewers: echristo, dblaikie, aprantl.
probinson added a subscriber: cfe-commits.

We were forgetting the template parameters on the forward declaration of a 
template class.


http://reviews.llvm.org/D14358

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGenCXX/debug-info-template-fwd-param.cpp
  test/CodeGenCXX/debug-info-template-member.cpp

Index: test/CodeGenCXX/debug-info-template-member.cpp
===
--- test/CodeGenCXX/debug-info-template-member.cpp
+++ test/CodeGenCXX/debug-info-template-member.cpp
@@ -34,6 +34,13 @@
 // CHECK: [[VIRT_TEMP_PARAM]] = !{[[VIRT_T:![0-9]*]]}
 // CHECK: [[VIRT_T]] = !DITemplateTypeParameter(name: "T", type: !"_ZTS4elem")
 
+// CHECK: [[ELEM:![0-9]*]] = !DICompositeType(tag: DW_TAG_structure_type, 
name: "elem"
+// CHECK-SAME:elements: [[ELEM_MEM:![0-9]*]]
+// CHECK-SAME:identifier: "_ZTS4elem"
+// CHECK: [[ELEM_MEM]] = !{[[ELEM_X:![0-9]*]]}
+// CHECK: [[ELEM_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: 
!"_ZTS4elem"
+// CHECK-SAME:baseType: !"_ZTS4virtI4elemE"
+
 // CHECK: [[C:![0-9]*]] = !DICompositeType(tag: DW_TAG_structure_type, name: 
"MyClass"
 // CHECK-SAME: elements: [[C_MEM:![0-9]*]]
 // CHECK-SAME: vtableHolder: !"_ZTS7MyClass"
@@ -43,13 +50,6 @@
 
 // CHECK: [[C_FUNC]] = !DISubprogram(name: "func",{{.*}} line: 7,
 
-// CHECK: [[ELEM:![0-9]*]] = !DICompositeType(tag: DW_TAG_structure_type, 
name: "elem"
-// CHECK-SAME:elements: [[ELEM_MEM:![0-9]*]]
-// CHECK-SAME:identifier: "_ZTS4elem"
-// CHECK: [[ELEM_MEM]] = !{[[ELEM_X:![0-9]*]]}
-// CHECK: [[ELEM_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: 
!"_ZTS4elem"
-// CHECK-SAME:baseType: !"_ZTS4virtI4elemE"
-
 // Check that the member function template specialization and implicit special
 // members (the default ctor) refer to their class by scope, even though they
 // didn't appear in the class's member list (C_MEM). This prevents the 
functions
Index: test/CodeGenCXX/debug-info-template-fwd-param.cpp
===
--- test/CodeGenCXX/debug-info-template-fwd-param.cpp
+++ test/CodeGenCXX/debug-info-template-fwd-param.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -debug-info-kind=limited 
-emit-llvm -o - | FileCheck %s
+// A forward declaration of a template should still have template parameters.
+
+template class A {
+public:
+  A(T val);
+private:
+  T x;
+};
+
+struct B {
+  A *p;
+};
+
+B b;
+
+// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A"
+// CHECK-SAME: flags: DIFlagFwdDecl
+// CHECK-SAME: templateParams: [[PARAM_LIST:![0-9]*]]
+// CHECK: [[PARAM_LIST]] = !{[[PARAM:![0-9]*]]}
+// CHECK: [[PARAM]] = !DITemplateTypeParameter(name: "T",
+// CHECK-SAME: type: [[CTYPE:![0-9]*]]
+// CHECK: [[CTYPE]] = !DIDerivedType(tag: DW_TAG_const_type
+// CHECK-SAME: baseType: [[BTYPE:![0-9]*]]
+// CHECK: [[BTYPE]] = !DIBasicType(name: "int"
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -702,6 +702,10 @@
   llvm::DICompositeType *RetTy = DBuilder.createReplaceableCompositeType(
   getTagForRecord(RD), RDName, Ctx, DefUnit, Line, 0, Size, Align,
   llvm::DINode::FlagFwdDecl, FullName);
+  if (const ClassTemplateSpecializationDecl *TSpecial =
+  dyn_cast(RD))
+DBuilder.replaceArrays(RetTy, llvm::DINodeArray(),
+   CollectCXXTemplateParams(TSpecial, DefUnit));
   ReplaceMap.emplace_back(
   std::piecewise_construct, std::make_tuple(Ty),
   std::make_tuple(static_cast(RetTy)));


Index: test/CodeGenCXX/debug-info-template-member.cpp
===
--- test/CodeGenCXX/debug-info-template-member.cpp
+++ test/CodeGenCXX/debug-info-template-member.cpp
@@ -34,6 +34,13 @@
 // CHECK: [[VIRT_TEMP_PARAM]] = !{[[VIRT_T:![0-9]*]]}
 // CHECK: [[VIRT_T]] = !DITemplateTypeParameter(name: "T", type: !"_ZTS4elem")
 
+// CHECK: [[ELEM:![0-9]*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "elem"
+// CHECK-SAME:elements: [[ELEM_MEM:![0-9]*]]
+// CHECK-SAME:identifier: "_ZTS4elem"
+// CHECK: [[ELEM_MEM]] = !{[[ELEM_X:![0-9]*]]}
+// CHECK: [[ELEM_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !"_ZTS4elem"
+// CHECK-SAME:baseType: !"_ZTS4virtI4elemE"
+
 // CHECK: [[C:![0-9]*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "MyClass"
 // CHECK-SAME: elements: [[C_MEM:![0-9]*]]
 // CHECK-SAME: vtableHolder

r252107 - Fix nullptr crash in -Wthread-safety-beta

2015-11-04 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Wed Nov  4 18:24:01 2015
New Revision: 252107

URL: http://llvm.org/viewvc/llvm-project?rev=252107&view=rev
Log:
Fix nullptr crash in -Wthread-safety-beta

Modified:
cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp

Modified: cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyCommon.h?rev=252107&r1=252106&r2=252107&view=diff
==
--- cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyCommon.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyCommon.h Wed Nov  4 
18:24:01 2015
@@ -287,7 +287,7 @@ public:
   }
 
   const ValueDecl* valueDecl() const {
-if (Negated)
+if (Negated || CapExpr == nullptr)
   return nullptr;
 if (auto *P = dyn_cast(CapExpr))
   return P->clangDecl();

Modified: cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp?rev=252107&r1=252106&r2=252107&view=diff
==
--- cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp Wed Nov  4 18:24:01 
2015
@@ -5182,3 +5182,10 @@ void test() {
 
 }  // end namespace LockableUnions
 
+// This used to crash.
+class acquired_before_empty_str {
+  void WaitUntilSpaceAvailable() {
+lock_.ReaderLock(); // expected-note {{acquired here}}
+  } // expected-warning {{mutex 'lock_' is still held at the end of function}}
+  Mutex lock_ ACQUIRED_BEFORE("");
+};


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


Re: [PATCH] D14358: DWARF's forward decl of a template should have template parameters.

2015-11-04 Thread Paul Robinson via cfe-commits
probinson added a comment.

In debug-info-template-member.cpp, some things came out in a different order; 
that's the only change there.


http://reviews.llvm.org/D14358



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


  1   2   >