Re: [PATCH] D14919: Fix IssueHash generation

2015-11-25 Thread Orbán György via cfe-commits
I did not create a test checker for the NormalizeLine error in the patch.
Should I add a test checker for this? Do you have any suggestions
where to put it if required?

GetEnclosingDeclContextSignature already checks for nullptr, this
should have been done in the NormalizeLine function also, but in that
case it is not enough because the Lexer needs the LangOpts.


On Tue, Nov 24, 2015 at 5:18 PM, Sean Eveson  wrote:
> seaneveson added a subscriber: seaneveson.
> seaneveson added a comment.
>
>> If the Decl *D pointer is nullptr the NormalizeLine would crash while 
>> getting the LangOptions.
>
>
> Do you have a reproducible test case for this?
>
>
> http://reviews.llvm.org/D14919
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2015-11-25 Thread Strahinja Petrovic via cfe-commits
spetrovic updated the summary for this revision.
spetrovic updated this revision to Diff 41142.
spetrovic marked 4 inline comments as done.

http://reviews.llvm.org/D14871

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

Index: test/CodeGen/ppc-varargs-struct.c
===
--- test/CodeGen/ppc-varargs-struct.c
+++ test/CodeGen/ppc-varargs-struct.c
@@ -39,9 +39,13 @@
 // CHECK-PPC:[[USING_OVERFLOW]]
 // CHECK-PPC-NEXT:  [[OVERFLOW_AREA_P:%[0-9]+]] = getelementptr inbounds 
%struct.__va_list_tag, %struct.__va_list_tag* [[ARRAYDECAY]], i32 0, i32 3
 // CHECK-PPC-NEXT:  [[OVERFLOW_AREA:%.+]] = load i8*, i8** 
[[OVERFLOW_AREA_P]], align 4
-// CHECK-PPC-NEXT:  [[MEMADDR:%.+]] = bitcast i8* [[OVERFLOW_AREA]] to 
%struct.x**
-// CHECK-PPC-NEXT:  [[NEW_OVERFLOW_AREA:%[0-9]+]] = getelementptr inbounds i8, 
i8* [[OVERFLOW_AREA]], i32 4
-// CHECK-PPC-NEXT:  store i8* [[NEW_OVERFLOW_AREA]], i8** [[OVERFLOW_AREA_P]]
+// CHECK-PPC-NEXT:  %{{[0-9]+}} =  ptrtoint i8* %{{[0-9]+}} to i32
+// CHECK-PPC-NEXT:  %{{[0-9]+}} = add i32 %{{[0-9]+}}, 7
+// CHECK-PPC-NEXT:  %{{[0-9]+}} = and i32 %{{[0-9]+}}, -8
+// CHECK-PPC-NEXT:  %overflow_arg_area.align = inttoptr i32 %{{[0-9]+}} to i8*
+// CHECK-PPC-NEXT:  [[MEMADDR:%.+]] = bitcast i8* %overflow_arg_area.align to 
%struct.x**
+// CHECK-PPC-NEXT:  [[NEW_OVERFLOW_AREA:%[0-9]+]] = getelementptr inbounds i8, 
i8* %overflow_arg_area.align, i32 4
+// CHECK-PPC-NEXT:  store i8* [[NEW_OVERFLOW_AREA:%[0-9]+]], i8** 
[[OVERFLOW_AREA_P]], align 4
 // CHECK-PPC-NEXT:  br label %[[CONT]]
 //
 // CHECK-PPC:[[CONT]]
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -223,6 +223,23 @@
   return Addr;
 }
 
+static Address emitRoundPointerUpToAlignment(CodeGenFunction ,
+ llvm::Value *OverflowArgArea,
+ CharUnits Align) {
+  llvm::Value *PtrAsInt = OverflowArgArea;
+  // OverflowArgArea = (OverflowArgArea + Align - 1) & -Align;
+  PtrAsInt = CGF.Builder.CreatePtrToInt(PtrAsInt, CGF.IntPtrTy);
+  PtrAsInt = CGF.Builder.CreateAdd(PtrAsInt,
+llvm::ConstantInt::get(CGF.IntPtrTy, Align.getQuantity() - 1));
+  llvm::Value *Mask = llvm::ConstantInt::get(CGF.Int32Ty,
+ -Align.getQuantity());
+  PtrAsInt = CGF.Builder.CreateAnd(PtrAsInt, Mask);
+  PtrAsInt = CGF.Builder.CreateIntToPtr(PtrAsInt,
+OverflowArgArea->getType(),
+"overflow_arg_area.align");
+  return Address(PtrAsInt, Align);
+}
+
 /// Emit va_arg for a platform using the common void* representation,
 /// where arguments are simply emitted in an array of slots on the stack.
 ///
@@ -3543,9 +3560,14 @@
   Builder.CreateStructGEP(VAList, 3, CharUnits::fromQuantity(4));
 Address OverflowArea(Builder.CreateLoad(OverflowAreaAddr),
  OverflowAreaAlign);
-
-// The current address is the address of the varargs element.
-// FIXME: do we not need to round up to alignment?
+// Round up address of argument to alignment
+llvm::Value *OverflowArgArea = OverflowArea.getPointer();
+CharUnits Align = CGF.getContext().getTypeAlignInChars(Ty);
+if (Align > OverflowAreaAlign) {
+  OverflowArea = emitRoundPointerUpToAlignment(CGF, OverflowArgArea,
+   Align);
+}
+ 
 MemAddr = Builder.CreateElementBitCast(OverflowArea, DirectTy);
 
 // Increase the overflow area.


Index: test/CodeGen/ppc-varargs-struct.c
===
--- test/CodeGen/ppc-varargs-struct.c
+++ test/CodeGen/ppc-varargs-struct.c
@@ -39,9 +39,13 @@
 // CHECK-PPC:[[USING_OVERFLOW]]
 // CHECK-PPC-NEXT:  [[OVERFLOW_AREA_P:%[0-9]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* [[ARRAYDECAY]], i32 0, i32 3
 // CHECK-PPC-NEXT:  [[OVERFLOW_AREA:%.+]] = load i8*, i8** [[OVERFLOW_AREA_P]], align 4
-// CHECK-PPC-NEXT:  [[MEMADDR:%.+]] = bitcast i8* [[OVERFLOW_AREA]] to %struct.x**
-// CHECK-PPC-NEXT:  [[NEW_OVERFLOW_AREA:%[0-9]+]] = getelementptr inbounds i8, i8* [[OVERFLOW_AREA]], i32 4
-// CHECK-PPC-NEXT:  store i8* [[NEW_OVERFLOW_AREA]], i8** [[OVERFLOW_AREA_P]]
+// CHECK-PPC-NEXT:  %{{[0-9]+}} =  ptrtoint i8* %{{[0-9]+}} to i32
+// CHECK-PPC-NEXT:  %{{[0-9]+}} = add i32 %{{[0-9]+}}, 7
+// CHECK-PPC-NEXT:  %{{[0-9]+}} = and i32 %{{[0-9]+}}, -8
+// CHECK-PPC-NEXT:  %overflow_arg_area.align = inttoptr i32 %{{[0-9]+}} to i8*
+// CHECK-PPC-NEXT:  [[MEMADDR:%.+]] = bitcast i8* %overflow_arg_area.align to %struct.x**
+// CHECK-PPC-NEXT:  [[NEW_OVERFLOW_AREA:%[0-9]+]] = getelementptr inbounds i8, i8* %overflow_arg_area.align, i32 4
+// CHECK-PPC-NEXT:  store i8* [[NEW_OVERFLOW_AREA:%[0-9]+]], i8** 

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

2015-11-25 Thread David Blaikie via cfe-commits
Guessing this or one of the related patches introduced this build breakage?
I haven't looked at it too carefully yet...

http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/26570/steps/compile/logs/stdio

On Mon, Nov 23, 2015 at 11:13 PM, Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

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


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

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

If you are going to make unit tests, consider alternative approach also. In 
repository `test-suite` the directory `SingleSource/UnitTests` contains runtime 
tests obtained from single file. You could modify Makefile that runs these 
tests in such a way that each test runs twice, one as now it runs and the other 
would run through the sequence `compile to ast` - `compile empty source with 
with ast-import`. Tests for missing nodes could be added into 
`SingleSource/UnitTests`, they would be substantially simpler that those using 
ASTMatchers. More importantly, such tests would make indeed exhaustive testing 
of importer.


http://reviews.llvm.org/D14286



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


Re: [PATCH] D6370: Disable frame pointer elimination when -pg is used

2015-11-25 Thread Sanjay Patel via cfe-commits
spatel added a subscriber: spatel.
spatel added a comment.

Abandon patch?
http://reviews.llvm.org/D14215
http://reviews.llvm.org/rL253886


http://reviews.llvm.org/D6370



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


[clang-tools-extra] r254074 - [clang-tidy] Fix a typo in my latest commit.

2015-11-25 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Nov 25 10:38:22 2015
New Revision: 254074

URL: http://llvm.org/viewvc/llvm-project?rev=254074=rev
Log:
[clang-tidy] Fix a typo in my latest commit.

Modified:
clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp?rev=254074=254073=254074=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstantArgumentCheck.cpp Wed 
Nov 25 10:38:22 2015
@@ -60,8 +60,8 @@ void MoveConstantArgumentCheck::check(co
 SM, getLangOpts());
 
 if (BeforeArgumentsRange.isValid() && AfterArgumentsRange.isValid()) {
-  DB << FixItHint::CreateRemoval(BeforeArgumentsRange)
- << FixItHint::CreateRemoval(AfterArgumentsRange);
+  Diag << FixItHint::CreateRemoval(BeforeArgumentsRange)
+   << FixItHint::CreateRemoval(AfterArgumentsRange);
 }
   }
 }


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


Re: [libcxx] r254050 - Silence a -Wmissing-braces warning in the tests; mbstate_t is defined differently on different C libraries.

2015-11-25 Thread David Blaikie via cfe-commits
Is {} not portable in some way?
On Nov 25, 2015 5:58 AM, "Joerg Sonnenberger via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

> On Tue, Nov 24, 2015 at 05:38:23PM -0800, David Blaikie via cfe-commits
> wrote:
> > Could this initialization just be written as "mbstate_t mb = {}" & avoid
> > the warning entirely (I'm not entirely sure what the warning was, but I
> > imagine that'd avoid it)
>
> Or even better, just use the portable memset(, 0, sizeof(mb)).
>
> Joerg
> ___
> 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


r254117 - Driver: protect from empty -L args

2015-11-25 Thread Martell Malone via cfe-commits
Author: martell
Date: Wed Nov 25 19:02:07 2015
New Revision: 254117

URL: http://llvm.org/viewvc/llvm-project?rev=254117=rev
Log:
Driver: protect from empty -L args

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

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

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=254117=254116=254117=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Wed Nov 25 19:02:07 2015
@@ -619,7 +619,8 @@ void ToolChain::AddCXXStdlibLibArgs(cons
 void ToolChain::AddFilePathLibArgs(const ArgList ,
ArgStringList ) const {
   for (const auto  : getFilePaths())
-CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+if(LibPath.length() > 0)
+  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
 }
 
 void ToolChain::AddCCKextLibArgs(const ArgList ,


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


Re: [PATCH] D13980: Add "x87" in x86 target feature map

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


Comment at: lib/Basic/Targets.cpp:2548
@@ +2547,3 @@
+  // All X86 processors but i386 have X87.
+  if (Kind != CK_i386)
+setFeatureEnabledImpl(Features, "x87", true);

What about `CK_Generic`? Also, if `CK_i486` can be used for the 486SX, we need 
to exclude it here too. It looks (from wikipedia) like all the "WinChip" 
flavours of 486 have an x87 unit, but it'd be nice if someone could confirm 
that. Maybe we should have separate `CPUKind`s for 486 SX versus 486 DX.


http://reviews.llvm.org/D13980



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


LLVM buildmaster will be restarted tonight

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

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

Thanks

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


[PATCH] Don't crash when dumping objc_bridge_related attributes

2015-11-25 Thread Joe Ranieri via cfe-commits
Clang's AST dumping currently crashes when dumping objc_bridge_related
attributes where the class method and instance method fields are left
empty. The attached patch marks the two arguments as optional and
updates TableGen to understand the optional flag for identifier
attribute arguments when generating the dump function.

-- Joe Ranieri
Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td (revision 254076)
+++ include/clang/Basic/Attr.td (working copy)
@@ -1071,8 +1071,8 @@
   let Spellings = [GNU<"objc_bridge_related">];
   let Subjects = SubjectList<[Record], ErrorDiag>;
   let Args = [IdentifierArgument<"RelatedClass">,
-  IdentifierArgument<"ClassMethod">,
-  IdentifierArgument<"InstanceMethod">];
+  IdentifierArgument<"ClassMethod", 1>,
+  IdentifierArgument<"InstanceMethod", 1>];
   let HasCustomParsing = 1;
   let Documentation = [Undocumented];
 }
Index: test/Misc/ast-dump-attr.cpp
===
--- test/Misc/ast-dump-attr.cpp (revision 254076)
+++ test/Misc/ast-dump-attr.cpp (working copy)
@@ -150,3 +150,7 @@
   // CHECK: DeprecatedAttr
 }
 }
+
+struct __attribute__((objc_bridge_related(NSParagraphStyle,,))) TestBridgedRef;
+// CHECK: CXXRecordDecl{{.*}} struct TestBridgedRef
+// CHECK-NEXT: ObjCBridgeRelatedAttr{{.*}} NSParagraphStyle
Index: utils/TableGen/ClangAttrEmitter.cpp
===
--- utils/TableGen/ClangAttrEmitter.cpp (revision 254076)
+++ utils/TableGen/ClangAttrEmitter.cpp (working copy)
@@ -279,6 +279,8 @@
 OS << "OS << \" \";\n";
 OS << "dumpBareDeclRef(SA->get" << getUpperName() << "());\n"; 
   } else if (type == "IdentifierInfo *") {
+if (isOptional())
+  OS << "if (SA->get" << getUpperName() << "())\n  ";
 OS << "OS << \" \" << SA->get" << getUpperName()
<< "()->getName();\n";
   } else if (type == "TypeSourceInfo *") {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r254107 - [analyzer] Include block capture copy expressions in the CFG.

2015-11-25 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Wed Nov 25 16:35:37 2015
New Revision: 254107

URL: http://llvm.org/viewvc/llvm-project?rev=254107=rev
Log:
[analyzer] Include block capture copy expressions in the CFG.

This prevents spurious dead store warnings when a C++ lambda is casted to a 
block.

I've also added several tests documenting our still-incomplete support for 
lambda-to-block
casts.

rdar://problem/22236293

Added:
cfe/trunk/test/Analysis/blocks.mm
Modified:
cfe/trunk/lib/Analysis/CFG.cpp
cfe/trunk/test/Analysis/lambdas.mm

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=254107=254106=254107=diff
==
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Wed Nov 25 16:35:37 2015
@@ -460,6 +460,7 @@ private:
   CFGBlock *VisitImplicitCastExpr(ImplicitCastExpr *E, AddStmtChoice asc);
   CFGBlock *VisitIndirectGotoStmt(IndirectGotoStmt *I);
   CFGBlock *VisitLabelStmt(LabelStmt *L);
+  CFGBlock *VisitBlockExpr(BlockExpr *E, AddStmtChoice asc);
   CFGBlock *VisitLambdaExpr(LambdaExpr *E, AddStmtChoice asc);
   CFGBlock *VisitLogicalOperator(BinaryOperator *B);
   std::pair VisitLogicalOperator(BinaryOperator *B,
@@ -1453,7 +1454,7 @@ CFGBlock *CFGBuilder::Visit(Stmt * S, Ad
   return VisitBinaryOperator(cast(S), asc);
 
 case Stmt::BlockExprClass:
-  return VisitNoRecurse(cast(S), asc);
+  return VisitBlockExpr(cast(S), asc);
 
 case Stmt::BreakStmtClass:
   return VisitBreakStmt(cast(S));
@@ -2333,6 +2334,18 @@ CFGBlock *CFGBuilder::VisitLabelStmt(Lab
   return LabelBlock;
 }
 
+CFGBlock *CFGBuilder::VisitBlockExpr(BlockExpr *E, AddStmtChoice asc) {
+  CFGBlock *LastBlock = VisitNoRecurse(E, asc);
+  for (const BlockDecl::Capture  : E->getBlockDecl()->captures()) {
+if (Expr *CopyExpr = CI.getCopyExpr()) {
+  CFGBlock *Tmp = Visit(CopyExpr);
+  if (Tmp)
+LastBlock = Tmp;
+}
+  }
+  return LastBlock;
+}
+
 CFGBlock *CFGBuilder::VisitLambdaExpr(LambdaExpr *E, AddStmtChoice asc) {
   CFGBlock *LastBlock = VisitNoRecurse(E, asc);
   for (LambdaExpr::capture_init_iterator it = E->capture_init_begin(),

Added: cfe/trunk/test/Analysis/blocks.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/blocks.mm?rev=254107=auto
==
--- cfe/trunk/test/Analysis/blocks.mm (added)
+++ cfe/trunk/test/Analysis/blocks.mm Wed Nov 25 16:35:37 2015
@@ -0,0 +1,75 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze 
-analyzer-checker=core -fblocks -analyzer-opt-analyze-nested-blocks -verify -x 
objective-c++ %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -analyze 
-analyzer-checker=core,debug.DumpCFG -fblocks 
-analyzer-opt-analyze-nested-blocks  %s > %t 2>&1
+// RUN: FileCheck --input-file=%t %s
+
+// expected-no-diagnostics
+
+void testBlockWithoutCopyExpression(int i) {
+  // Captures i, with no copy expression.
+  (void)(^void() {
+(void)i;
+  });
+}
+
+// CHECK-LABEL:void testBlockWithoutCopyExpression(int i)
+// CHECK-NEXT: [B2 (ENTRY)]
+// CHECK-NEXT:   Succs (1): B1
+
+// CHECK: [B1]
+// CHECK-NEXT:   1: ^{ }
+// CHECK-NEXT:   2: (void)([B1.1]) (CStyleCastExpr, ToVoid, void)
+// CHECK-NEXT:   Preds (1): B2
+// CHECK-NEXT:   Succs (1): B0
+
+// CHECK: [B0 (EXIT)]
+// CHECK-NEXT:   Preds (1): B1
+
+struct StructWithCopyConstructor {
+  StructWithCopyConstructor(int i);
+  StructWithCopyConstructor(const StructWithCopyConstructor );
+};
+void testBlockWithCopyExpression(StructWithCopyConstructor s) {
+  // Captures s, with a copy expression calling the copy constructor for 
StructWithCopyConstructor.
+  (void)(^void() {
+(void)s;
+  });
+}
+
+// CHECK-LABEL:void testBlockWithCopyExpression(StructWithCopyConstructor s)
+// CHECK-NEXT: [B2 (ENTRY)]
+// CHECK-NEXT:   Succs (1): B1
+
+// CHECK: [B1]
+// CHECK-NEXT:   1: s
+// CHECK-NEXT:   2: [B1.1] (CXXConstructExpr, const struct 
StructWithCopyConstructor)
+// CHECK-NEXT:   3: ^{ }
+// CHECK-NEXT:   4: (void)([B1.3]) (CStyleCastExpr, ToVoid, void)
+// CHECK-NEXT:   Preds (1): B2
+// CHECK-NEXT:   Succs (1): B0
+
+// CHECK: [B0 (EXIT)]
+// CHECK-NEXT:   Preds (1): B1
+
+void testBlockWithCaptureByReference() {
+  __block StructWithCopyConstructor s(5);
+  // Captures s by reference, so no copy expression.
+  (void)(^void() {
+(void)s;
+  });
+}
+
+// CHECK-LABEL:void testBlockWithCaptureByReference()
+// CHECK-NEXT: [B2 (ENTRY)]
+// CHECK-NEXT:   Succs (1): B1
+
+// CHECK: [B1]
+// CHECK-NEXT:   1: 5
+// CHECK-NEXT:   2: [B1.1] (CXXConstructExpr, struct StructWithCopyConstructor)
+// CHECK-NEXT:   3: StructWithCopyConstructor s(5) 
__attribute__((blocks("byref")));
+// CHECK-NEXT:   4: ^{ }
+// CHECK-NEXT:   5: (void)([B1.4]) (CStyleCastExpr, ToVoid, void)
+// CHECK-NEXT:   Preds (1): B2
+// CHECK-NEXT:   Succs (1): B0
+
+// CHECK: [B0 (EXIT)]
+// 

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

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


Comment at: lib/CodeGen/TargetInfo.cpp:241
@@ +240,3 @@
+  return Address(PtrAsInt, Align);
+}
+

Thank you for extracting this.

First, this function deserves a doc comment now; I would suggest:

  /// Dynamically round a pointer up to a multiple of the given alignment.

Also, this is now generically useful, so (1) please rename OverflowArgArea to 
something more generic, like Ptr, and (2) please use LLVM value names based on 
the name already in Ptr.  That is, instead of "overflow_arg_area.align", please 
use
  Ptr->getName () + ".aligned"

Finally, please look for the other places in this file that you could change to 
use this new function.  There's one in emitVoidPtrDirectVAArg, and there are 
several other in other targets.


Comment at: lib/CodeGen/TargetInfo.cpp:3568
@@ +3567,3 @@
+  OverflowArea = emitRoundPointerUpToAlignment(CGF, OverflowArgArea,
+   Align);
+}

Please sink OverflowArgArea into the if block, since you don't need it outside.


http://reviews.llvm.org/D14871



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


r254122 - P0002R1: increment on expressions of type bool is no longer allowed in C++1z.

2015-11-25 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Nov 25 20:16:37 2015
New Revision: 254122

URL: http://llvm.org/viewvc/llvm-project?rev=254122=rev
Log:
P0002R1: increment on expressions of type bool is no longer allowed in C++1z.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/CXX/drs/dr1xx.cpp
cfe/trunk/test/SemaCXX/deprecated.cpp
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=254122=254121=254122=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed Nov 25 20:16:37 2015
@@ -187,7 +187,8 @@ def CXX14Compat : DiagGroup<"c++14-compa
 def CXX14CompatPedantic : DiagGroup<"c++14-compat-pedantic",
 [CXXPre1zCompatPedantic]>;
 
-def CXX1zCompat : DiagGroup<"c++1z-compat", [DeprecatedRegister]>;
+def CXX1zCompat : DiagGroup<"c++1z-compat", [DeprecatedRegister,
+ DeprecatedIncrementBool]>;
 
 def : DiagGroup<"effc++">;
 def DivZero : DiagGroup<"division-by-zero">;
@@ -204,6 +205,7 @@ def DanglingElse: DiagGroup<"dangling-el
 def DanglingField : DiagGroup<"dangling-field">;
 def DistributedObjectModifiers : DiagGroup<"distributed-object-modifiers">;
 def FlagEnum : DiagGroup<"flag-enum">;
+def IncrementBool : DiagGroup<"increment-bool", [DeprecatedIncrementBool]>;
 def InfiniteRecursion : DiagGroup<"infinite-recursion">;
 def GNUImaginaryConstant : DiagGroup<"gnu-imaginary-constant">;
 def IgnoredQualifiers : DiagGroup<"ignored-qualifiers">;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=254122=254121=254122=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov 25 20:16:37 
2015
@@ -5727,8 +5727,11 @@ def note_member_declared_here : Note<
   "member %0 declared here">;
 def err_decrement_bool : Error<"cannot decrement expression of type bool">;
 def warn_increment_bool : Warning<
-  "incrementing expression of type bool is deprecated">,
-  InGroup;
+  "incrementing expression of type bool is deprecated and "
+  "incompatible with C++1z">, InGroup;
+def ext_increment_bool : ExtWarn<
+  "ISO C++1z does not allow incrementing expression of type bool">,
+  DefaultError, InGroup;
 def err_increment_decrement_enum : Error<
   "cannot %select{decrement|increment}0 expression of enum type %1">;
 def err_catch_incomplete_ptr : Error<

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=254122=254121=254122=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Nov 25 20:16:37 2015
@@ -9680,7 +9680,9 @@ static QualType CheckIncrementDecrementO
   return QualType();
 }
 // Increment of bool sets it to true, but is deprecated.
-S.Diag(OpLoc, diag::warn_increment_bool) << Op->getSourceRange();
+S.Diag(OpLoc, S.getLangOpts().CPlusPlus1z ? diag::ext_increment_bool
+  : diag::warn_increment_bool)
+  << Op->getSourceRange();
   } else if (S.getLangOpts().CPlusPlus && ResType->isEnumeralType()) {
 // Error on enum increments and decrements in C++ mode
 S.Diag(OpLoc, diag::err_increment_decrement_enum) << IsInc << ResType;

Modified: cfe/trunk/test/CXX/drs/dr1xx.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr1xx.cpp?rev=254122=254121=254122=diff
==
--- cfe/trunk/test/CXX/drs/dr1xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr1xx.cpp Wed Nov 25 20:16:37 2015
@@ -524,8 +524,13 @@ namespace dr143 { // dr143: yes
 
 namespace dr145 { // dr145: yes
   void f(bool b) {
+#if __cplusplus <= 201402L
 ++b; // expected-warning {{deprecated}}
 b++; // expected-warning {{deprecated}}
+#else
+++b; // expected-error {{increment}}
+b++; // expected-error {{increment}}
+#endif
   }
 }
 

Modified: cfe/trunk/test/SemaCXX/deprecated.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/deprecated.cpp?rev=254122=254121=254122=diff
==
--- cfe/trunk/test/SemaCXX/deprecated.cpp (original)
+++ cfe/trunk/test/SemaCXX/deprecated.cpp Wed Nov 25 20:16:37 2015
@@ -28,7 +28,19 @@ void stuff() {
 
   int k = to_int(n); // no-warning
   bool b;
-  ++b; // 

Re: [PATCH] D12466: Fix empty -L Path on OSX hosts

2015-11-25 Thread Martell Malone via cfe-commits
martell added a comment.

> Is this testable?


Seems to me the only way to add this as a test would be to add bad code to 
clang to purposely pass an empty LibPath argument.
This is probably something we do not want to do.

This is probably why Reid never asked me for one in the review.


Repository:
  rL LLVM

http://reviews.llvm.org/D12466



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


[PATCH] D15005: Fix PR8170: Clang does not check constructor declaration that uses a template-id

2015-11-25 Thread Faisal Vali via cfe-commits
faisalv created this revision.
faisalv added a reviewer: rsmith.
faisalv added a subscriber: cfe-commits.

Clang currently does no real checking of the template argument list when a 
template-id is used to declare a constructor:

template struct X {
  X(); // Clang erroneously accepts this.
};

Both gcc and edg emit an error on the above code (though one could claim the 
spec temp.local p1 is perhaps not as explicit as it could be in this regard)

See: https://llvm.org/bugs/show_bug.cgi?id=8170



http://reviews.llvm.org/D15005

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Parse/Parser.h
  include/clang/Sema/Sema.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseExprCXX.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaTemplate.cpp
  test/CXX/temp/temp.res/temp.local/p1.cpp

Index: test/CXX/temp/temp.res/temp.local/p1.cpp
===
--- test/CXX/temp/temp.res/temp.local/p1.cpp
+++ test/CXX/temp/temp.res/temp.local/p1.cpp
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
-// expected-no-diagnostics
+
 
 // C++0x [temp.local]p1:
 //   Like normal (non-template) classes, class templates have an
@@ -11,12 +11,15 @@
 template  struct X0 {
   X0();
   ~X0();
+  X0(int); 
+  X0(int*); //expected-error{{expected 'X0' or 'X0'}}
   X0 f(const X0&);
 };
 
 // Test non-type template parameters.
 template  struct X1 {
   X1();
+  template X1(char); //expected-error{{expected 'X1' or 'X1'}}
   ~X1();
   X1 f(const X1& x1a) { X1 x1b(x1a); return x1b; }
 };
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -518,6 +518,65 @@
   llvm_unreachable("Unhandled parsed template argument");
 }
 
+std::string
+Sema::stringifyTemplateArguments(const TemplateSpecializationType *TST) {
+  ArrayRef TemplateArgs(TST->getArgs(), TST->getNumArgs());
+
+  llvm::SmallString<256> StringifiedTemplateArgs;
+  std::for_each(TemplateArgs.begin(), TemplateArgs.end(),
+[, this](const TemplateArgument ) {
+if (const bool IsFirst = !StringifiedTemplateArgs.size())
+  StringifiedTemplateArgs = "<";
+else
+  StringifiedTemplateArgs += ",";
+llvm::raw_svector_ostream OS(StringifiedTemplateArgs);
+TA.print(this->getPrintingPolicy(), OS);
+  });
+
+  StringifiedTemplateArgs += ">";
+  return StringifiedTemplateArgs.c_str();
+}
+
+void Sema::checkUnqualifiedTemplateIdIsConstructor(
+TemplateIdAnnotation *TemplateId, const CXXRecordDecl *TemplatedClass) {
+  assert(TemplatedClass->getDescribedClassTemplate());
+  assert(TemplateId->Name == TemplatedClass->getIdentifier() &&
+ "TemplateId must have the same identifier as that of the class!");
+
+  // Get the type that corresponds to this template id, while suppressing all
+  // diagnostics.
+  const bool PrevSuppress = Diags.getSuppressAllDiagnostics();
+  Diags.setSuppressAllDiagnostics(true);
+  TypeResult TemplateIdTy = ActOnTemplateIdType(
+  TemplateId->SS, TemplateId->TemplateKWLoc,
+  TemplateTy::make(
+  TemplateName(TemplatedClass->getDescribedClassTemplate())),
+  TemplateId->TemplateNameLoc, TemplateId->LAngleLoc,
+  ASTTemplateArgsPtr(TemplateId->getTemplateArgs(), TemplateId->NumArgs),
+  TemplateId->RAngleLoc, /*IsCtorOrDtorName*/ true);
+  Diags.setSuppressAllDiagnostics(PrevSuppress);
+
+  // If the template-id type is the same type as the type of the
+  // templated-class, all is ok - else emit a diagnostic.
+  if (TemplateIdTy.get() &&
+  Context.hasSameType(GetTypeFromParser(TemplateIdTy.get()).getTypePtr(),
+  Context.getTypeDeclType(TemplatedClass).getTypePtr()))
+return;
+
+  // Emit a diagnostic, indicating that the template arguments do not match up
+  // to the injected class name.
+  std::string ExpectedTemplateId = TemplateId->Name->getName();
+  ExpectedTemplateId += stringifyTemplateArguments(
+  cast(Context.getTypeDeclType(TemplatedClass))
+  ->getInjectedTST());
+
+  Diag(TemplateId->TemplateNameLoc,
+   diag::err_expected_constructor_template_id)
+  << TemplateId->Name << ExpectedTemplateId.c_str()
+  << FixItHint::CreateRemoval(
+ SourceRange(TemplateId->LAngleLoc, TemplateId->RAngleLoc));
+}
+
 /// \brief Translates template arguments as provided by the parser
 /// into template arguments used by semantic analysis.
 void Sema::translateTemplateArguments(const ASTTemplateArgsPtr ,
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -1270,18 +1270,23 @@
 /// nested classes, this will only return true if II is the name of
 /// the innermost class.
 bool Sema::isCurrentClassName(const IdentifierInfo , Scope *,
-  const CXXScopeSpec *SS) {
+  

r254121 - [modules] Refactor handling of -fmodules-embed-*. Track this properly rather

2015-11-25 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Nov 25 20:04:16 2015
New Revision: 254121

URL: http://llvm.org/viewvc/llvm-project?rev=254121=rev
Log:
[modules] Refactor handling of -fmodules-embed-*. Track this properly rather
than reusing the "overridden buffer" mechanism. This will allow us to make
embedded files and overridden files behave differently in future.

Modified:
cfe/trunk/include/clang/Basic/SourceManager.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/lib/Basic/FileManager.cpp
cfe/trunk/lib/Basic/SourceManager.cpp
cfe/trunk/lib/Frontend/FrontendActions.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=254121=254120=254121=diff
==
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Wed Nov 25 20:04:16 2015
@@ -122,7 +122,7 @@ namespace SrcMgr {
 /// \brief The number of lines in this ContentCache.
 ///
 /// This is only valid if SourceLineCache is non-null.
-unsigned NumLines : 31;
+unsigned NumLines;
 
 /// \brief Indicates whether the buffer itself was provided to override
 /// the actual file contents.
@@ -135,12 +135,17 @@ namespace SrcMgr {
 /// file considered as a system one.
 unsigned IsSystemFile : 1;
 
+/// \brief True if this file may be transient, that is, if it might not
+/// exist at some later point in time when this content entry is used,
+/// after serialization and deserialization.
+unsigned IsTransient : 1;
+
 ContentCache(const FileEntry *Ent = nullptr) : ContentCache(Ent, Ent) {}
 
 ContentCache(const FileEntry *Ent, const FileEntry *contentEnt)
   : Buffer(nullptr, false), OrigEntry(Ent), ContentsEntry(contentEnt),
 SourceLineCache(nullptr), NumLines(0), BufferOverridden(false),
-IsSystemFile(false) {}
+IsSystemFile(false), IsTransient(false) {}
 
 ~ContentCache();
 
@@ -149,7 +154,7 @@ namespace SrcMgr {
 /// is not transferred, so this is a logical error.
 ContentCache(const ContentCache )
   : Buffer(nullptr, false), SourceLineCache(nullptr),
-BufferOverridden(false), IsSystemFile(false) {
+BufferOverridden(false), IsSystemFile(false), IsTransient(false) {
   OrigEntry = RHS.OrigEntry;
   ContentsEntry = RHS.ContentsEntry;
 
@@ -862,17 +867,13 @@ public:
   /// This should be called before parsing has begun.
   void disableFileContentsOverride(const FileEntry *File);
 
-  /// \brief Request that the contents of the given source file are written
-  /// to a created module file if they are used in this compilation. This
-  /// removes the requirement that the file still exist when the module is used
-  /// (but does not make the file visible to header search and the like when
-  /// the module is used).
-  void embedFileContentsInModule(const FileEntry *SourceFile);
-
-  /// \brief Request that all files that are read during this compilation be
-  /// written to any created module file.
-  void setEmbedAllFileContentsInModule(bool Embed) {
-FilesAreTransient = Embed;
+  /// \brief Specify that a file is transient.
+  void setFileIsTransient(const FileEntry *SourceFile);
+
+  /// \brief Specify that all files that are read during this compilation are
+  /// transient.
+  void setAllFilesAreTransient(bool Transient) {
+FilesAreTransient = Transient;
   }
 
   
//======//

Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=254121=254120=254121=diff
==
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Wed Nov 25 20:04:16 2015
@@ -1058,6 +1058,7 @@ private:
 off_t StoredSize;
 time_t StoredTime;
 bool Overridden;
+bool Transient;
   };
 
   /// \brief Reads the stored information about an input file.

Modified: cfe/trunk/lib/Basic/FileManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=254121=254120=254121=diff
==
--- cfe/trunk/lib/Basic/FileManager.cpp (original)
+++ cfe/trunk/lib/Basic/FileManager.cpp Wed Nov 25 20:04:16 2015
@@ -137,7 +137,7 @@ void FileManager::addAncestorsAsVirtualD
   // at the same time.  Therefore, if DirName is already in the cache,
   // we don't need to recurse as its ancestors must also already be in
   // the cache.
-  if (NamedDirEnt.second)
+  if (NamedDirEnt.second && NamedDirEnt.second != NON_EXISTENT_DIR)
 return;
 

r254123 - Update reference to final TM TS spec.

2015-11-25 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Nov 25 20:23:21 2015
New Revision: 254123

URL: http://llvm.org/viewvc/llvm-project?rev=254123=rev
Log:
Update reference to final TM TS spec.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=254123=254122=254123=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Wed Nov 25 20:23:21 2015
@@ -679,7 +679,7 @@ Clang version they became available:
 
 
   [TS] Transactional Memory
-  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4302.pdf;>N4302
+  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4514.pdf;>N4514
   No
 
 


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


Re: [PATCH] D12466: Fix empty -L Path on OSX hosts

2015-11-25 Thread Martell Malone via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL254117: Driver: protect from empty -L args (authored by 
martell).

Changed prior to commit:
  http://reviews.llvm.org/D12466?vs=33510=41202#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12466

Files:
  cfe/trunk/lib/Driver/ToolChain.cpp

Index: cfe/trunk/lib/Driver/ToolChain.cpp
===
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -619,7 +619,8 @@
 void ToolChain::AddFilePathLibArgs(const ArgList ,
ArgStringList ) const {
   for (const auto  : getFilePaths())
-CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+if(LibPath.length() > 0)
+  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
 }
 
 void ToolChain::AddCCKextLibArgs(const ArgList ,


Index: cfe/trunk/lib/Driver/ToolChain.cpp
===
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -619,7 +619,8 @@
 void ToolChain::AddFilePathLibArgs(const ArgList ,
ArgStringList ) const {
   for (const auto  : getFilePaths())
-CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+if(LibPath.length() > 0)
+  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
 }
 
 void ToolChain::AddCCKextLibArgs(const ArgList ,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12466: Fix empty -L Path on OSX hosts

2015-11-25 Thread David Blaikie via cfe-commits
Is this testable?
On Nov 25, 2015 5:56 PM, "Martell Malone via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL254117: Driver: protect from empty -L args (authored by
> martell).
>
> Changed prior to commit:
>   http://reviews.llvm.org/D12466?vs=33510=41202#toc
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D12466
>
> Files:
>   cfe/trunk/lib/Driver/ToolChain.cpp
>
> Index: cfe/trunk/lib/Driver/ToolChain.cpp
> ===
> --- cfe/trunk/lib/Driver/ToolChain.cpp
> +++ cfe/trunk/lib/Driver/ToolChain.cpp
> @@ -619,7 +619,8 @@
>  void ToolChain::AddFilePathLibArgs(const ArgList ,
> ArgStringList ) const {
>for (const auto  : getFilePaths())
> -CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
> +if(LibPath.length() > 0)
> +  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
>  }
>
>  void ToolChain::AddCCKextLibArgs(const ArgList ,
>
>
>
> ___
> 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] D12466: Fix empty -L Path on OSX hosts

2015-11-25 Thread David Blaikie via cfe-commits
dblaikie added a subscriber: dblaikie.
dblaikie added a comment.

Is this testable?


Repository:
  rL LLVM

http://reviews.llvm.org/D12466



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


Re: [PATCH] D14964: [clang-tidy] Fix problem with parallel configure build

2015-11-25 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL254081: Fix problem with Clang-tidy parallel configure 
build. (authored by eugenezelenko).

Changed prior to commit:
  http://reviews.llvm.org/D14964?vs=41076=41160#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14964

Files:
  clang-tools-extra/trunk/clang-tidy/tool/Makefile

Index: clang-tools-extra/trunk/clang-tidy/tool/Makefile
===
--- clang-tools-extra/trunk/clang-tidy/tool/Makefile
+++ clang-tools-extra/trunk/clang-tidy/tool/Makefile
@@ -39,10 +39,10 @@
$(Echo) Making install directory: $@
$(Verb) $(MKDIR) $@
 
-$(DESTFILES): $(SRCFILES)
+$(DESTFILES): $(SRCFILES) $(PROJ_sharedir)
 
 $(PROJ_sharedir)/%.py: $(PROJ_SRC_DIR)/%.py
$(Echo) Installing script file: $(notdir $<)
$(Verb) $(ScriptInstall) $< $(PROJ_sharedir)
 
-install-local:: $(PROJ_sharedir) $(DESTFILES)
+install-local:: $(DESTFILES)


Index: clang-tools-extra/trunk/clang-tidy/tool/Makefile
===
--- clang-tools-extra/trunk/clang-tidy/tool/Makefile
+++ clang-tools-extra/trunk/clang-tidy/tool/Makefile
@@ -39,10 +39,10 @@
 	$(Echo) Making install directory: $@
 	$(Verb) $(MKDIR) $@
 
-$(DESTFILES): $(SRCFILES)
+$(DESTFILES): $(SRCFILES) $(PROJ_sharedir)
 
 $(PROJ_sharedir)/%.py: $(PROJ_SRC_DIR)/%.py
 	$(Echo) Installing script file: $(notdir $<)
 	$(Verb) $(ScriptInstall) $< $(PROJ_sharedir)
 
-install-local:: $(PROJ_sharedir) $(DESTFILES)
+install-local:: $(DESTFILES)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r254081 - Fix problem with Clang-tidy parallel configure build.

2015-11-25 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Wed Nov 25 13:16:34 2015
New Revision: 254081

URL: http://llvm.org/viewvc/llvm-project?rev=254081=rev
Log:
Fix problem with Clang-tidy parallel configure build.

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

Modified:
clang-tools-extra/trunk/clang-tidy/tool/Makefile

Modified: clang-tools-extra/trunk/clang-tidy/tool/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/Makefile?rev=254081=254080=254081=diff
==
--- clang-tools-extra/trunk/clang-tidy/tool/Makefile (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/Makefile Wed Nov 25 13:16:34 2015
@@ -39,10 +39,10 @@ $(PROJ_sharedir):
$(Echo) Making install directory: $@
$(Verb) $(MKDIR) $@
 
-$(DESTFILES): $(SRCFILES)
+$(DESTFILES): $(SRCFILES) $(PROJ_sharedir)
 
 $(PROJ_sharedir)/%.py: $(PROJ_SRC_DIR)/%.py
$(Echo) Installing script file: $(notdir $<)
$(Verb) $(ScriptInstall) $< $(PROJ_sharedir)
 
-install-local:: $(PROJ_sharedir) $(DESTFILES)
+install-local:: $(DESTFILES)


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


Re: [PATCH] D14982: ARM v8.1a adds Advanced SIMD instructions for Rounding Double Multiply Add/Subtract.

2015-11-25 Thread Tim Northover via cfe-commits
t.p.northover added a subscriber: t.p.northover.
t.p.northover added a comment.

Do these get the right diagnostics when used on CPUs without the new feature? I 
can't see how __ARM_FEATURE_QRDMX gets wired through to arm_neon.h.


http://reviews.llvm.org/D14982



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


Re: [PATCH] D13126: New static analyzer checker for loss of sign/precision

2015-11-25 Thread Artem Dergachev via cfe-commits
NoQ added a subscriber: NoQ.
NoQ added a comment.

In http://reviews.llvm.org/D13126#291763, @danielmarjamaki wrote:

> I have problems with the "default" handling of expressions.
>
> I want to warn about loss of precision for such code:
>
>   unsigned int x = 256;
>   unsigned char c;
>   c = x;
>   
>
> The analyser tells me that the RHS value is 0 instead of 256 in the 
> assignment "c = x". Here is the dump of the ProgramState:
>
> Store (direct and default bindings), 0x0 :
>
> Expressions:
>  (0x7b9bd30,0x7b458d8) c : 
>  (0x7b9bd30,0x7b45940) x : 0 U8b
>  Ranges are empty.


Hmm. I guess you need to sign up for the cast expression rather than for the 
binary operator expression. By the time you reach the assignment operator, the 
value before the cast is already removed from the environment.


http://reviews.llvm.org/D13126



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


r254083 - Stop using SFINAE to detect whether a derived-class override of Traverse* can

2015-11-25 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Nov 25 13:33:20 2015
New Revision: 254083

URL: http://llvm.org/viewvc/llvm-project?rev=254083=rev
Log:
Stop using SFINAE to detect whether a derived-class override of Traverse* can
take a queue; some supported versions of GCC believe that this substitution
failure is an error. Instead, use a partial specialization to detect the type
of a pointer to the corresponding member. This is less general, but good enough
for our uses.

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

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=254083=254082=254083=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Wed Nov 25 13:33:20 2015
@@ -276,14 +276,11 @@ public:
 //  Methods on Stmts 
 
 private:
-  // Determine if the specified derived-class member M can be passed a
-  // DataRecursionQueue* argument.
-  template
-  std::false_type callableWithQueue(...);
-  template
-  std::true_type callableWithQueue(M m, Derived *d = nullptr, P *p = nullptr,
-   DataRecursionQueue *q = nullptr,
-   decltype((d->*m)(p, q)) = false);
+  template
+  struct has_same_member_pointer_type : std::false_type {};
+  template
+  struct has_same_member_pointer_type
+  : std::true_type {};
 
   // Traverse the given statement. If the most-derived traverse function takes 
a
   // data recursion queue, pass it on; otherwise, discard it. Note that the
@@ -291,10 +288,13 @@ private:
   // class can take a queue, so if we're taking the second arm, make the first
   // arm call our function rather than the derived class version.
 #define TRAVERSE_STMT_BASE(NAME, CLASS, VAR, QUEUE)
\
-  (decltype(callableWithQueue(::Traverse##NAME))::value 
\
+  (has_same_member_pointer_type::value 
\
? static_cast(::Traverse##NAME))::value,   
\
+ has_same_member_pointer_type< 
\
+ decltype(::Traverse##NAME),   
\
+ decltype(::Traverse##NAME)>::value,   
\
  Derived &, RecursiveASTVisitor &>::type>(*this)   
\
  .Traverse##NAME(static_cast(VAR), QUEUE) 
\
: getDerived().Traverse##NAME(static_cast(VAR)))


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


Re: [PATCH] D14872: PR25575: Make GCC 4.4+ comatible layout for packed bit-fileds of char type

2015-11-25 Thread Richard Smith via cfe-commits
On Nov 25, 2015 1:53 PM, "hfin...@anl.gov via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:
>
> hfinkel added inline comments.
>
> 
> Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2783
> @@ -2783,1 +2782,3 @@
> +  "the newer semantic is provided here">,
> +  InGroup>;
>  def warn_transparent_union_attribute_field_size_align : Warning<
> 
> Calling this "a semantic" reads oddly to me. This sounds better to me:
>
>   def note_attribute_packed_for_bitfield_offset_changed : Warning<
> "the offset assigned to packed bit-field member %0 has changed with
GCC version 4.4 - "

Please also remove the "has" here.

> "the newer offset is used here">,
> InGroup>;
>
> 
> Comment at: lib/Sema/SemaDeclAttr.cpp:1040
> @@ -1039,3 +1039,3 @@
>  // If the alignment is less than or equal to 8 bits, the packed
attribute
>  // has no effect.
>  if (!FD->getType()->isDependentType() &&
> 
> This comment is now out of date?
>
>
> http://reviews.llvm.org/D14872
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14872: PR25575: Make GCC 4.4+ comatible layout for packed bit-fileds of char type

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


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2783
@@ -2783,1 +2782,3 @@
+  "the newer semantic is provided here">,
+  InGroup>;
 def warn_transparent_union_attribute_field_size_align : Warning<

Calling this "a semantic" reads oddly to me. This sounds better to me:

  def note_attribute_packed_for_bitfield_offset_changed : Warning<
"the offset assigned to packed bit-field member %0 has changed with GCC 
version 4.4 - "
"the newer offset is used here">,
InGroup>;


Comment at: lib/Sema/SemaDeclAttr.cpp:1040
@@ -1039,3 +1039,3 @@
 // If the alignment is less than or equal to 8 bits, the packed attribute
 // has no effect.
 if (!FD->getType()->isDependentType() &&

This comment is now out of date?


http://reviews.llvm.org/D14872



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


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

2015-11-25 Thread Simon Pilgrim via cfe-commits
RKSimon added a subscriber: RKSimon.
RKSimon closed this revision.
RKSimon added a comment.

Committed at http://reviews.llvm.org/rL253886


http://reviews.llvm.org/D14215



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


r254097 - P0001R1: 'register' storage class specifier is no longer permitted in C++1z.

2015-11-25 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Nov 25 15:34:21 2015
New Revision: 254097

URL: http://llvm.org/viewvc/llvm-project?rev=254097=rev
Log:
P0001R1: 'register' storage class specifier is no longer permitted in C++1z.

We will still allow it in system headers, in macros from system headers, when
combined with an 'asm' label, and under the flag -Wno-register.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/deprecated.cpp
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=254097=254096=254097=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed Nov 25 15:34:21 2015
@@ -187,6 +187,8 @@ def CXX14Compat : DiagGroup<"c++14-compa
 def CXX14CompatPedantic : DiagGroup<"c++14-compat-pedantic",
 [CXXPre1zCompatPedantic]>;
 
+def CXX1zCompat : DiagGroup<"c++1z-compat", [DeprecatedRegister]>;
+
 def : DiagGroup<"effc++">;
 def DivZero : DiagGroup<"division-by-zero">;
 def ExitTimeDestructors : DiagGroup<"exit-time-destructors">;
@@ -314,6 +316,7 @@ def : DiagGroup<"redundant-decls">;
 def RedeclaredClassMember : DiagGroup<"redeclared-class-member">;
 def GNURedeclaredEnum : DiagGroup<"gnu-redeclared-enum">;
 def RedundantMove : DiagGroup<"redundant-move">;
+def Register : DiagGroup<"register", [DeprecatedRegister]>;
 def ReturnStackAddress : DiagGroup<"return-stack-address">;
 def ReturnTypeCLinkage : DiagGroup<"return-type-c-linkage">;
 def ReturnType : DiagGroup<"return-type", [ReturnTypeCLinkage]>;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=254097=254096=254097=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Nov 25 15:34:21 
2015
@@ -213,8 +213,11 @@ def warn_auto_storage_class : Warning<
   InGroup, DefaultIgnore;
 
 def warn_deprecated_register : Warning<
-  "'register' storage class specifier is deprecated">,
-  InGroup;
+  "'register' storage class specifier is deprecated "
+  "and incompatible with C++1z">, InGroup;
+def ext_register_storage_class : ExtWarn<
+  "ISO C++1z does not allow 'register' storage class specifier">,
+  DefaultError, InGroup;
 
 def err_invalid_decl_spec_combination : Error<
   "cannot combine with previous '%0' declaration specifier">;

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=254097=254096=254097=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Nov 25 15:34:21 2015
@@ -5709,7 +5709,8 @@ Sema::ActOnVariableDeclarator(Scope *S,
 // Suppress the warning in system macros, it's used in macros in some
 // popular C system headers, such as in glibc's htonl() macro.
 Diag(D.getDeclSpec().getStorageClassSpecLoc(),
- diag::warn_deprecated_register)
+ getLangOpts().CPlusPlus1z ? diag::ext_register_storage_class
+   : diag::warn_deprecated_register)
   << FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc());
   }
 

Modified: cfe/trunk/test/SemaCXX/deprecated.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/deprecated.cpp?rev=254097=254096=254097=diff
==
--- cfe/trunk/test/SemaCXX/deprecated.cpp (original)
+++ cfe/trunk/test/SemaCXX/deprecated.cpp Wed Nov 25 15:34:21 2015
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -std=c++98 %s -Wdeprecated -verify -triple x86_64-linux-gnu
 // RUN: %clang_cc1 -std=c++11 %s -Wdeprecated -verify -triple x86_64-linux-gnu
 // RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu
+// RUN: %clang_cc1 -std=c++1z %s -Wdeprecated -verify -triple x86_64-linux-gnu
 
 // RUN: %clang_cc1 -std=c++1y %s -Wdeprecated -verify -triple x86_64-linux-gnu 
-Wno-deprecated-register -DNO_DEPRECATED_FLAGS
 
@@ -17,8 +18,10 @@ void h() throw(...);
 
 void stuff() {
   register int n;
-#if __cplusplus >= 201103L && !defined(NO_DEPRECATED_FLAGS)
-  // expected-warning@-2 {{'register' storage class specifier is deprecated}}
+#if __cplusplus > 201402L
+  // expected-error@-2 {{ISO C++1z does not allow 'register' storage class 
specifier}}
+#elif __cplusplus >= 201103L && !defined(NO_DEPRECATED_FLAGS)
+  // expected-warning@-4 {{'register' storage class specifier is deprecated}}
 

Re: [PATCH] D15006: Driver: Better detection of mingw-gcc

2015-11-25 Thread Martell Malone via cfe-commits
martell added a comment.

@ismail can you test this for your setup please? :)


http://reviews.llvm.org/D15006



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


Re: [PATCH] D15006: Driver: Better detection of mingw-gcc

2015-11-25 Thread Martell Malone via cfe-commits
martell updated the summary for this revision.
martell updated this revision to Diff 41208.
martell added a comment.

Removed the break that I didn't think was needed
Can be re-added ??

Will added testcases


http://reviews.llvm.org/D15006

Files:
  lib/Driver/MinGWToolChain.cpp

Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -66,15 +66,20 @@
 : ToolChain(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());

-  // On Windows if there is no sysroot we search for gcc on the PATH.
+  llvm::SmallVector, 2> Gccs;
+  Gccs.emplace_back(getTriple().getArchName());
+  Gccs[0] += "-w64-mingw32-gcc";
+  Gccs.emplace_back("mingw32-gcc");
+
+  for (StringRef CandidateGcc : Gccs)
+if (llvm::ErrorOr GPPName =
+  llvm::sys::findProgramByName(CandidateGcc))
+  Base = llvm::sys::path::parent_path(
+  llvm::sys::path::parent_path(GPPName.get()));
+
   if (getDriver().SysRoot.size())
-  Base = getDriver().SysRoot;
-#ifdef LLVM_ON_WIN32
-  else if (llvm::ErrorOr GPPName =
-   llvm::sys::findProgramByName("gcc"))
-Base = llvm::sys::path::parent_path(
-llvm::sys::path::parent_path(GPPName.get()));
-#endif
+Base = getDriver().SysRoot;
+
   if (!Base.size())
 Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
 


Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -66,15 +66,20 @@
 : ToolChain(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());

-  // On Windows if there is no sysroot we search for gcc on the PATH.
+  llvm::SmallVector, 2> Gccs;
+  Gccs.emplace_back(getTriple().getArchName());
+  Gccs[0] += "-w64-mingw32-gcc";
+  Gccs.emplace_back("mingw32-gcc");
+
+  for (StringRef CandidateGcc : Gccs)
+if (llvm::ErrorOr GPPName =
+  llvm::sys::findProgramByName(CandidateGcc))
+  Base = llvm::sys::path::parent_path(
+  llvm::sys::path::parent_path(GPPName.get()));
+
   if (getDriver().SysRoot.size())
-  Base = getDriver().SysRoot;
-#ifdef LLVM_ON_WIN32
-  else if (llvm::ErrorOr GPPName =
-   llvm::sys::findProgramByName("gcc"))
-Base = llvm::sys::path::parent_path(
-llvm::sys::path::parent_path(GPPName.get()));
-#endif
+Base = getDriver().SysRoot;
+
   if (!Base.size())
 Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r254134 - [Diagnostics] Call setMapping on the correct diagnostic states in a few places. GetCurDiagState() was being used when it shouldn't be.

2015-11-25 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Wed Nov 25 23:51:54 2015
New Revision: 254134

URL: http://llvm.org/viewvc/llvm-project?rev=254134=rev
Log:
[Diagnostics] Call setMapping on the correct diagnostic states in a few places. 
GetCurDiagState() was being used when it shouldn't be.

I spotted this by inspection in the for loop that wasn't using its iterator and 
was just acting on the current state repeatedly.

This appears to have been introduced as a copy and paste bug in r140763 over 4 
years ago.

I have no idea how to test this. I just went back to the original commit and 
tried to use the variables it was using before that.

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

Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=254134=254133=254134=diff
==
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Wed Nov 25 23:51:54 2015
@@ -226,12 +226,12 @@ void DiagnosticsEngine::setSeverity(diag
   // Update all diagnostic states that are active after the given location.
   for (DiagStatePointsTy::iterator
  I = Pos+1, E = DiagStatePoints.end(); I != E; ++I) {
-GetCurDiagState()->setMapping(Diag, Mapping);
+I->State->setMapping(Diag, Mapping);
   }
 
   // If the location corresponds to an existing point, just update its state.
   if (Pos->Loc == Loc) {
-GetCurDiagState()->setMapping(Diag, Mapping);
+Pos->State->setMapping(Diag, Mapping);
 return;
   }
 
@@ -240,7 +240,7 @@ void DiagnosticsEngine::setSeverity(diag
   assert(Pos->Loc.isBeforeInTranslationUnitThan(Loc));
   DiagStates.push_back(*Pos->State);
   DiagState *NewState = ();
-  GetCurDiagState()->setMapping(Diag, Mapping);
+  NewState->setMapping(Diag, Mapping);
   DiagStatePoints.insert(Pos+1, DiagStatePoint(NewState,
FullSourceLoc(Loc, 
*SourceMgr)));
 }


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


Re: [PATCH] D13980: Add "x87" in x86 target feature map

2015-11-25 Thread Andrey Turetskiy via cfe-commits
aturetsk updated this revision to Diff 41137.
aturetsk added a comment.

Use getCPUKind once


http://reviews.llvm.org/D13980

Files:
  lib/Basic/Targets.cpp
  test/CodeGen/attr-target-x86-mmx.c
  test/CodeGen/attr-target-x86.c

Index: test/CodeGen/attr-target-x86.c
===
--- test/CodeGen/attr-target-x86.c
+++ test/CodeGen/attr-target-x86.c
@@ -18,6 +18,8 @@
 
 int __attribute__((target("no-mmx"))) qq(int a) { return 40; }
 
+int __attribute__((target("arch=i386"))) qix(int a) { return 4; }
+
 // Check that we emit the additional subtarget and cpu features for foo and 
not for baz or bar.
 // CHECK: baz{{.*}} #0
 // CHECK: foo{{.*}} #1
@@ -31,9 +33,11 @@
 // CHECK: qux{{.*}} #1
 // CHECK: qax{{.*}} #4
 // CHECK: qq{{.*}} #5
-// CHECK: #0 = {{.*}}"target-cpu"="x86-64" 
"target-features"="+fxsr,+mmx,+sse,+sse2"
-// CHECK: #1 = {{.*}}"target-cpu"="ivybridge" 
"target-features"="+aes,+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+xsave,+xsaveopt"
-// CHECK: #2 = {{.*}}"target-cpu"="x86-64" 
"target-features"="+fxsr,+mmx,+sse,-aes,-avx,-avx2,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512pf,-avx512vl,-f16c,-fma,-fma4,-pclmul,-sha,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-xop,-xsave,-xsaveopt"
-// CHECK: #3 = {{.*}}"target-cpu"="x86-64" 
"target-features"="+fxsr,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3"
-// CHECK: #4 = {{.*}}"target-cpu"="ivybridge" 
"target-features"="+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+xsave,+xsaveopt,-aes"
-// CHECK: #5 = {{.*}}"target-cpu"="x86-64" 
"target-features"="+fxsr,+sse,+sse2,-3dnow,-3dnowa,-mmx"
+// CHECK: qix{{.*}} #6
+// CHECK: #0 = {{.*}}"target-cpu"="x86-64" 
"target-features"="+fxsr,+mmx,+sse,+sse2,+x87"
+// CHECK: #1 = {{.*}}"target-cpu"="ivybridge" 
"target-features"="+aes,+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt"
+// CHECK: #2 = {{.*}}"target-cpu"="x86-64" 
"target-features"="+fxsr,+mmx,+sse,+x87,-aes,-avx,-avx2,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512pf,-avx512vl,-f16c,-fma,-fma4,-pclmul,-sha,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-xop,-xsave,-xsaveopt"
+// CHECK: #3 = {{.*}}"target-cpu"="x86-64" 
"target-features"="+fxsr,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87"
+// CHECK: #4 = {{.*}}"target-cpu"="ivybridge" 
"target-features"="+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt,-aes"
+// CHECK: #5 = {{.*}}"target-cpu"="x86-64" 
"target-features"="+fxsr,+sse,+sse2,+x87,-3dnow,-3dnowa,-mmx"
+// CHECK: #6 = {{.*}}"target-cpu"="i386" "target-features"="+mmx,+sse,+sse2"
Index: test/CodeGen/attr-target-x86-mmx.c
===
--- test/CodeGen/attr-target-x86-mmx.c
+++ test/CodeGen/attr-target-x86-mmx.c
@@ -19,4 +19,4 @@
   _mm_srai_pi32(a, c);
 }
 
-// CHECK: "target-features"="+mmx,+sse"
+// CHECK: "target-features"="+mmx,+sse,+x87"
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -2542,7 +2542,13 @@
   if (getTriple().getArch() == llvm::Triple::x86_64)
 setFeatureEnabledImpl(Features, "sse2", true);
 
-  switch (getCPUKind(CPU)) {
+  CPUKind Kind = getCPUKind(CPU);
+
+  // All X86 processors but i386 have X87.
+  if (Kind != CK_i386)
+setFeatureEnabledImpl(Features, "x87", true);
+
+  switch (Kind) {
   case CK_Generic:
   case CK_i386:
   case CK_i486:


Index: test/CodeGen/attr-target-x86.c
===
--- test/CodeGen/attr-target-x86.c
+++ test/CodeGen/attr-target-x86.c
@@ -18,6 +18,8 @@
 
 int __attribute__((target("no-mmx"))) qq(int a) { return 40; }
 
+int __attribute__((target("arch=i386"))) qix(int a) { return 4; }
+
 // Check that we emit the additional subtarget and cpu features for foo and not for baz or bar.
 // CHECK: baz{{.*}} #0
 // CHECK: foo{{.*}} #1
@@ -31,9 +33,11 @@
 // CHECK: qux{{.*}} #1
 // CHECK: qax{{.*}} #4
 // CHECK: qq{{.*}} #5
-// CHECK: #0 = {{.*}}"target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2"
-// CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+aes,+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+xsave,+xsaveopt"
-// CHECK: #2 = {{.*}}"target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,-aes,-avx,-avx2,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512pf,-avx512vl,-f16c,-fma,-fma4,-pclmul,-sha,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-xop,-xsave,-xsaveopt"
-// CHECK: #3 = {{.*}}"target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3"
-// CHECK: #4 = {{.*}}"target-cpu"="ivybridge" 

Re: [PATCH] D13980: Add "x87" in x86 target feature map

2015-11-25 Thread Andrey Turetskiy via cfe-commits
aturetsk added a comment.

> Are there any of the intrinsics in the headers that also depend on x87?


Not that I could find.



Comment at: lib/Basic/Targets.cpp:2545-2546
@@ -2544,2 +2544,4 @@
 
-  switch (getCPUKind(CPU)) {
+  CPUKind Kind = getCPUKind(CPU);
+
+  // All X86 processors but i386 have X87.

Done.


http://reviews.llvm.org/D13980



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


Re: [PATCH] D14824: [PATCH] Add clang-tidy check for static or thread_local objects where construction may throw

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

Sorry for the delay, I was sick last week.

Looks mostly fine.



Comment at: clang-tidy/cert/CERTTidyModule.cpp:19
@@ -18,2 +18,3 @@
 #include "../misc/ThrowByValueCatchByReferenceCheck.h"
+#include "StaticObjectExceptionCheck.h"
 #include "SetLongJmpCheck.h"

Please sort includes.


Comment at: clang-tidy/cert/StaticObjectExceptionCheck.cpp:18
@@ +17,3 @@
+namespace {
+AST_MATCHER(CXXConstructorDecl, isNoThrowConstructor) {
+  const auto *FnTy = Node.getType()->getAs();

ThrownExceptionTypeCheck.cpp defines a similar matcher. Looks like we need to 
move the `isNothrow` part to the ASTMatchers.h already.


Comment at: clang-tidy/cert/StaticObjectExceptionCheck.h:18
@@ +17,3 @@
+
+/// FIXME: Write a short description.
+///

Maybe address the FIXME right away? ;)


http://reviews.llvm.org/D14824



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


Re: [PATCH] D12031: Const std::move() argument ClangTidy check

2015-11-25 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Awesome! Thank you for the new check!

There are a couple of nits, but I'll fix these before submitting the patch.



Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:42
@@ +41,3 @@
+auto MoveRange = CharSourceRange::getCharRange(CallMove->getSourceRange());
+auto FileMoveRange = Lexer::makeFileCharRange(MoveRange, SM, 
getLangOpts());
+if (!FileMoveRange.isValid()) {

s/auto/CharSourceRange/


Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:47
@@ +46,3 @@
+bool IsVariable = isa(Arg);
+DiagnosticBuilder DB =
+diag(FileMoveRange.getBegin(), "std::move of the %select{|const }0"

I'd replace `DiagnosticBuilder DB` with `auto Diag` - this is more a local 
convention, not a general rule.


Comment at: clang-tidy/misc/MoveConstantArgumentCheck.cpp:57
@@ +56,3 @@
+  Arg->getLocStart()),
+SM, getLangOpts());
+CharSourceRange AfterArgumentsRange = Lexer::makeFileCharRange(

This can probably happen when `Arg` comes from another macro (or a macro 
argument). A test can be added later.


http://reviews.llvm.org/D12031



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


r254141 - [OPENMP 4.5] Fixed rules for 'ordered' clause.

2015-11-25 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu Nov 26 01:50:39 2015
New Revision: 254141

URL: http://llvm.org/viewvc/llvm-project?rev=254141=rev
Log:
[OPENMP 4.5] Fixed rules for 'ordered' clause.
According to OpenMP 4.5 the parameter of 'ordered' clause must be greater than 
or equal to the parameter of 'collapse' clause. Patch adds this rule.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/for_ordered_clause.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=254141=254140=254141=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Nov 26 01:50:39 
2015
@@ -7901,6 +7901,10 @@ def note_omp_static_member_in_target : N
   "mappable type cannot contain static members">;
 def err_omp_threadprivate_in_map : Error<
   "threadprivate variables are not allowed in map clause">;
+def err_omp_wrong_ordered_loop_count : Error<
+  "the parameter of the 'ordered' clause must be greater than or equal to the 
parameter of the 'collapse' clause">;
+def note_collapse_loop_count : Note<
+  "parameter of the 'collapse' clause">;
 } // end of OpenMP category
 
 let CategoryName = "Related Result Type Issue" in {

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=254141=254140=254141=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu Nov 26 01:50:39 2015
@@ -3359,13 +3359,22 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKin
 // Found 'collapse' clause - calculate collapse number.
 llvm::APSInt Result;
 if (CollapseLoopCountExpr->EvaluateAsInt(Result, SemaRef.getASTContext()))
-  NestedLoopCount += Result.getLimitedValue() - 1;
+  NestedLoopCount = Result.getLimitedValue();
   }
   if (OrderedLoopCountExpr) {
 // Found 'ordered' clause - calculate collapse number.
 llvm::APSInt Result;
-if (OrderedLoopCountExpr->EvaluateAsInt(Result, SemaRef.getASTContext()))
-  NestedLoopCount += Result.getLimitedValue() - 1;
+if (OrderedLoopCountExpr->EvaluateAsInt(Result, SemaRef.getASTContext())) {
+  if (Result.getLimitedValue() < NestedLoopCount) {
+SemaRef.Diag(OrderedLoopCountExpr->getExprLoc(),
+ diag::err_omp_wrong_ordered_loop_count)
+<< OrderedLoopCountExpr->getSourceRange();
+SemaRef.Diag(CollapseLoopCountExpr->getExprLoc(),
+ diag::note_collapse_loop_count)
+<< CollapseLoopCountExpr->getSourceRange();
+  }
+  NestedLoopCount = Result.getLimitedValue();
+}
   }
   // This is helper routine for loop directives (e.g., 'for', 'simd',
   // 'for simd', etc.).
@@ -5256,13 +5265,10 @@ ExprResult Sema::VerifyPositiveIntegerCo
 << E->getSourceRange();
 return ExprError();
   }
-  if (CKind == OMPC_collapse) {
-DSAStack->setCollapseNumber(DSAStack->getCollapseNumber() - 1 +
-Result.getExtValue());
-  } else if (CKind == OMPC_ordered) {
-DSAStack->setCollapseNumber(DSAStack->getCollapseNumber() - 1 +
-Result.getExtValue());
-  }
+  if (CKind == OMPC_collapse)
+DSAStack->setCollapseNumber(Result.getExtValue());
+  else if (CKind == OMPC_ordered)
+DSAStack->setCollapseNumber(Result.getExtValue());
   return ICE;
 }
 

Modified: cfe/trunk/test/OpenMP/for_ordered_clause.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_ordered_clause.cpp?rev=254141=254140=254141=diff
==
--- cfe/trunk/test/OpenMP/for_ordered_clause.cpp (original)
+++ cfe/trunk/test/OpenMP/for_ordered_clause.cpp Thu Nov 26 01:50:39 2015
@@ -52,11 +52,19 @@ T tmain(T argc, S **argv) {
 #pragma omp for ordered(1)
   for (int i = ST; i < N; i++)
 argv[0][i] = argv[0][i] - argv[0][i - ST];
+#pragma omp for ordered(N-1) // expected-error 2 {{argument to 'ordered' 
clause must be a positive integer value}}
+  for (int i = ST; i < N; i++)
+argv[0][i] = argv[0][i] - argv[0][i - ST];
 #pragma omp for ordered(N) // expected-error {{argument to 'ordered' clause 
must be a positive integer value}}
   for (T i = ST; i < N; i++)
 argv[0][i] = argv[0][i] - argv[0][i - ST];
 #pragma omp for ordered(2) // expected-note {{as specified in 'ordered' 
clause}}
   foo();// expected-error {{expected 2 for loops after 
'#pragma omp for'}}
+#pragma omp for ordered(N) collapse(N + 2) // expected-error {{the parameter 
of the 'ordered' clause must be greater than or equal to the parameter of the 
'collapse' clause}} expected-note 

Re: [PATCH] D15006: Driver: Better detection of mingw-gcc

2015-11-25 Thread Martell Malone via cfe-commits
martell updated this revision to Diff 41209.
martell added a comment.

Updated to reflect feedback

I'm not too sure what todo for testcases on this one because they already exist 
for the most part.
I ran the test suite and they all pass.

I would have to create a mingw32-gcc and {armv7|i686|x86_64}-w64-mingw32-gcc 
and chmod+x for the testcase.
Is that safe ?


http://reviews.llvm.org/D15006

Files:
  lib/Driver/MinGWToolChain.cpp
  lib/Driver/ToolChains.h

Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -661,6 +661,7 @@
   std::string Arch;
   mutable std::unique_ptr Preprocessor;
   mutable std::unique_ptr Compiler;
+  void findGccDir();
   void findGccLibDir();
 };
 
Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -62,19 +62,29 @@
   }
 }

+void MinGW::findGccDir() {
+  llvm::SmallVector, 2> Gccs;
+  Gccs.emplace_back(getTriple().getArchName());
+  Gccs[0] += "-w64-mingw32-gcc";
+  Gccs.emplace_back("mingw32-gcc");
+  for (StringRef CandidateGcc : Gccs)
+if (llvm::ErrorOr GPPName =
+  llvm::sys::findProgramByName(CandidateGcc)) {
+  Base = llvm::sys::path::parent_path(
+  llvm::sys::path::parent_path(GPPName.get()));
+  return;
+}
+}
+
 MinGW::MinGW(const Driver , const llvm::Triple , const ArgList )
 : ToolChain(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());

-  // On Windows if there is no sysroot we search for gcc on the PATH.
   if (getDriver().SysRoot.size())
-  Base = getDriver().SysRoot;
-#ifdef LLVM_ON_WIN32
-  else if (llvm::ErrorOr GPPName =
-   llvm::sys::findProgramByName("gcc"))
-Base = llvm::sys::path::parent_path(
-llvm::sys::path::parent_path(GPPName.get()));
-#endif
+Base = getDriver().SysRoot;
+  else
+findGccDir();
+
   if (!Base.size())
 Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());



Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -661,6 +661,7 @@
   std::string Arch;
   mutable std::unique_ptr Preprocessor;
   mutable std::unique_ptr Compiler;
+  void findGccDir();
   void findGccLibDir();
 };
 
Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -62,19 +62,29 @@
   }
 }

+void MinGW::findGccDir() {
+  llvm::SmallVector, 2> Gccs;
+  Gccs.emplace_back(getTriple().getArchName());
+  Gccs[0] += "-w64-mingw32-gcc";
+  Gccs.emplace_back("mingw32-gcc");
+  for (StringRef CandidateGcc : Gccs)
+if (llvm::ErrorOr GPPName =
+  llvm::sys::findProgramByName(CandidateGcc)) {
+  Base = llvm::sys::path::parent_path(
+  llvm::sys::path::parent_path(GPPName.get()));
+  return;
+}
+}
+
 MinGW::MinGW(const Driver , const llvm::Triple , const ArgList )
 : ToolChain(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());

-  // On Windows if there is no sysroot we search for gcc on the PATH.
   if (getDriver().SysRoot.size())
-  Base = getDriver().SysRoot;
-#ifdef LLVM_ON_WIN32
-  else if (llvm::ErrorOr GPPName =
-   llvm::sys::findProgramByName("gcc"))
-Base = llvm::sys::path::parent_path(
-llvm::sys::path::parent_path(GPPName.get()));
-#endif
+Base = getDriver().SysRoot;
+  else
+findGccDir();
+
   if (!Base.size())
 Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());

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


Re: [PATCH] D14653: [libcxx] Introduce the mechanism for fixing -fno-exceptions test failures.

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

Gentle ping.


http://reviews.llvm.org/D14653



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


[PATCH] D14977: clang-tidy: code cleanup with isAssignmentOperator

2015-11-25 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision.
danielmarjamaki added subscribers: cfe-commits, alexfh.

This is a small code cleanup. No change in logical behaviour is intended.

http://reviews.llvm.org/D14977

Files:
  clang-tidy/misc/AssertSideEffectCheck.cpp

Index: clang-tidy/misc/AssertSideEffectCheck.cpp
===
--- clang-tidy/misc/AssertSideEffectCheck.cpp
+++ clang-tidy/misc/AssertSideEffectCheck.cpp
@@ -33,11 +33,7 @@
   }
 
   if (const auto *Op = dyn_cast(E)) {
-BinaryOperator::Opcode OC = Op->getOpcode();
-return OC == BO_Assign || OC == BO_MulAssign || OC == BO_DivAssign ||
-   OC == BO_RemAssign || OC == BO_AddAssign || OC == BO_SubAssign ||
-   OC == BO_ShlAssign || OC == BO_ShrAssign || OC == BO_AndAssign ||
-   OC == BO_XorAssign || OC == BO_OrAssign;
+return Op->isAssignmentOp();
   }
 
   if (const auto *OpCallExpr = dyn_cast(E)) {


Index: clang-tidy/misc/AssertSideEffectCheck.cpp
===
--- clang-tidy/misc/AssertSideEffectCheck.cpp
+++ clang-tidy/misc/AssertSideEffectCheck.cpp
@@ -33,11 +33,7 @@
   }
 
   if (const auto *Op = dyn_cast(E)) {
-BinaryOperator::Opcode OC = Op->getOpcode();
-return OC == BO_Assign || OC == BO_MulAssign || OC == BO_DivAssign ||
-   OC == BO_RemAssign || OC == BO_AddAssign || OC == BO_SubAssign ||
-   OC == BO_ShlAssign || OC == BO_ShrAssign || OC == BO_AndAssign ||
-   OC == BO_XorAssign || OC == BO_OrAssign;
+return Op->isAssignmentOp();
   }
 
   if (const auto *OpCallExpr = dyn_cast(E)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r254063 - [X86] Support for C calling convention only for MCU target.

2015-11-25 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Wed Nov 25 03:24:26 2015
New Revision: 254063

URL: http://llvm.org/viewvc/llvm-project?rev=254063=rev
Log:
[X86] Support for C calling convention only for MCU target.
For MCU only C calling convention is allowed, all other calling conventions are 
not supported.
Differential Revision: http://reviews.llvm.org/D14864

Added:
cfe/trunk/test/Sema/callingconv-iamcu.c   (with props)
Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=254063=254062=254063=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Nov 25 03:24:26 2015
@@ -3391,11 +3391,6 @@ void X86TargetInfo::getTargetDefines(con
   }
   if (CPU >= CK_i586)
 Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
-
-  if (getTriple().isOSIAMCU()) {
-Builder.defineMacro("__iamcu");
-Builder.defineMacro("__iamcu__");
-  }
 }
 
 bool X86TargetInfo::hasFeature(StringRef Feature) const {
@@ -3644,11 +3639,6 @@ public:
 IntPtrType = SignedInt;
 RegParmMax = 3;
 
-if (getTriple().isOSIAMCU()) {
-  LongDoubleWidth = 64;
-  LongDoubleFormat = ::APFloat::IEEEdouble;
-}
-
 // Use fpret for all types.
 RealTypeUsesObjCFPRet = ((1 << TargetInfo::Float) |
  (1 << TargetInfo::Double) |
@@ -3881,6 +3871,27 @@ public:
   }
 };
 
+// X86-32 MCU target
+class MCUX86_32TargetInfo : public X86_32TargetInfo {
+public:
+  MCUX86_32TargetInfo(const llvm::Triple ) : X86_32TargetInfo(Triple) {
+LongDoubleWidth = 64;
+LongDoubleFormat = ::APFloat::IEEEdouble;
+  }
+
+  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override 
{
+// On MCU we support only C calling convention.
+return CC == CC_C ? CCCR_OK : CCCR_Warning;
+  }
+
+  void getTargetDefines(const LangOptions ,
+MacroBuilder ) const override {
+X86_32TargetInfo::getTargetDefines(Opts, Builder);
+Builder.defineMacro("__iamcu");
+Builder.defineMacro("__iamcu__");
+  }
+};
+
 // RTEMS Target
 template
 class RTEMSTargetInfo : public OSTargetInfo {
@@ -7769,6 +7780,8 @@ static TargetInfo *AllocateTarget(const
   return new RTEMSX86_32TargetInfo(Triple);
 case llvm::Triple::NaCl:
   return new NaClTargetInfo(Triple);
+case llvm::Triple::ELFIAMCU:
+  return new MCUX86_32TargetInfo(Triple);
 default:
   return new X86_32TargetInfo(Triple);
 }

Added: cfe/trunk/test/Sema/callingconv-iamcu.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/callingconv-iamcu.c?rev=254063=auto
==
--- cfe/trunk/test/Sema/callingconv-iamcu.c (added)
+++ cfe/trunk/test/Sema/callingconv-iamcu.c Wed Nov 25 03:24:26 2015
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 %s -fsyntax-only -triple i686-intel-elfiamcu -verify
+
+void __attribute__((fastcall)) foo(float *a) { // expected-warning {{calling 
convention 'fastcall' ignored for this target}}
+}
+
+void __attribute__((stdcall)) bar(float *a) { // expected-warning {{calling 
convention 'stdcall' ignored for this target}}
+}
+
+void __attribute__((fastcall(1))) baz(float *a) { // expected-error 
{{'fastcall' attribute takes no arguments}}
+}
+
+void __attribute__((fastcall)) test2(int a, ...) { // expected-warning 
{{calling convention 'fastcall' ignored for this target}}
+}
+void __attribute__((stdcall)) test3(int a, ...) { // expected-warning 
{{calling convention 'stdcall' ignored for this target}}
+}
+void __attribute__((thiscall)) test4(int a, ...) { // expected-warning 
{{calling convention 'thiscall' ignored for this target}}
+}
+
+void __attribute__((cdecl)) ctest0() {}
+
+void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{'cdecl' 
attribute takes no arguments}}
+
+void (__attribute__((fastcall)) *pfoo)(float*) = foo; // expected-warning 
{{calling convention 'fastcall' ignored for this target}}
+
+void (__attribute__((stdcall)) *pbar)(float*) = bar; // expected-warning 
{{calling convention 'stdcall' ignored for this target}}
+
+void (*pctest0)() = ctest0;
+
+void ctest2() {}
+void (__attribute__((cdecl)) *pctest2)() = ctest2;
+
+typedef void (__attribute__((fastcall)) *Handler) (float *); // 
expected-warning {{calling convention 'fastcall' ignored for this target}}
+Handler H = foo;
+
+int __attribute__((pcs("aapcs", "aapcs"))) pcs1(void); // expected-error 
{{'pcs' attribute takes one argument}}
+int __attribute__((pcs())) pcs2(void); // expected-error {{'pcs' attribute 
takes one argument}}
+int __attribute__((pcs(pcs1))) pcs3(void); // expected-error {{'pcs' attribute 
requires a string}} \
+   // expected-error {{invalid PCS 
type}}
+int __attribute__((pcs(0))) pcs4(void); // expected-error {{'pcs' attribute 
requires a 

[PATCH] D14980: PR18513: make gcc compatible layout for bit-fields with explicit aligned attribute

2015-11-25 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin created this revision.
DmitryPolukhin added a reviewer: rjmccall.
DmitryPolukhin added a subscriber: cfe-commits.

Fix binary compatibility issue with GCC.

http://reviews.llvm.org/D14980

Files:
  lib/AST/RecordLayoutBuilder.cpp
  test/Sema/bitfield-layout.c

Index: test/Sema/bitfield-layout.c
===
--- test/Sema/bitfield-layout.c
+++ test/Sema/bitfield-layout.c
@@ -1,8 +1,13 @@
 // RUN: %clang_cc1 %s -fsyntax-only -verify -triple=i686-apple-darwin9
 // expected-no-diagnostics
+#include 
 
-#define CHECK_SIZE(kind, name, size) extern int name##1[sizeof(kind name) == 
size ? 1 : -1];
-#define CHECK_ALIGN(kind, name, size) extern int name##2[__alignof(kind name) 
== size ? 1 : -1];
+#define CHECK_SIZE(kind, name, size) \
+  extern int name##1[sizeof(kind name) == size ? 1 : -1];
+#define CHECK_ALIGN(kind, name, size) \
+  extern int name##2[__alignof(kind name) == size ? 1 : -1];
+#define CHECK_OFFSET(kind, name, member, offset) \
+  extern int name##2[offsetof(kind name, member) == offset ? 1 : -1];
 
 // Zero-width bit-fields
 struct a {char x; int : 0; char y;};
@@ -56,3 +61,35 @@
 CHECK_SIZE(struct, s0, 0x3218)
 CHECK_ALIGN(struct, s0, 4)
 
+// Bit-field with explicit align bigger than normal.
+struct g0 {
+  char a;
+  __attribute__((aligned(16))) int b : 1;
+  char c;
+};
+
+CHECK_SIZE(struct, g0, 32);
+CHECK_ALIGN(struct, g0, 16);
+CHECK_OFFSET(struct, g0, c, 17);
+
+// Bit-field with explicit align smaller than normal.
+struct g1 {
+  char a;
+  __attribute__((aligned(2))) int b : 1;
+  char c;
+};
+
+CHECK_SIZE(struct, g1, 4);
+CHECK_ALIGN(struct, g1, 4);
+CHECK_OFFSET(struct, g1, c, 3);
+
+// Same as above but without explicit align.
+struct g2 {
+  char a;
+  int b : 1;
+  char c;
+};
+
+CHECK_SIZE(struct, g2, 4);
+CHECK_ALIGN(struct, g2, 4);
+CHECK_OFFSET(struct, g2, c, 2);
Index: lib/AST/RecordLayoutBuilder.cpp
===
--- lib/AST/RecordLayoutBuilder.cpp
+++ lib/AST/RecordLayoutBuilder.cpp
@@ -1552,7 +1552,8 @@
 FieldAlign = 1;
 
   // But, if there's an 'aligned' attribute on the field, honor that.
-  if (unsigned ExplicitFieldAlign = D->getMaxAlignment()) {
+  unsigned ExplicitFieldAlign = D->getMaxAlignment();
+  if (ExplicitFieldAlign) {
 FieldAlign = std::max(FieldAlign, ExplicitFieldAlign);
 UnpackedFieldAlign = std::max(UnpackedFieldAlign, ExplicitFieldAlign);
   }
@@ -1601,10 +1602,12 @@
 (AllowPadding &&
  (FieldOffset & (FieldAlign-1)) + FieldSize > TypeSize)) {
   FieldOffset = llvm::RoundUpToAlignment(FieldOffset, FieldAlign);
-}
+} else if (ExplicitFieldAlign)
+  FieldOffset = llvm::RoundUpToAlignment(FieldOffset, ExplicitFieldAlign);
 
 // Repeat the computation for diagnostic purposes.
 if (FieldSize == 0 ||
+ExplicitFieldAlign ||
 (AllowPadding &&
  (UnpackedFieldOffset & (UnpackedFieldAlign-1)) + FieldSize > 
TypeSize))
   UnpackedFieldOffset = llvm::RoundUpToAlignment(UnpackedFieldOffset,


Index: test/Sema/bitfield-layout.c
===
--- test/Sema/bitfield-layout.c
+++ test/Sema/bitfield-layout.c
@@ -1,8 +1,13 @@
 // RUN: %clang_cc1 %s -fsyntax-only -verify -triple=i686-apple-darwin9
 // expected-no-diagnostics
+#include 
 
-#define CHECK_SIZE(kind, name, size) extern int name##1[sizeof(kind name) == size ? 1 : -1];
-#define CHECK_ALIGN(kind, name, size) extern int name##2[__alignof(kind name) == size ? 1 : -1];
+#define CHECK_SIZE(kind, name, size) \
+  extern int name##1[sizeof(kind name) == size ? 1 : -1];
+#define CHECK_ALIGN(kind, name, size) \
+  extern int name##2[__alignof(kind name) == size ? 1 : -1];
+#define CHECK_OFFSET(kind, name, member, offset) \
+  extern int name##2[offsetof(kind name, member) == offset ? 1 : -1];
 
 // Zero-width bit-fields
 struct a {char x; int : 0; char y;};
@@ -56,3 +61,35 @@
 CHECK_SIZE(struct, s0, 0x3218)
 CHECK_ALIGN(struct, s0, 4)
 
+// Bit-field with explicit align bigger than normal.
+struct g0 {
+  char a;
+  __attribute__((aligned(16))) int b : 1;
+  char c;
+};
+
+CHECK_SIZE(struct, g0, 32);
+CHECK_ALIGN(struct, g0, 16);
+CHECK_OFFSET(struct, g0, c, 17);
+
+// Bit-field with explicit align smaller than normal.
+struct g1 {
+  char a;
+  __attribute__((aligned(2))) int b : 1;
+  char c;
+};
+
+CHECK_SIZE(struct, g1, 4);
+CHECK_ALIGN(struct, g1, 4);
+CHECK_OFFSET(struct, g1, c, 3);
+
+// Same as above but without explicit align.
+struct g2 {
+  char a;
+  int b : 1;
+  char c;
+};
+
+CHECK_SIZE(struct, g2, 4);
+CHECK_ALIGN(struct, g2, 4);
+CHECK_OFFSET(struct, g2, c, 2);
Index: lib/AST/RecordLayoutBuilder.cpp
===
--- lib/AST/RecordLayoutBuilder.cpp
+++ lib/AST/RecordLayoutBuilder.cpp
@@ -1552,7 +1552,8 @@
 FieldAlign = 1;
 
   // But, if there's an 'aligned' attribute on the field, 

Re: [PATCH] D14977: clang-tidy: code cleanup with isAssignmentOperator

2015-11-25 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki closed this revision.
danielmarjamaki added a comment.

Committed with 254066.


http://reviews.llvm.org/D14977



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


Re: [PATCH] D14954: [x86] Exclusion of incorrect include headers paths for MCU target

2015-11-25 Thread Michael Kuperstein via cfe-commits
mkuper accepted this revision.
mkuper added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D14954



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


[clang-tools-extra] r254066 - [clang-tidy] code cleanup using isAssignmentOp()

2015-11-25 Thread Daniel Marjamaki via cfe-commits
Author: danielmarjamaki
Date: Wed Nov 25 05:30:00 2015
New Revision: 254066

URL: http://llvm.org/viewvc/llvm-project?rev=254066=rev
Log:
[clang-tidy] code cleanup using isAssignmentOp()

Modified:
clang-tools-extra/trunk/clang-tidy/misc/AssertSideEffectCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/AssertSideEffectCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/AssertSideEffectCheck.cpp?rev=254066=254065=254066=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/AssertSideEffectCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/AssertSideEffectCheck.cpp Wed Nov 
25 05:30:00 2015
@@ -33,11 +33,7 @@ AST_MATCHER_P(Expr, hasSideEffect, bool,
   }
 
   if (const auto *Op = dyn_cast(E)) {
-BinaryOperator::Opcode OC = Op->getOpcode();
-return OC == BO_Assign || OC == BO_MulAssign || OC == BO_DivAssign ||
-   OC == BO_RemAssign || OC == BO_AddAssign || OC == BO_SubAssign ||
-   OC == BO_ShlAssign || OC == BO_ShrAssign || OC == BO_AndAssign ||
-   OC == BO_XorAssign || OC == BO_OrAssign;
+return Op->isAssignmentOp();
   }
 
   if (const auto *OpCallExpr = dyn_cast(E)) {


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


Re: [PATCH] D10599: [OPENMP 4.0] Initial support for '#pragma omp declare simd' directive.

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

Richard, any comments?


http://reviews.llvm.org/D10599



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


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

2015-11-25 Thread Alexey Bataev via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL254067: [MSVC] 'property' with an empty array in array 
subscript expression. (authored by ABataev).

Changed prior to commit:
  http://reviews.llvm.org/D13336?vs=41018=41125#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13336

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

Index: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
===
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
@@ -2112,6 +2112,8 @@
   TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
 })
 
+DEF_TRAVERSE_STMT(MSPropertySubscriptExpr, {})
+
 DEF_TRAVERSE_STMT(CXXUuidofExpr, {
   // The child-iterator will pick up the arg if it's an expression,
   // but not if it's a type.
Index: cfe/trunk/include/clang/AST/ExprCXX.h
===
--- cfe/trunk/include/clang/AST/ExprCXX.h
+++ cfe/trunk/include/clang/AST/ExprCXX.h
@@ -677,6 +677,69 @@
   friend class ASTStmtReader;
 };
 
+/// MS property subscript expression.
+/// MSVC supports 'property' attribute and allows to apply it to the
+/// declaration of an empty array in a class or structure definition.
+/// For example:
+/// \code
+/// __declspec(property(get=GetX, put=PutX)) int x[];
+/// \endcode
+/// The above statement indicates that x[] can be used with one or more array
+/// indices. In this case, i=p->x[a][b] will be turned into i=p->GetX(a, b), and
+/// p->x[a][b] = i will be turned into p->PutX(a, b, i).
+/// This is a syntactic pseudo-object expression.
+class MSPropertySubscriptExpr : public Expr {
+  friend class ASTStmtReader;
+  enum { BASE_EXPR, IDX_EXPR, NUM_SUBEXPRS = 2 };
+  Stmt *SubExprs[NUM_SUBEXPRS];
+  SourceLocation RBracketLoc;
+
+  void setBase(Expr *Base) { SubExprs[BASE_EXPR] = Base; }
+  void setIdx(Expr *Idx) { SubExprs[IDX_EXPR] = Idx; }
+
+public:
+  MSPropertySubscriptExpr(Expr *Base, Expr *Idx, QualType Ty, ExprValueKind VK,
+  ExprObjectKind OK, SourceLocation RBracketLoc)
+  : Expr(MSPropertySubscriptExprClass, Ty, VK, OK, Idx->isTypeDependent(),
+ Idx->isValueDependent(), Idx->isInstantiationDependent(),
+ Idx->containsUnexpandedParameterPack()),
+RBracketLoc(RBracketLoc) {
+SubExprs[BASE_EXPR] = Base;
+SubExprs[IDX_EXPR] = Idx;
+  }
+
+  /// \brief Create an empty array subscript expression.
+  explicit MSPropertySubscriptExpr(EmptyShell Shell)
+  : Expr(MSPropertySubscriptExprClass, Shell) {}
+
+  Expr *getBase() { return cast(SubExprs[BASE_EXPR]); }
+  const Expr *getBase() const { return cast(SubExprs[BASE_EXPR]); }
+
+  Expr *getIdx() { return cast(SubExprs[IDX_EXPR]); }
+  const Expr *getIdx() const { return cast(SubExprs[IDX_EXPR]); }
+
+  SourceLocation getLocStart() const LLVM_READONLY {
+return getBase()->getLocStart();
+  }
+  SourceLocation getLocEnd() const LLVM_READONLY { return RBracketLoc; }
+
+  SourceLocation getRBracketLoc() const { return RBracketLoc; }
+  void setRBracketLoc(SourceLocation L) { RBracketLoc = L; }
+
+  SourceLocation getExprLoc() const LLVM_READONLY {
+return getBase()->getExprLoc();
+  }
+
+  static bool classof(const Stmt *T) {
+return T->getStmtClass() == MSPropertySubscriptExprClass;
+  }
+
+  // Iterators
+  child_range children() {
+return child_range([0], [0] + NUM_SUBEXPRS);
+  }
+};
+
 /// A Microsoft C++ @c __uuidof expression, which gets
 /// the _GUID that corresponds to the supplied type or expression.
 ///
Index: cfe/trunk/include/clang/Basic/StmtNodes.td
===
--- cfe/trunk/include/clang/Basic/StmtNodes.td
+++ cfe/trunk/include/clang/Basic/StmtNodes.td
@@ -180,6 +180,7 @@
 
 // Microsoft Extensions.
 def MSPropertyRefExpr : DStmt;
+def MSPropertySubscriptExpr : DStmt;
 def CXXUuidofExpr : DStmt; 
 def SEHTryStmt : Stmt;
 def SEHExceptStmt : Stmt;
Index: cfe/trunk/include/clang/Serialization/ASTBitCodes.h

r254067 - [MSVC] 'property' with an empty array in array subscript expression.

2015-11-25 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Wed Nov 25 06:01:00 2015
New Revision: 254067

URL: http://llvm.org/viewvc/llvm-project?rev=254067=rev
Log:
[MSVC] 'property' with an empty array in array subscript expression.
MSVC supports 'property' attribute and allows to apply it to the declaration of 
an empty array in a class or structure definition.
For example:
```
__declspec(property(get=GetX, put=PutX)) int x[];
```
The above statement indicates that x[] can be used with one or more array 
indices. In this case, i=p->x[a][b] will be turned into i=p->GetX(a, b), and 
p->x[a][b] = i will be turned into p->PutX(a, b, i);
Differential Revision: http://reviews.llvm.org/D13336

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

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=254067=254066=254067=diff
==
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Wed Nov 25 06:01:00 2015
@@ -677,6 +677,69 @@ public:
   friend class ASTStmtReader;
 };
 
+/// MS property subscript expression.
+/// MSVC supports 'property' attribute and allows to apply it to the
+/// declaration of an empty array in a class or structure definition.
+/// For example:
+/// \code
+/// __declspec(property(get=GetX, put=PutX)) int x[];
+/// \endcode
+/// The above statement indicates that x[] can be used with one or more array
+/// indices. In this case, i=p->x[a][b] will be turned into i=p->GetX(a, b), 
and
+/// p->x[a][b] = i will be turned into p->PutX(a, b, i).
+/// This is a syntactic pseudo-object expression.
+class MSPropertySubscriptExpr : public Expr {
+  friend class ASTStmtReader;
+  enum { BASE_EXPR, IDX_EXPR, NUM_SUBEXPRS = 2 };
+  Stmt *SubExprs[NUM_SUBEXPRS];
+  SourceLocation RBracketLoc;
+
+  void setBase(Expr *Base) { SubExprs[BASE_EXPR] = Base; }
+  void setIdx(Expr *Idx) { SubExprs[IDX_EXPR] = Idx; }
+
+public:
+  MSPropertySubscriptExpr(Expr *Base, Expr *Idx, QualType Ty, ExprValueKind VK,
+  ExprObjectKind OK, SourceLocation RBracketLoc)
+  : Expr(MSPropertySubscriptExprClass, Ty, VK, OK, Idx->isTypeDependent(),
+ Idx->isValueDependent(), Idx->isInstantiationDependent(),
+ Idx->containsUnexpandedParameterPack()),
+RBracketLoc(RBracketLoc) {
+SubExprs[BASE_EXPR] = Base;
+SubExprs[IDX_EXPR] = Idx;
+  }
+
+  /// \brief Create an empty array subscript expression.
+  explicit MSPropertySubscriptExpr(EmptyShell Shell)
+  : Expr(MSPropertySubscriptExprClass, Shell) {}
+
+  Expr *getBase() { return cast(SubExprs[BASE_EXPR]); }
+  const Expr *getBase() const { return cast(SubExprs[BASE_EXPR]); }
+
+  Expr *getIdx() { return cast(SubExprs[IDX_EXPR]); }
+  const Expr *getIdx() const { return cast(SubExprs[IDX_EXPR]); }
+
+  SourceLocation getLocStart() const LLVM_READONLY {
+return getBase()->getLocStart();
+  }
+  SourceLocation getLocEnd() const LLVM_READONLY { return RBracketLoc; }
+
+  SourceLocation getRBracketLoc() const { return RBracketLoc; }
+  void setRBracketLoc(SourceLocation L) { RBracketLoc = L; }
+
+  SourceLocation getExprLoc() const LLVM_READONLY {
+return getBase()->getExprLoc();
+  }
+
+  static bool classof(const Stmt *T) {
+return T->getStmtClass() == MSPropertySubscriptExprClass;
+  }
+
+  // Iterators
+  child_range children() {
+return child_range([0], [0] + NUM_SUBEXPRS);
+  }
+};
+
 /// A Microsoft C++ @c __uuidof expression, which gets
 /// the _GUID that corresponds to the supplied type or expression.
 ///

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=254067=254066=254067=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Wed Nov 25 06:01:00 2015
@@ -2112,6 +2112,8 @@ 

[PATCH] D14982: ARM v8.1a adds Advanced SIMD instructions for Rounding Double Multiply Add/Subtract.

2015-11-25 Thread Alexandros Lamprineas via cfe-commits
labrinea created this revision.
labrinea added reviewers: jmolloy, rengolin, cfe-commits.
Herald added subscribers: rengolin, aemerson.

The following instructions are added to AArch32 instruction set:
  - VQRDMLAH: Vector Saturating Rounding Doubling Multiply Accumulate Retu   
ing High Half
  - VQRDMLSH: Vector Saturating Rounding Doubling Multiply Subtract Returning 
High Half

The following instructions are added to AArch64 instruction set:
  - SQRDMLAH: Signed Saturating Rounding Doubling Multiply Accumulate Returning 
High Half
  - SQRDMLSH: Signed Saturating Rounding Doubling Multiply Subtract Returning 
High Half

This patch adds intrinsic and ACLE macro support for these instructions, as 
well as corresponding tests.

http://reviews.llvm.org/D14982

Files:
  include/clang/Basic/arm_neon.td
  lib/Basic/Targets.cpp
  test/CodeGen/aarch64-neon-2velem.c
  test/CodeGen/aarch64-neon-intrinsics.c
  test/CodeGen/aarch64-neon-scalar-x-indexed-elem.c
  test/CodeGen/arm_neon_intrinsics.c
  test/Preprocessor/aarch64-target-features.c
  test/Preprocessor/arm-target-features.c

Index: test/Preprocessor/arm-target-features.c
===
--- test/Preprocessor/arm-target-features.c
+++ test/Preprocessor/arm-target-features.c
@@ -407,4 +407,5 @@
 // CHECK-V81A: __ARM_ARCH 8
 // CHECK-V81A: __ARM_ARCH_8_1A__ 1
 // CHECK-V81A: #define __ARM_ARCH_PROFILE 'A'
+// CHECK-V81A: __ARM_FEATURE_QRDMX 1
 // CHECK-V81A: #define __ARM_FP 0xE
Index: test/Preprocessor/aarch64-target-features.c
===
--- test/Preprocessor/aarch64-target-features.c
+++ test/Preprocessor/aarch64-target-features.c
@@ -71,6 +71,9 @@
 // CHECK-NEON: __ARM_NEON 1
 // CHECK-NEON: __ARM_NEON_FP 0xE
 
+// RUN: %clang -target aarch64-none-eabi -march=armv8.1-a -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V81A %s
+// CHECK-V81A: __ARM_FEATURE_QRDMX 1
+
 // RUN: %clang -target aarch64 -march=arm64 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-ARCH-NOT-ACCEPT %s
 // RUN: %clang -target aarch64 -march=aarch64 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-ARCH-NOT-ACCEPT %s
 // CHECK-ARCH-NOT-ACCEPT: error: the clang compiler does not support
Index: test/CodeGen/arm_neon_intrinsics.c
===
--- test/CodeGen/arm_neon_intrinsics.c
+++ test/CodeGen/arm_neon_intrinsics.c
@@ -6425,6 +6425,64 @@
 }
 
 
+// CHECK-LABEL: test_vqrdmlah_s16
+// CHECK:  vqrdmulh.s16 [[REG:d[0-9]+]], d{{[0-9]+}}, d{{[0-9]+}}
+// CHECK-NEXT: vqadd.s16 d{{[0-9]+}}, d{{[0-9]+}}, [[REG]]
+int16x4_t test_vqrdmlah_s16(int16x4_t a, int16x4_t b, int16x4_t c) {
+  return vqrdmlah_s16(a, b, c);
+}
+
+// CHECK-LABEL: test_vqrdmlah_s32
+// CHECK:  vqrdmulh.s32 [[REG:d[0-9]+]], d{{[0-9]+}}, d{{[0-9]+}}
+// CHECK-NEXT: vqadd.s32 d{{[0-9]+}}, d{{[0-9]+}}, [[REG]]
+int32x2_t test_vqrdmlah_s32(int32x2_t a, int32x2_t b, int32x2_t c) {
+  return vqrdmlah_s32(a, b, c);
+}
+
+// CHECK-LABEL: test_vqrdmlahq_s16
+// CHECK:  vqrdmulh.s16 [[REG:q[0-9]+]], q{{[0-9]+}}, q{{[0-9]+}}
+// CHECK-NEXT: vqadd.s16 q{{[0-9]+}}, q{{[0-9]+}}, [[REG]]
+int16x8_t test_vqrdmlahq_s16(int16x8_t a, int16x8_t b, int16x8_t c) {
+  return vqrdmlahq_s16(a, b, c);
+}
+
+// CHECK-LABEL: test_vqrdmlahq_s32
+// CHECK:  vqrdmulh.s32 [[REG:q[0-9]+]], q{{[0-9]+}}, q{{[0-9]+}}
+// CHECK-NEXT: vqadd.s32 q{{[0-9]+}}, q{{[0-9]+}}, [[REG]]
+int32x4_t test_vqrdmlahq_s32(int32x4_t a, int32x4_t b, int32x4_t c) {
+  return vqrdmlahq_s32(a, b, c);
+}
+
+
+// CHECK-LABEL: test_vqrdmlsh_s16
+// CHECK:  vqrdmulh.s16 [[REG:d[0-9]+]], d{{[0-9]+}}, d{{[0-9]+}}
+// CHECK-NEXT: vqsub.s16 d{{[0-9]+}}, d{{[0-9]+}}, [[REG]]
+int16x4_t test_vqrdmlsh_s16(int16x4_t a, int16x4_t b, int16x4_t c) {
+  return vqrdmlsh_s16(a, b, c);
+}
+
+// CHECK-LABEL: test_vqrdmlsh_s32
+// CHECK:  vqrdmulh.s32 [[REG:d[0-9]+]], d{{[0-9]+}}, d{{[0-9]+}}
+// CHECK-NEXT: vqsub.s32 d{{[0-9]+}}, d{{[0-9]+}}, [[REG]]
+int32x2_t test_vqrdmlsh_s32(int32x2_t a, int32x2_t b, int32x2_t c) {
+  return vqrdmlsh_s32(a, b, c);
+}
+
+// CHECK-LABEL: test_vqrdmlshq_s16
+// CHECK:  vqrdmulh.s16 [[REG:q[0-9]+]], q{{[0-9]+}}, q{{[0-9]+}}
+// CHECK-NEXT: vqsub.s16 q{{[0-9]+}}, q{{[0-9]+}}, [[REG]]
+int16x8_t test_vqrdmlshq_s16(int16x8_t a, int16x8_t b, int16x8_t c) {
+  return vqrdmlshq_s16(a, b, c);
+}
+
+// CHECK-LABEL: test_vqrdmlshq_s32
+// CHECK:  vqrdmulh.s32 [[REG:q[0-9]+]], q{{[0-9]+}}, q{{[0-9]+}}
+// CHECK-NEXT: vqsub.s32 q{{[0-9]+}}, q{{[0-9]+}}, [[REG]]
+int32x4_t test_vqrdmlshq_s32(int32x4_t a, int32x4_t b, int32x4_t c) {
+  return vqrdmlshq_s32(a, b, c);
+}
+
+
 // CHECK-LABEL: test_vqrdmulh_lane_s16
 // CHECK: vqrdmulh.s16 d{{[0-9]+}}, d{{[0-9]+}}, d{{[0-9]+}}[{{[0-9]}}]
 int16x4_t test_vqrdmulh_lane_s16(int16x4_t a, int16x4_t b) {
@@ -6450,6 +6508,64 @@
 }
 
 
+// CHECK-LABEL: test_vqrdmlah_lane_s16
+// CHECK:  vqrdmulh.s16 [[REG:d[0-9]+]], d{{[0-9]+}}, 

Re: [PATCH] D14964: [clang-tidy] Fix problem with parallel configure build

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

LG

Do you need me to submit this?


Repository:
  rL LLVM

http://reviews.llvm.org/D14964



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


Re: [PATCH] D11182: [OPENMP 4.0] Initial support for 'omp declare reduction' construct.

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

Richard, could you take a look one more time, please?


http://reviews.llvm.org/D11182



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


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

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

John, thanks a lot for the review!
Committed version has a fix according to your last comment.


Repository:
  rL LLVM

http://reviews.llvm.org/D13336



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


Re: [libcxx] r254050 - Silence a -Wmissing-braces warning in the tests; mbstate_t is defined differently on different C libraries.

2015-11-25 Thread Joerg Sonnenberger via cfe-commits
On Tue, Nov 24, 2015 at 05:38:23PM -0800, David Blaikie via cfe-commits wrote:
> Could this initialization just be written as "mbstate_t mb = {}" & avoid
> the warning entirely (I'm not entirely sure what the warning was, but I
> imagine that'd avoid it)

Or even better, just use the portable memset(, 0, sizeof(mb)).

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


Re: [PATCH] D14582: [clang-tidy] cppcoreguidelines-pro-bounds-pointer-arithmetic: ignore generated pointer arithmetic

2015-11-25 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Sorry for the delay, I was sick and didn't read mail.

Looks good with a nit. Thanks for the fix!



Comment at: clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp:28
@@ -28,1 +27,3 @@
+ hasType(pointerType()),
+ 
unless(hasLHS(ignoringImpCasts(declRefExpr(to(isImplicit()))
   .bind("expr"),

nit: Does this still fit to 80 characters? I mean, clang-format, please ;)


http://reviews.llvm.org/D14582



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


Re: [PATCH] D14940: [OpenMP] Update target directive codegen to use 4.5 implicit data mappings.

2015-11-25 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.


Comment at: include/clang/AST/Stmt.h:2018-2020
@@ -2016,2 +2017,5 @@
 break;
+  case VCK_ByCopy:
+assert(Var && "capturing by copy must have a variable!");
+break;
   case VCK_VLAType:

Also add assertion that only pointers anmd scalars are allowed to be captured 
by value


Comment at: lib/CodeGen/CGStmtOpenMP.cpp:139-140
@@ -112,2 +138,4 @@
   I = S.captures().begin();
-  for (auto *FD : RD->fields()) {
+  for (auto FI = RD->field_begin(), FE = RD->field_end(); FI != FE;
+   ++FI, ++Cnt, ++I) {
+auto *FD = *FI;

Turn back to range-based loop


Comment at: lib/Sema/SemaOpenMP.cpp:818-819
@@ +817,4 @@
+// captures in that those cases.
+IsByRef = isa(Ty) || isa(Ty) ||
+  isa(Ty);
+  }

Wow. I think it is just enough to check !Ty->isScalarType().


http://reviews.llvm.org/D14940



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


r254133 - Use range-based for loops. NFC

2015-11-25 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Wed Nov 25 23:10:07 2015
New Revision: 254133

URL: http://llvm.org/viewvc/llvm-project?rev=254133=rev
Log:
Use range-based for loops. NFC

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

Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=254133=254132=254133=diff
==
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Wed Nov 25 23:10:07 2015
@@ -278,8 +278,8 @@ bool DiagnosticsEngine::setDiagnosticGro
 return true;
 
   // Perform the mapping change.
-  for (unsigned i = 0, e = GroupDiags.size(); i != e; ++i) {
-DiagnosticMapping  = 
GetCurDiagState()->getOrAddMapping(GroupDiags[i]);
+  for (diag::kind Diag : GroupDiags) {
+DiagnosticMapping  = GetCurDiagState()->getOrAddMapping(Diag);
 
 if (Info.getSeverity() == diag::Severity::Error ||
 Info.getSeverity() == diag::Severity::Fatal)
@@ -309,8 +309,8 @@ bool DiagnosticsEngine::setDiagnosticGro
 return true;
 
   // Perform the mapping change.
-  for (unsigned i = 0, e = GroupDiags.size(); i != e; ++i) {
-DiagnosticMapping  = 
GetCurDiagState()->getOrAddMapping(GroupDiags[i]);
+  for (diag::kind Diag : GroupDiags) {
+DiagnosticMapping  = GetCurDiagState()->getOrAddMapping(Diag);
 
 if (Info.getSeverity() == diag::Severity::Fatal)
   Info.setSeverity(diag::Severity::Error);
@@ -329,9 +329,9 @@ void DiagnosticsEngine::setSeverityForAl
   Diags->getAllDiagnostics(Flavor, AllDiags);
 
   // Set the mapping.
-  for (unsigned i = 0, e = AllDiags.size(); i != e; ++i)
-if (Diags->isBuiltinWarningOrExtension(AllDiags[i]))
-  setSeverity(AllDiags[i], Map, Loc);
+  for (diag::kind Diag : AllDiags)
+if (Diags->isBuiltinWarningOrExtension(Diag))
+  setSeverity(Diag, Map, Loc);
 }
 
 void DiagnosticsEngine::Report(const StoredDiagnostic ) {


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


Re: [PATCH] D15006: Driver: Better detection of mingw-gcc

2015-11-25 Thread Yaron Keren via cfe-commits
yaron.keren added a comment.

This always searches for something-gcc and then discards the result if sysroot 
was provided, which is a waste.
Move the searching to a helper function and then it can be done only if sysroot 
was not provided, as it is now.

The break is needed to avoid looking for mingw32-gcc after 
x86_64-w64-mingw32-gcc was already found. It's a wasted search.


http://reviews.llvm.org/D15006



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