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

2016-01-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 2 inline comments as done.
danielmarjamaki added a comment.

For information, I am testing this patch right now.. it will take a while 1-2 
days.


http://reviews.llvm.org/D13126



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


Re: [PATCH] D16113: [clang-tdiy] Add header file extension configuration support.

2016-01-26 Thread Haojian Wu via cfe-commits
hokein added a comment.

ping @alexfh.


http://reviews.llvm.org/D16113



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


Re: [PATCH] D16310: new clang-tidy checker misc-long-cast

2016-01-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added a comment.

For information I have now tested latest patch.

Statistics:
projects: 1804
files:85976
warnings: 100

There were some new interesting warnings and imho they were TP.


http://reviews.llvm.org/D16310



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


Re: [PATCH] D15283: [ARMv8-M] Add Clang targeting for ARMv8-M Baseline/Mainline

2016-01-26 Thread Bradley Smith via cfe-commits
bsmith added a comment.

Now that the LLVM side of this is committed, it would be great to get this 
reviewed also, thanks.


Repository:
  rL LLVM

http://reviews.llvm.org/D15283



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


[PATCH] D16572: PR23057: fix use-after-free due to local token buffer in ParseCXXAmbiguousParenExpression

2016-01-26 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin created this revision.
DmitryPolukhin added a reviewer: rjmccall.
DmitryPolukhin added a subscriber: cfe-commits.

To completely eliminate use-after-free in this place I had to copy tokens into 
new array and pass ownership. As far as I understand the code it is not 
possible to guarantee that all inserted tokens are consumed before exiting from 
this function. Depending on how many tokens were consumed before SkipUntil is 
called, it may not happen due to unbalanced brackets, etc. Other places where 
EnterTokenStream is called usually pass vector that some class owns but here it 
is not possible because this place can be called recursively.

http://reviews.llvm.org/D16572

Files:
  lib/Parse/ParseExprCXX.cpp
  test/Parser/cxx-ambig-paren-expr-asan.cpp

Index: test/Parser/cxx-ambig-paren-expr-asan.cpp
===
--- /dev/null
+++ test/Parser/cxx-ambig-paren-expr-asan.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+
+// This syntax error used to cause use-after free due to token local buffer
+// in ParseCXXAmbiguousParenExpression.
+int H((int()[)]);
+// expected-error@-1 {{expected expression}}
+// expected-error@-2 {{expected ']'}}
+// expected-note@-3 {{to match this '['}}
Index: lib/Parse/ParseExprCXX.cpp
===
--- lib/Parse/ParseExprCXX.cpp
+++ lib/Parse/ParseExprCXX.cpp
@@ -3083,10 +3083,17 @@
 
   // The current token should go after the cached tokens.
   Toks.push_back(Tok);
+
+  // Make a copy of stored token to pass ownership to EnterTokenStream 
function.
+  // This copy is required because we may exit from this function when some
+  // tokens are not consumed yet.
+  Token *Buffer = new Token[Toks.size()];
+  std::copy(Toks.begin(), Toks.end(), Buffer);
+
   // Re-enter the stored parenthesized tokens into the token stream, so we may
   // parse them now.
-  PP.EnterTokenStream(Toks.data(), Toks.size(),
-  true/*DisableMacroExpansion*/, false/*OwnsTokens*/);
+  PP.EnterTokenStream(Buffer, Toks.size(),
+  true/*DisableMacroExpansion*/, true/*OwnsTokens*/);
   // Drop the current token and bring the first cached one. It's the same token
   // as when we entered this function.
   ConsumeAnyToken();


Index: test/Parser/cxx-ambig-paren-expr-asan.cpp
===
--- /dev/null
+++ test/Parser/cxx-ambig-paren-expr-asan.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+
+// This syntax error used to cause use-after free due to token local buffer
+// in ParseCXXAmbiguousParenExpression.
+int H((int()[)]);
+// expected-error@-1 {{expected expression}}
+// expected-error@-2 {{expected ']'}}
+// expected-note@-3 {{to match this '['}}
Index: lib/Parse/ParseExprCXX.cpp
===
--- lib/Parse/ParseExprCXX.cpp
+++ lib/Parse/ParseExprCXX.cpp
@@ -3083,10 +3083,17 @@
 
   // The current token should go after the cached tokens.
   Toks.push_back(Tok);
+
+  // Make a copy of stored token to pass ownership to EnterTokenStream function.
+  // This copy is required because we may exit from this function when some
+  // tokens are not consumed yet.
+  Token *Buffer = new Token[Toks.size()];
+  std::copy(Toks.begin(), Toks.end(), Buffer);
+
   // Re-enter the stored parenthesized tokens into the token stream, so we may
   // parse them now.
-  PP.EnterTokenStream(Toks.data(), Toks.size(),
-  true/*DisableMacroExpansion*/, false/*OwnsTokens*/);
+  PP.EnterTokenStream(Buffer, Toks.size(),
+  true/*DisableMacroExpansion*/, true/*OwnsTokens*/);
   // Drop the current token and bring the first cached one. It's the same token
   // as when we entered this function.
   ConsumeAnyToken();
___
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

2016-01-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 45972.
danielmarjamaki marked 2 inline comments as done.
danielmarjamaki added a comment.

fixed review comments, readded 'loss of sign' checking


http://reviews.llvm.org/D13126

Files:
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
  test/Analysis/conversion.c

Index: test/Analysis/conversion.c
===
--- test/Analysis/conversion.c
+++ test/Analysis/conversion.c
@@ -0,0 +1,78 @@
+// RUN: %clang_cc1 -Wno-conversion -analyze -analyzer-checker=core,alpha.core.Conversion -verify %s
+
+unsigned char U8;
+signed char S8;
+
+
+void assign(unsigned U, signed S) {
+  if (S < -10)
+U8 = S; // expected-warning {{loss of sign in implicit conversion}}
+  if (U > 300)
+S8 = U; // expected-warning {{loss of precision in implicit conversion}}
+  if (S > 10)
+U8 = S;
+  if (U < 200)
+S8 = U;
+}
+
+void init1() {
+  long long A = 1LL << 60;
+  short X = A; // expected-warning {{loss of precision in implicit conversion}}
+}
+
+void relational(unsigned U, signed S) {
+  if (S > 10) {
+if (U < S) {}
+  }
+  if (S < -10) {
+if (U < S) {} // expected-warning {{loss of sign in implicit conversion}}
+  }
+}
+
+void multiplication(unsigned U, signed S) {
+  if (S > 5)
+S = U * S;
+  if (S < -10)
+S = U * S; // expected-warning {{loss of sign}}
+}
+
+void division(unsigned U, signed S) {
+  if (S > 5)
+S = U / S;
+  if (S < -10)
+S = U / S; // expected-warning {{loss of sign}}
+}
+
+
+void dontwarn1(unsigned U, signed S) {
+  U8 = S; // It might be known that S is always 0x00-0xff.
+  S8 = U; // It might be known that U is always 0x00-0xff.
+
+  U8 = -1; // Explicit conversion.
+  S8 = ~0U; // Explicit conversion.
+  if (U > 300)
+U8 &= U; // No loss of precision since there is &=.
+}
+
+void dontwarn2(unsigned int U) {
+  if (U <= 4294967295) {}
+  if (U <= (2147483647 * 2U + 1U)) {}
+}
+
+void dontwarn3(int X) {
+  S8 = X ? 'a' : 'b';
+}
+
+// don't warn for macros
+#define DOSTUFF   ({ unsigned X = 1000; U8 = X; })
+void dontwarn4() {
+  DOSTUFF;
+}
+
+// don't warn for calculations
+// seen some fp. For instance:  c2 = (c2 >= 'A' && c2 <= 'Z') ? c2 - 'A' + 'a' : c2;
+// there is a todo in the checker to handle calculations
+void dontwarn5() {
+  signed S = -32;
+  U8 = S + 10;
+}
Index: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
+++ lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
@@ -0,0 +1,166 @@
+//=== ConversionChecker.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This defines ConversionChecker that warns about dangerous conversions where
+// there is possible loss of precision.
+//
+//===--===//
+#include "ClangSACheckers.h"
+#include "clang/AST/ParentMap.h"
+#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
+#include "clang/StaticAnalyzer/Core/Checker.h"
+#include "clang/StaticAnalyzer/Core/CheckerManager.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+
+using namespace clang;
+using namespace ento;
+
+namespace {
+class ConversionChecker : public Checker {
+  mutable std::unique_ptr BT;
+
+public:
+  void checkPreStmt(const ImplicitCastExpr *Cast, CheckerContext ) const {
+// TODO: For now we only warn about DeclRefExpr, to avoid noise. Warn for
+// calculations also.
+if (!isa(Cast->IgnoreParenImpCasts()))
+  return;
+
+// Don't warn for loss of sign/precision in macros
+if (Cast->getExprLoc().isMacroID())
+  return;
+
+// Get Parent.
+const ParentMap  = C.getLocationContext()->getParentMap();
+const Stmt *Parent = PM.getParent(Cast);
+if (!Parent)
+  return;
+
+// Loss of sign/precision in binary operation..
+if (const auto *B = dyn_cast(Parent)) {
+  BinaryOperator::Opcode Opc = B->getOpcode();
+  if (Opc == BO_Assign || Opc == BO_AddAssign || Opc == BO_SubAssign ||
+  Opc == BO_MulAssign) {
+diagnoseLossOfSign(Cast, C);
+diagnoseLossOfPrecision(Cast, C);
+  } else if (B->isRelationalOp() || B->isMultiplicativeOp()) {
+diagnoseLossOfSign(Cast, C);
+  }
+} else if (isa(Parent)) {
+  diagnoseLossOfSign(Cast, C);
+  diagnoseLossOfPrecision(Cast, C);
+}
+  }
+
+private:
+  void diagnoseLossOfPrecision(const ImplicitCastExpr *Cast,
+   CheckerContext ) const;
+  void diagnoseLossOfSign(const ImplicitCastExpr 

Re: [PATCH] D15897: [libc++] Silence warning about padding inserted at the tail of struct _Rep_base

2016-01-26 Thread Joerg Sonnenberger via cfe-commits
joerg added a comment.

As I said on IRC, it might be useful to set -Wpadding -Wno-error=padding, but I 
don't think the current state adds value. So removing the option is certainly 
an acceptable step forward to me.


http://reviews.llvm.org/D15897



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


Re: [PATCH] D15721: [Sema] Fix ICE on casting a vector of bools to a vector of T

2016-01-26 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

OpenCL side seems fine! Thanks for adding OpenCL diagnostic btw. I think we 
will also need to forbid the invalid conversions too at some point.



Comment at: lib/Sema/SemaExpr.cpp:5715
@@ +5714,3 @@
+  // when compiling code as e.g. C++)
+  uint64_t srcEltSize =
+  srcEltTy->isBooleanType() ? 1 : Context.getTypeSize(srcEltTy);

Ok, I see now. I think your code here makes sense.

I am just generally a bit confused about how it should work. If I look at a 
slightly different example:

  typedef __attribute__((__ext_vector_type__(4))) bool BoolVector; 
  typedef __attribute__((__ext_vector_type__(1))) int IntVector;

  int main() {
BoolVector bv;
bool b=1;
bv.s1 = b;
  }

this generates in IR:
  store <4 x i1> %2, <4 x i1>* %bv

seems a bit odd to see a store of 4 bits. Would it be changed by a 
middlend/backend then?


Comment at: lib/Sema/SemaType.cpp:2191
@@ +2190,3 @@
+  // Additionally, OpenCL prohibits vectors of booleans (they're considered a
+  // reserved data type under Section 6.1.4), but we do allow their use outside
+  // of OpenCL.

Could you change (there can be differences depending on a language version):

under Section 6.1.4 -> OpenCL v2.0 s6.1.4


http://reviews.llvm.org/D15721



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


Re: [PATCH] D16040: [OpenCL] Refine OpenCLImageAccessAttr to OpenCLAccessAttr

2016-01-26 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: lib/Sema/SemaDeclAttr.cpp:5705
@@ -5669,8 +5704,3 @@
 
-  // Walk the declarator structure, applying decl attributes that were in a 
type
-  // position to the decl itself.  This handles cases like:
-  //   int *__attr__(x)** D;
-  // when X is a decl attribute.
-  for (unsigned i = 0, e = PD.getNumTypeObjects(); i != e; ++i)
-if (const AttributeList *Attrs = PD.getTypeObject(i).getAttrs())
-  ProcessDeclAttributeList(S, D, Attrs, /*IncludeCXX11Attributes=*/false);
+  // Skip pipe type, it will be processed twice with its element type
+  const ParmVarDecl *PDecl = llvm::dyn_cast(D);

Do you mean to remove "twice" here? As I think that's what you are trying to 
avoid.


Comment at: test/Parser/opencl-image-access.cl:2
@@ -1,2 +1,3 @@
 // RUN: %clang_cc1 %s -fsyntax-only
+// RUN: %clang_cc1 %s -fsyntax-only -cl-std=CL2.0 -DCL20
 

please, add -verify flag


Comment at: test/Parser/opencl-image-access.cl:9
@@ -7,1 +8,3 @@
+#if CL20
 __kernel void f__rw(__read_write image2d_t a) { }
+#endif

Btw, I can see that read_write is now accepted even if -cl-std=CL1.1. So 
essentially you don't need to add CL20 checks here.

But I might prepare a quick fix of it afterwards.  


Comment at: test/SemaOpenCL/invalid-access-qualifier.cl:11
@@ +10,3 @@
+#ifdef CL20
+void test4(read_write image1d_t i){} 
+

this is being tested in test/Parser/opencl-image-access.cl already


http://reviews.llvm.org/D16040



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


Re: r258720 - [MSVC Compat] Only warn for unknown clang-cl arguments

2016-01-26 Thread Renato Golin via cfe-commits
On 26 January 2016 at 01:56, Ehsan Akhgari  wrote:
> OK, I reverted the test in r258772.

Thanks!

Ok, the error code with no output will make for an interesting
investigation... :)

I'll try to collect as much info as possible. In the meantime, if you
have any insights, just let me know.

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


Re: [PATCH] D15373: Fix for bug 25786 - Assertion "Chunk.Kind == DeclaratorChunk::Function" failed with regparm attribute.

2016-01-26 Thread Alexander Makarov via cfe-commits
a.makarov added a comment.

Ping


http://reviews.llvm.org/D15373



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


r258804 - [OPENMP 4.5] Allow arrays in 'reduction' clause.

2016-01-26 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Tue Jan 26 06:20:39 2016
New Revision: 258804

URL: http://llvm.org/viewvc/llvm-project?rev=258804=rev
Log:
[OPENMP 4.5] Allow arrays in 'reduction' clause.
OpenMP 4.5, alogn with array sections, allows to use variables of array type in 
reductions.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/for_reduction_codegen.cpp
cfe/trunk/test/OpenMP/for_reduction_messages.cpp
cfe/trunk/test/OpenMP/for_simd_reduction_messages.cpp
cfe/trunk/test/OpenMP/parallel_for_reduction_messages.cpp
cfe/trunk/test/OpenMP/parallel_for_simd_reduction_messages.cpp
cfe/trunk/test/OpenMP/parallel_reduction_messages.cpp
cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp
cfe/trunk/test/OpenMP/sections_reduction_messages.cpp
cfe/trunk/test/OpenMP/simd_reduction_messages.cpp
cfe/trunk/test/OpenMP/teams_reduction_messages.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=258804=258803=258804=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jan 26 06:20:39 
2016
@@ -7847,8 +7847,6 @@ def warn_omp_loop_64_bit_var : Warning<
   InGroup;
 def err_omp_unknown_reduction_identifier : Error<
   "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', 
'^', '&&', '||', 'min' or 'max'">;
-def err_omp_reduction_type_array : Error<
-  "a reduction list item with array type %0">;
 def err_omp_reduction_ref_type_arg : Error<
   "argument of OpenMP clause 'reduction' must reference the same object in all 
threads">;
 def err_omp_clause_not_arithmetic_type_arg : Error<

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=258804=258803=258804=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Tue Jan 26 06:20:39 2016
@@ -967,26 +967,6 @@ CGOpenMPRuntime::createRuntimeFunction(O
   return RTLFn;
 }
 
-static llvm::Value *getTypeSize(CodeGenFunction , QualType Ty) {
-  auto  = CGF.getContext();
-  llvm::Value *Size = nullptr;
-  auto SizeInChars = C.getTypeSizeInChars(Ty);
-  if (SizeInChars.isZero()) {
-// getTypeSizeInChars() returns 0 for a VLA.
-while (auto *VAT = C.getAsVariableArrayType(Ty)) {
-  llvm::Value *ArraySize;
-  std::tie(ArraySize, Ty) = CGF.getVLASize(VAT);
-  Size = Size ? CGF.Builder.CreateNUWMul(Size, ArraySize) : ArraySize;
-}
-SizeInChars = C.getTypeSizeInChars(Ty);
-assert(!SizeInChars.isZero());
-Size = CGF.Builder.CreateNUWMul(
-Size, llvm::ConstantInt::get(CGF.SizeTy, SizeInChars.getQuantity()));
-  } else
-Size = llvm::ConstantInt::get(CGF.SizeTy, SizeInChars.getQuantity());
-  return Size;
-}
-
 llvm::Constant *CGOpenMPRuntime::createForStaticInitFunction(unsigned IVSize,
  bool IVSigned) {
   assert((IVSize == 32 || IVSize == 64) &&
@@ -1655,7 +1635,7 @@ void CGOpenMPRuntime::emitSingleRegion(C
 auto *CpyFn = emitCopyprivateCopyFunction(
 CGM, CGF.ConvertTypeForMem(CopyprivateArrayTy)->getPointerTo(),
 CopyprivateVars, SrcExprs, DstExprs, AssignmentOps);
-auto *BufSize = getTypeSize(CGF, CopyprivateArrayTy);
+auto *BufSize = CGF.getTypeSize(CopyprivateArrayTy);
 Address CL =
   CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(CopyprivateList,
   CGF.VoidPtrTy);
@@ -2806,7 +2786,7 @@ void CGOpenMPRuntime::emitTaskCall(
   C.getPointerType(KmpTaskTWithPrivatesQTy);
   auto *KmpTaskTWithPrivatesTy = CGF.ConvertType(KmpTaskTWithPrivatesQTy);
   auto *KmpTaskTWithPrivatesPtrTy = KmpTaskTWithPrivatesTy->getPointerTo();
-  auto *KmpTaskTWithPrivatesTySize = getTypeSize(CGF, KmpTaskTWithPrivatesQTy);
+  auto *KmpTaskTWithPrivatesTySize = CGF.getTypeSize(KmpTaskTWithPrivatesQTy);
   QualType SharedsPtrTy = C.getPointerType(SharedsTy);
 
   // Emit initial values for private copies (if any).
@@ -3006,7 +2986,7 @@ void CGOpenMPRuntime::emitTaskCall(
 llvm::Value *UpIntPtr = CGF.Builder.CreatePtrToInt(UpAddr, CGM.SizeTy);
 Size = CGF.Builder.CreateNUWSub(UpIntPtr, LowIntPtr);
   } else
-Size = getTypeSize(CGF, Ty);
+Size = CGF.getTypeSize(Ty);
   auto Base = CGF.MakeAddrLValue(
   CGF.Builder.CreateConstArrayGEP(DependenciesArray, i, 
DependencySize),
   KmpDependInfoTy);
@@ -3255,17 +3235,16 

Re: [PATCH] D16529: [clang-tidy] Add modernize-raw-string-literal check

2016-01-26 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 46101.
LegalizeAdulthood marked 2 inline comments as done.
LegalizeAdulthood added a comment.

Update from comments:

- leave existing raw string literals unchanged
- don't change UTF-8, UTF-16, UTF-32 or wide character string literals
- apply changes only to C++11 or later source files
- improve detection of strings with control characters


http://reviews.llvm.org/D16529

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/RawStringLiteralCheck.cpp
  clang-tidy/modernize/RawStringLiteralCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-raw-string-literal.rst
  test/clang-tidy/modernize-raw-string-literal.cpp

Index: test/clang-tidy/modernize-raw-string-literal.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-raw-string-literal.cpp
@@ -0,0 +1,65 @@
+// RUN: %check_clang_tidy %s modernize-raw-string-literal %t
+
+char const *const BackSlash{"goink\\frob"};
+// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: escaped string literal can be written as a raw string literal [modernize-raw-string-literal]
+// CHECK-FIXES: {{^}}char const *const BackSlash{R"(goink\frob)"};{{$}}
+
+char const *const Bell{"goink\a\\frob"};
+char const *const BackSpace{"goink\b\\frob"};
+char const *const FormFeed{"goink\f\\frob"};
+char const *const CarraigeReturn{"goink\r\\frob"};
+char const *const HorizontalTab{"goink\t\\frob"};
+char const *const VerticalTab{"goink\v\\frob"};
+char const *const OctalNonPrintable{"\003\\"};
+char const *const HexNonPrintable{"\x03\\"};
+char const *const Delete{"\\\177"};
+char const *const AlreadyRaw{R"(foobie\\bletch)"};
+char const *const UTF8Literal{u8"foobie\\bletch"};
+char const *const UTF8RawLiteral{u8R"(foobie\\bletch)"};
+char16_t const *const UTF16Literal{u"foobie\\bletch"};
+char16_t const *const UTF16RawLiteral{uR"(foobie\\bletch)"};
+char32_t const *const UTF32Literal{U"foobie\\bletch"};
+char32_t const *const UTF32RawLiteral{UR"(foobie\\bletch)"};
+wchar_t const *const WideLiteral{L"foobie\\bletch"};
+wchar_t const *const WideRawLiteral{LR"(foobie\\bletch)"};
+
+char const *const NewLine{"goink\nfrob"};
+// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const NewLine{R"(goink{{$}}
+// CHECK-FIXES-NEXT: {{^}}frob)"};{{$}}
+
+char const *const SingleQuote{"goink\'frob"};
+// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: {{.*}} can be written as a raw string literal
+// CHECK-XFIXES: {{^}}char const *const SingleQuote{R"(goink'frob)"};{{$}}
+
+char const *const DoubleQuote{"goink\"frob"};
+// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const DoubleQuote{R"(goink"frob)"};{{$}}
+
+char const *const QuestionMark{"goink\?frob"};
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const QuestionMark{R"(goink?frob)"};{{$}}
+
+char const *const RegEx{"goink\\(one|two\\)\\?.*\\nfrob"};
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const RegEx{R"(goink\(one|two\)\\\?.*\nfrob)"};{{$}}
+
+char const *const Path{"C:\\Program Files\\Vendor\\Application\\Application.exe"};
+// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const Path{R"(C:\Program Files\Vendor\Application\Application.exe)"};{{$}}
+
+char const *const ContainsSentinel{"who\\ops)\""};
+// CHECK-MESSAGES: :[[@LINE-1]]:36: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const ContainsSentinel{R"lit(who\ops)")lit"};{{$}}
+
+char const *const ContainsDelim{"whoops)\")lit\""};
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const ContainsDelim{R"lit1(whoops)")lit")lit1"};{{$}}
+
+char const *const OctalPrintable{"\100\\"};
+// CHECK-MESSAGES: :[[@LINE-1]]:34: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const OctalPrintable{R"(@\)"};{{$}}
+
+char const *const HexPrintable{"\x40\\"};
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: {{.*}} can be written as a raw string literal
+// CHECK-FIXES: {{^}}char const *const HexPrintable{R"(@\)"};{{$}}
Index: docs/clang-tidy/checks/modernize-raw-string-literal.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-raw-string-literal.rst
@@ -0,0 +1,29 @@
+.. title:: clang-tidy - modernize-raw-string-literal
+
+modernize-raw-string-literal
+
+
+This check replaces string literals containing escaped characters with
+raw string literals.
+
+Example:
+
+.. code-blocK:: c++
+
+  

Re: [PATCH] D16047: [OpenCL] Add Sema checks for OpenCL 2.0

2016-01-26 Thread Xiuli PAN via cfe-commits
pxli168 marked 6 inline comments as done.
pxli168 added a comment.

I will separate this patch into small ones.



Comment at: lib/Sema/SemaDecl.cpp:5724
@@ +5723,3 @@
+  R->isPipeType()) {
+Diag(D.getIdentifierLoc(),
+ diag::err_opencl_type_can_only_be_used_as_function_parameter)

Anastasia wrote:
> pxli168 wrote:
> > Anastasia wrote:
> > > Some of them have to be. For example for C types that we use differently 
> > > in CL. But for CL only types do we need to check additionally that it's 
> > > CL? Do we not know it already?
> > Yes, but it seems all old code write in that way. I just follow the style.
> Ok, I think an improvement to the old code is always welcome!
OK, I think we can try here to see if it will bring some errors.


Comment at: lib/Sema/SemaDecl.cpp:7279
@@ -7228,1 +7278,3 @@
 
+  if (PT->isReserveIDT())
+return InvalidKernelParam;

Anastasia wrote:
> Is there a test for this?
I will add one.


http://reviews.llvm.org/D16047



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


Re: [PATCH] D15120: Add support for __float128 type to be used by targets that support it

2016-01-26 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added a comment.

In http://reviews.llvm.org/D15120#336891, @rjmccall wrote:

> > The C committee decided that "undefined behavior" was what they could agree 
> > on for this sort of case.
>
>
> That's only when the operand value is actually outside of the range of the 
> type, which for implementations claiming IEEE 754 compatibility means "never" 
> because of the infinities.  Even if it weren't specified, every 
> implementation I know of in practice does give this defined behavior using 
> the active FP rounding rules.


The applicable wording is quoted here: http://reviews.llvm.org/D15120#310972, 
but I guess that's unimportant for the purposes this discussion now.

> Anyway, I think we're agreed that we should just give make float128_t higher 
> rank on all platforms.


Agreed.


Repository:
  rL LLVM

http://reviews.llvm.org/D15120



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


Re: [PATCH] D15120: Add support for __float128 type to be used by targets that support it

2016-01-26 Thread John McCall via cfe-commits
rjmccall added a comment.

In http://reviews.llvm.org/D15120#336996, @hubert.reinterpretcast wrote:

> In http://reviews.llvm.org/D15120#336891, @rjmccall wrote:
>
> > > The C committee decided that "undefined behavior" was what they could 
> > > agree on for this sort of case.
> >
> >
> > That's only when the operand value is actually outside of the range of the 
> > type, which for implementations claiming IEEE 754 compatibility means 
> > "never" because of the infinities.  Even if it weren't specified, every 
> > implementation I know of in practice does give this defined behavior using 
> > the active FP rounding rules.
>
>
> The applicable wording is quoted here: http://reviews.llvm.org/D15120#310972, 
> but I guess that's unimportant for the purposes this discussion now.


Oh, I see, you were referring to an FP->FP conversion rule, whereas I was still 
talking about the int->FP conversion rule as an example where C accepts 
converting to a common FP type even when it loses precision.

That TS rule is extremely strange; I wonder whether they really mean 
"undefined", or if they just mean "implementation-defined", or if they just 
meant to say that it's UB if the original value isn't a member of the result 
type.  I really don't know why you would intentionally give an entire 
statically-determined operation dynamically undefined behavior instead of 
simply making it ill-formed.  Sometimes TSes aren't drafted very carefully.

Oh well, a question for another day.


Repository:
  rL LLVM

http://reviews.llvm.org/D15120



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


Re: [PATCH] D16582: fix array index out of bounds

2016-01-26 Thread Daniel Marjamäki via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258911: Fix array index out of bounds (authored by 
danielmarjamaki).

Changed prior to commit:
  http://reviews.llvm.org/D16582?vs=45991=46102#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16582

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

Index: cfe/trunk/lib/Driver/MSVCToolChain.cpp
===
--- cfe/trunk/lib/Driver/MSVCToolChain.cpp
+++ cfe/trunk/lib/Driver/MSVCToolChain.cpp
@@ -141,8 +141,8 @@
   nextKey++;
 size_t partialKeyLength = keyEnd - keyPath;
 char partialKey[256];
-if (partialKeyLength > sizeof(partialKey))
-  partialKeyLength = sizeof(partialKey);
+if (partialKeyLength >= sizeof(partialKey))
+  partialKeyLength = sizeof(partialKey) - 1;
 strncpy(partialKey, keyPath, partialKeyLength);
 partialKey[partialKeyLength] = '\0';
 HKEY hTopKey = NULL;


Index: cfe/trunk/lib/Driver/MSVCToolChain.cpp
===
--- cfe/trunk/lib/Driver/MSVCToolChain.cpp
+++ cfe/trunk/lib/Driver/MSVCToolChain.cpp
@@ -141,8 +141,8 @@
   nextKey++;
 size_t partialKeyLength = keyEnd - keyPath;
 char partialKey[256];
-if (partialKeyLength > sizeof(partialKey))
-  partialKeyLength = sizeof(partialKey);
+if (partialKeyLength >= sizeof(partialKey))
+  partialKeyLength = sizeof(partialKey) - 1;
 strncpy(partialKey, keyPath, partialKeyLength);
 partialKey[partialKeyLength] = '\0';
 HKEY hTopKey = NULL;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-01-26 Thread Richard Trieu via cfe-commits
rtrieu added a comment.

It looks like you are limiting to one diagnostic per printf, no matter the 
number of format strings.  How is the case when multiple format strings would 
trigger the warning?


http://reviews.llvm.org/D15636



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


Re: [PATCH] D16040: [OpenCL] Refine OpenCLImageAccessAttr to OpenCLAccessAttr

2016-01-26 Thread Xiuli PAN via cfe-commits
pxli168 added inline comments.


Comment at: test/Parser/opencl-image-access.cl:9
@@ -7,1 +8,3 @@
+#if CL20
 __kernel void f__rw(__read_write image2d_t a) { }
+#endif

Anastasia wrote:
> Btw, I can see that read_write is now accepted even if -cl-std=CL1.1. So 
> essentially you don't need to add CL20 checks here.
> 
> But I might prepare a quick fix of it afterwards.  
Yes, this is what this patch added in. It will check if read_write used earlier 
than CL2.0 as the spec said.


Comment at: test/SemaOpenCL/invalid-access-qualifier.cl:11
@@ +10,3 @@
+#ifdef CL20
+void test4(read_write image1d_t i){} 
+

Anastasia wrote:
> this is being tested in test/Parser/opencl-image-access.cl already
I will remove it.


http://reviews.llvm.org/D16040



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


r258911 - Fix array index out of bounds

2016-01-26 Thread Daniel Marjamaki via cfe-commits
Author: danielmarjamaki
Date: Wed Jan 27 01:33:50 2016
New Revision: 258911

URL: http://llvm.org/viewvc/llvm-project?rev=258911=rev
Log:
Fix array index out of bounds

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

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

Modified: cfe/trunk/lib/Driver/MSVCToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MSVCToolChain.cpp?rev=258911=258910=258911=diff
==
--- cfe/trunk/lib/Driver/MSVCToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/MSVCToolChain.cpp Wed Jan 27 01:33:50 2016
@@ -141,8 +141,8 @@ static bool getSystemRegistryString(cons
   nextKey++;
 size_t partialKeyLength = keyEnd - keyPath;
 char partialKey[256];
-if (partialKeyLength > sizeof(partialKey))
-  partialKeyLength = sizeof(partialKey);
+if (partialKeyLength >= sizeof(partialKey))
+  partialKeyLength = sizeof(partialKey) - 1;
 strncpy(partialKey, keyPath, partialKeyLength);
 partialKey[partialKeyLength] = '\0';
 HKEY hTopKey = NULL;


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


Re: [PATCH] D16535: [clang-tidy] Check to find unintended semicolons that changes the semantics.

2016-01-26 Thread Gábor Horváth via cfe-commits
xazax.hun updated this revision to Diff 45949.
xazax.hun added a comment.

- Fixed the nits pointed out by the review.


http://reviews.llvm.org/D16535

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/SuspiciousSemicolonCheck.cpp
  clang-tidy/misc/SuspiciousSemicolonCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-suspicious-semicolon.rst
  test/clang-tidy/misc-suspicious-semicolon.cpp

Index: test/clang-tidy/misc-suspicious-semicolon.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-suspicious-semicolon.cpp
@@ -0,0 +1,95 @@
+// RUN: %check_clang_tidy %s misc-suspicious-semicolon %t
+
+int x = 5;
+
+void nop();
+
+void correct1()
+{
+	if(x < 5) nop();
+}
+
+void correct2()
+{
+	if(x == 5)
+		nop();
+}
+
+void correct3()
+{
+	if(x > 5)
+	{
+		nop();
+	}
+}
+
+void fail1()
+{
+  if(x > 5); nop();
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: potentially unintended semicolon [misc-suspicious-semicolon]
+  // CHECK-FIXES: if(x > 5) nop();
+}
+
+void fail2()
+{
+	if(x == 5);
+		nop();
+  // CHECK-MESSAGES: :[[@LINE-2]]:12: warning: potentially unintended semicolon [misc-suspicious-semicolon]
+  // CHECK-FIXES: if(x == 5){{$}}
+}
+
+void fail3()
+{
+	if(x < 5);
+	{
+		nop();
+	}
+  // CHECK-MESSAGES: :[[@LINE-4]]:11: warning: potentially unintended semicolon
+  // CHECK-FIXES: if(x < 5){{$}}
+}
+
+void correct4()
+{
+  while(x % 5 == 1);
+  nop();
+}
+
+void correct5()
+{
+	for(int i = 0; i < x; ++i)
+		;
+}
+
+void fail4()
+{
+	for(int i = 0; i < x; ++i);
+		nop();
+  // CHECK-MESSAGES: :[[@LINE-2]]:28: warning: potentially unintended semicolon
+  // CHECK-FIXES: for(int i = 0; i < x; ++i){{$}}
+}
+
+void fail5()
+{
+	if(x % 5 == 1);
+	  nop();
+  // CHECK-MESSAGES: :[[@LINE-2]]:16: warning: potentially unintended semicolon
+  // CHECK-FIXES: if(x % 5 == 1){{$}}
+}
+
+void correct6()
+{
+	do; while(false);
+}
+
+int correct7()
+{
+  int t_num = 0;
+  char c = 'b';
+  char *s = "a";
+  if (s == "(" || s != "'" || c == '"') {
+t_num += 3;
+return (c == ')' && c == '\'');
+  }
+
+  return 0;
+}
Index: docs/clang-tidy/checks/misc-suspicious-semicolon.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/misc-suspicious-semicolon.rst
@@ -0,0 +1,72 @@
+.. title:: clang-tidy - misc-suspicious-semicolon
+
+misc-suspicious-semicolon
+=
+
+Finds most instances of stray semicolons that unexpectedly alter the meaning of
+the code. More specifically, it looks for `if`, `while`, `for` and `for-range`
+statements whose body is a single semicolon, and then analyzes the context of
+the code (e.g. indentation) in an attempt to determine whether that is
+intentional.
+
+  .. code-block:: c++
+
+if(x < y);
+{
+  x++;
+}
+
+Here the body of the `if` statement consists of only the semicolon at the end of
+the first line, and `x` will be incremented regardless of the condition.
+
+
+  .. code-block:: c++
+
+while((line = readLine(file)) != NULL);
+  processLine(line);
+
+As a result of this code, `processLine()` will only be called once, when the
+`while` loop with the empty body exits with `line == NULL`. The indentation of
+the code indicates the intention of the programmer.
+
+
+  .. code-block:: c++
+
+if(x >= y);
+x -= y;
+
+While the indentation does not imply any nesting, there is simply no valid
+reason to have an `if` statement with an empty body (but it can make sense for
+a loop).
+
+To solve the issue remove the stray semicolon or in case the empty body is
+intentional, reflect this using code indentation or put the semicolon in a new
+line. For example:
+
+  .. code-block:: c++
+
+while(readWhitespace());
+  Token t = readNextToken();
+
+Here the second line is indented in a way that suggests that it is meant to be
+the body of the `while` loop - whose body is in fact empty, becasue of the
+semicolon at the end of the first line.
+
+Either remove the indentation from the second line:
+
+  .. code-block:: c++
+
+while(readWhitespace());
+Token t = readNextToken();
+
+... or move the semicolon from the end of the first line to a new line:
+
+  .. code-block:: c++
+
+while(readWhitespace())
+  ;
+
+  Token t = readNextToken();
+
+In this case the check will assume that you know what you are doing, and will
+not raise a warning.
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -58,6 +58,7 @@
misc-sizeof-container
misc-static-assert
misc-string-integer-assignment
+   misc-suspicious-semicolon
misc-swapped-arguments
misc-throw-by-value-catch-by-reference
misc-undelegated-constructor
Index: clang-tidy/misc/SuspiciousSemicolonCheck.h

Re: [PATCH] D16535: [clang-tidy] Check to find unintended semicolons that changes the semantics.

2016-01-26 Thread Gábor Horváth via cfe-commits
xazax.hun marked 5 inline comments as done.
xazax.hun added a comment.

http://reviews.llvm.org/D16535



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


Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-01-26 Thread Andy Gibbs via cfe-commits
AndyG added a comment.

Hi Richard,

Thank you for looking at my patch.  I would argue that the code

  printf(minimal ? "%i\n" : "%i: %s\n", code, msg);

is valid and should //not// cause a warning due to unused arguments since at 
least one code path uses all the arguments.  This in my view is the problem 
with the diagnostic as it currently stands.

I should expect that the following would cause the warning:

  printf(minimal ? "%i\n" : "%i: %s\n", code, msg, unused);

which indeed it still does under this patch for the argument 'unused'.  Also, 
where the compiler can determine that a code path is ever followed then it will 
still produce the warning, as in:

  printf(1 ? "%i\n" : "%i: %s\n", code, msg);

Cheers,
Andy


http://reviews.llvm.org/D15636



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


Re: [PATCH] D16566: [Clang-tidy] Fix Clang-tidy modernize-use-override warning in unittests/clang-tidy/IncludeInserterTest.cpp; other minor fixes

2016-01-26 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


Repository:
  rL LLVM

http://reviews.llvm.org/D16566



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


Re: r258720 - [MSVC Compat] Only warn for unknown clang-cl arguments

2016-01-26 Thread Ehsan Akhgari via cfe-commits
Hi Renato,

Thanks, Nico helped me diagnose and fix the test yesterday <
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160125/147979.html>.
I fixed the test accordingly in r258776 and that seems to have worked!

Cheers,
Ehsan

On Tue, Jan 26, 2016 at 7:41 AM, Renato Golin 
wrote:

> Hi,
>
> So, the results I'm getting on that RUN list is:
>
> 1. clang -cake-is-lie etc.
>
> Runs ok, prints expected error messages, returns 1.
>
> 2. clang-cl -cake-is-lie
>
> I've hit an assert on
> llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp:80:
> llvm::MCCodeGenInfo* createAArch64MCCodeGenInfo(const llvm::Triple&,
> llvm::Reloc::Model, llvm::CodeModel::Model, llvm::CodeGenOpt::Level):
> Assertion `(TT.isOSBinFormatELF() || TT.isOSBinFormatMachO()) && "Only
> expect Darwin and ELF targets"' failed.
>
> Returns with error code 254, which is the one the bot was complaining
> about. Script attached.
>
> 3. Same, with -Werror=unknown-argument
>
> Runs ok, prints expected error messages, returns 1.
>
> 4. Same, with -Wno-unknown-argument
>
> Fails on "// SILENT-NOT: error", since Clang's -v output contains:
> "-ferror-limit 19". I think you'll have to be more specific there. I'm
> not sure how this passed anywhere.
>
> 5. Clang -S
>
> Get the expected warning, returns 0.
>
> Hope that helps.
>
> cheers,
> --renato
>



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


Re: [PATCH] D16365: Do not define GXX_RTTI macro for C

2016-01-26 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith.
rsmith added a comment.

LGTM, assuming this is the same behaviour as GCC.


http://reviews.llvm.org/D16365



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


Re: [PATCH] D16066: [clang-format] Add BeforeWhileInDoWhile BraceWrapping option

2016-01-26 Thread Eric Baker via cfe-commits
ebaker355 added a comment.

Thanks for responding, and for the documentation link! It is certainly wise to 
not attempt "to supporting every single style used by a codebase somewhere in 
the wild."

I do not know of a predefined coding style that recommends this format. My 
thinking was:

- it complements the "else on new line" option
- I have seen other code formatters that offer this style option


http://reviews.llvm.org/D16066



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


Re: [PATCH] D16376: clang-tidy check: Assignment and Construction

2016-01-26 Thread Jonathan B Coe via cfe-commits
jbcoe retitled this revision from "clang-tidy check: User-defined copy without 
assignment" to "clang-tidy check: Assignment and Construction".
jbcoe updated the summary for this revision.
jbcoe set the repository for this revision to rL LLVM.
jbcoe updated this revision to Diff 45987.
jbcoe added a comment.

Rename check and restructure code to avoid repetition.


Repository:
  rL LLVM

http://reviews.llvm.org/D16376

Files:
  clang-tidy/misc/AssignmentAndConstructionCheck.cpp
  clang-tidy/misc/AssignmentAndConstructionCheck.h
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-assignment-and-construction.rst
  test/clang-tidy/misc-assignment-and-construction.cpp

Index: test/clang-tidy/misc-assignment-and-construction.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-assignment-and-construction.cpp
@@ -0,0 +1,161 @@
+// RUN: %check_clang_tidy %s misc-assignment-and-construction %t
+
+//
+// User defined copy-constructors
+//
+class A {
+  A(const A &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: class 'A' defines a copy-constructor but not a copy-assignment operator [misc-assignment-and-construction]
+};
+
+// CHECK-FIXES: class A {
+// CHECK-FIXES-NEXT: A(const A &);
+// CHECK-FIXES-NEXT: A =(const A &) = delete;
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class B {
+  B(const B &);
+  B =(const B &);
+};
+
+class C {
+  C(const C &) = default;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: class 'C' defines a copy-constructor but not a copy-assignment operator [misc-assignment-and-construction]
+};
+
+// CHECK-FIXES: class C {
+// CHECK-FIXES-NEXT: C(const C &) = default;
+// CHECK-FIXES-NEXT: C =(const C &) = default;
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class D {
+  D(const D &);
+  D =(const D &) = default;
+};
+
+class E {
+  E(const E &);
+  E =(const E &) = delete;
+};
+
+//
+// User defined copy-assignment
+//
+class A2 {
+  A2 =(const A2 &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: class 'A2' defines a copy-assignment operator but not a copy-constructor [misc-assignment-and-construction]
+};
+
+// CHECK-FIXES: class A2 {
+// CHECK-FIXES-NEXT: A2(const A2 &) = delete;
+// CHECK-FIXES-NEXT: A2 =(const A2 &);
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class B2 {
+  B2(const B2 &);
+  B2 =(const B2 &);
+};
+
+class C2 {
+  C2 =(const C2 &) = default;
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: class 'C2' defines a copy-assignment operator but not a copy-constructor [misc-assignment-and-construction]
+};
+
+// CHECK-FIXES: class C2 {
+// CHECK-FIXES-NEXT: C2(const C2 &) = default;
+// CHECK-FIXES-NEXT: C2 =(const C2 &) = default;
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class D2 {
+  D2(const D2 &) = default;
+  D2 =(const D2 &);
+};
+
+class E2 {
+  E2(const E2 &) = delete;
+  E2 =(const E2 &);
+};
+
+//
+// User defined move-constructors
+//
+class A3 {
+  A3(A3 &&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: class 'A3' defines a move-constructor but not a move-assignment operator [misc-assignment-and-construction]
+};
+
+// CHECK-FIXES: class A3 {
+// CHECK-FIXES-NEXT: A3(A3 &&);
+// CHECK-FIXES-NEXT: A3 =(A3 &&) = delete;
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class B3 {
+  B3(B3 &&);
+  B3 =(B3 &&);
+};
+
+class C3 {
+  C3(C3 &&) = default;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: class 'C3' defines a move-constructor but not a move-assignment operator [misc-assignment-and-construction]
+};
+
+// CHECK-FIXES: class C3 {
+// CHECK-FIXES-NEXT: C3(C3 &&) = default;
+// CHECK-FIXES-NEXT: C3 =(C3 &&) = default;
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class D3 {
+  D3(D3 &&);
+  D3 =(D3 &&) = default;
+};
+
+class E3 {
+  E3(E3 &&);
+  E3 =(E3 &&) = delete;
+};
+
+//
+// User defined move-assignment
+//
+class A4 {
+  A4 =(A4 &&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: class 'A4' defines a move-assignment operator but not a move-constructor [misc-assignment-and-construction]
+};
+
+// CHECK-FIXES: class A4 {
+// CHECK-FIXES-NEXT: A4(A4 &&) = delete;
+// CHECK-FIXES-NEXT: A4 =(A4 &&);
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class B4 {
+  B4(B4 &&);
+  B4 =(B4 &&);
+};
+
+class C4 {
+  C4 =(C4 &&) = default;
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: class 'C4' defines a move-assignment operator but not a move-constructor [misc-assignment-and-construction]
+};
+
+// CHECK-FIXES: class C4 {
+// CHECK-FIXES-NEXT: C4(C4 &&) = default;
+// CHECK-FIXES-NEXT: C4 =(C4 &&) = default;
+// CHECK-FIXES-NEXT: //
+// CHECK-FIXES-NEXT: };
+
+class D4 {
+  D4(D4 &&) = default;
+  D4 =(D4 &&);
+};
+
+class E4 {
+  E4(E4 &&) = delete;
+  E4 =(E4 &&);
+};
Index: docs/clang-tidy/checks/misc-assignment-and-construction.rst
===
--- /dev/null
+++ 

Re: [PATCH] D16066: [clang-format] Add BeforeWhileInDoWhile BraceWrapping option

2016-01-26 Thread Daniel Jasper via cfe-commits
djasper added a comment.

Feel free to leave this patch around. Maybe somebody else comes up with 
something that meets the other criteria ;-).

Me personally, I just think that seeing "while (1);" on a single line is quite 
misleading. But maybe that is just me.


http://reviews.llvm.org/D16066



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


Re: [PATCH] D16066: [clang-format] Add BeforeWhileInDoWhile BraceWrapping option

2016-01-26 Thread Eric Baker via cfe-commits
ebaker355 reclaimed this revision.
ebaker355 added a comment.

Ok, cool! :) Thanks!


http://reviews.llvm.org/D16066



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


[PATCH] D16579: Warn if friend function depends on template parameters.

2016-01-26 Thread Serge Pavlov via cfe-commits
sepavloff created this revision.
sepavloff added a subscriber: cfe-commits.

Declaration of friend function may depend on template parameters,
however it does not become a template function:

template class C1 {
  friend void func(T x);
};

It may be not obvious for user, so compiler could emit a warning in
such case. This patch implements appropriate warning, the wording is
taken from GCC message. The patch fixes PR23342.

http://reviews.llvm.org/D16579

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDecl.cpp
  test/CXX/drs/dr3xx.cpp
  test/CXX/drs/dr5xx.cpp
  test/CXX/temp/temp.decls/temp.friend/p1.cpp
  test/PCH/cxx-templates.cpp
  test/PCH/cxx-templates.h
  test/SemaCXX/friend.cpp
  test/SemaCXX/overload-call.cpp

Index: test/SemaCXX/overload-call.cpp
===
--- test/SemaCXX/overload-call.cpp
+++ test/SemaCXX/overload-call.cpp
@@ -566,13 +566,15 @@
   // Ensure that overload resolution attempts to complete argument types when
   // performing ADL.
   template struct S {
-friend int f(const S&);
+friend int f(const S&);  // expected-warning{{friend declaration 'IncompleteArg::f' declares a non-template function}}
+ // expected-note@-1{{if this is not what you intended, make sure the function template has already been declared and add <> after the function name here}}
   };
   extern S s;
   int k = f(s);
 
   template struct Op {
-friend bool operator==(const Op &, const Op &);
+friend bool operator==(const Op &, const Op &);  // expected-warning{{friend declaration 'IncompleteArg::operator==' declares a non-template function}}
+ // expected-note@-1{{if this is not what you intended, make sure the function template has already been declared and add <> after the function name here}}
   };
   extern Op op;
   bool b = op == op;
Index: test/SemaCXX/friend.cpp
===
--- test/SemaCXX/friend.cpp
+++ test/SemaCXX/friend.cpp
@@ -21,7 +21,8 @@
   template  struct Outer {
 void foo(T);
 struct Inner {
-  friend void Outer::foo(T);
+  friend void Outer::foo(T);  // expected-warning{{friend declaration 'test1::Outer::Inner::foo' declares a non-template function}}
+  // expected-note@-1{{if this is not what you intended, make sure the function template has already been declared and add <> after the function name here}}
 };
   };
 
@@ -363,3 +364,47 @@
   f_pr6954(5); // expected-error{{undeclared identifier 'f_pr6954'}}
 }
 
+
+template void pr23342_func(T x);
+template
+struct pr23342_C1 {
+  friend void pr23342_func<>(T x);
+  friend bool func(T x);  // expected-warning{{friend declaration 'func' declares a non-template function}}
+  // expected-note@-1{{if this is not what you intended, make sure the function template has already been declared and add <> after the function name here}}
+  friend bool func2(int x);
+  template friend bool func3(T2 x);
+  friend T func4();  // expected-warning{{friend declaration 'func4' declares a non-template function}}
+ // expected-note@-1{{if this is not what you intended, make sure the function template has already been declared and add <> after the function name here}}
+};
+
+namespace pr23342 {
+
+template
+struct C1 {
+  friend void pr23342_func<>(T x);
+  friend bool func(T x);  // expected-warning{{friend declaration 'pr23342::func' declares a non-template function}}
+  // expected-note@-1{{if this is not what you intended, make sure the function template has already been declared and add <> after the function name here}}
+  friend bool func2(int x);
+  template friend bool func3(T2 x);
+  friend T func4();// expected-warning{{friend declaration 'pr23342::func4' declares a non-template function}}
+   // expected-note@-1{{if this is not what you intended, make sure the function template has already been declared and add <> after the function name here}}};
+};
+
+template 
+struct Arg {
+  friend bool operator==(const Arg& lhs, T rhs) {
+   return false;
+  }
+  friend bool operator!=(const Arg& lhs, T rhs);  // expected-warning{{friend declaration 'pr23342::operator!=' declares a non-template function}}
+   // expected-note@-1{{if this is not what you intended, make sure the function template has already been declared and add <> after the function name here}}};
+};
+template 
+bool operator!=(const Arg& lhs, T rhs) {
+  return true;
+}
+bool foo() {
+  Arg arg;
+  return (arg == 42) || (arg != 42);
+}
+
+}
Index: test/PCH/cxx-templates.h
===
--- test/PCH/cxx-templates.h
+++ test/PCH/cxx-templates.h
@@ -1,4 +1,5 @@
 // Header for PCH test cxx-templates.cpp

[PATCH] D16582: fix array index out of bounds

2016-01-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki created this revision.
danielmarjamaki added a subscriber: cfe-commits.
danielmarjamaki set the repository for this revision to rL LLVM.

This little patch fixes possible array index out of bounds:

[tools/clang/lib/Driver/MSVCToolChain.cpp:147]: (error) Array 'partialKey[256]' 
accessed at index 256, which is out of bounds

There is a slight change in behaviour now. If partialKey is filled with data 
then partialData[255] is zeroed instead of partialData[256]. I thought about 
making partialData one byte bigger so partialData[256]='\0' would be ok but I 
_think_ that it is 256 elements by intention.


Repository:
  rL LLVM

http://reviews.llvm.org/D16582

Files:
  lib/Driver/MSVCToolChain.cpp

Index: lib/Driver/MSVCToolChain.cpp
===
--- lib/Driver/MSVCToolChain.cpp
+++ lib/Driver/MSVCToolChain.cpp
@@ -141,8 +141,8 @@
   nextKey++;
 size_t partialKeyLength = keyEnd - keyPath;
 char partialKey[256];
-if (partialKeyLength > sizeof(partialKey))
-  partialKeyLength = sizeof(partialKey);
+if (partialKeyLength >= sizeof(partialKey))
+  partialKeyLength = sizeof(partialKey) - 1;
 strncpy(partialKey, keyPath, partialKeyLength);
 partialKey[partialKeyLength] = '\0';
 HKEY hTopKey = NULL;


Index: lib/Driver/MSVCToolChain.cpp
===
--- lib/Driver/MSVCToolChain.cpp
+++ lib/Driver/MSVCToolChain.cpp
@@ -141,8 +141,8 @@
   nextKey++;
 size_t partialKeyLength = keyEnd - keyPath;
 char partialKey[256];
-if (partialKeyLength > sizeof(partialKey))
-  partialKeyLength = sizeof(partialKey);
+if (partialKeyLength >= sizeof(partialKey))
+  partialKeyLength = sizeof(partialKey) - 1;
 strncpy(partialKey, keyPath, partialKeyLength);
 partialKey[partialKeyLength] = '\0';
 HKEY hTopKey = NULL;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16582: fix array index out of bounds

2016-01-26 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki added reviewers: rnk, hans, chandlerc, majnemer.
danielmarjamaki added a comment.

adding reviewers according to 'svn blame' and CODE_OWNERS.txt


Repository:
  rL LLVM

http://reviews.llvm.org/D16582



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


r258813 - [Driver] Update FIXME comment now that PR4941 has been addressed.

2016-01-26 Thread Chad Rosier via cfe-commits
Author: mcrosier
Date: Tue Jan 26 09:46:29 2016
New Revision: 258813

URL: http://llvm.org/viewvc/llvm-project?rev=258813=rev
Log:
[Driver] Update FIXME comment now that PR4941 has been addressed.

The actual fix should be addressed by someone who can test on Darwin.

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

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=258813=258812=258813=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Jan 26 09:46:29 2016
@@ -5474,7 +5474,7 @@ void Clang::ConstructJob(Compilation ,
 
 // Default to -fno-builtin-str{cat,cpy} on Darwin for ARM.
 //
-// FIXME: This is disabled until clang -cc1 supports -fno-builtin-foo. PR4941.
+// FIXME: Now that PR4941 has been fixed this can be enabled.
 #if 0
   if (getToolChain().getTriple().isOSDarwin() &&
   (getToolChain().getArch() == llvm::Triple::arm ||


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


Re: [PATCH] D16566: [Clang-tidy] Fix Clang-tidy modernize-use-override warning in unittests/clang-tidy/IncludeInserterTest.cpp; other minor fixes

2016-01-26 Thread David Blaikie via cfe-commits
On Mon, Jan 25, 2016 at 6:20 PM, Eugene Zelenko via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Eugene.Zelenko created this revision.
> Eugene.Zelenko added reviewers: alexfh, aaron.ballman.
> Eugene.Zelenko added a subscriber: cfe-commits.
> Eugene.Zelenko set the repository for this revision to rL LLVM.
>
> I checked this patch on my own build on RHEL 6. Regressions were OK.
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D16566
>
> Files:
>   unittests/clang-tidy/IncludeInserterTest.cpp
>
> Index: unittests/clang-tidy/IncludeInserterTest.cpp
> ===
> --- unittests/clang-tidy/IncludeInserterTest.cpp
> +++ unittests/clang-tidy/IncludeInserterTest.cpp
> @@ -98,7 +98,7 @@
>  public:
>CXXSystemIncludeInserterCheck(StringRef CheckName, ClangTidyContext
> *Context)
>: IncludeInserterCheckBase(CheckName, Context) {}
> -  virtual ~CXXSystemIncludeInserterCheck() {}
> +  ~CXXSystemIncludeInserterCheck() override = default;
>

Perhaps we should just remove this user-declared dtor entirely? The
implicitly provided dtor will do all that by default anyway...


>
>std::vector HeadersToInclude() const override { return
> {"set"}; }
>bool IsAngledInclude() const override { return true; }
> @@ -522,7 +522,7 @@
> "insert_includes_test_header.cc"));
>  }
>
> -} // namespace
> +} // anonymous namespace
>  } // namespace tidy
>  } // namespace clang
>
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r258814 - [Driver] Make sure -fno-math-builtin option is being passed by the driver.

2016-01-26 Thread Chad Rosier via cfe-commits
Author: mcrosier
Date: Tue Jan 26 09:52:05 2016
New Revision: 258814

URL: http://llvm.org/viewvc/llvm-project?rev=258814=rev
Log:
[Driver] Make sure -fno-math-builtin option is being passed by the driver.

Support for the -fno-math-builtin option was added in r186899.  The codegen side
is being tested in test/CodeGen/nomathbuiltin.c.  The missing part was just
passing the option through the driver.

PR26317

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/CodeGen/nomathbuiltin.c
cfe/trunk/test/Driver/clang_f_opts.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=258814=258813=258814=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Jan 26 09:52:05 2016
@@ -5465,12 +5465,13 @@ void Clang::ConstructJob(Compilation ,
options::OPT_fno_apple_pragma_pack, false))
 CmdArgs.push_back("-fapple-pragma-pack");
 
+  // Process -fno-math-builtin options.
   // le32-specific flags:
   //  -fno-math-builtin: clang should not convert math builtins to intrinsics
   // by default.
-  if (getToolChain().getArch() == llvm::Triple::le32) {
+  if (Args.hasArg(options::OPT_fno_math_builtin) ||
+  getToolChain().getArch() == llvm::Triple::le32)
 CmdArgs.push_back("-fno-math-builtin");
-  }
 
 // Default to -fno-builtin-str{cat,cpy} on Darwin for ARM.
 //

Modified: cfe/trunk/test/CodeGen/nomathbuiltin.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/nomathbuiltin.c?rev=258814=258813=258814=diff
==
--- cfe/trunk/test/CodeGen/nomathbuiltin.c (original)
+++ cfe/trunk/test/CodeGen/nomathbuiltin.c Tue Jan 26 09:52:05 2016
@@ -9,4 +9,3 @@ double foo(double a, double b) {
   return pow(a, b);
 // CHECK: call {{.*}}double @pow
 }
-

Modified: cfe/trunk/test/Driver/clang_f_opts.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=258814=258813=258814=diff
==
--- cfe/trunk/test/Driver/clang_f_opts.c (original)
+++ cfe/trunk/test/Driver/clang_f_opts.c Tue Jan 26 09:52:05 2016
@@ -191,6 +191,9 @@
 // RUN: %clang -### -S -fexec-charset=iso-8859-1 -o /dev/null %s 2>&1 | 
FileCheck -check-prefix=CHECK-INVALID-INPUT-CHARSET %s
 // CHECK-INVALID-INPUT-CHARSET: error: invalid value 'iso-8859-1' in 
'-fexec-charset=iso-8859-1'
 
+// RUN: %clang -### -S -fno-math-builtin %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-MATH-BUILTIN %s
+// CHECK-NO-MATH-BUILTIN: "-fno-math-builtin"
+
 // Test that we don't error on these.
 // RUN: %clang -### -S -Werror\
 // RUN: -falign-functions -falign-functions=2 -fno-align-functions\


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


[PATCH] D16584: [libcxx] Work around for clang calling GAS after having already failed.

2016-01-26 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added reviewers: EricWF, mclow.lists, hans.
dsanders added a subscriber: cfe-commits.

This is a workaround to a clang bug which causes libcxx tests to fail in the 3.8
release. The clang bug is currently being investigated. It seems that clang
does not stop after frontend errors when using -verify and -fno-integrated-as
(or when this is the default). This patch adds -fsyntax-only to prevent GAS
from being called, fixing the libcxx failures.

PR26277

Patch by Eric Fiselier

http://reviews.llvm.org/D16584

Files:
  test/libcxx/test/format.py

Index: test/libcxx/test/format.py
===
--- test/libcxx/test/format.py
+++ test/libcxx/test/format.py
@@ -161,7 +161,7 @@
'expected-error', 'expected-no-diagnostics']
 use_verify = self.use_verify_for_fail and \
  any([tag in contents for tag in verify_tags])
-extra_flags = []
+extra_flags = ['-fsyntax-only']
 if use_verify:
 extra_flags += ['-Xclang', '-verify',
 '-Xclang', '-verify-ignore-unexpected=note']


Index: test/libcxx/test/format.py
===
--- test/libcxx/test/format.py
+++ test/libcxx/test/format.py
@@ -161,7 +161,7 @@
'expected-error', 'expected-no-diagnostics']
 use_verify = self.use_verify_for_fail and \
  any([tag in contents for tag in verify_tags])
-extra_flags = []
+extra_flags = ['-fsyntax-only']
 if use_verify:
 extra_flags += ['-Xclang', '-verify',
 '-Xclang', '-verify-ignore-unexpected=note']
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r258815 - Revert "[Driver] Make sure -fno-math-builtin option is being passed by the driver."

2016-01-26 Thread Chad Rosier via cfe-commits
Author: mcrosier
Date: Tue Jan 26 10:16:53 2016
New Revision: 258815

URL: http://llvm.org/viewvc/llvm-project?rev=258815=rev
Log:
Revert "[Driver] Make sure -fno-math-builtin option is being passed by the 
driver."

This reverts commit r258814.

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/CodeGen/nomathbuiltin.c
cfe/trunk/test/Driver/clang_f_opts.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=258815=258814=258815=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Jan 26 10:16:53 2016
@@ -5465,13 +5465,12 @@ void Clang::ConstructJob(Compilation ,
options::OPT_fno_apple_pragma_pack, false))
 CmdArgs.push_back("-fapple-pragma-pack");
 
-  // Process -fno-math-builtin options.
   // le32-specific flags:
   //  -fno-math-builtin: clang should not convert math builtins to intrinsics
   // by default.
-  if (Args.hasArg(options::OPT_fno_math_builtin) ||
-  getToolChain().getArch() == llvm::Triple::le32)
+  if (getToolChain().getArch() == llvm::Triple::le32) {
 CmdArgs.push_back("-fno-math-builtin");
+  }
 
 // Default to -fno-builtin-str{cat,cpy} on Darwin for ARM.
 //

Modified: cfe/trunk/test/CodeGen/nomathbuiltin.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/nomathbuiltin.c?rev=258815=258814=258815=diff
==
--- cfe/trunk/test/CodeGen/nomathbuiltin.c (original)
+++ cfe/trunk/test/CodeGen/nomathbuiltin.c Tue Jan 26 10:16:53 2016
@@ -9,3 +9,4 @@ double foo(double a, double b) {
   return pow(a, b);
 // CHECK: call {{.*}}double @pow
 }
+

Modified: cfe/trunk/test/Driver/clang_f_opts.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=258815=258814=258815=diff
==
--- cfe/trunk/test/Driver/clang_f_opts.c (original)
+++ cfe/trunk/test/Driver/clang_f_opts.c Tue Jan 26 10:16:53 2016
@@ -191,9 +191,6 @@
 // RUN: %clang -### -S -fexec-charset=iso-8859-1 -o /dev/null %s 2>&1 | 
FileCheck -check-prefix=CHECK-INVALID-INPUT-CHARSET %s
 // CHECK-INVALID-INPUT-CHARSET: error: invalid value 'iso-8859-1' in 
'-fexec-charset=iso-8859-1'
 
-// RUN: %clang -### -S -fno-math-builtin %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-MATH-BUILTIN %s
-// CHECK-NO-MATH-BUILTIN: "-fno-math-builtin"
-
 // Test that we don't error on these.
 // RUN: %clang -### -S -Werror\
 // RUN: -falign-functions -falign-functions=2 -fno-align-functions\


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


Re: [PATCH] D16578: [clang-tidy] bug fix: Don't warn on partial template specialization in `misc-definitions-in-headers` check.

2016-01-26 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG. Do you need me to commit the patch?


Repository:
  rL LLVM

http://reviews.llvm.org/D16578



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


Re: [PATCH] D16566: [Clang-tidy] Fix Clang-tidy modernize-use-override warning in unittests/clang-tidy/IncludeInserterTest.cpp; other minor fixes

2016-01-26 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: unittests/clang-tidy/IncludeInserterTest.cpp:101
@@ -100,3 +100,3 @@
   : IncludeInserterCheckBase(CheckName, Context) {}
-  virtual ~CXXSystemIncludeInserterCheck() {}
+  ~CXXSystemIncludeInserterCheck() override = default;
 

I'd better remove it completely.


Repository:
  rL LLVM

http://reviews.llvm.org/D16566



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


Re: r258815 - Revert "[Driver] Make sure -fno-math-builtin option is being passed by the driver."

2016-01-26 Thread Chad Rosier via cfe-commits
All,
In r258814 I upgraded the -fno-math-builtin option from a cc1 only option
to a full blown compiler option.  However, after a bit of searching I
can't seem to find documentation of this actually being a supported option
by gcc.  Therefore, I reverted the change.  I can see the potential
utility of the option, but I don't think we should add new options (that
must be supported for all of eternity) unless they really are necessary.

PR26317 should be addressed by marking the -fno-math-builtin with the
HelpHidden flag, so as to not confuse the users of clang.

Sorry for the noise..

 Chad

> Author: mcrosier
> Date: Tue Jan 26 10:16:53 2016
> New Revision: 258815
>
> URL: http://llvm.org/viewvc/llvm-project?rev=258815=rev
> Log:
> Revert "[Driver] Make sure -fno-math-builtin option is being passed by the
> driver."
>
> This reverts commit r258814.
>
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/test/CodeGen/nomathbuiltin.c
> cfe/trunk/test/Driver/clang_f_opts.c
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=258815=258814=258815=diff
> ==
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Tue Jan 26 10:16:53 2016
> @@ -5465,13 +5465,12 @@ void Clang::ConstructJob(Compilation ,
> options::OPT_fno_apple_pragma_pack, false))
>  CmdArgs.push_back("-fapple-pragma-pack");
>
> -  // Process -fno-math-builtin options.
>// le32-specific flags:
>//  -fno-math-builtin: clang should not convert math builtins to
> intrinsics
>// by default.
> -  if (Args.hasArg(options::OPT_fno_math_builtin) ||
> -  getToolChain().getArch() == llvm::Triple::le32)
> +  if (getToolChain().getArch() == llvm::Triple::le32) {
>  CmdArgs.push_back("-fno-math-builtin");
> +  }
>
>  // Default to -fno-builtin-str{cat,cpy} on Darwin for ARM.
>  //
>
> Modified: cfe/trunk/test/CodeGen/nomathbuiltin.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/nomathbuiltin.c?rev=258815=258814=258815=diff
> ==
> --- cfe/trunk/test/CodeGen/nomathbuiltin.c (original)
> +++ cfe/trunk/test/CodeGen/nomathbuiltin.c Tue Jan 26 10:16:53 2016
> @@ -9,3 +9,4 @@ double foo(double a, double b) {
>return pow(a, b);
>  // CHECK: call {{.*}}double @pow
>  }
> +
>
> Modified: cfe/trunk/test/Driver/clang_f_opts.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=258815=258814=258815=diff
> ==
> --- cfe/trunk/test/Driver/clang_f_opts.c (original)
> +++ cfe/trunk/test/Driver/clang_f_opts.c Tue Jan 26 10:16:53 2016
> @@ -191,9 +191,6 @@
>  // RUN: %clang -### -S -fexec-charset=iso-8859-1 -o /dev/null %s 2>&1 |
> FileCheck -check-prefix=CHECK-INVALID-INPUT-CHARSET %s
>  // CHECK-INVALID-INPUT-CHARSET: error: invalid value 'iso-8859-1' in
> '-fexec-charset=iso-8859-1'
>
> -// RUN: %clang -### -S -fno-math-builtin %s 2>&1 |
> FileCheck -check-prefix=CHECK-NO-MATH-BUILTIN %s
> -// CHECK-NO-MATH-BUILTIN: "-fno-math-builtin"
> -
>  // Test that we don't error on these.
>  // RUN: %clang -### -S -Werror
> \
>  // RUN: -falign-functions -falign-functions=2 -fno-align-functions
> \
>
>
> ___
> 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] D16517: ClangTidy check to flag uninitialized builtin and pointer fields.

2016-01-26 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

A high-level comment: I think, this comment 
 still applies. I'm also slightly 
concerned about having this check in misc-, since the check isn't universally 
applicable (e.g. based on a couple of discussions, I guess LLVM community would 
likely not welcome this rule), but I'd like to leave misc- enabled by default. 
So moving the check to cppcoreguidelines- makes sense to me.

More substantial comments later.


http://reviews.llvm.org/D16517



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


Re: [PATCH] D16527: [OpenMP] Parsing + sema for defaultmap clause.

2016-01-26 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258817: [OpenMP] Parsing + sema for defaultmap clause. 
(authored by arpith).

Changed prior to commit:
  http://reviews.llvm.org/D16527?vs=45856=46000#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16527

Files:
  cfe/trunk/include/clang/AST/OpenMPClause.h
  cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
  cfe/trunk/include/clang/Basic/OpenMPKinds.def
  cfe/trunk/include/clang/Basic/OpenMPKinds.h
  cfe/trunk/include/clang/Sema/Sema.h
  cfe/trunk/lib/AST/StmtPrinter.cpp
  cfe/trunk/lib/AST/StmtProfile.cpp
  cfe/trunk/lib/Basic/OpenMPKinds.cpp
  cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
  cfe/trunk/lib/Parse/ParseOpenMP.cpp
  cfe/trunk/lib/Sema/SemaOpenMP.cpp
  cfe/trunk/lib/Sema/TreeTransform.h
  cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
  cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
  cfe/trunk/test/OpenMP/target_ast_print.cpp
  cfe/trunk/test/OpenMP/target_defaultmap_messages.cpp
  cfe/trunk/tools/libclang/CIndex.cpp

Index: cfe/trunk/lib/Basic/OpenMPKinds.cpp
===
--- cfe/trunk/lib/Basic/OpenMPKinds.cpp
+++ cfe/trunk/lib/Basic/OpenMPKinds.cpp
@@ -114,6 +114,14 @@
 #define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name)
 #include "clang/Basic/OpenMPKinds.def"
 .Default(OMPC_DIST_SCHEDULE_unknown);
+  case OMPC_defaultmap:
+return llvm::StringSwitch(Str)
+#define OPENMP_DEFAULTMAP_KIND(Name)   \
+  .Case(#Name, static_cast(OMPC_DEFAULTMAP_##Name))
+#define OPENMP_DEFAULTMAP_MODIFIER(Name)   \
+  .Case(#Name, static_cast(OMPC_DEFAULTMAP_MODIFIER_##Name))
+#include "clang/Basic/OpenMPKinds.def"
+.Default(OMPC_DEFAULTMAP_unknown);
   case OMPC_unknown:
   case OMPC_threadprivate:
   case OMPC_if:
@@ -234,6 +242,20 @@
 #include "clang/Basic/OpenMPKinds.def"
 }
 llvm_unreachable("Invalid OpenMP 'dist_schedule' clause type");
+  case OMPC_defaultmap:
+switch (Type) {
+case OMPC_DEFAULTMAP_unknown:
+case OMPC_DEFAULTMAP_MODIFIER_last:
+  return "unknown";
+#define OPENMP_DEFAULTMAP_KIND(Name) \
+case OMPC_DEFAULTMAP_##Name: \
+  return #Name;
+#define OPENMP_DEFAULTMAP_MODIFIER(Name) \
+case OMPC_DEFAULTMAP_MODIFIER_##Name:\
+  return #Name;
+#include "clang/Basic/OpenMPKinds.def"
+}
+llvm_unreachable("Invalid OpenMP 'schedule' clause type");
   case OMPC_unknown:
   case OMPC_threadprivate:
   case OMPC_if:
Index: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
===
--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
@@ -2046,6 +2046,14 @@
   Writer->Writer.AddSourceLocation(C->getCommaLoc(), Record);
 }
 
+void OMPClauseWriter::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) {
+  Record.push_back(C->getDefaultmapKind());
+  Record.push_back(C->getDefaultmapModifier());
+  Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record);
+  Writer->Writer.AddSourceLocation(C->getDefaultmapModifierLoc(), Record);
+  Writer->Writer.AddSourceLocation(C->getDefaultmapKindLoc(), Record);
+}
+
 //===--===//
 // OpenMP Directives.
 //===--===//
Index: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
===
--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
@@ -1881,6 +1881,9 @@
   case OMPC_dist_schedule:
 C = new (Context) OMPDistScheduleClause();
 break;
+  case OMPC_defaultmap:
+C = new (Context) OMPDefaultmapClause();
+break;
   }
   Visit(C);
   C->setLocStart(Reader->ReadSourceLocation(Record, Idx));
@@ -2253,6 +2256,16 @@
   C->setCommaLoc(Reader->ReadSourceLocation(Record, Idx));
 }
 
+void OMPClauseReader::VisitOMPDefaultmapClause(OMPDefaultmapClause *C) {
+  C->setDefaultmapKind(
+   static_cast(Record[Idx++]));
+  C->setDefaultmapModifier(
+  static_cast(Record[Idx++]));
+  C->setLParenLoc(Reader->ReadSourceLocation(Record, Idx));
+  C->setDefaultmapModifierLoc(Reader->ReadSourceLocation(Record, Idx));
+  C->setDefaultmapKindLoc(Reader->ReadSourceLocation(Record, Idx));
+}
+
 //===--===//
 // OpenMP Directives.
 //===--===//
Index: cfe/trunk/lib/Parse/ParseOpenMP.cpp
===
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp
@@ -512,8 

Re: [PATCH] D16572: PR23057: fix use-after-free due to local token buffer in ParseCXXAmbiguousParenExpression

2016-01-26 Thread David Blaikie via cfe-commits
I don't fully understand your explanation. Is your change introducing a
memory leak? (or was the old code causing a double free (if
EnterTokenStream does take ownership of this argument)in addition to
use-after-free?)

On Tue, Jan 26, 2016 at 2:45 AM, Dmitry Polukhin via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> DmitryPolukhin created this revision.
> DmitryPolukhin added a reviewer: rjmccall.
> DmitryPolukhin added a subscriber: cfe-commits.
>
> To completely eliminate use-after-free in this place I had to copy tokens
> into new array and pass ownership. As far as I understand the code it is
> not possible to guarantee that all inserted tokens are consumed before
> exiting from this function. Depending on how many tokens were consumed
> before SkipUntil is called, it may not happen due to unbalanced brackets,
> etc. Other places where EnterTokenStream is called usually pass vector that
> some class owns but here it is not possible because this place can be
> called recursively.
>
> http://reviews.llvm.org/D16572
>
> Files:
>   lib/Parse/ParseExprCXX.cpp
>   test/Parser/cxx-ambig-paren-expr-asan.cpp
>
> Index: test/Parser/cxx-ambig-paren-expr-asan.cpp
> ===
> --- /dev/null
> +++ test/Parser/cxx-ambig-paren-expr-asan.cpp
> @@ -0,0 +1,8 @@
> +// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
> +
> +// This syntax error used to cause use-after free due to token local
> buffer
> +// in ParseCXXAmbiguousParenExpression.
> +int H((int()[)]);
> +// expected-error@-1 {{expected expression}}
> +// expected-error@-2 {{expected ']'}}
> +// expected-note@-3 {{to match this '['}}
> Index: lib/Parse/ParseExprCXX.cpp
> ===
> --- lib/Parse/ParseExprCXX.cpp
> +++ lib/Parse/ParseExprCXX.cpp
> @@ -3083,10 +3083,17 @@
>
>// The current token should go after the cached tokens.
>Toks.push_back(Tok);
> +
> +  // Make a copy of stored token to pass ownership to EnterTokenStream
> function.
> +  // This copy is required because we may exit from this function when
> some
> +  // tokens are not consumed yet.
> +  Token *Buffer = new Token[Toks.size()];
> +  std::copy(Toks.begin(), Toks.end(), Buffer);
> +
>// Re-enter the stored parenthesized tokens into the token stream, so
> we may
>// parse them now.
> -  PP.EnterTokenStream(Toks.data(), Toks.size(),
> -  true/*DisableMacroExpansion*/, false/*OwnsTokens*/);
> +  PP.EnterTokenStream(Buffer, Toks.size(),
> +  true/*DisableMacroExpansion*/, true/*OwnsTokens*/);
>// Drop the current token and bring the first cached one. It's the same
> token
>// as when we entered this function.
>ConsumeAnyToken();
>
>
>
> ___
> 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] D16517: ClangTidy check to flag uninitialized builtin and pointer fields.

2016-01-26 Thread Felix Berger via cfe-commits
flx added a comment.

In http://reviews.llvm.org/D16517#336148, @alexfh wrote:

> A high-level comment: I think, this comment 
>  still applies. I'm also slightly 
> concerned about having this check in misc-, since the check isn't universally 
> applicable (e.g. based on a couple of discussions, I guess LLVM community 
> would likely not welcome this rule), but I'd like to leave misc- enabled by 
> default. So moving the check to cppcoreguidelines- makes sense to me.
>
> More substantial comments later.


Sounds good to me. If I'm reading the original comment correctly what's missing 
would be this part:

"Issue a diagnostic when constructing an object of a trivially constructible 
type without () or {} to initialize its members. To fix: Add () or {}. "

Is that correct?

Please let me know if that changes the name of the check and whether the next 
step should be moving the check or we'll do that after a detailed review of the 
specifics.

Thanks,
Felix


http://reviews.llvm.org/D16517



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


[PATCH] D16586: Make clang AAPCS compliant w.r.t volatile bitfield accesses

2016-01-26 Thread Asiri Rathnayake via cfe-commits
rmaprath created this revision.
rmaprath added reviewers: rjmccall, jmolloy, rengolin, olista01.
rmaprath added a subscriber: cfe-commits.
Herald added a subscriber: aemerson.

Lets consider the following plain struct:
```
  struct S1 {
char a;
short b : 8;
  };
```
According to the AAPCS, the bitfield 'b' _can_ be accessed by loading its
"container" (a short in this case) and then using bit-shifting operations to
extract the actual bitfield value. However, for plain (non-volatile) bitfields,
the AAPCS does not mandate this, so compilers are free to use whatever type of
access they think is best. armcc tends to use wider accesses even when narrower
accesses are possible (like in the above example, b can be byte-loaded), whereas
clang and gcc tend to issue narrow loads/stores where available.

But things get tricky when volatile bitfields are involved:
```
  struct S2 {
char a;
volatile short b : 8;
  };
```
Now the AAPCS mandates that 'b' must be accessed through loads/stores of widths
as appropriate to the container type (Section 7.1.7.5). To complicate matters
further, AAPCS allows overlapping of bitfields with regular fields
(Section 7.1.7.4). What this means is that the storage units of 'a' and 'b'
are overlapping, where 'a' occupies the first byte of the struct and 'b' lies
on the first half-word of the struct. Loading 'b' will load 'a' as well since
'b' is loaded as a short.

Currently, clang will byte-load 'b' and is therefore not AAPCS compliant. The
purpose of this patch is to make clang respect these access widths of volatile
bitfields.

One way to fix this problem is to teach clang the concept of overlapping storage
units, this would require an overhaul of clang's structure layout code, as the
idea of distinct storage units is deeply embedded in clang's structure layout
routines. In this patch, I take the view that this confusion is only a matter of
abstraction; whether the above struct's storage is viewed as two consecutive
bytes (this is how clang lays out the struct) or as a single half-word (this is
how armcc lays out the struct) is irrelevant, the actual data of the fields will
always be at the same offset from the base of the struct. This difference of
abstraction only matters when we generate code to access the relevant fields, we
can therefore intercept those loads/stores in clang and adjust the accesses so
that they are AAPCS compliant.

http://reviews.llvm.org/D16586

Files:
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGRecordLayoutBuilder.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGen/aapcs-bitfield.c
  test/CodeGen/arm-bitfield-alignment.c

Index: test/CodeGen/arm-bitfield-alignment.c
===
--- test/CodeGen/arm-bitfield-alignment.c
+++ test/CodeGen/arm-bitfield-alignment.c
@@ -12,4 +12,4 @@
 }
 
 // CHECK: @g = external global %struct.T, align 4
-// CHECK: %{{.*}} = load i64, i64* bitcast (%struct.T* @g to i64*), align 4
+// CHECK: %{{.*}} = load i32, i32* bitcast (%struct.T* @g to i32*), align 4
Index: test/CodeGen/aapcs-bitfield.c
===
--- /dev/null
+++ test/CodeGen/aapcs-bitfield.c
@@ -0,0 +1,467 @@
+// RUN: %clang_cc1 -triple armv8-none-linux-eabi %s -emit-llvm -o - -O3 \
+// RUN:   | FileCheck %s -check-prefix=LE -check-prefix=CHECK
+// RUN: %clang_cc1 -triple armebv8-none-linux-eabi %s -emit-llvm -o - -O3 \
+// RUN:   | FileCheck %s -check-prefix=BE -check-prefix=CHECK
+
+// CHECK: %struct.st0 = type { i8, i8 }
+// CHECK: %struct.st1 = type { i16, [2 x i8] }
+// CHECK: %struct.st2 = type { i16, i8 }
+// CHECK: %struct.st3 = type { i8, i8 }
+// CHECK: %struct.st4 = type { i16, [2 x i8] }
+// CHECK: %struct.st5 = type { i16, i8 }
+// CHECK: %struct.st6 = type { i16, i8, i8 }
+// CHECK: %struct.st7b = type { i8, [3 x i8], %struct.st7a }
+// CHECK: %struct.st7a = type { i8, i8, [2 x i8] }
+// CHECK: %struct.st8 = type { i16, [2 x i8] }
+
+// A simple plain bit-field
+struct st0 {
+  // Expected masks (0s mark the bit-field):
+  // le: 0xff80 (-128)
+  // be: 0x01ff (511)
+  short c : 7;
+};
+
+// CHECK-LABEL: st0_check_load
+int st0_check_load(struct st0 *m) {
+  // LE: %[[PTR:.*]] = bitcast %struct.st0* %m to i16*
+  // LE-NEXT: %[[LD:.*]] = load i16, i16* %[[PTR]], align 2
+  // LE-NEXT: %[[CLR1:.*]] = shl i16 %[[LD]], 9
+  // LE-NEXT: %[[CLR2:.*]] = ashr exact i16 %[[CLR1]], 9
+  // LE-NEXT: %[[SEXT:.*]] = sext i16 %[[CLR2]] to i32
+  // LE-NEXT: ret i32 %[[SEXT]]
+
+  // BE: %[[PTR:.*]] = bitcast %struct.st0* %m to i16*
+  // BE-NEXT: %[[LD:.*]] = load i16, i16* %[[PTR]], align 2
+  // BE-NEXT: %[[CLR:.*]] = ashr i16 %[[LD]], 9
+  // BE-NEXT: %[[SEXT:.*]] = sext i16 %[[CLR]] to i32
+  // BE-NEXT: ret i32 %[[SEXT]]
+  return m->c;
+}
+
+// CHECK-LABEL: st0_check_store
+void st0_check_store(struct st0 *m) {
+  // LE: %[[PTR:.*]] = bitcast %struct.st0* %m to i16*
+  // LE-NEXT: %[[LD:.*]] = load i16, i16* %[[PTR]], align 2
+  // LE-NEXT: 

Re: [PATCH] D16582: fix array index out of bounds

2016-01-26 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm

This code is old and super janky. =/


Repository:
  rL LLVM

http://reviews.llvm.org/D16582



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


[PATCH] D16587: Fixed function params comparison. Updated docs and tests.

2016-01-26 Thread Cong Liu via cfe-commits
congliu created this revision.
congliu added a reviewer: alexfh.
congliu added a subscriber: cfe-commits.

"checkParamTypes" may fail if the the type of some parameter is not canonical. 
Fixed it by comparing canonical types. And added "getCanonicalType()" and 
"getCanonicalDecl()" on more places to prevent potential fail.

http://reviews.llvm.org/D16587

Files:
  clang-tidy/misc/VirtualNearMissCheck.cpp
  docs/clang-tidy/checks/misc-virtual-near-miss.rst
  test/clang-tidy/misc-virtual-near-miss.cpp

Index: test/clang-tidy/misc-virtual-near-miss.cpp
===
--- test/clang-tidy/misc-virtual-near-miss.cpp
+++ test/clang-tidy/misc-virtual-near-miss.cpp
@@ -26,12 +26,15 @@
   Derived ==(const Base &); // Should not warn: operators are ignored.
 };
 
+typedef Derived derived_type;
+
 class Father {
 public:
   Father();
   virtual void func();
   virtual Father *create(int i);
   virtual Base &();
+  virtual Base *canonical(Derived D);
 };
 
 class Mother {
@@ -70,6 +73,11 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method 'Child::decaz' has {{.*}} 'Mother::decay'
 
   operator bool();
+
+  derived_type *canonica(derived_type D);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method 'Child::canonica' has {{.*}} 'Father::canonical'
+
+
 private:
   void funk();
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method 'Child::funk' has {{.*}} 'Father::func'
Index: docs/clang-tidy/checks/misc-virtual-near-miss.rst
===
--- docs/clang-tidy/checks/misc-virtual-near-miss.rst
+++ docs/clang-tidy/checks/misc-virtual-near-miss.rst
@@ -13,5 +13,5 @@
 
   struct Derived : Base {
 virtual funk();
-// warning: Do you want to override 'func'?
+// warning: 'Derived::funk' has a similar name and the same signature as virtual method 'Base::func'; did you mean to override it?
   };
Index: clang-tidy/misc/VirtualNearMissCheck.cpp
===
--- clang-tidy/misc/VirtualNearMissCheck.cpp
+++ clang-tidy/misc/VirtualNearMissCheck.cpp
@@ -32,10 +32,14 @@
 static bool checkOverridingFunctionReturnType(const ASTContext *Context,
   const CXXMethodDecl *BaseMD,
   const CXXMethodDecl *DerivedMD) {
-  QualType BaseReturnTy =
-  BaseMD->getType()->getAs()->getReturnType();
-  QualType DerivedReturnTy =
-  DerivedMD->getType()->getAs()->getReturnType();
+  QualType BaseReturnTy = BaseMD->getType()
+  ->getAs()
+  ->getReturnType()
+  .getCanonicalType();
+  QualType DerivedReturnTy = DerivedMD->getType()
+ ->getAs()
+ ->getReturnType()
+ .getCanonicalType();
 
   if (DerivedReturnTy->isDependentType() || BaseReturnTy->isDependentType())
 return false;
@@ -54,8 +58,8 @@
   /// BTy is the class type in return type of BaseMD. For example,
   ///B* Base::md()
   /// While BRD is the declaration of B.
-  QualType DTy = DerivedReturnTy->getPointeeType();
-  QualType BTy = BaseReturnTy->getPointeeType();
+  QualType DTy = DerivedReturnTy->getPointeeType().getCanonicalType();
+  QualType BTy = BaseReturnTy->getPointeeType().getCanonicalType();
 
   const CXXRecordDecl *DRD = DTy->getAsCXXRecordDecl();
   const CXXRecordDecl *BRD = BTy->getAsCXXRecordDecl();
@@ -81,7 +85,7 @@
 // Check accessibility.
 // FIXME: We currently only support checking if B is accessible base class
 // of D, or D is the same class which DerivedMD is in.
-bool IsItself = DRD == DerivedMD->getParent();
+bool IsItself = DRD == DerivedMD->getParent()->getCanonicalDecl();
 bool HasPublicAccess = false;
 for (const auto  : Paths) {
   if (Path.Access == AS_public)
@@ -121,8 +125,9 @@
 return false;
 
   for (unsigned I = 0; I < NumParamA; I++) {
-if (getDecayedType(BaseMD->getParamDecl(I)->getType()) !=
-getDecayedType(DerivedMD->getParamDecl(I)->getType()))
+if (getDecayedType(BaseMD->getParamDecl(I)->getType().getCanonicalType()) !=
+getDecayedType(
+DerivedMD->getParamDecl(I)->getType().getCanonicalType()))
   return false;
   }
   return true;
@@ -230,7 +235,7 @@
 
   const ASTContext *Context = Result.Context;
 
-  const auto *DerivedRD = DerivedMD->getParent();
+  const auto *DerivedRD = DerivedMD->getParent()->getCanonicalDecl();
 
   for (const auto  : DerivedRD->bases()) {
 if (const auto *BaseRD = BaseSpec.getType()->getAsCXXRecordDecl()) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16559: [CUDA] Add -fcuda-allow-variadic-functions.

2016-01-26 Thread Benjamin Kramer via cfe-commits
bkramer accepted this revision.
bkramer added a reviewer: bkramer.
bkramer added a comment.
This revision is now accepted and ready to land.

Looks good to me, but I don't really now CUDA.


http://reviews.llvm.org/D16559



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


Re: [PATCH] D16578: [clang-tidy] bug fix: Don't warn on partial template specialization in `misc-definitions-in-headers` check.

2016-01-26 Thread Haojian Wu via cfe-commits
hokein added a comment.

Yes, please help to land the patch for me :). Thanks.


Repository:
  rL LLVM

http://reviews.llvm.org/D16578



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


Re: [PATCH] D16559: [CUDA] Add -fcuda-allow-variadic-functions.

2016-01-26 Thread Artem Belevich via cfe-commits
tra accepted this revision.
tra added a comment.

LGTM.


http://reviews.llvm.org/D16559



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


r258822 - [CUDA] Add -fcuda-allow-variadic-functions.

2016-01-26 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Tue Jan 26 11:47:20 2016
New Revision: 258822

URL: http://llvm.org/viewvc/llvm-project?rev=258822=rev
Log:
[CUDA] Add -fcuda-allow-variadic-functions.

Summary:
Turns out the variadic function checking added in r258643 was too strict
for some existing users; give them an escape valve.  When
-fcuda-allow-variadic-functions is passed, the front-end makes no
attempt to disallow C-style variadic functions.  Calls to va_arg are
still not allowed.

Reviewers: tra

Subscribers: cfe-commits, jhen, echristo, bkramer

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

Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCUDA/vararg.cu

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=258822=258821=258822=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Tue Jan 26 11:47:20 2016
@@ -171,6 +171,7 @@ LANGOPT(CUDAIsDevice  , 1, 0, "Compi
 LANGOPT(CUDAAllowHostCallsFromHostDevice, 1, 0, "Allow host device functions 
to call host functions")
 LANGOPT(CUDADisableTargetCallChecks, 1, 0, "Disable checks for call targets 
(host, device, etc.)")
 LANGOPT(CUDATargetOverloads, 1, 0, "Enable function overloads based on CUDA 
target attributes")
+LANGOPT(CUDAAllowVariadicFunctions, 1, 0, "Allow variadic functions in CUDA 
device code")
 
 LANGOPT(AssumeSaneOperatorNew , 1, 1, "implicit __attribute__((malloc)) for 
C++'s new operators")
 LANGOPT(SizedDeallocation , 1, 0, "enable sized deallocation functions")

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=258822=258821=258822=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Tue Jan 26 11:47:20 2016
@@ -678,6 +678,8 @@ def fcuda_include_gpubinary : Separate<[
   HelpText<"Incorporate CUDA device-side binary into host object file.">;
 def fcuda_target_overloads : Flag<["-"], "fcuda-target-overloads">,
   HelpText<"Enable function overloads based on CUDA target attributes.">;
+def fcuda_allow_variadic_functions : Flag<["-"], 
"fcuda-allow-variadic-functions">,
+  HelpText<"Allow variadic functions in CUDA device code.">;
 
 
//===--===//
 // OpenMP Options

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=258822=258821=258822=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Jan 26 11:47:20 2016
@@ -1521,6 +1521,9 @@ static void ParseLangArgs(LangOptions 
   if (Args.hasArg(OPT_fcuda_target_overloads))
 Opts.CUDATargetOverloads = 1;
 
+  if (Args.hasArg(OPT_fcuda_allow_variadic_functions))
+Opts.CUDAAllowVariadicFunctions = 1;
+
   if (Opts.ObjC1) {
 if (Arg *arg = Args.getLastArg(OPT_fobjc_runtime_EQ)) {
   StringRef value = arg->getValue();

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=258822=258821=258822=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Jan 26 11:47:20 2016
@@ -8290,9 +8290,11 @@ Sema::ActOnFunctionDeclarator(Scope *S,
 }
 
 // Variadic functions, other than a *declaration* of printf, are not 
allowed
-// in device-side CUDA code.
-if (NewFD->isVariadic() && (NewFD->hasAttr() ||
-NewFD->hasAttr()) &&
+// in device-side CUDA code, unless someone passed
+// -fcuda-allow-variadic-functions.
+if (!getLangOpts().CUDAAllowVariadicFunctions && NewFD->isVariadic() &&
+(NewFD->hasAttr() ||
+ NewFD->hasAttr()) &&
 !(II && II->isStr("printf") && NewFD->isExternC() &&
   !D.isFunctionDefinition())) {
   Diag(NewFD->getLocation(), diag::err_variadic_device_fn);

Modified: cfe/trunk/test/SemaCUDA/vararg.cu
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCUDA/vararg.cu?rev=258822=258821=258822=diff
==
--- cfe/trunk/test/SemaCUDA/vararg.cu (original)
+++ cfe/trunk/test/SemaCUDA/vararg.cu Tue Jan 26 11:47:20 2016
@@ -1,8 +1,11 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: nvptx-registered-target
 // RUN: 

Re: [PATCH] D16559: [CUDA] Add -fcuda-allow-variadic-functions.

2016-01-26 Thread Justin Lebar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258822: [CUDA] Add -fcuda-allow-variadic-functions. 
(authored by jlebar).

Changed prior to commit:
  http://reviews.llvm.org/D16559?vs=45915=46005#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16559

Files:
  cfe/trunk/include/clang/Basic/LangOptions.def
  cfe/trunk/include/clang/Driver/CC1Options.td
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/test/SemaCUDA/vararg.cu

Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -8290,9 +8290,11 @@
 }
 
 // Variadic functions, other than a *declaration* of printf, are not allowed
-// in device-side CUDA code.
-if (NewFD->isVariadic() && (NewFD->hasAttr() ||
-NewFD->hasAttr()) &&
+// in device-side CUDA code, unless someone passed
+// -fcuda-allow-variadic-functions.
+if (!getLangOpts().CUDAAllowVariadicFunctions && NewFD->isVariadic() &&
+(NewFD->hasAttr() ||
+ NewFD->hasAttr()) &&
 !(II && II->isStr("printf") && NewFD->isExternC() &&
   !D.isFunctionDefinition())) {
   Diag(NewFD->getLocation(), diag::err_variadic_device_fn);
Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
===
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp
@@ -1521,6 +1521,9 @@
   if (Args.hasArg(OPT_fcuda_target_overloads))
 Opts.CUDATargetOverloads = 1;
 
+  if (Args.hasArg(OPT_fcuda_allow_variadic_functions))
+Opts.CUDAAllowVariadicFunctions = 1;
+
   if (Opts.ObjC1) {
 if (Arg *arg = Args.getLastArg(OPT_fobjc_runtime_EQ)) {
   StringRef value = arg->getValue();
Index: cfe/trunk/include/clang/Driver/CC1Options.td
===
--- cfe/trunk/include/clang/Driver/CC1Options.td
+++ cfe/trunk/include/clang/Driver/CC1Options.td
@@ -678,6 +678,8 @@
   HelpText<"Incorporate CUDA device-side binary into host object file.">;
 def fcuda_target_overloads : Flag<["-"], "fcuda-target-overloads">,
   HelpText<"Enable function overloads based on CUDA target attributes.">;
+def fcuda_allow_variadic_functions : Flag<["-"], "fcuda-allow-variadic-functions">,
+  HelpText<"Allow variadic functions in CUDA device code.">;
 
 //===--===//
 // OpenMP Options
Index: cfe/trunk/include/clang/Basic/LangOptions.def
===
--- cfe/trunk/include/clang/Basic/LangOptions.def
+++ cfe/trunk/include/clang/Basic/LangOptions.def
@@ -171,6 +171,7 @@
 LANGOPT(CUDAAllowHostCallsFromHostDevice, 1, 0, "Allow host device functions to call host functions")
 LANGOPT(CUDADisableTargetCallChecks, 1, 0, "Disable checks for call targets (host, device, etc.)")
 LANGOPT(CUDATargetOverloads, 1, 0, "Enable function overloads based on CUDA target attributes")
+LANGOPT(CUDAAllowVariadicFunctions, 1, 0, "Allow variadic functions in CUDA device code")
 
 LANGOPT(AssumeSaneOperatorNew , 1, 1, "implicit __attribute__((malloc)) for C++'s new operators")
 LANGOPT(SizedDeallocation , 1, 0, "enable sized deallocation functions")
Index: cfe/trunk/test/SemaCUDA/vararg.cu
===
--- cfe/trunk/test/SemaCUDA/vararg.cu
+++ cfe/trunk/test/SemaCUDA/vararg.cu
@@ -1,16 +1,19 @@
 // REQUIRES: x86-registered-target
 // REQUIRES: nvptx-registered-target
 // RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -fsyntax-only \
-// RUN:   -verify -DEXPECT_ERR %s
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s
+// RUN:   -verify -DEXPECT_VA_ARG_ERR -DEXPECT_VARARG_ERR %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -fsyntax-only \
+// RUN:   -fcuda-allow-variadic-functions -verify -DEXPECT_VA_ARG_ERR %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify \
+// RUN:   -DEXPECT_VARARG_ERR %s
 
 #include 
 #include "Inputs/cuda.h"
 
 __device__ void foo() {
   va_list list;
   va_arg(list, int);
-#ifdef EXPECT_ERR
+#ifdef EXPECT_VA_ARG_ERR
   // expected-error@-2 {{CUDA device code does not support va_arg}}
 #endif
 }
@@ -28,15 +31,21 @@
 }
 
 __device__ void vararg(const char* x, ...) {}
-// expected-error@-1 {{CUDA device code does not support variadic functions}}
+#ifdef EXPECT_VARARG_ERR
+// expected-error@-2 {{CUDA device code does not support variadic functions}}
+#endif
 
 extern "C" __device__ int printf(const char* fmt, ...);  // OK, special case.
 
 // Definition of printf not allowed.
 extern "C" __device__ int printf(const char* fmt, ...) { return 0; }
-// expected-error@-1 {{CUDA device code does not support variadic functions}}
+#ifdef 

Re: [PATCH] D16572: PR23057: fix use-after-free due to local token buffer in ParseCXXAmbiguousParenExpression

2016-01-26 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin added a comment.

I didn't introduce a leak because I pass ownership of the Buffer to 
EnterTokenStream (i.e. pass true as the last argument OwnsTokens). ASan also 
doesn't report a leak with my patch. Original code didn't have double free 
because it used call EnterTokenStream with OwnsTokens == false.


http://reviews.llvm.org/D16572



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


[PATCH] D16591: Add backend dignostic printer for unsupported features

2016-01-26 Thread Oliver Stannard via cfe-commits
olista01 created this revision.
olista01 added reviewers: ast, sunfish, tstellarAMD.
olista01 added a subscriber: cfe-commits.
olista01 set the repository for this revision to rL LLVM.

The related LLVM patch adds a backend diagnostic type for reporting
unsupported features, this adds a printer for them to clang.

In the case where debug location information is not available, I've
changed the printer to report the location as the first line of the
function, rather than the closing brace, as the latter does not give the
user any information. This also affects optimisation remarks.

Repository:
  rL LLVM

http://reviews.llvm.org/D16591

Files:
  include/clang/Basic/DiagnosticFrontendKinds.td
  lib/CodeGen/CodeGenAction.cpp
  test/Frontend/optimization-remark-analysis.c
  test/Misc/backend-optimization-failure-nodbg.cpp

Index: test/Misc/backend-optimization-failure-nodbg.cpp
===
--- test/Misc/backend-optimization-failure-nodbg.cpp
+++ test/Misc/backend-optimization-failure-nodbg.cpp
@@ -4,7 +4,7 @@
 // Test verifies optimization failures generated by the backend are handled
 // correctly by clang. LLVM tests verify all of the failure conditions.
 
-void test_switch(int *A, int *B, int Length) {
+void test_switch(int *A, int *B, int Length) { /* expected-warning {{loop not vectorized: failed explicitly specified loop vectorization}} */
 #pragma clang loop vectorize(enable) unroll(disable)
   for (int i = 0; i < Length; i++) {
 switch (A[i]) {
@@ -18,4 +18,4 @@
   B[i] = 3;
 }
   }
-/* expected-warning {{loop not vectorized: failed explicitly specified loop vectorization}} */ }
+}
Index: test/Frontend/optimization-remark-analysis.c
===
--- test/Frontend/optimization-remark-analysis.c
+++ test/Frontend/optimization-remark-analysis.c
@@ -1,8 +1,8 @@
 // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm -Rpass-analysis -S %s -o - 2>&1 | FileCheck %s --check-prefix=RPASS
 // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm -S %s -o - 2>&1 | FileCheck %s
 
-// RPASS: {{.*}}:21:1: remark: loop not vectorized: loop contains a switch statement
-// CHECK-NOT: {{.*}}:21:1: remark: loop not vectorized: loop contains a switch statement
+// RPASS: {{.*}}:7:8: remark: loop not vectorized: loop contains a switch statement
+// CHECK-NOT: {{.*}}:7:8: remark: loop not vectorized: loop contains a switch statement
 
 double foo(int N, int *Array) {
   double v = 0.0;
Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -238,6 +238,13 @@
   ((BackendConsumer *)Context)->DiagnosticHandlerImpl(DI);
 }
 
+/// Get the best possible source location to represent a diagnostic that
+/// may have associated debug info.
+const FullSourceLoc
+getBestLocationFromDebugLoc(const llvm::DiagnosticInfoWithDebugLocBase ,
+bool , StringRef ,
+unsigned , unsigned ) const;
+
 void InlineAsmDiagHandler2(const llvm::SMDiagnostic &,
SourceLocation LocCookie);
 
@@ -250,6 +257,8 @@
 /// \return True if the diagnostic has been successfully reported, false
 /// otherwise.
 bool StackSizeDiagHandler(const llvm::DiagnosticInfoStackSize );
+/// \brief Specialized handler for unsupported backend feature diagnostic.
+void UnsupportedDiagHandler(const llvm::DiagnosticInfoUnsupported );
 /// \brief Specialized handlers for optimization remarks.
 /// Note that these handlers only accept remarks and they always handle
 /// them.
@@ -435,16 +444,11 @@
   return false;
 }
 
-void BackendConsumer::EmitOptimizationMessage(
-const llvm::DiagnosticInfoOptimizationBase , unsigned DiagID) {
-  // We only support warnings and remarks.
-  assert(D.getSeverity() == llvm::DS_Remark ||
- D.getSeverity() == llvm::DS_Warning);
-
+const FullSourceLoc BackendConsumer::getBestLocationFromDebugLoc(
+const llvm::DiagnosticInfoWithDebugLocBase , bool , StringRef ,
+unsigned , unsigned ) const {
   SourceManager  = Context->getSourceManager();
   FileManager  = SourceMgr.getFileManager();
-  StringRef Filename;
-  unsigned Line, Column;
   SourceLocation DILoc;
 
   if (D.isLocationAvailable()) {
@@ -455,26 +459,72 @@
   // source manager, so pass 1 if Column is not set.
   DILoc = SourceMgr.translateFileLineCol(FE, Line, Column ? Column : 1);
 }
+BadDebugInfo = DILoc.isInvalid();
   }
 
   // If a location isn't available, try to approximate it using the associated
   // function definition. We use the definition's right brace to differentiate
   // from diagnostics that genuinely relate to the function itself.
   FullSourceLoc Loc(DILoc, SourceMgr);
   if 

r258824 - Use instance_properties instead of properties. NFC.

2016-01-26 Thread Manman Ren via cfe-commits
Author: mren
Date: Tue Jan 26 12:05:23 2016
New Revision: 258824

URL: http://llvm.org/viewvc/llvm-project?rev=258824=rev
Log:
Use instance_properties instead of properties. NFC.

All current properties are instance properties.

This is the second patch in a series of patches to support class properties
in addition to instance properties in objective-c.

rdar://23891898

Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
cfe/trunk/lib/ARCMigrate/TransProperties.cpp
cfe/trunk/lib/AST/DeclObjC.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp
cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp

Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=258824=258823=258824=diff
==
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Tue Jan 26 12:05:23 2016
@@ -904,11 +904,13 @@ public:
   typedef llvm::iterator_range
 prop_range;
 
-  prop_range properties() const { return prop_range(prop_begin(), prop_end()); 
}
-  prop_iterator prop_begin() const {
+  prop_range instance_properties() const {
+return prop_range(instprop_begin(), instprop_end());
+  }
+  prop_iterator instprop_begin() const {
 return prop_iterator(decls_begin());
   }
-  prop_iterator prop_end() const {
+  prop_iterator instprop_end() const {
 return prop_iterator(decls_end());
   }
 

Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=258824=258823=258824=diff
==
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Tue Jan 26 12:05:23 2016
@@ -588,7 +588,7 @@ void ObjCMigrateASTConsumer::migrateObjC
   if (!(ASTMigrateActions & 
FrontendOptions::ObjCMT_ReturnsInnerPointerProperty))
 return;
   
-  for (auto *Prop : D->properties()) {
+  for (auto *Prop : D->instance_properties()) {
 if ((ASTMigrateActions & FrontendOptions::ObjCMT_Annotation) &&
 !Prop->isDeprecated())
   migratePropertyNsReturnsInnerPointer(Ctx, Prop);
@@ -605,7 +605,7 @@ ClassImplementsAllMethodsAndProperties(A
   // in class interface.
   bool HasAtleastOneRequiredProperty = false;
   if (const ObjCProtocolDecl *PDecl = Protocol->getDefinition())
-for (const auto *Property : PDecl->properties()) {
+for (const auto *Property : PDecl->instance_properties()) {
   if (Property->getPropertyImplementation() == ObjCPropertyDecl::Optional)
 continue;
   HasAtleastOneRequiredProperty = true;

Modified: cfe/trunk/lib/ARCMigrate/TransProperties.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/TransProperties.cpp?rev=258824=258823=258824=diff
==
--- cfe/trunk/lib/ARCMigrate/TransProperties.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/TransProperties.cpp Tue Jan 26 12:05:23 2016
@@ -76,7 +76,7 @@ public:
 
   static void collectProperties(ObjCContainerDecl *D, AtPropDeclsTy ,
 AtPropDeclsTy *PrevAtProps = nullptr) {
-for (auto *Prop : D->properties()) {
+for (auto *Prop : D->instance_properties()) {
   if (Prop->getAtLoc().isInvalid())
 continue;
   unsigned RawLoc = Prop->getAtLoc().getRawEncoding();

Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=258824=258823=258824=diff
==
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Tue Jan 26 12:05:23 2016
@@ -122,7 +122,7 @@ bool ObjCContainerDecl::HasUserDeclaredS
   // declaration of this property. If one found, presumably a setter will
   // be provided (properties declared in categories will not get
   // auto-synthesized).
-  for (const auto *P : Cat->properties())
+  for (const auto *P : Cat->instance_properties())
 if (P->getIdentifier() == Property->getIdentifier()) {
   if (P->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readwrite)
 return true;
@@ -341,13 +341,13 @@ ObjCInterfaceDecl::FindPropertyVisibleIn
 
 void ObjCInterfaceDecl::collectPropertiesToImplement(PropertyMap ,
  PropertyDeclOrder ) 
const {
-  for (auto *Prop : properties()) {
+  for (auto *Prop : 

Re: [PATCH] D15120: Add support for __float128 type to be used by targets that support it

2016-01-26 Thread Nemanja Ivanovic via cfe-commits
nemanjai updated this revision to Diff 45998.
nemanjai added a comment.

Addressed review comments.
The key differences are:

- No assignments or operations between entities of long double and __float128 
allowed if the two types have a different representation
- Each type has a distinct rank

This isn't the same behaviour as GCC currently has. For example, GCC allows 
assignments between the two types on PowerPC. The conversion is achieved 
through a library routine. However, there is no compelling reason at this point 
to allow such behaviour and this work is deferred until such a need arises.


Repository:
  rL LLVM

http://reviews.llvm.org/D15120

Files:
  bindings/python/clang/cindex.py
  include/clang-c/Index.h
  include/clang/AST/ASTContext.h
  include/clang/AST/BuiltinTypes.def
  include/clang/AST/Type.h
  include/clang/AST/TypeLoc.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/Specifiers.h
  include/clang/Basic/TargetInfo.h
  include/clang/Basic/TokenKinds.def
  include/clang/Driver/Options.td
  include/clang/Lex/LiteralSupport.h
  include/clang/Sema/DeclSpec.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/ASTContext.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/MicrosoftMangle.cpp
  lib/AST/NSAPI.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/Type.cpp
  lib/AST/TypeLoc.cpp
  lib/Analysis/PrintfFormatString.cpp
  lib/Basic/TargetInfo.cpp
  lib/Basic/Targets.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/CodeGen/CodeGenTypes.cpp
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/Format/FormatToken.cpp
  lib/Frontend/InitPreprocessor.cpp
  lib/Index/USRGeneration.cpp
  lib/Lex/LiteralSupport.cpp
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseExpr.cpp
  lib/Parse/ParseExprCXX.cpp
  lib/Parse/ParseTentative.cpp
  lib/Sema/DeclSpec.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaTemplateVariadic.cpp
  lib/Sema/SemaType.cpp
  lib/Serialization/ASTCommon.cpp
  lib/Serialization/ASTReader.cpp
  test/CodeGenCXX/float128-declarations.cpp
  test/Preprocessor/init.c
  test/Sema/128bitfloat.cpp
  test/Sema/float128-ld-incompatibility.cpp
  test/SemaCXX/deleted-operator.cpp
  test/SemaCXX/overloaded-builtin-operators.cpp
  tools/libclang/CXType.cpp

Index: tools/libclang/CXType.cpp
===
--- tools/libclang/CXType.cpp
+++ tools/libclang/CXType.cpp
@@ -51,6 +51,7 @@
 BTCASE(Float);
 BTCASE(Double);
 BTCASE(LongDouble);
+BTCASE(Float128);
 BTCASE(NullPtr);
 BTCASE(Overload);
 BTCASE(Dependent);
@@ -466,6 +467,7 @@
 TKIND(Float);
 TKIND(Double);
 TKIND(LongDouble);
+TKIND(Float128);
 TKIND(NullPtr);
 TKIND(Overload);
 TKIND(Dependent);
Index: test/SemaCXX/overloaded-builtin-operators.cpp
===
--- test/SemaCXX/overloaded-builtin-operators.cpp
+++ test/SemaCXX/overloaded-builtin-operators.cpp
@@ -183,7 +183,7 @@
   // FIXME: lots of candidates here!
   (void)(1.0f * a); // expected-error{{ambiguous}} \
 // expected-note 4{{candidate}} \
-// expected-note {{remaining 117 candidates omitted; pass -fshow-overloads=all to show them}}
+// expected-note {{remaining 140 candidates omitted; pass -fshow-overloads=all to show them}}
 }
 
 // pr5432
Index: test/SemaCXX/deleted-operator.cpp
===
--- test/SemaCXX/deleted-operator.cpp
+++ test/SemaCXX/deleted-operator.cpp
@@ -9,7 +9,7 @@
   PR10757 a1;
   // FIXME: We get a ridiculous number of "built-in candidate" notes here...
   if(~a1) {} // expected-error {{overload resolution selected deleted operator}} expected-note 8 {{built-in candidate}}
-  if(a1==a1) {} // expected-error {{overload resolution selected deleted operator}} expected-note 121 {{built-in candidate}}
+  if(a1==a1) {} // expected-error {{overload resolution selected deleted operator}} expected-note 144 {{built-in candidate}}
 }
 
 struct DelOpDel {
Index: test/Sema/float128-ld-incompatibility.cpp
===
--- test/Sema/float128-ld-incompatibility.cpp
+++ test/Sema/float128-ld-incompatibility.cpp
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 \
+// RUN: -triple powerpc64le-unknown-linux-gnu -target-cpu pwr8 \
+// RUN: -target-feature +float128 %s
+
+__float128 qf();
+long double ldf();
+
+// FIXME: once operations between long double and __float128 are implemented for
+//targets where the types are different, these next two will change
+long double ld{qf()}; // expected-error {{cannot initialize a variable of type 'long double' with an rvalue of type '__float128'}}
+__float128 q{ldf()};  // expected-error {{cannot initialize a variable of type '__float128' with an rvalue of type 'long double'}}
+

Merge OpenCL 2.0 Pipe builtins (r258782) in 3.8

2016-01-26 Thread Anastasia Stulova via cfe-commits
Hi Hans,

Could you please merge Clang commit r258782 into release 3.8.

It adds Pipe BIFs to be used along with Pipe type committed earlier (in 
r257254).

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


Re: [PATCH] D16351: [FIX] Bug 25404 - Crash on typedef in OpenCL 2.0

2016-01-26 Thread Matt Arsenault via cfe-commits
arsenm added a subscriber: arsenm.
arsenm added a comment.

Add cfe-commits


http://reviews.llvm.org/D16351



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


r258834 - Class Property: parse property attribute (class).

2016-01-26 Thread Manman Ren via cfe-commits
Author: mren
Date: Tue Jan 26 12:52:43 2016
New Revision: 258834

URL: http://llvm.org/viewvc/llvm-project?rev=258834=rev
Log:
Class Property: parse property attribute (class).

This is the third patch in a series of patches to support class properties
in addition to instance properties in objective-c.

rdar://23891898

Added:
cfe/trunk/test/Parser/objc-class-property.m
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=258834=258833=258834=diff
==
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Tue Jan 26 12:52:43 2016
@@ -716,12 +716,13 @@ public:
 /// property attribute rather than a type qualifier.
 OBJC_PR_nullability = 0x1000,
 OBJC_PR_null_resettable = 0x2000,
+OBJC_PR_class = 0x4000
 // Adding a property should change NumPropertyAttrsBits
   };
 
   enum {
 /// \brief Number of bits fitting all the property attributes.
-NumPropertyAttrsBits = 14
+NumPropertyAttrsBits = 15
   };
 
   enum SetterKind { Assign, Retain, Copy, Weak };
@@ -823,6 +824,9 @@ public:
 (OBJC_PR_retain | OBJC_PR_strong | OBJC_PR_copy));
   }
 
+  bool isInstanceProperty() const { return !isClassProperty(); }
+  bool isClassProperty() const { return PropertyAttributes & OBJC_PR_class; }
+
   /// getSetterKind - Return the method used for doing assignment in
   /// the property setter. This is only valid if the property has been
   /// defined to have a setter.
@@ -899,21 +903,49 @@ public:
 SourceLocation atStartLoc)
 : NamedDecl(DK, DC, nameLoc, Id), DeclContext(DK), AtStart(atStartLoc) {}
 
-  // Iterator access to properties.
+  // Iterator access to instance/class properties.
   typedef specific_decl_iterator prop_iterator;
   typedef llvm::iterator_range
 prop_range;
 
-  prop_range instance_properties() const {
-return prop_range(instprop_begin(), instprop_end());
-  }
-  prop_iterator instprop_begin() const {
+  prop_range properties() const { return prop_range(prop_begin(), prop_end()); 
}
+  prop_iterator prop_begin() const {
 return prop_iterator(decls_begin());
   }
-  prop_iterator instprop_end() const {
+  prop_iterator prop_end() const {
 return prop_iterator(decls_end());
   }
 
+  typedef filtered_decl_iterator
+instprop_iterator;
+  typedef llvm::iterator_range instprop_range;
+
+  instprop_range instance_properties() const {
+return instprop_range(instprop_begin(), instprop_end());
+  }
+  instprop_iterator instprop_begin() const {
+return instprop_iterator(decls_begin());
+  }
+  instprop_iterator instprop_end() const {
+return instprop_iterator(decls_end());
+  }
+
+  typedef filtered_decl_iterator
+classprop_iterator;
+  typedef llvm::iterator_range classprop_range;
+
+  classprop_range class_properties() const {
+return classprop_range(classprop_begin(), classprop_end());
+  }
+  classprop_iterator classprop_begin() const {
+return classprop_iterator(decls_begin());
+  }
+  classprop_iterator classprop_end() const {
+return classprop_iterator(decls_end());
+  }
+
   // Iterator access to instance/class methods.
   typedef specific_decl_iterator method_iterator;
   typedef llvm::iterator_range

Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=258834=258833=258834=diff
==
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Tue Jan 26 12:52:43 2016
@@ -800,7 +800,8 @@ public:
 DQ_PR_strong = 0x400,
 DQ_PR_unsafe_unretained = 0x800,
 DQ_PR_nullability = 0x1000,
-DQ_PR_null_resettable = 0x2000
+DQ_PR_null_resettable = 0x2000,
+DQ_PR_class = 0x4000
   };
 
   ObjCDeclSpec()
@@ -860,7 +861,7 @@ private:
   ObjCDeclQualifier objcDeclQualifier : 7;
 
   // NOTE: VC++ treats enums as signed, avoid using ObjCPropertyAttributeKind
-  unsigned PropertyAttributes : 14;
+  unsigned PropertyAttributes : 15;
 
   unsigned Nullability : 2;
 

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=258834=258833=258834=diff
==
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ 

Re: [PATCH] D16591: Add backend dignostic printer for unsupported features

2016-01-26 Thread Alexei Starovoitov via cfe-commits
ast added a comment.

looks good.
could you add a testcase for DK_Unsupported ?


Repository:
  rL LLVM

http://reviews.llvm.org/D16591



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


Re: [PATCH] D16553: [OpenMP] Parsing + sema for target parallel directive.

2016-01-26 Thread Arpith Jacob via cfe-commits
arpith-jacob closed this revision.
arpith-jacob added a comment.

Committed revision 258832.

I had to modify test cases 'target_parallel_reduction_messages.cpp' and 
'target_parallel_map_messages.cpp' to use the updated error messages from 
patches recently committed to trunk.


http://reviews.llvm.org/D16553



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


Re: [PATCH] D16559: [CUDA] Add -fcuda-allow-variadic-functions.

2016-01-26 Thread Chad Rosier via cfe-commits
mcrosier added a subscriber: mcrosier.


Comment at: cfe/trunk/include/clang/Driver/CC1Options.td:681
@@ -680,1 +680,3 @@
   HelpText<"Enable function overloads based on CUDA target attributes.">;
+def fcuda_allow_variadic_functions : Flag<["-"], 
"fcuda-allow-variadic-functions">,
+  HelpText<"Allow variadic functions in CUDA device code.">;

AFAICT, these are customer facing flags, correct?  If so, shouldn't these 
options be hidden from the help (via the HelpHidden flag AFAICT)?


Repository:
  rL LLVM

http://reviews.llvm.org/D16559



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


[clang-tools-extra] r258835 - Test commit. Fix typo in comment.

2016-01-26 Thread Jonathan Coe via cfe-commits
Author: jbcoe
Date: Tue Jan 26 12:55:55 2016
New Revision: 258835

URL: http://llvm.org/viewvc/llvm-project?rev=258835=rev
Log:
Test commit. Fix typo in comment.

Modified:
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp?rev=258835=258834=258835=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
Tue Jan 26 12:55:55 2016
@@ -504,7 +504,7 @@ static StyleKind findStyleKind(
 static void addUsage(IdentifierNamingCheck::NamingCheckFailureMap ,
  const NamedDecl *Decl, SourceRange Range,
  const SourceManager *SM) {
-  // Do nothin if the provided range is invalid
+  // Do nothing if the provided range is invalid.
   if (Range.getBegin().isInvalid() || Range.getEnd().isInvalid())
 return;
 


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


Re: [PATCH] D16559: [CUDA] Add -fcuda-allow-variadic-functions.

2016-01-26 Thread Chad Rosier via cfe-commits
mcrosier added inline comments.


Comment at: cfe/trunk/include/clang/Driver/CC1Options.td:681
@@ -680,1 +680,3 @@
   HelpText<"Enable function overloads based on CUDA target attributes.">;
+def fcuda_allow_variadic_functions : Flag<["-"], 
"fcuda-allow-variadic-functions">,
+  HelpText<"Allow variadic functions in CUDA device code.">;

mcrosier wrote:
> AFAICT, these are customer facing flags, correct?  If so, shouldn't these 
> options be hidden from the help (via the HelpHidden flag AFAICT)?
This might cause issues such as those reported in PR26317 and PR26318.


Repository:
  rL LLVM

http://reviews.llvm.org/D16559



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


r258836 - Fix Clang-tidy modernize-use-nullptr warnings; other minor fixes.

2016-01-26 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Tue Jan 26 13:01:06 2016
New Revision: 258836

URL: http://llvm.org/viewvc/llvm-project?rev=258836=rev
Log:
Fix Clang-tidy modernize-use-nullptr warnings; other minor fixes.

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

Modified:
cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/VforkChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=258836=258835=258836=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Tue Jan 26 
13:01:06 2016
@@ -420,7 +420,7 @@ public:
   template 
   Matcher(const Matcher ,
   typename std::enable_if::value &&
-  !std::is_same::value>::type * = 0)
+   !std::is_same::value>::type * = 
nullptr)
   : Implementation(restrictMatcher(Other.Implementation)) {
 assert(Implementation.getSupportedKind().isSame(
 ast_type_traits::ASTNodeKind::getFromNodeKind()));
@@ -433,7 +433,7 @@ public:
   Matcher(const Matcher ,
   typename std::enable_if<
 std::is_same::value &&
-std::is_same::value>::type* = 0)
+std::is_same::value>::type* = nullptr)
   : Implementation(new TypeToQualType(Other)) {}
 
   /// \brief Convert \c this into a \c Matcher by applying dyn_cast<> to the
@@ -1600,4 +1600,4 @@ inline const Stmt *GetBodyMatcherhttp://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=258836=258835=258836=diff
==
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Tue Jan 26 13:01:06 2016
@@ -1552,7 +1552,7 @@ struct DeclaratorChunk {
 I.Kind  = Pipe;
 I.Loc   = Loc;
 I.Cls.TypeQuals = TypeQuals;
-I.Cls.AttrList  = 0;
+I.Cls.AttrList  = nullptr;
 return I;
   }
 
@@ -2341,4 +2341,4 @@ struct LambdaIntroducer {
 
 } // end namespace clang
 
-#endif
+#endif // LLVM_CLANG_SEMA_DECLSPEC_H

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h?rev=258836=258835=258836=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h Tue Jan 26 13:01:06 2016
@@ -1,4 +1,4 @@
-//===--- Marshallers.h - Generic matcher function marshallers -*- C++ -*-===//
+//===--- Marshallers.h - Generic matcher function marshallers ---*- C++ 
-*-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -32,7 +32,6 @@ namespace ast_matchers {
 namespace dynamic {
 namespace internal {
 
-
 /// \brief Helper template class to just from argument type to the right is/get
 ///   functions in VariantValue.
 /// Used to verify and extract the matcher arguments below.
@@ -234,7 +233,7 @@ static VariantMatcher outvalueToVariantM
 template 
 static VariantMatcher outvalueToVariantMatcher(const T ,
typename T::ReturnTypes * =
-   NULL) {
+   nullptr) {
   std::vector Matchers;
   mergePolyMatchers(PolyMatcher, Matchers, typename T::ReturnTypes());
   VariantMatcher Out = VariantMatcher::PolymorphicMatcher(std::move(Matchers));
@@ -410,7 +409,6 @@ private:
 return VariantMatcher();   
\
   }
 
-
 /// \brief 0-arg marshaller function.
 template 
 static VariantMatcher matcherMarshall0(void (*Func)(), StringRef MatcherName,
@@ -708,9 +706,9 @@ makeMatcherAutoMarshall(ast_matchers::in
MatcherName);
 }
 
-}  // namespace internal
-}  // namespace dynamic
-}  // namespace ast_matchers
-}  // namespace clang
+} // namespace internal
+} // namespace dynamic
+} // namespace ast_matchers
+} // namespace clang
 
-#endif  // LLVM_CLANG_AST_MATCHERS_DYNAMIC_MARSHALLERS_H
+#endif // LLVM_CLANG_AST_MATCHERS_DYNAMIC_MARSHALLERS_H

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=258836=258835=258836=diff

Re: [PATCH] D16567: [Clang] Fix Clang-tidy modernize-use-nullptr warnings; other minor fixes

2016-01-26 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258836: Fix Clang-tidy modernize-use-nullptr warnings; other 
minor fixes. (authored by eugenezelenko).

Changed prior to commit:
  http://reviews.llvm.org/D16567?vs=45941=46016#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16567

Files:
  cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
  cfe/trunk/include/clang/Sema/DeclSpec.h
  cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h
  cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
  cfe/trunk/lib/Sema/SemaType.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/VforkChecker.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
  cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp

Index: cfe/trunk/include/clang/Sema/DeclSpec.h
===
--- cfe/trunk/include/clang/Sema/DeclSpec.h
+++ cfe/trunk/include/clang/Sema/DeclSpec.h
@@ -1552,7 +1552,7 @@
 I.Kind  = Pipe;
 I.Loc   = Loc;
 I.Cls.TypeQuals = TypeQuals;
-I.Cls.AttrList  = 0;
+I.Cls.AttrList  = nullptr;
 return I;
   }
 
@@ -2341,4 +2341,4 @@
 
 } // end namespace clang
 
-#endif
+#endif // LLVM_CLANG_SEMA_DECLSPEC_H
Index: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
===
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -420,7 +420,7 @@
   template 
   Matcher(const Matcher ,
   typename std::enable_if::value &&
-  !std::is_same::value>::type * = 0)
+   !std::is_same::value>::type * = nullptr)
   : Implementation(restrictMatcher(Other.Implementation)) {
 assert(Implementation.getSupportedKind().isSame(
 ast_type_traits::ASTNodeKind::getFromNodeKind()));
@@ -433,7 +433,7 @@
   Matcher(const Matcher ,
   typename std::enable_if<
 std::is_same::value &&
-std::is_same::value>::type* = 0)
+std::is_same::value>::type* = nullptr)
   : Implementation(new TypeToQualType(Other)) {}
 
   /// \brief Convert \c this into a \c Matcher by applying dyn_cast<> to the
@@ -1600,4 +1600,4 @@
 } // end namespace ast_matchers
 } // end namespace clang
 
-#endif
+#endif // LLVM_CLANG_ASTMATCHERS_ASTMATCHERSINTERNAL_H
Index: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
===
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -2103,11 +2103,11 @@
   CGM.getTypes().ConvertTypeForMem(getTgtOffloadEntryQTy());
   llvm::GlobalVariable *HostEntriesBegin = new llvm::GlobalVariable(
   M, OffloadEntryTy, /*isConstant=*/true,
-  llvm::GlobalValue::ExternalLinkage, /*Initializer=*/0,
+  llvm::GlobalValue::ExternalLinkage, /*Initializer=*/nullptr,
   ".omp_offloading.entries_begin");
   llvm::GlobalVariable *HostEntriesEnd = new llvm::GlobalVariable(
   M, OffloadEntryTy, /*isConstant=*/true,
-  llvm::GlobalValue::ExternalLinkage, /*Initializer=*/0,
+  llvm::GlobalValue::ExternalLinkage, /*Initializer=*/nullptr,
   ".omp_offloading.entries_end");
 
   // Create all device images
@@ -2119,10 +2119,11 @@
 StringRef T = Devices[i].getTriple();
 auto *ImgBegin = new llvm::GlobalVariable(
 M, CGM.Int8Ty, /*isConstant=*/true, llvm::GlobalValue::ExternalLinkage,
-/*Initializer=*/0, Twine(".omp_offloading.img_start.") + Twine(T));
+/*Initializer=*/nullptr,
+Twine(".omp_offloading.img_start.") + Twine(T));
 auto *ImgEnd = new llvm::GlobalVariable(
 M, CGM.Int8Ty, /*isConstant=*/true, llvm::GlobalValue::ExternalLinkage,
-/*Initializer=*/0, Twine(".omp_offloading.img_end.") + Twine(T));
+/*Initializer=*/nullptr, Twine(".omp_offloading.img_end.") + Twine(T));
 
 llvm::Constant *Dev =
 llvm::ConstantStruct::get(DeviceImageTy, ImgBegin, ImgEnd,
Index: cfe/trunk/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
@@ -75,8 +75,8 @@
 // Extract lhs and rhs from assignment statement
 std::pair
 clang::ento::parseAssignment(const Stmt *S) {
-  const VarDecl *VD = 0;
-  const Expr *RHS = 0;
+  const VarDecl *VD = nullptr;
+  const Expr *RHS = nullptr;
 
   if (auto Assign = dyn_cast_or_null(S)) {
 if (Assign->isAssignmentOp()) {
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/VforkChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/VforkChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/VforkChecker.cpp
@@ -54,10 +54,10 @@
   bool 

Re: [PATCH] D16559: [CUDA] Add -fcuda-allow-variadic-functions.

2016-01-26 Thread Artem Belevich via cfe-commits
tra added inline comments.


Comment at: cfe/trunk/include/clang/Driver/CC1Options.td:681
@@ -680,1 +680,3 @@
   HelpText<"Enable function overloads based on CUDA target attributes.">;
+def fcuda_allow_variadic_functions : Flag<["-"], 
"fcuda-allow-variadic-functions">,
+  HelpText<"Allow variadic functions in CUDA device code.">;

mcrosier wrote:
> mcrosier wrote:
> > AFAICT, these are customer facing flags, correct?  If so, shouldn't these 
> > options be hidden from the help (via the HelpHidden flag AFAICT)?
> This might cause issues such as those reported in PR26317 and PR26318.
These are cc1-only options and do *not* show up in top-level --help.



Repository:
  rL LLVM

http://reviews.llvm.org/D16559



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


Re: [libcxx] r258107 - Fix PR#26175. Thanks to Josh Petrie for the report and the patch. Reviewed as http://reviews.llvm.org/D16262

2016-01-26 Thread Hans Wennborg via cfe-commits
On Tue, Jan 19, 2016 at 9:21 AM, Hans Wennborg  wrote:
> On Tue, Jan 19, 2016 at 12:01 AM, Dimitry Andric  wrote:
>> On 19 Jan 2016, at 01:50, Marshall Clow via cfe-commits 
>>  wrote:
>>>
>>> Author: marshall
>>> Date: Mon Jan 18 18:50:37 2016
>>> New Revision: 258107
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=258107=rev
>>> Log:
>>> Fix PR#26175. Thanks to Josh Petrie for the report and the patch. Reviewed 
>>> as http://reviews.llvm.org/D16262
>>
>> This looks like a good candidate for the 3.8 branch, do you agree?
>
> Sounds good to me if Marshall agrees.

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


Re: [PATCH] D16408: [libcxx] Additional 'REQUIRE' directives for tests that require en_US.UTF-8.

2016-01-26 Thread Hans Wennborg via cfe-commits
hans added a comment.

Ping? This and r258403 are on my watch-list for 3.8.


http://reviews.llvm.org/D16408



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


Re: [PATCH] D16566: [Clang-tidy] Fix Clang-tidy modernize-use-override warning in unittests/clang-tidy/IncludeInserterTest.cpp; other minor fixes

2016-01-26 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added inline comments.


Comment at: unittests/clang-tidy/IncludeInserterTest.cpp:101
@@ -100,3 +100,3 @@
   : IncludeInserterCheckBase(CheckName, Context) {}
-  virtual ~CXXSystemIncludeInserterCheck() {}
+  ~CXXSystemIncludeInserterCheck() override = default;
 

alexfh wrote:
> I'd better remove it completely.
Will do this in commit.


Repository:
  rL LLVM

http://reviews.llvm.org/D16566



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


Re: [libcxx] r249798 - Split out of .

2016-01-26 Thread Hans Wennborg via cfe-commits
Eric, Marshall: has there been any progress here?

On Wed, Jan 20, 2016 at 10:29 AM, Hans Wennborg  wrote:
> /sub
>
> On Wed, Jan 20, 2016 at 4:45 AM, Nico Weber via cfe-commits
>  wrote:
>> Eric, Marshall: another ping. This should be fixed on the 3.8 branch, so it
>> needs to be resolved soon.
>>
>> On Jan 5, 2016 5:25 PM, "Nico Weber"  wrote:
>>>
>>> On Wed, Dec 30, 2015 at 8:28 PM, Richard Smith 
>>> wrote:

 On Wed, Dec 30, 2015 at 1:17 PM, Nico Weber  wrote:
>
> One problem with this patch: stdio.h can be used in .c files, and when
> building .c files with -gnu99 -pedantic,


 Do you mean -std=gnu89?

>
> clang will complain about // comments. Not only does this stdio.h have
> // comments, it also pulls in some libc++ headers (__config) that have //
> comments as well. I suppose all the comments in header files pulled in by 
> C
> headers need to become /* */ comments?


 I suppose so too. Your configuration is probably somewhat broken if
 libc++'s headers are in your include path while building C code, but it
 doesn't seem unreasonable to properly support that mode, and my changes 
 were
 already trying to do so.

 Eric, Marshall, what do you think about using only /*...*/-style comments
 in these headers, to handle the case where libc++ is somehow in the include
 path for a C89 compilation?
>>>
>>>
>>> Eric, Marshall: Ping ^
>>>


>
> On Tue, Oct 13, 2015 at 7:34 PM, Richard Smith via cfe-commits
>  wrote:
>>
>> On Tue, Oct 13, 2015 at 3:26 PM, Eric Fiselier  wrote:
>>>
>>> This change LGTM. Let's hold off on the using "_Static_assert" until
>>> we understand how that would work with "-pedantic" when the macro is
>>> expanded in user code.
>>
>>
>> Committed as r250247, thanks.
>>
>>>
>>> /Eric
>>>
>>> On Tue, Oct 13, 2015 at 4:19 PM, Richard Smith 
>>> wrote:

 On Tue, Oct 13, 2015 at 2:12 PM, Eric Fiselier via cfe-commits
  wrote:
>
> I would rather not do this if possible but I understand why we need
> to do it.
>
> Richard is there a cost associated with the 'extern "C++"'
> construct? or by forcing the compiler to switch modes in general?


 Not a significant one compared to the cost of the code wrapped in the
 'extern "C++"' here. (Also, this is wrapped in an #ifdef that only 
 applies
 in C++98; we could further reduce the set of cases when this happens by
 using _Static_assert when available instead of this static_assert
 emulation.)

>
> On Mon, Oct 12, 2015 at 12:27 PM, Richard Smith
>  wrote:
>>
>> On Mon, Oct 12, 2015 at 9:41 AM, Steven Wu via cfe-commits
>>  wrote:
>>>
>>> Hi Richard
>>>
>>> Your splitting seems causing problem when using extern "C". Here
>>> is a test case:
>>>
>>> $ cat test.cpp
>>> #ifdef __cplusplus
>>> extern "C" {
>>> #endif
>>> #include 
>>> #ifdef __cplusplus
>>> }
>>> #endif
>>>
>>> Error:
>>> clang -fsyntax-only test.cpp
>>> In file included from test.cpp:4:
>>> In file included from /usr/bin/../include/c++/v1/stdio.h:102:
>>> /usr/bin/../include/c++/v1/__config:593:1: error:
>>>   templates must have C++ linkage
>>> template  struct __static_assert_test;
>>> ^~~
>>> /usr/bin/../include/c++/v1/__config:594:20: error:
>>>   explicit specialization of non-template struct
>>> '__static_assert_test'
>>> template <> struct __static_assert_test {};
>>>^   ~~
>>> /usr/bin/../include/c++/v1/__config:595:1: error:
>>>   templates must have C++ linkage
>>> template  struct __static_assert_check {};
>>> ^~~
>>> 3 errors generated.
>>>
>>> Because the code is actually compiled in C++, the guard in the
>>> header failed to exclude the templates. In the meantime, I don't 
>>> know if
>>> there are ways to detect the header is in extern "C".
>>
>>
>> This was supposed to work, but apparently I only tested it when
>> compiling as C++11; the static_assert emulation in C++98 mode needs 
>> some
>> massaging to cope with this.
>>
>> Eric, Marshall: Are you OK with the attached patch? The idea is to
>> make 

Re: r258307 - [OPENMP 4.0] Fix for codegen of 'cancel' directive within 'sections' directive.

2016-01-26 Thread Hans Wennborg via cfe-commits
Did that fix land, and should it be merged to 3.8?

On Thu, Jan 21, 2016 at 7:03 PM, Alexey Bataev  wrote:
> Later today I will post another fix, that will fix all 'sections'
> related troubles, including this one. So I don't think it is necessary
> to merge it
>
> Best regards,
> Alexey Bataev
> =
> Software Engineer
> Intel Compiler Team
>
> 22.01.2016 0:10, Hans Wennborg пишет:
>> Jack suggested (https://llvm.org/bugs/show_bug.cgi?id=26059#c7) that
>> this should be merged to 3.8.
>>
>> Alexey, you're the code owner here. OK for merging? If yes, do you
>> want to go ahead and merge with utils/release/merge.sh?
>>
>> On Wed, Jan 20, 2016 at 4:29 AM, Alexey Bataev via cfe-commits
>>  wrote:
>>> Author: abataev
>>> Date: Wed Jan 20 06:29:47 2016
>>> New Revision: 258307
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=258307=rev
>>> Log:
>>> [OPENMP 4.0] Fix for codegen of 'cancel' directive within 'sections' 
>>> directive.
>>> Allow to emit code for 'cancel' directive within 'sections' directive with 
>>> single sub-section.
>>>
>>> Modified:
>>>  cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
>>>  cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
>>>  cfe/trunk/test/OpenMP/cancel_codegen.cpp
>>>
>>> Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=258307=258306=258307=diff
>>> ==
>>> --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Wed Jan 20 06:29:47 2016
>>> @@ -3685,8 +3685,6 @@ void CGOpenMPRuntime::emitCancelCall(Cod
>>> // kmp_int32 cncl_kind);
>>> if (auto *OMPRegionInfo =
>>> dyn_cast_or_null(CGF.CapturedStmtInfo)) {
>>> -if (OMPRegionInfo->getDirectiveKind() == OMPD_single)
>>> -  return;
>>>   auto & = [this, Loc, CancelRegion,
>>> OMPRegionInfo](CodeGenFunction ) {
>>> llvm::Value *Args[] = {
>>>
>>> Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=258307=258306=258307=diff
>>> ==
>>> --- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Wed Jan 20 06:29:47 2016
>>> @@ -1786,7 +1786,11 @@ CodeGenFunction::EmitSections(const OMPE
>>>   CGF.EmitOMPPrivateClause(S, SingleScope);
>>>   (void)SingleScope.Privatize();
>>>
>>> +auto Exit = CGF.getJumpDestInCurrentScope("omp.sections.exit");
>>> +CGF.BreakContinueStack.push_back(BreakContinue(Exit, Exit));
>>>   CGF.EmitStmt(Stmt);
>>> +CGF.EmitBlock(Exit.getBlock());
>>> +CGF.BreakContinueStack.pop_back();
>>> };
>>> CGM.getOpenMPRuntime().emitSingleRegion(*this, CodeGen, S.getLocStart(),
>>> llvm::None, llvm::None, 
>>> llvm::None,
>>> @@ -2647,7 +2651,8 @@ CodeGenFunction::getOMPCancelDestination
>>> if (Kind == OMPD_parallel || Kind == OMPD_task)
>>>   return ReturnBlock;
>>> assert(Kind == OMPD_for || Kind == OMPD_section || Kind == 
>>> OMPD_sections ||
>>> - Kind == OMPD_parallel_sections || Kind == OMPD_parallel_for);
>>> + Kind == OMPD_parallel_sections || Kind == OMPD_parallel_for ||
>>> + Kind == OMPD_single);
>>> return BreakContinueStack.back().BreakBlock;
>>>   }
>>>
>>>
>>> Modified: cfe/trunk/test/OpenMP/cancel_codegen.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/cancel_codegen.cpp?rev=258307=258306=258307=diff
>>> ==
>>> --- cfe/trunk/test/OpenMP/cancel_codegen.cpp (original)
>>> +++ cfe/trunk/test/OpenMP/cancel_codegen.cpp Wed Jan 20 06:29:47 2016
>>> @@ -20,7 +20,7 @@ int main (int argc, char **argv) {
>>>   #pragma omp cancel sections
>>>   }
>>>   // CHECK: call i32 @__kmpc_single(
>>> -// CHECK-NOT: @__kmpc_cancel
>>> +// CHECK: call i32 @__kmpc_cancel(
>>>   // CHECK: call void @__kmpc_end_single(
>>>   // CHECK: call void @__kmpc_barrier(%ident_t*
>>>   #pragma omp sections
>>> @@ -126,7 +126,7 @@ for (int i = 0; i < argc; ++i) {
>>>
>>>   // CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}})
>>>   // CHECK: call i32 @__kmpc_single(
>>> -// CHECK-NOT: @__kmpc_cancel
>>> +// CHECK: call i32 @__kmpc_cancel(
>>>   // CHECK: call void @__kmpc_end_single(
>>>   // CHECK: ret void
>>>
>>>
>>>
>>> ___
>>> 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] D16559: [CUDA] Add -fcuda-allow-variadic-functions.

2016-01-26 Thread Chad Rosier via cfe-commits
mcrosier added inline comments.


Comment at: cfe/trunk/include/clang/Driver/CC1Options.td:681
@@ -680,1 +680,3 @@
   HelpText<"Enable function overloads based on CUDA target attributes.">;
+def fcuda_allow_variadic_functions : Flag<["-"], 
"fcuda-allow-variadic-functions">,
+  HelpText<"Allow variadic functions in CUDA device code.">;

tra wrote:
> mcrosier wrote:
> > mcrosier wrote:
> > > AFAICT, these are customer facing flags, correct?  If so, shouldn't these 
> > > options be hidden from the help (via the HelpHidden flag AFAICT)?
> > This might cause issues such as those reported in PR26317 and PR26318.
> These are cc1-only options and do *not* show up in top-level --help.
> 
Ah, yes.  You are correct.


Repository:
  rL LLVM

http://reviews.llvm.org/D16559



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


[PATCH] D16593: [CUDA] Implemented device-side support for functions in .

2016-01-26 Thread Artem Belevich via cfe-commits
tra created this revision.
tra added a reviewer: jlebar.
tra added a subscriber: cfe-commits.

CUDA expects math functions in std:: namespace to work on device side.
In order to make it work with clang without allowing device-side code
generation for functions w/o appropriate target attributes, this patch
provides device-side implementations for  functions. Most of
them call global-scope math functions provided by CUDA headers. In few
cases we use clang builtins.

Tested out-of tree by compiling and running thrust's unit_tests.
https://github.com/thrust/thrust/tree/master/testing


http://reviews.llvm.org/D16593

Files:
  lib/Headers/CMakeLists.txt
  lib/Headers/__clang_cuda_cmath.h
  lib/Headers/__clang_cuda_runtime_wrapper.h

Index: lib/Headers/__clang_cuda_runtime_wrapper.h
===
--- lib/Headers/__clang_cuda_runtime_wrapper.h
+++ lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -46,6 +46,7 @@
 // while some required macros (like __THROW) are in a weird state.
 #include 
 #include 
+#include 
 
 // Preserve common macros that will be changed below by us or by CUDA
 // headers.
@@ -217,5 +218,7 @@
 extern "C" __device__ int vprintf(const char*, const char*);
 #endif
 
+#include <__clang_cuda_cmath.h>
+
 #endif // __CUDA__
 #endif // __CLANG_CUDA_RUNTIME_WRAPPER_H__
Index: lib/Headers/__clang_cuda_cmath.h
===
--- /dev/null
+++ lib/Headers/__clang_cuda_cmath.h
@@ -0,0 +1,224 @@
+/*=== __clang_cuda_cmath.h - Device-side CUDA cmath support ===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+#ifndef __CLANG_CUDA_CMATH_H__
+#define __CLANG_CUDA_CMATH_H__
+#ifndef __CUDA__
+#error "This file is for CUDA compilation only."
+#endif
+
+// CUDA allows using math functions form std:: on device side.  This
+// file provides __device__ overloads for math functions that map to
+// appropriate math functions provided by CUDA headers or to compiler
+// builtins if CUDA does not provide a suitable function.
+// We also provide device-side std::abs() for integer types.
+
+#define __DEVICE__ static __device__ __inline__ __attribute__((always_inline))
+
+namespace std {
+__DEVICE__ long long abs(long long n) { return ::llabs(n); }
+__DEVICE__ long abs(long n) { return ::labs(n); }
+__DEVICE__ int abs(int n) { return ::abs(n); }
+__DEVICE__ float abs(float x) { return ::fabsf(x); }
+__DEVICE__ double abs(double x) { return ::fabs(x); }
+__DEVICE__ float acos(float x) { return ::acosf(x); }
+__DEVICE__ double acos(double x) { return ::acos(x); }
+__DEVICE__ float acosh(float x) { return ::acoshf(x); }
+__DEVICE__ double acosh(double x) { return ::acosh(x); }
+__DEVICE__ float asin(float x) { return ::asinf(x); }
+__DEVICE__ double asin(double x) { return ::asin(x); }
+__DEVICE__ float asinh(float x) { return ::asinhf(x); }
+__DEVICE__ double asinh(double x) { return ::asinh(x); }
+__DEVICE__ float atan(float x) { return ::atanf(x); }
+__DEVICE__ double atan(double x) { return ::atan(x); }
+__DEVICE__ float atan2(float x, float y) { return ::atan2f(x, y); }
+__DEVICE__ double atan2(double x, double y) { return ::atan2(x, y); }
+__DEVICE__ float atanh(float x) { return ::atanhf(x); }
+__DEVICE__ double atanh(double x) { return ::atanh(x); }
+__DEVICE__ float cbrt(float x) { return ::cbrtf(x); }
+__DEVICE__ double cbrt(double x) { return ::cbrt(x); }
+__DEVICE__ float ceil(float x) { return ::ceilf(x); }
+__DEVICE__ double ceil(double x) { return ::ceil(x); }
+__DEVICE__ float copysign(float x, float y) { return ::copysignf(x, y); }
+__DEVICE__ double copysign(double x, double y) { return ::copysign(x, y); }
+__DEVICE__ float cos(float x) { return ::cosf(x); }
+__DEVICE__ double cos(double x) { return ::cos(x); }
+__DEVICE__ float cosh(float x) { return ::coshf(x); }

r258839 - [MS ABI] Allow a member pointers' converted type to change

2016-01-26 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Tue Jan 26 13:30:26 2016
New Revision: 258839

URL: http://llvm.org/viewvc/llvm-project?rev=258839=rev
Log:
[MS ABI] Allow a member pointers' converted type to change

Member pointers in the MS ABI are tricky for a variety of reasons.
The size of a member pointer is indeterminate until the program reaches
a point where the representation is required to be known.  However,
*pointers* to member pointers may exist without knowing the pointee
type's representation.  In these cases, we synthesize an opaque LLVM
type for the pointee type.

However, we can be in a situation where the underlying member pointer's
representation became known mid-way through the program.  To account for
this, we attempted to manicure CodeGen's type-cache so that we can
replace the opaque member pointer type with the real deal while leaving
the pointer types unperturbed.  This, unfortunately, is a problematic
approach to take as we will violate CodeGen's invariants.

These violations are mostly harmless but let's do the right thing
instead: invalidate the type-cache if a member pointer's LLVM
representation changes.

This fixes PR26313.

Modified:
cfe/trunk/include/clang/AST/ASTConsumer.h
cfe/trunk/include/clang/Frontend/MultiplexConsumer.h
cfe/trunk/lib/CodeGen/CodeGenAction.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
cfe/trunk/lib/CodeGen/CodeGenTypes.h
cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
cfe/trunk/lib/Frontend/MultiplexConsumer.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/CodeGenCXX/microsoft-abi-member-pointers.cpp

Modified: cfe/trunk/include/clang/AST/ASTConsumer.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTConsumer.h?rev=258839=258838=258839=diff
==
--- cfe/trunk/include/clang/AST/ASTConsumer.h (original)
+++ cfe/trunk/include/clang/AST/ASTConsumer.h Tue Jan 26 13:30:26 2016
@@ -121,6 +121,10 @@ public:
   /// modified by the introduction of an implicit zero initializer.
   virtual void CompleteTentativeDefinition(VarDecl *D) {}
 
+  /// \brief Callback invoked when an MSInheritanceAttr has been attached to a
+  /// CXXRecordDecl.
+  virtual void AssignInheritanceModel(CXXRecordDecl *RD) {}
+
   /// HandleCXXStaticMemberVarInstantiation - Tell the consumer that this
   // variable has been instantiated.
   virtual void HandleCXXStaticMemberVarInstantiation(VarDecl *D) {}

Modified: cfe/trunk/include/clang/Frontend/MultiplexConsumer.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/MultiplexConsumer.h?rev=258839=258838=258839=diff
==
--- cfe/trunk/include/clang/Frontend/MultiplexConsumer.h (original)
+++ cfe/trunk/include/clang/Frontend/MultiplexConsumer.h Tue Jan 26 13:30:26 
2016
@@ -49,6 +49,7 @@ public:
 llvm::StringRef Value) override;
   void HandleDependentLibrary(llvm::StringRef Lib) override;
   void CompleteTentativeDefinition(VarDecl *D) override;
+  void AssignInheritanceModel(CXXRecordDecl *RD) override;
   void HandleVTable(CXXRecordDecl *RD) override;
   ASTMutationListener *GetASTMutationListener() override;
   ASTDeserializationListener *GetASTDeserializationListener() override;

Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=258839=258838=258839=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Tue Jan 26 13:30:26 2016
@@ -210,6 +210,10 @@ namespace clang {
   Gen->CompleteTentativeDefinition(D);
 }
 
+void AssignInheritanceModel(CXXRecordDecl *RD) override {
+  Gen->AssignInheritanceModel(RD);
+}
+
 void HandleVTable(CXXRecordDecl *RD) override {
   Gen->HandleVTable(RD);
 }

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=258839=258838=258839=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Jan 26 13:30:26 2016
@@ -489,6 +489,11 @@ void CodeGenModule::UpdateCompletedType(
   Types.UpdateCompletedType(TD);
 }
 
+void CodeGenModule::RefreshTypeCacheForClass(const CXXRecordDecl *RD) {
+  // Make sure that this type is translated.
+  Types.RefreshTypeCacheForClass(RD);
+}
+
 llvm::MDNode *CodeGenModule::getTBAAInfo(QualType QTy) {
   if (!TBAA)
 return nullptr;

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: 

Re: [PATCH] D16586: Make clang AAPCS compliant w.r.t volatile bitfield accesses

2016-01-26 Thread John McCall via cfe-commits
rjmccall added a comment.

Well, that's certainly an interesting ABI rule.

A few high-level notes:

1. AAPCS requires the bit-field to be loaded on a store, even if the store 
fills the entire container; that doesn't seem to be implemented in your patch.

2. Especially because of #1, let's not do this unless the l-value is actually 
volatile.  The ABI rule here is arguably actively wrong for non-volatile cases, 
e.g. struct { volatile char c; short s : 8; }.

3. Instead of using string comparisons all over the place, please make this a 
flag on the CG TargetInfo or something.



Comment at: lib/CodeGen/CGExpr.cpp:1761
@@ +1760,3 @@
+Ptr = Address(AdjustAAPCSBitfieldAccess(Dst, Info, false),
+  getContext().getTypeAlignInChars(Dst.getType()));
+

This alignment computation is wrong; you need to be basing this on the 
alignment of the base.  It would be easier to do that in the formation of the 
LValue in the first place in EmitLValueForField, and then you won't need to 
modify as many of these uses.


http://reviews.llvm.org/D16586



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


Re: [PATCH] D13357: [Concepts] Diagnose when 'concept' is specified on a specialization

2016-01-26 Thread Nathan Wilson via cfe-commits
nwilson added a comment.

Ping.

@rsmith - would you also mind clarifying the comment regarding `setConcept(bool 
IC)` at to whether it should exist at all or simply not have any params?


http://reviews.llvm.org/D13357



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


Re: [PATCH] D15897: [libc++] Silence warning about padding inserted at the tail of struct _Rep_base

2016-01-26 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

Do you mean "-Wpadded -Wno-error=padded" instead of padding?

I'm looking for a way to silence the warning, so that isn't enough. If we need 
more time to decide whether we want to use -Wpadded (for both buildit and 
cmake), I think I'll just remove -Wpadded from buildit's command line for now.


http://reviews.llvm.org/D15897



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


Re: [PATCH] D15897: [libc++] Silence warning about padding inserted at the tail of struct _Rep_base

2016-01-26 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

There is also a PR about splitting -Wpadded into two options: one warns about 
padding in the middle of a struct and the other warns about padding at the end. 
If the former option is used instead of -Wpadded, I believe it's possible to 
remove the pragmas that are currently used in libc++.

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


http://reviews.llvm.org/D15897



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


Re: [PATCH] D16593: [CUDA] Implemented device-side support for functions in .

2016-01-26 Thread Justin Lebar via cfe-commits
jlebar added a comment.

Missing (?) functions:

- div, ldiv, lldiv, imaxdiv
- imaxabs

If you left these out intentionally (I forget if nvidia supports div_t), that's 
probably fine, but maybe add a comment?

wrt the "::" comments, some are nits because I think we end up calling the 
right thing, assuming that nobody defines the wrong thing in namespace std.  
But some aren't nits because afaict they lead to infinite recursion.  We should 
probably just give fully-qualified names for all functions we call.



Comment at: lib/Headers/__clang_cuda_cmath.h:33
@@ +32,3 @@
+// builtins if CUDA does not provide a suitable function.
+// We also provide device-side std::abs() for integer types.
+

Why is std::abs a special case that needs to be called out here?


Comment at: lib/Headers/__clang_cuda_cmath.h:38
@@ +37,3 @@
+namespace std {
+__DEVICE__ long long abs(long long n) { return ::llabs(n); }
+__DEVICE__ long abs(long n) { return ::labs(n); }

We should probably respect the standard and not define functions that aren't 
available in C++11 if we're not in c++11 mode.


Comment at: lib/Headers/__clang_cuda_cmath.h:93
@@ +92,3 @@
+  return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
+  FP_ZERO, x);
+}

Looking through bugzilla, it appears that this builtin may try to invoke 
library functions, which may or may not exist in our case (e.g. extern "C" fabs 
vs ::fabs).  It's probably worth checking this one in particular to make sure 
it works.


Comment at: lib/Headers/__clang_cuda_cmath.h:99
@@ +98,3 @@
+}
+__DEVICE__ float frexp(float arg, int *exp) { return frexpf(arg, exp); }
+__DEVICE__ double frexp(double arg, int *exp) { return frexp(arg, exp); }

Nit, ::


Comment at: lib/Headers/__clang_cuda_cmath.h:100
@@ +99,3 @@
+__DEVICE__ float frexp(float arg, int *exp) { return frexpf(arg, exp); }
+__DEVICE__ double frexp(double arg, int *exp) { return frexp(arg, exp); }
+__DEVICE__ float hypot(float x, float y) { return ::hypotf(x, y); }

Need :: to avoid infinite recursion, right?


Comment at: lib/Headers/__clang_cuda_cmath.h:105
@@ +104,3 @@
+__DEVICE__ int ilogb(double arg) { return ::ilogb(arg); }
+__DEVICE__ bool isfinite(float x) { return __finitef(x); }
+__DEVICE__ bool isfinite(double x) { return __finite(x); }

Where's __finitef coming from?  Same for the other __ functions used here.


Comment at: lib/Headers/__clang_cuda_cmath.h:105
@@ +104,3 @@
+__DEVICE__ int ilogb(double arg) { return ::ilogb(arg); }
+__DEVICE__ bool isfinite(float x) { return __finitef(x); }
+__DEVICE__ bool isfinite(double x) { return __finite(x); }

jlebar wrote:
> Where's __finitef coming from?  Same for the other __ functions used here.
Nit: "::" in front of all the __ functions.


Comment at: lib/Headers/__clang_cuda_cmath.h:146
@@ +145,3 @@
+__DEVICE__ long labs(long n) { return ::labs(n); }
+__DEVICE__ float ldexp(float arg, int exp) { return ldexpf(arg, exp); }
+__DEVICE__ double ldexp(double arg, int exp) { return ldexp(arg, exp); }

Nit: ::ldexpf?


Comment at: lib/Headers/__clang_cuda_cmath.h:147
@@ +146,3 @@
+__DEVICE__ float ldexp(float arg, int exp) { return ldexpf(arg, exp); }
+__DEVICE__ double ldexp(double arg, int exp) { return ldexp(arg, exp); }
+__DEVICE__ float lgamma(float x) { return ::lgammaf(x); }

:: not optional on this one, right?


http://reviews.llvm.org/D16593



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


Re: [PATCH] D15120: Add support for __float128 type to be used by targets that support it

2016-01-26 Thread John McCall via cfe-commits
rjmccall added a comment.

In http://reviews.llvm.org/D15120#336282, @nemanjai wrote:

> Addressed review comments.
>  The key differences are:
>
> - No assignments or operations between entities of long double and __float128 
> allowed if the two types have a different representation
> - Each type has a distinct rank
>
>   This isn't the same behaviour as GCC currently has. For example, GCC allows 
> assignments between the two types on PowerPC. The conversion is achieved 
> through a library routine. However, there is no compelling reason at this 
> point to allow such behaviour and this work is deferred until such a need 
> arises.


As I understand it, PPC's long-double (~103 bits of precision) is still 
strictly less precise than float128_t (113 bits of precision), so it ought to 
be have lower rank.  Is there actually a supported platform where this is not 
true?  If not, we should just add this as another type with higher rank.


Repository:
  rL LLVM

http://reviews.llvm.org/D15120



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


r258850 - Do not define GXX_RTTI macro for C.

2016-01-26 Thread Yunzhong Gao via cfe-commits
Author: ygao
Date: Tue Jan 26 14:15:02 2016
New Revision: 258850

URL: http://llvm.org/viewvc/llvm-project?rev=258850=rev
Log:
Do not define GXX_RTTI macro for C.
This is same as GCC behavior (tested with GCC 4.8.2).

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


Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=258850=258849=258850=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Jan 26 14:15:02 2016
@@ -1669,7 +1669,7 @@ static void ParseLangArgs(LangOptions 
   Opts.SjLjExceptions = Args.hasArg(OPT_fsjlj_exceptions);
   Opts.TraditionalCPP = Args.hasArg(OPT_traditional_cpp);
 
-  Opts.RTTI = !Args.hasArg(OPT_fno_rtti);
+  Opts.RTTI = Opts.CPlusPlus && !Args.hasArg(OPT_fno_rtti);
   Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data);
   Opts.Blocks = Args.hasArg(OPT_fblocks);
   Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=258850=258849=258850=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Tue Jan 26 14:15:02 2016
@@ -57,6 +57,10 @@
 //
 // C99:#define __STDC_VERSION__ 199901L
 // C99:#define __STRICT_ANSI__ 1
+// C99-NOT: __GXX_EXPERIMENTAL_CXX0X__
+// C99-NOT: __GXX_RTTI
+// C99-NOT: __GXX_WEAK__
+// C99-NOT: __cplusplus
 //
 // 
 // RUN: %clang_cc1 -std=c11 -E -dM < /dev/null | FileCheck -check-prefix C11 %s
@@ -65,6 +69,10 @@
 // C11:#define __STDC_UTF_32__ 1
 // C11:#define __STDC_VERSION__ 201112L
 // C11:#define __STRICT_ANSI__ 1
+// C11-NOT: __GXX_EXPERIMENTAL_CXX0X__
+// C11-NOT: __GXX_RTTI
+// C11-NOT: __GXX_WEAK__
+// C11-NOT: __cplusplus
 //
 // 
 // RUN: %clang_cc1 -E -dM < /dev/null | FileCheck -check-prefix COMMON %s
@@ -3286,7 +3294,6 @@
 // MIPSN32BE: #define __GNUC_STDC_INLINE__ 1
 // MIPSN32BE: #define __GNUC__ 4
 // MIPSN32BE: #define __GXX_ABI_VERSION 1002
-// MIPSN32BE: #define __GXX_RTTI 1
 // MIPSN32BE: #define __ILP32__ 1
 // MIPSN32BE: #define __INT16_C_SUFFIX__
 // MIPSN32BE: #define __INT16_FMTd__ "hd"
@@ -3592,7 +3599,6 @@
 // MIPSN32EL: #define __GNUC_STDC_INLINE__ 1
 // MIPSN32EL: #define __GNUC__ 4
 // MIPSN32EL: #define __GXX_ABI_VERSION 1002
-// MIPSN32EL: #define __GXX_RTTI 1
 // MIPSN32EL: #define __ILP32__ 1
 // MIPSN32EL: #define __INT16_C_SUFFIX__
 // MIPSN32EL: #define __INT16_FMTd__ "hd"
@@ -7618,7 +7624,6 @@
 // X86_64-CLOUDABI:#define __GNUC_STDC_INLINE__ 1
 // X86_64-CLOUDABI:#define __GNUC__ 4
 // X86_64-CLOUDABI:#define __GXX_ABI_VERSION 1002
-// X86_64-CLOUDABI:#define __GXX_RTTI 1
 // X86_64-CLOUDABI:#define __INT16_C_SUFFIX__ 
 // X86_64-CLOUDABI:#define __INT16_FMTd__ "hd"
 // X86_64-CLOUDABI:#define __INT16_FMTi__ "hi"
@@ -8483,7 +8488,6 @@
 // WEBASSEMBLY32-NEXT:#define __GNUC_STDC_INLINE__ 1{{$}}
 // WEBASSEMBLY32-NEXT:#define __GNUC__ {{.}}
 // WEBASSEMBLY32-NEXT:#define __GXX_ABI_VERSION 1002{{$}}
-// WEBASSEMBLY32-NEXT:#define __GXX_RTTI 1{{$}}
 // WEBASSEMBLY32-NEXT:#define __ILP32__ 1{{$}}
 // WEBASSEMBLY32-NEXT:#define __INT16_C_SUFFIX__ {{$}}
 // WEBASSEMBLY32-NEXT:#define __INT16_FMTd__ "hd"{{$}}
@@ -8799,7 +8803,6 @@
 // WEBASSEMBLY64-NEXT:#define __GNUC_STDC_INLINE__ 1{{$}}
 // WEBASSEMBLY64-NEXT:#define __GNUC__ {{.}}
 // WEBASSEMBLY64-NEXT:#define __GXX_ABI_VERSION 1002{{$}}
-// WEBASSEMBLY64-NEXT:#define __GXX_RTTI 1{{$}}
 // WEBASSEMBLY64-NOT:#define __ILP32__
 // WEBASSEMBLY64-NEXT:#define __INT16_C_SUFFIX__ {{$}}
 // WEBASSEMBLY64-NEXT:#define __INT16_FMTd__ "hd"{{$}}


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


Re: [PATCH] D16365: Do not define GXX_RTTI macro for C

2016-01-26 Thread Yunzhong Gao via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258850: Do not define GXX_RTTI macro for C. (authored by 
ygao).

Changed prior to commit:
  http://reviews.llvm.org/D16365?vs=45416=46031#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16365

Files:
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/Preprocessor/init.c

Index: cfe/trunk/test/Preprocessor/init.c
===
--- cfe/trunk/test/Preprocessor/init.c
+++ cfe/trunk/test/Preprocessor/init.c
@@ -57,14 +57,22 @@
 //
 // C99:#define __STDC_VERSION__ 199901L
 // C99:#define __STRICT_ANSI__ 1
+// C99-NOT: __GXX_EXPERIMENTAL_CXX0X__
+// C99-NOT: __GXX_RTTI
+// C99-NOT: __GXX_WEAK__
+// C99-NOT: __cplusplus
 //
 // 
 // RUN: %clang_cc1 -std=c11 -E -dM < /dev/null | FileCheck -check-prefix C11 %s
 //
 // C11:#define __STDC_UTF_16__ 1
 // C11:#define __STDC_UTF_32__ 1
 // C11:#define __STDC_VERSION__ 201112L
 // C11:#define __STRICT_ANSI__ 1
+// C11-NOT: __GXX_EXPERIMENTAL_CXX0X__
+// C11-NOT: __GXX_RTTI
+// C11-NOT: __GXX_WEAK__
+// C11-NOT: __cplusplus
 //
 // 
 // RUN: %clang_cc1 -E -dM < /dev/null | FileCheck -check-prefix COMMON %s
@@ -3286,7 +3294,6 @@
 // MIPSN32BE: #define __GNUC_STDC_INLINE__ 1
 // MIPSN32BE: #define __GNUC__ 4
 // MIPSN32BE: #define __GXX_ABI_VERSION 1002
-// MIPSN32BE: #define __GXX_RTTI 1
 // MIPSN32BE: #define __ILP32__ 1
 // MIPSN32BE: #define __INT16_C_SUFFIX__
 // MIPSN32BE: #define __INT16_FMTd__ "hd"
@@ -3592,7 +3599,6 @@
 // MIPSN32EL: #define __GNUC_STDC_INLINE__ 1
 // MIPSN32EL: #define __GNUC__ 4
 // MIPSN32EL: #define __GXX_ABI_VERSION 1002
-// MIPSN32EL: #define __GXX_RTTI 1
 // MIPSN32EL: #define __ILP32__ 1
 // MIPSN32EL: #define __INT16_C_SUFFIX__
 // MIPSN32EL: #define __INT16_FMTd__ "hd"
@@ -7618,7 +7624,6 @@
 // X86_64-CLOUDABI:#define __GNUC_STDC_INLINE__ 1
 // X86_64-CLOUDABI:#define __GNUC__ 4
 // X86_64-CLOUDABI:#define __GXX_ABI_VERSION 1002
-// X86_64-CLOUDABI:#define __GXX_RTTI 1
 // X86_64-CLOUDABI:#define __INT16_C_SUFFIX__ 
 // X86_64-CLOUDABI:#define __INT16_FMTd__ "hd"
 // X86_64-CLOUDABI:#define __INT16_FMTi__ "hi"
@@ -8483,7 +8488,6 @@
 // WEBASSEMBLY32-NEXT:#define __GNUC_STDC_INLINE__ 1{{$}}
 // WEBASSEMBLY32-NEXT:#define __GNUC__ {{.}}
 // WEBASSEMBLY32-NEXT:#define __GXX_ABI_VERSION 1002{{$}}
-// WEBASSEMBLY32-NEXT:#define __GXX_RTTI 1{{$}}
 // WEBASSEMBLY32-NEXT:#define __ILP32__ 1{{$}}
 // WEBASSEMBLY32-NEXT:#define __INT16_C_SUFFIX__ {{$}}
 // WEBASSEMBLY32-NEXT:#define __INT16_FMTd__ "hd"{{$}}
@@ -8799,7 +8803,6 @@
 // WEBASSEMBLY64-NEXT:#define __GNUC_STDC_INLINE__ 1{{$}}
 // WEBASSEMBLY64-NEXT:#define __GNUC__ {{.}}
 // WEBASSEMBLY64-NEXT:#define __GXX_ABI_VERSION 1002{{$}}
-// WEBASSEMBLY64-NEXT:#define __GXX_RTTI 1{{$}}
 // WEBASSEMBLY64-NOT:#define __ILP32__
 // WEBASSEMBLY64-NEXT:#define __INT16_C_SUFFIX__ {{$}}
 // WEBASSEMBLY64-NEXT:#define __INT16_FMTd__ "hd"{{$}}
Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
===
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp
@@ -1669,7 +1669,7 @@
   Opts.SjLjExceptions = Args.hasArg(OPT_fsjlj_exceptions);
   Opts.TraditionalCPP = Args.hasArg(OPT_traditional_cpp);
 
-  Opts.RTTI = !Args.hasArg(OPT_fno_rtti);
+  Opts.RTTI = Opts.CPlusPlus && !Args.hasArg(OPT_fno_rtti);
   Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data);
   Opts.Blocks = Args.hasArg(OPT_fblocks);
   Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);


Index: cfe/trunk/test/Preprocessor/init.c
===
--- cfe/trunk/test/Preprocessor/init.c
+++ cfe/trunk/test/Preprocessor/init.c
@@ -57,14 +57,22 @@
 //
 // C99:#define __STDC_VERSION__ 199901L
 // C99:#define __STRICT_ANSI__ 1
+// C99-NOT: __GXX_EXPERIMENTAL_CXX0X__
+// C99-NOT: __GXX_RTTI
+// C99-NOT: __GXX_WEAK__
+// C99-NOT: __cplusplus
 //
 // 
 // RUN: %clang_cc1 -std=c11 -E -dM < /dev/null | FileCheck -check-prefix C11 %s
 //
 // C11:#define __STDC_UTF_16__ 1
 // C11:#define __STDC_UTF_32__ 1
 // C11:#define __STDC_VERSION__ 201112L
 // C11:#define __STRICT_ANSI__ 1
+// C11-NOT: __GXX_EXPERIMENTAL_CXX0X__
+// C11-NOT: __GXX_RTTI
+// C11-NOT: __GXX_WEAK__
+// C11-NOT: __cplusplus
 //
 // 
 // RUN: %clang_cc1 -E -dM < /dev/null | FileCheck -check-prefix COMMON %s
@@ -3286,7 +3294,6 @@
 // MIPSN32BE: #define __GNUC_STDC_INLINE__ 1
 // MIPSN32BE: #define __GNUC__ 4
 // MIPSN32BE: #define __GXX_ABI_VERSION 1002
-// MIPSN32BE: #define __GXX_RTTI 1
 // MIPSN32BE: #define __ILP32__ 1
 // MIPSN32BE: #define __INT16_C_SUFFIX__
 // MIPSN32BE: #define __INT16_FMTd__ "hd"
@@ -3592,7 +3599,6 @@
 // MIPSN32EL: #define __GNUC_STDC_INLINE__ 1
 // MIPSN32EL: #define __GNUC__ 4
 // MIPSN32EL: #define __GXX_ABI_VERSION 1002
-// MIPSN32EL: #define __GXX_RTTI 1
 // MIPSN32EL: #define __ILP32__ 1
 // MIPSN32EL: #define 

Re: [PATCH] D16408: [libcxx] Additional 'REQUIRE' directives for tests that require en_US.UTF-8.

2016-01-26 Thread Eric Fiselier via cfe-commits
EricWF added a subscriber: EricWF.
EricWF accepted this revision.
EricWF added a reviewer: EricWF.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM. 
@dsanders: What platform are you on that doesn't have en_US.UTF-8? If your 
serious about testing libc++ you should install the locale. (but I understand 
that's not always possible).
@hans I'm OK with this and r258403 can be merged into 3.8.


http://reviews.llvm.org/D16408



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


[libcxx] r258852 - Fix PR26103 - Error calling is_convertible with incomplete type. Patch from Michael Daniels.

2016-01-26 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Tue Jan 26 14:24:30 2016
New Revision: 258852

URL: http://llvm.org/viewvc/llvm-project?rev=258852=rev
Log:
Fix PR26103 - Error calling is_convertible with incomplete type. Patch from 
Michael Daniels.

Modified:
libcxx/trunk/include/type_traits
libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=258852=258851=258852=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Jan 26 14:24:30 2016
@@ -1347,10 +1347,9 @@ struct __is_convertible_test : public fa
 
 template 
 struct __is_convertible_test<_From, _To,
-decltype(__test_convert<_To>(_VSTD::declval<_From>()))> : public true_type
+
decltype(_VSTD::__is_convertible_imp::__test_convert<_To>(_VSTD::declval<_From>()))>
 : public true_type
 {};
 
-template  __two __test(...);
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 template  _Tp&& __source();
 #else

Modified: libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp?rev=258852=258851=258852=diff
==
--- libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp 
(original)
+++ libcxx/trunk/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp Tue 
Jan 26 14:24:30 2016
@@ -52,6 +52,11 @@ class NonCopyable {
   NonCopyable(NonCopyable&);
 };
 
+template 
+class CannotInstantiate {
+  enum { X = T::ThisExpressionWillBlowUp };
+};
+
 int main()
 {
 // void
@@ -206,4 +211,7 @@ int main()
 test_is_not_convertible();
 #endif
 
+// Ensure that CannotInstantiate is not instantiated by is_convertible 
when it is not needed.
+// For example CannotInstantiate is instatiated as a part of ADL lookup 
for arguments of type CannotInstantiate*.
+static_assert((std::is_convertible::value), "");
 }


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


Re: [PATCH] D16344: [libcxx] Fix PR26103 - Error calling is_convertible with incomplete type

2016-01-26 Thread Eric Fiselier via cfe-commits
EricWF closed this revision.
EricWF added a comment.

Committed as r258852. Thanks for the patch.


http://reviews.llvm.org/D16344



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


[libcxx] r258855 - Remove dead code missed in r258852.

2016-01-26 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Tue Jan 26 14:31:01 2016
New Revision: 258855

URL: http://llvm.org/viewvc/llvm-project?rev=258855=rev
Log:
Remove dead code missed in r258852.

Modified:
libcxx/trunk/include/type_traits

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=258855=258854=258855=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Jan 26 14:31:01 2016
@@ -1350,12 +1350,6 @@ struct __is_convertible_test<_From, _To,
 
decltype(_VSTD::__is_convertible_imp::__test_convert<_To>(_VSTD::declval<_From>()))>
 : public true_type
 {};
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template  _Tp&& __source();
-#else
-template  typename remove_reference<_Tp>::type& __source();
-#endif
-
 template ::value,
  bool _IsFunction = is_function<_Tp>::value,
  bool _IsVoid = is_void<_Tp>::value>


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


Re: [PATCH] D16584: [libcxx] Work around for clang calling GAS after having already failed.

2016-01-26 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

Obviously LGTM. @hans I'm OK with this going into 3.8.


http://reviews.llvm.org/D16584



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


Re: [PATCH] D16135: Macro Debug Info support in Clang

2016-01-26 Thread Amjad Aboud via cfe-commits
aaboud updated this revision to Diff 46034.
aaboud marked 6 inline comments as done.
aaboud added a comment.

Added comments explaining the implementation.


http://reviews.llvm.org/D16135

Files:
  include/clang/AST/ASTConsumer.h
  lib/AST/ASTConsumer.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  lib/CodeGen/CMakeLists.txt
  lib/CodeGen/CodeGenAction.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/CodeGen/MacroPPCallbacks.cpp
  lib/CodeGen/MacroPPCallbacks.h
  lib/CodeGen/ModuleBuilder.cpp
  lib/Parse/ParseAST.cpp

Index: lib/Parse/ParseAST.cpp
===
--- lib/Parse/ParseAST.cpp
+++ lib/Parse/ParseAST.cpp
@@ -128,6 +128,12 @@
   new Parser(S.getPreprocessor(), S, SkipFunctionBodies));
   Parser  = *ParseOP.get();
 
+  std::unique_ptr Callbacks =
+  Consumer->CreatePreprocessorCallbacks(S.getPreprocessor());
+  if (Callbacks) {
+S.getPreprocessor().addPPCallbacks(std::move(Callbacks));
+  }
+
   llvm::CrashRecoveryContextCleanupRegistrar
   CleanupPrettyStack(llvm::SavePrettyStackState());
   PrettyStackTraceParserEntry CrashInfo(P);
Index: lib/CodeGen/ModuleBuilder.cpp
===
--- lib/CodeGen/ModuleBuilder.cpp
+++ lib/CodeGen/ModuleBuilder.cpp
@@ -20,6 +20,7 @@
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/CodeGenOptions.h"
+#include "clang/Lex/PPCallbacks.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/LLVMContext.h"
@@ -234,6 +235,11 @@
 void HandleDependentLibrary(llvm::StringRef Lib) override {
   Builder->AddDependentLib(Lib);
 }
+
+std::unique_ptr
+CreatePreprocessorCallbacks(Preprocessor ) override {
+  return Builder->createPreprocessorCallbacks(PP);
+}
   };
 }
 
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -24,6 +24,7 @@
 #include "CodeGenPGO.h"
 #include "CodeGenTBAA.h"
 #include "CoverageMappingGen.h"
+#include "MacroPPCallbacks.h"
 #include "TargetInfo.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/CharUnits.h"
@@ -208,6 +209,16 @@
   CUDARuntime = CreateNVCUDARuntime(*this);
 }
 
+std::unique_ptr
+CodeGenModule::createPreprocessorCallbacks(Preprocessor ) {
+  // Enable generating macro debug info only in FullDebugInfo mode.
+  if (CodeGenOpts.getDebugInfo() < CodeGenOptions::FullDebugInfo ||
+  !getModuleDebugInfo())
+return nullptr;
+
+  return std::make_unique(*getModuleDebugInfo(), PP);
+}
+
 void CodeGenModule::addReplacement(StringRef Name, llvm::Constant *C) {
   Replacements[Name] = C;
 }
Index: lib/CodeGen/MacroPPCallbacks.h
===
--- lib/CodeGen/MacroPPCallbacks.h
+++ lib/CodeGen/MacroPPCallbacks.h
@@ -0,0 +1,82 @@
+//===--- MacroPPCallbacks.h -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+//  This file defines implementation for the macro preprocessors callbacks.
+//
+//===--===//
+
+#include "clang/Lex/PPCallbacks.h"
+#include "clang/Parse/Parser.h"
+#include 
+
+namespace llvm {
+class DIMacroFile;
+}
+namespace clang {
+
+namespace CodeGen {
+class CGDebugInfo;
+}
+class MacroPPCallbacks : public PPCallbacks {
+  /// Debug info code generator
+  CodeGen::CGDebugInfo 
+  /// Preprocessor
+  Preprocessor 
+  /// Location (used for line number) for recent included file.
+  SourceLocation LastHashLoc;
+  /// Location (used for file name) for first included file (source main).
+  SourceLocation FirstIncludeFile;
+  /// Indicates that first file inclusion occurred.
+  bool FirstInclude;
+  /// Indicates that DIMacroFile entry was created for first included file.
+  bool FirstIncludeDone;
+  /// Counts current number of command line included files, which was entered
+  /// and was not exited yet.
+  int CommandIncludeFiles;
+  /// Number of fake files that should skip that were not exited yet.
+  int SkipFiles;
+  /// Parent contains all entered files that were not exited yet according to
+  /// the inclusion order.
+  std::vector Parents;
+
+  /// Use the passed preprocessor to calculate the macro name and value from
+  /// the given macro info and identifier info.
+  static void getMacroDefinition(const IdentifierInfo , const MacroInfo ,
+ Preprocessor , raw_ostream ,
+ raw_ostream );
+
+public:
+  MacroPPCallbacks(CodeGen::CGDebugInfo , Preprocessor );
+
+  /// Callback 

Re: [PATCH] D15897: [libc++] Silence warning about padding inserted at the tail of struct _Rep_base

2016-01-26 Thread Joerg Sonnenberger via cfe-commits
On Tue, Jan 26, 2016 at 07:43:03PM +, Akira Hatanaka via cfe-commits wrote:
> ahatanak added a comment.
> 
> Do you mean "-Wpadded -Wno-error=padded" instead of padding?
> 
> I'm looking for a way to silence the warning, so that isn't enough. If
> we need more time to decide whether we want to use -Wpadded (for both
> buildit and cmake), I think I'll just remove -Wpadded from buildit's
> command line for now.

I just mean that it should not be fatal.

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


Re: [PATCH] D16593: [CUDA] Implemented device-side support for functions in .

2016-01-26 Thread Artem Belevich via cfe-commits
tra updated this revision to Diff 46041.
tra marked 3 inline comments as done.
tra added a comment.

Added missing ::


http://reviews.llvm.org/D16593

Files:
  lib/Headers/CMakeLists.txt
  lib/Headers/__clang_cuda_cmath.h
  lib/Headers/__clang_cuda_runtime_wrapper.h

Index: lib/Headers/__clang_cuda_runtime_wrapper.h
===
--- lib/Headers/__clang_cuda_runtime_wrapper.h
+++ lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -46,6 +46,7 @@
 // while some required macros (like __THROW) are in a weird state.
 #include 
 #include 
+#include 
 
 // Preserve common macros that will be changed below by us or by CUDA
 // headers.
@@ -217,5 +218,7 @@
 extern "C" __device__ int vprintf(const char*, const char*);
 #endif
 
+#include <__clang_cuda_cmath.h>
+
 #endif // __CUDA__
 #endif // __CLANG_CUDA_RUNTIME_WRAPPER_H__
Index: lib/Headers/__clang_cuda_cmath.h
===
--- /dev/null
+++ lib/Headers/__clang_cuda_cmath.h
@@ -0,0 +1,223 @@
+/*=== __clang_cuda_cmath.h - Device-side CUDA cmath support ===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+#ifndef __CLANG_CUDA_CMATH_H__
+#define __CLANG_CUDA_CMATH_H__
+#ifndef __CUDA__
+#error "This file is for CUDA compilation only."
+#endif
+
+// CUDA allows using math functions form std:: on device side.  This
+// file provides __device__ overloads for math functions that map to
+// appropriate math functions provided by CUDA headers or to compiler
+// builtins if CUDA does not provide a suitable function.
+
+#define __DEVICE__ static __device__ __inline__ __attribute__((always_inline))
+
+namespace std {
+__DEVICE__ long long abs(long long n) { return ::llabs(n); }
+__DEVICE__ long abs(long n) { return ::labs(n); }
+__DEVICE__ int abs(int n) { return ::abs(n); }
+__DEVICE__ float abs(float x) { return ::fabsf(x); }
+__DEVICE__ double abs(double x) { return ::fabs(x); }
+__DEVICE__ float acos(float x) { return ::acosf(x); }
+__DEVICE__ double acos(double x) { return ::acos(x); }
+__DEVICE__ float acosh(float x) { return ::acoshf(x); }
+__DEVICE__ double acosh(double x) { return ::acosh(x); }
+__DEVICE__ float asin(float x) { return ::asinf(x); }
+__DEVICE__ double asin(double x) { return ::asin(x); }
+__DEVICE__ float asinh(float x) { return ::asinhf(x); }
+__DEVICE__ double asinh(double x) { return ::asinh(x); }
+__DEVICE__ float atan(float x) { return ::atanf(x); }
+__DEVICE__ double atan(double x) { return ::atan(x); }
+__DEVICE__ float atan2(float x, float y) { return ::atan2f(x, y); }
+__DEVICE__ double atan2(double x, double y) { return ::atan2(x, y); }
+__DEVICE__ float atanh(float x) { return ::atanhf(x); }
+__DEVICE__ double atanh(double x) { return ::atanh(x); }
+__DEVICE__ float cbrt(float x) { return ::cbrtf(x); }
+__DEVICE__ double cbrt(double x) { return ::cbrt(x); }
+__DEVICE__ float ceil(float x) { return ::ceilf(x); }
+__DEVICE__ double ceil(double x) { return ::ceil(x); }
+__DEVICE__ float copysign(float x, float y) { return ::copysignf(x, y); }
+__DEVICE__ double copysign(double x, double y) { return ::copysign(x, y); }
+__DEVICE__ float cos(float x) { return ::cosf(x); }
+__DEVICE__ double cos(double x) { return ::cos(x); }
+__DEVICE__ float cosh(float x) { return ::coshf(x); }
+__DEVICE__ double cosh(double x) { return ::cosh(x); }
+__DEVICE__ float erf(float x) { return ::erff(x); }
+__DEVICE__ double erf(double x) { return ::erf(x); }
+__DEVICE__ float erfc(float x) { return ::erfcf(x); }
+__DEVICE__ double erfc(double x) { return ::erfc(x); }
+__DEVICE__ float exp(float x) { return ::expf(x); }
+__DEVICE__ double exp(double x) { return ::exp(x); }
+__DEVICE__ float exp2(float x) { return ::exp2f(x); }
+__DEVICE__ double exp2(double x) { return ::exp2(x); }
+__DEVICE__ float expm1(float x) { return 

Re: [PATCH] D16475: Remove autoconf support

2016-01-26 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258864: Remove autoconf support (authored by cbieneman).

Changed prior to commit:
  http://reviews.llvm.org/D16475?vs=45709=46045#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16475

Files:
  clang-tools-extra/trunk/Makefile
  clang-tools-extra/trunk/clang-apply-replacements/Makefile
  clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/Makefile
  clang-tools-extra/trunk/clang-apply-replacements/tool/Makefile
  clang-tools-extra/trunk/clang-query/Makefile
  clang-tools-extra/trunk/clang-query/tool/Makefile
  clang-tools-extra/trunk/clang-rename/Makefile
  clang-tools-extra/trunk/clang-rename/tool/Makefile
  clang-tools-extra/trunk/clang-tidy/Makefile
  clang-tools-extra/trunk/clang-tidy/cert/Makefile
  clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/Makefile
  clang-tools-extra/trunk/clang-tidy/google/Makefile
  clang-tools-extra/trunk/clang-tidy/llvm/Makefile
  clang-tools-extra/trunk/clang-tidy/misc/Makefile
  clang-tools-extra/trunk/clang-tidy/modernize/Makefile
  clang-tools-extra/trunk/clang-tidy/performance/Makefile
  clang-tools-extra/trunk/clang-tidy/readability/Makefile
  clang-tools-extra/trunk/clang-tidy/tool/Makefile
  clang-tools-extra/trunk/clang-tidy/utils/Makefile
  clang-tools-extra/trunk/docs/Makefile
  clang-tools-extra/trunk/modularize/Makefile
  clang-tools-extra/trunk/pp-trace/Makefile
  clang-tools-extra/trunk/test/Makefile
  clang-tools-extra/trunk/tool-template/Makefile
  clang-tools-extra/trunk/unittests/Makefile
  clang-tools-extra/trunk/unittests/clang-apply-replacements/Makefile
  clang-tools-extra/trunk/unittests/clang-query/Makefile
  clang-tools-extra/trunk/unittests/clang-rename/Makefile
  clang-tools-extra/trunk/unittests/clang-tidy/Makefile

Index: clang-tools-extra/trunk/test/Makefile
===
--- clang-tools-extra/trunk/test/Makefile
+++ clang-tools-extra/trunk/test/Makefile
@@ -1,73 +0,0 @@
-##===- tools/extra/test/Makefile ---*- Makefile -*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===--===##
-
-CLANG_LEVEL := ../../..
-include $(CLANG_LEVEL)/Makefile
-
-# Test in all immediate subdirectories if unset.
-ifdef TESTSUITE
-TESTDIRS := $(TESTSUITE:%=$(PROJ_SRC_DIR)/%)
-else
-TESTDIRS ?= $(PROJ_SRC_DIR)
-endif
-
-# 'lit' wants objdir paths, so it will pick up the lit.site.cfg.
-TESTDIRS := $(TESTDIRS:$(PROJ_SRC_DIR)%=$(PROJ_OBJ_DIR)%)
-
-# Allow EXTRA_TESTDIRS to provide additional test directories.
-TESTDIRS += $(EXTRA_TESTDIRS)
-
-ifndef TESTARGS
-ifdef VERBOSE
-TESTARGS = -v
-else
-TESTARGS = -s -v
-endif
-endif
-
-# Make sure any extra test suites can find the main site config.
-LIT_ARGS := --param clang_site_config=$(PROJ_OBJ_DIR)/lit.site.cfg
-
-ifdef VG
-  LIT_ARGS += "--vg"
-endif
-
-all:: lit.site.cfg Unit/lit.site.cfg
-	@ echo '--- Running the Clang extra tools tests for $(TARGET_TRIPLE) ---'
-	@ $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py \
-	  $(LIT_ARGS) $(TESTARGS) $(TESTDIRS)
-
-FORCE:
-
-lit.site.cfg: FORCE
-	@echo "Making lit.site.cfg for Clang extra tools..."
-	@$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp
-	@$(ECHOPATH) s=@LLVM_LIBS_DIR@=$(LibDir)=g >> lit.tmp
-	@$(ECHOPATH) s=@CLANG_TOOLS_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> lit.tmp
-	@$(ECHOPATH) s=@CLANG_TOOLS_BINARY_DIR@=$(PROJ_OBJ_DIR)/..=g >> lit.tmp
-	@$(ECHOPATH) s=@CLANG_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp
-	@$(ECHOPATH) s=@PYTHON_EXECUTABLE@=$(PYTHON)=g >> lit.tmp
-	@$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp
-	@sed -f lit.tmp $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
-	@-rm -f lit.tmp
-
-Unit/lit.site.cfg: FORCE
-	@echo "Making Unit/lit.site.cfg for Clang extra tools..."
-	@$(MKDIR) $(dir $@)
-	@$(ECHOPATH) s=@LLVM_LIBS_DIR@=$(LibDir)=g >> unit.tmp
-	@$(ECHOPATH) s=@CLANG_TOOLS_BINARY_DIR@=$(PROJ_OBJ_DIR)/..=g >> unit.tmp
-	@$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> unit.tmp
-	@$(ECHOPATH) s=@CLANG_TOOLS_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> unit.tmp
-	@sed -f unit.tmp $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
-	@-rm -f unit.tmp
-
-clean::
-	@ find . -name Output | xargs rm -fr
-
-.PHONY: all report clean
Index: clang-tools-extra/trunk/pp-trace/Makefile
===
--- clang-tools-extra/trunk/pp-trace/Makefile
+++ clang-tools-extra/trunk/pp-trace/Makefile
@@ -1,22 +0,0 @@
-##===- extra/pp-trace/Makefile --*- Makefile -*---===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===-===##

[clang-tools-extra] r258864 - Remove autoconf support

2016-01-26 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Tue Jan 26 15:31:36 2016
New Revision: 258864

URL: http://llvm.org/viewvc/llvm-project?rev=258864=rev
Log:
Remove autoconf support

Summary:
This patch is provided in preparation for removing autoconf on 1/26. The 
proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: 
http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"Now I am become Death, the destroyer of worlds."
-J. Robert Oppenheimer

Reviewers: chandlerc, grosbach, bob.wilson, echristo

Subscribers: cfe-commits, klimek

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

Removed:
clang-tools-extra/trunk/Makefile
clang-tools-extra/trunk/clang-apply-replacements/Makefile
clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/Makefile
clang-tools-extra/trunk/clang-apply-replacements/tool/Makefile
clang-tools-extra/trunk/clang-query/Makefile
clang-tools-extra/trunk/clang-query/tool/Makefile
clang-tools-extra/trunk/clang-rename/Makefile
clang-tools-extra/trunk/clang-rename/tool/Makefile
clang-tools-extra/trunk/clang-tidy/Makefile
clang-tools-extra/trunk/clang-tidy/cert/Makefile
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/Makefile
clang-tools-extra/trunk/clang-tidy/google/Makefile
clang-tools-extra/trunk/clang-tidy/llvm/Makefile
clang-tools-extra/trunk/clang-tidy/misc/Makefile
clang-tools-extra/trunk/clang-tidy/modernize/Makefile
clang-tools-extra/trunk/clang-tidy/performance/Makefile
clang-tools-extra/trunk/clang-tidy/readability/Makefile
clang-tools-extra/trunk/clang-tidy/tool/Makefile
clang-tools-extra/trunk/clang-tidy/utils/Makefile
clang-tools-extra/trunk/docs/Makefile
clang-tools-extra/trunk/modularize/Makefile
clang-tools-extra/trunk/pp-trace/Makefile
clang-tools-extra/trunk/test/Makefile
clang-tools-extra/trunk/tool-template/Makefile
clang-tools-extra/trunk/unittests/Makefile
clang-tools-extra/trunk/unittests/clang-apply-replacements/Makefile
clang-tools-extra/trunk/unittests/clang-query/Makefile
clang-tools-extra/trunk/unittests/clang-rename/Makefile
clang-tools-extra/trunk/unittests/clang-tidy/Makefile

Removed: clang-tools-extra/trunk/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/Makefile?rev=258863=auto
==
--- clang-tools-extra/trunk/Makefile (original)
+++ clang-tools-extra/trunk/Makefile (removed)
@@ -1,41 +0,0 @@
-##===- tools/extra/Makefile *- Makefile 
-*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===--===##
-
-CLANG_LEVEL := ../..
-
-include $(CLANG_LEVEL)/../../Makefile.config
-
-PARALLEL_DIRS := tool-template modularize pp-trace
-DIRS := clang-apply-replacements clang-rename clang-tidy clang-query unittests
-
-include $(CLANG_LEVEL)/Makefile
-
-###
-# Handle the nested test suite.
-
-ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
-$(RecursiveTargets)::
-   $(Verb) for dir in test; do \
- if [ -f $(PROJ_SRC_DIR)/$${dir}/Makefile ] && [ ! -f $${dir}/Makefile 
]; then \
-   $(MKDIR) $${dir}; \
-   $(CP) $(PROJ_SRC_DIR)/$${dir}/Makefile $${dir}/Makefile; \
- fi \
-   done
-endif
-
-test::
-   @ $(MAKE) -C test
-
-report::
-   @ $(MAKE) -C test report
-
-clean::
-   @ $(MAKE) -C test clean
-
-.PHONY: test report clean

Removed: clang-tools-extra/trunk/clang-apply-replacements/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/Makefile?rev=258863=auto
==
--- clang-tools-extra/trunk/clang-apply-replacements/Makefile (original)
+++ clang-tools-extra/trunk/clang-apply-replacements/Makefile (removed)
@@ -1,15 +0,0 @@
-##===- clang-apply-replacements/Makefile ---*- Makefile 
-*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===--===##
-
-CLANG_LEVEL := ../../..
-include $(CLANG_LEVEL)/../../Makefile.config
-
-DIRS = lib/Tooling tool
-
-include $(CLANG_LEVEL)/Makefile

Removed: clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/Makefile?rev=258863=auto
==
--- clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/Makefile 
(original)
+++ clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/Makefile 
(removed)

Re: [PATCH] D15721: [Sema] Fix ICE on casting a vector of bools to a vector of T

2016-01-26 Thread George Burgess IV via cfe-commits
george.burgess.iv updated this revision to Diff 46053.
george.burgess.iv marked an inline comment as done.
george.burgess.iv added a comment.

Updated comment, as requested.


http://reviews.llvm.org/D15721

Files:
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaType.cpp
  test/CodeGen/bool-vector-conversion.c
  test/SemaOpenCL/bool-vectors.cl

Index: test/SemaOpenCL/bool-vectors.cl
===
--- /dev/null
+++ test/SemaOpenCL/bool-vectors.cl
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+typedef __attribute__((ext_vector_type(16))) _Bool bool8; // expected-error{{invalid vector element type 'bool'}}
Index: test/CodeGen/bool-vector-conversion.c
===
--- /dev/null
+++ test/CodeGen/bool-vector-conversion.c
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 %s -x c -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -x c++ -emit-llvm -o - | FileCheck %s
+//
+// In many parts of clang, we treat a bool as an i8, but we lower it to an i1.
+// This is usually fine, but it broke things with vectors (e.g. we deemed a cast
+// from a [4 x i1] to a [1 x i32] to be legal, and proceeded to crash shortly
+// afterward).
+
+#ifdef __cplusplus
+typedef bool BOOL;
+#else
+typedef _Bool BOOL;
+#endif
+
+// Only extended vectors allow bool elements.
+// __asm__ label keeps C++ mangling from happening
+void test() __asm__("test");
+
+// CHECK-LABEL: @test
+void test() {
+  typedef __attribute__((__ext_vector_type__(8))) BOOL CLVectorBool8;
+  typedef __attribute__((__ext_vector_type__(1))) unsigned char CLVectorInt1;
+
+  // CHECK: store <8 x i1> zeroinitializer
+  CLVectorBool8 bools = (CLVectorBool8)0;
+  // CHECK: store <1 x i8>
+  CLVectorInt1 ints = (CLVectorInt1)bools;
+  // CHECK: store <8 x i1>
+  bools = (CLVectorBool8)ints;
+
+  // Run through the code in CGExprConstant.
+  // CHECK: store <8 x i1> zeroinitializer
+  bools = (CLVectorBool8)(CLVectorInt1)(CLVectorBool8)0;
+}
+
Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -2184,10 +2184,15 @@
 /// Run the required checks for the extended vector type.
 QualType Sema::BuildExtVectorType(QualType T, Expr *ArraySize,
   SourceLocation AttrLoc) {
-  // unlike gcc's vector_size attribute, we do not allow vectors to be defined
+  // Unlike gcc's vector_size attribute, we do not allow vectors to be defined
   // in conjunction with complex types (pointers, arrays, functions, etc.).
-  if (!T->isDependentType() &&
-  !T->isIntegerType() && !T->isRealFloatingType()) {
+  //
+  // Additionally, OpenCL prohibits vectors of booleans (they're considered a
+  // reserved data type under OpenCL v2.0 s6.1.4), but we do allow their use
+  // outside of OpenCL.
+  if ((!T->isDependentType() && !T->isIntegerType() &&
+   !T->isRealFloatingType()) ||
+  (getLangOpts().OpenCL && T->isBooleanType())) {
 Diag(AttrLoc, diag::err_attribute_invalid_vector_type) << T;
 return QualType();
   }
@@ -2201,7 +2206,7 @@
   return QualType();
 }
 
-// unlike gcc's vector_size attribute, the size is specified as the
+// Unlike gcc's vector_size attribute, the size is specified as the
 // number of elements, not the number of bytes.
 unsigned vectorSize = static_cast(vecSize.getZExtValue());
 
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -5718,9 +5718,15 @@
   // ASTContext::getTypeSize will return the size rounded up to a
   // power of 2, so instead of using that, we need to use the raw
   // element size multiplied by the element count.
-  uint64_t srcEltSize = Context.getTypeSize(srcEltTy);
-  uint64_t destEltSize = Context.getTypeSize(destEltTy);
-  
+  //
+  // We need to be careful about booleans though; they're lowered to i1s, but
+  // getTypeSize views them as i8s. (They're allowed in extended vectors
+  // when compiling code as e.g. C++)
+  uint64_t srcEltSize =
+  srcEltTy->isBooleanType() ? 1 : Context.getTypeSize(srcEltTy);
+  uint64_t destEltSize =
+  destEltTy->isBooleanType() ? 1 : Context.getTypeSize(destEltTy);
+
   return (srcLen * srcEltSize == destLen * destEltSize);
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16566: [Clang-tidy] Fix Clang-tidy modernize-use-override warning in unittests/clang-tidy/IncludeInserterTest.cpp; other minor fixes

2016-01-26 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258870: Fix Clang-tidy modernize-use-override warning in 
unittests/clang… (authored by eugenezelenko).

Changed prior to commit:
  http://reviews.llvm.org/D16566?vs=45938=46054#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16566

Files:
  clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp

Index: clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
===
--- clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
+++ clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
@@ -98,7 +98,6 @@
 public:
   CXXSystemIncludeInserterCheck(StringRef CheckName, ClangTidyContext *Context)
   : IncludeInserterCheckBase(CheckName, Context) {}
-  virtual ~CXXSystemIncludeInserterCheck() {}
 
   std::vector HeadersToInclude() const override { return {"set"}; }
   bool IsAngledInclude() const override { return true; }
@@ -522,7 +521,7 @@
"insert_includes_test_header.cc"));
 }
 
-} // namespace
+} // anonymous namespace
 } // namespace tidy
 } // namespace clang
 


Index: clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
===
--- clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
+++ clang-tools-extra/trunk/unittests/clang-tidy/IncludeInserterTest.cpp
@@ -98,7 +98,6 @@
 public:
   CXXSystemIncludeInserterCheck(StringRef CheckName, ClangTidyContext *Context)
   : IncludeInserterCheckBase(CheckName, Context) {}
-  virtual ~CXXSystemIncludeInserterCheck() {}
 
   std::vector HeadersToInclude() const override { return {"set"}; }
   bool IsAngledInclude() const override { return true; }
@@ -522,7 +521,7 @@
"insert_includes_test_header.cc"));
 }
 
-} // namespace
+} // anonymous namespace
 } // namespace tidy
 } // namespace clang
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16593: [CUDA] Implemented device-side support for functions in .

2016-01-26 Thread Artem Belevich via cfe-commits
tra updated this revision to Diff 46055.
tra marked 6 inline comments as done.
tra added a comment.

Fixed few issues revealed by -Wdouble-promotion


http://reviews.llvm.org/D16593

Files:
  lib/Headers/CMakeLists.txt
  lib/Headers/__clang_cuda_cmath.h
  lib/Headers/__clang_cuda_runtime_wrapper.h

Index: lib/Headers/__clang_cuda_runtime_wrapper.h
===
--- lib/Headers/__clang_cuda_runtime_wrapper.h
+++ lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -46,6 +46,7 @@
 // while some required macros (like __THROW) are in a weird state.
 #include 
 #include 
+#include 
 
 // Preserve common macros that will be changed below by us or by CUDA
 // headers.
@@ -157,7 +158,7 @@
 static inline float sinpi(float a) { return sinpif(a); }
 static inline float cospi(float a) { return cospif(a); }
 static inline void sincospi(float a, float *b, float *c) {
-  return sincospi(a, b, c);
+  return sincospif(a, b, c);
 }
 static inline float erfcinv(float a) { return erfcinvf(a); }
 static inline float normcdfinv(float a) { return normcdfinvf(a); }
@@ -217,5 +218,7 @@
 extern "C" __device__ int vprintf(const char*, const char*);
 #endif
 
+#include <__clang_cuda_cmath.h>
+
 #endif // __CUDA__
 #endif // __CLANG_CUDA_RUNTIME_WRAPPER_H__
Index: lib/Headers/__clang_cuda_cmath.h
===
--- /dev/null
+++ lib/Headers/__clang_cuda_cmath.h
@@ -0,0 +1,223 @@
+/*=== __clang_cuda_cmath.h - Device-side CUDA cmath support ===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+#ifndef __CLANG_CUDA_CMATH_H__
+#define __CLANG_CUDA_CMATH_H__
+#ifndef __CUDA__
+#error "This file is for CUDA compilation only."
+#endif
+
+// CUDA allows using math functions form std:: on device side.  This
+// file provides __device__ overloads for math functions that map to
+// appropriate math functions provided by CUDA headers or to compiler
+// builtins if CUDA does not provide a suitable function.
+
+#define __DEVICE__ static __device__ __inline__ __attribute__((always_inline))
+
+namespace std {
+__DEVICE__ long long abs(long long n) { return ::llabs(n); }
+__DEVICE__ long abs(long n) { return ::labs(n); }
+__DEVICE__ int abs(int n) { return ::abs(n); }
+__DEVICE__ float abs(float x) { return ::fabsf(x); }
+__DEVICE__ double abs(double x) { return ::fabs(x); }
+__DEVICE__ float acos(float x) { return ::acosf(x); }
+__DEVICE__ double acos(double x) { return ::acos(x); }
+__DEVICE__ float acosh(float x) { return ::acoshf(x); }
+__DEVICE__ double acosh(double x) { return ::acosh(x); }
+__DEVICE__ float asin(float x) { return ::asinf(x); }
+__DEVICE__ double asin(double x) { return ::asin(x); }
+__DEVICE__ float asinh(float x) { return ::asinhf(x); }
+__DEVICE__ double asinh(double x) { return ::asinh(x); }
+__DEVICE__ float atan(float x) { return ::atanf(x); }
+__DEVICE__ double atan(double x) { return ::atan(x); }
+__DEVICE__ float atan2(float x, float y) { return ::atan2f(x, y); }
+__DEVICE__ double atan2(double x, double y) { return ::atan2(x, y); }
+__DEVICE__ float atanh(float x) { return ::atanhf(x); }
+__DEVICE__ double atanh(double x) { return ::atanh(x); }
+__DEVICE__ float cbrt(float x) { return ::cbrtf(x); }
+__DEVICE__ double cbrt(double x) { return ::cbrt(x); }
+__DEVICE__ float ceil(float x) { return ::ceilf(x); }
+__DEVICE__ double ceil(double x) { return ::ceil(x); }
+__DEVICE__ float copysign(float x, float y) { return ::copysignf(x, y); }
+__DEVICE__ double copysign(double x, double y) { return ::copysign(x, y); }
+__DEVICE__ float cos(float x) { return ::cosf(x); }
+__DEVICE__ double cos(double x) { return ::cos(x); }
+__DEVICE__ float cosh(float x) { return ::coshf(x); }
+__DEVICE__ double cosh(double x) { return ::cosh(x); }
+__DEVICE__ float erf(float x) { return ::erff(x); }
+__DEVICE__ 

[PATCH] D16605: Implement `std::experimental::ostream_joiner`

2016-01-26 Thread Marshall Clow via cfe-commits
mclow.lists created this revision.
mclow.lists added reviewers: EricWF, howard.hinnant.
mclow.lists added a subscriber: cfe-commits.

This is part of the Library Fundamentals 2 TS

http://reviews.llvm.org/D16605

Files:
  include/experimental/iterator
  test/std/experimental/iterator/nothing_to_do.pass.cpp
  
test/std/experimental/iterator/ostream.joiner/ostream.joiner.cons/ostream_joiner.cons.pass.cpp
  
test/std/experimental/iterator/ostream.joiner/ostream.joiner.creation/make_ostream_joiner.pass.cpp
  
test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.assign.pass.cpp
  
test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.postincrement.pass.cpp
  
test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.pretincrement.pass.cpp
  
test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.star.pass.cpp

Index: test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.star.pass.cpp
===
--- test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.star.pass.cpp
+++ test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.star.pass.cpp
@@ -0,0 +1,46 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// 
+//
+// template >
+//   class ostream_joiner;
+//
+//   ostream_joiner & operator*() noexcept
+// returns *this;
+
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+namespace exp = std::experimental;
+
+template 
+void test ( exp::ostream_joiner  ) {
+static_assert((noexcept(*oj)), "" );
+exp::ostream_joiner  = *oj;
+assert(  ==  );
+}
+
+int main () {
+
+{ exp::ostream_joiner oj(std::cout, '8'); test(oj); }
+{ exp::ostream_joiner  oj(std::cout, std::string("9"));test(oj); }
+{ exp::ostream_joiner oj(std::cout, std::wstring(L"10")); test(oj); }
+{ exp::ostream_joiner  oj(std::cout, 11);  test(oj); }
+
+{ exp::ostream_joiner oj(std::wcout, '8'); test(oj); }
+{ exp::ostream_joiner  oj(std::wcout, std::string("9"));test(oj); }
+{ exp::ostream_joiner oj(std::wcout, std::wstring(L"10")); test(oj); }
+{ exp::ostream_joiner  oj(std::wcout, 11);  test(oj); }
+}
Index: test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.pretincrement.pass.cpp
===
--- test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.pretincrement.pass.cpp
+++ test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.pretincrement.pass.cpp
@@ -0,0 +1,46 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// 
+//
+// template >
+//   class ostream_joiner;
+//
+//   ostream_joiner & operator++() noexcept
+// returns *this;
+
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+
+namespace exp = std::experimental;
+
+template 
+void test ( exp::ostream_joiner  ) {
+static_assert((noexcept(++oj)), "" );
+exp::ostream_joiner  = ++oj;
+assert(  ==  );
+}
+
+int main () {
+
+{ exp::ostream_joiner oj(std::cout, '8'); test(oj); }
+{ exp::ostream_joiner  oj(std::cout, std::string("9"));test(oj); }
+{ exp::ostream_joiner oj(std::cout, std::wstring(L"10")); test(oj); }
+{ exp::ostream_joiner  oj(std::cout, 11);  test(oj); }
+
+{ exp::ostream_joiner oj(std::wcout, '8'); test(oj); }
+{ exp::ostream_joiner  oj(std::wcout, std::string("9"));test(oj); }
+{ exp::ostream_joiner oj(std::wcout, std::wstring(L"10")); test(oj); }
+{ exp::ostream_joiner  oj(std::wcout, 11);  test(oj); }
+}
Index: test/std/experimental/iterator/ostream.joiner/ostream.joiner.ops/ostream_joiner.op.postincrement.pass.cpp

r258877 - [WinEH] Annotate calls to __RTtypeid with a funclet bundle

2016-01-26 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Tue Jan 26 17:14:47 2016
New Revision: 258877

URL: http://llvm.org/viewvc/llvm-project?rev=258877=rev
Log:
[WinEH] Annotate calls to __RTtypeid with a funclet bundle

Clang's CodeGen has several paths which end up invoking or calling a
function. The one that we used for calls to __RTtypeid did not
appropriately annotate the call with a funclet bundle.

This fixes PR26329.

Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/test/CodeGenCXX/microsoft-abi-typeid.cpp

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=258877=258876=258877=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Jan 26 17:14:47 2016
@@ -3121,13 +3121,16 @@ CodeGenFunction::EmitCallOrInvoke(llvm::
   ArrayRef Args,
   const Twine ) {
   llvm::BasicBlock *InvokeDest = getInvokeDest();
+  SmallVector BundleList;
+  getBundlesForFunclet(Callee, CurrentFuncletPad, BundleList);
 
   llvm::Instruction *Inst;
   if (!InvokeDest)
-Inst = Builder.CreateCall(Callee, Args, Name);
+Inst = Builder.CreateCall(Callee, Args, BundleList, Name);
   else {
 llvm::BasicBlock *ContBB = createBasicBlock("invoke.cont");
-Inst = Builder.CreateInvoke(Callee, ContBB, InvokeDest, Args, Name);
+Inst = Builder.CreateInvoke(Callee, ContBB, InvokeDest, Args, BundleList,
+Name);
 EmitBlock(ContBB);
   }
 

Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-typeid.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-typeid.cpp?rev=258877=258876=258877=diff
==
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-typeid.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-typeid.cpp Tue Jan 26 17:14:47 2016
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -O1 -o - -triple=i386-pc-win32 %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -O1 -o - -triple=i386-pc-win32 %s -fexceptions 
-fcxx-exceptions | FileCheck %s
 
 struct type_info;
 namespace std { using ::type_info; }
@@ -49,3 +49,22 @@ const std::type_info* test5_typeid() { r
 // CHECK:[[RT:%.*]] = tail call i8* @__RTtypeid(i8* bitcast 
(%struct.V* @"\01?v@@3UV@@A" to i8*))
 // CHECK-NEXT:   [[RET:%.*]] = bitcast i8* [[RT]] to %struct.type_info*
 // CHECK-NEXT:   ret %struct.type_info* [[RET]]
+
+namespace PR26329 {
+struct Polymorphic {
+  virtual ~Polymorphic();
+};
+
+void f(const Polymorphic ) {
+  try {
+throw;
+  } catch (...) {
+Polymorphic cleanup;
+typeid(poly);
+  }
+}
+// CHECK-LABEL: define void @"\01?f@PR26329@@YAXABUPolymorphic@1@@Z"(
+// CHECK: %[[cs:.*]] = catchswitch within none [label %{{.*}}] unwind to caller
+// CHECK: %[[cp:.*]] = catchpad within %[[cs]] [i8* null, i32 64, i8* null]
+// CHECK: invoke i8* @__RTtypeid(i8* {{.*}}) [ "funclet"(token %[[cp]]) ]
+}


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


[PATCH] D16607: Implementation of PS4 ABI, round 1

2016-01-26 Thread Sunil Srivastava via cfe-commits
Sunil_Srivastava created this revision.
Sunil_Srivastava added a reviewer: rsmith.
Sunil_Srivastava added a subscriber: cfe-commits.

We are planning to upstream changes needed for maintaining PS4 ABI across 
future releases.

Unlike many other targets, we need to maintain, in most cases, strict object 
compatibility to a stable base (llvm 3.2 in this case) across releases, even in 
cases where the behavior differs from common x86-64 documentation or current 
practice.

To maintain such compatibility we are proposing to introduce TargetCXXABI::PS4. 
This will be a variant of GenericItaniumABI, but will remain compatible to llvm 
3.2 in most cases, even if the GenericItaniumABI behavior changes. One such 
change has recently occurred in r257462, and is the motivation of taking up 
this task now.

This proposed change is the  first step of this work. This is not a change in 
the compiler at all, but just an addition to a test for x86_64_pc-linux-gnu 
triple. Its purpose is to guard against inadvertent changes to the default 
x86_64 ABI by future changes, in regard to the bitfield layout.

The proposed change adds a new run line with x86_64_pc-linux-gnu, along with 
few variants of tests where they x86_64 rules differ from other triple used In 
the test.

The next round of changes will introduce the concept of the PS4 ABI in the 
compiler itself.


http://reviews.llvm.org/D16607

Files:
  test/Sema/bitfield-layout.c

Index: test/Sema/bitfield-layout.c
===
--- test/Sema/bitfield-layout.c
+++ test/Sema/bitfield-layout.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 %s -fsyntax-only -verify -triple=i686-apple-darwin9
 // RUN: %clang_cc1 %s -fsyntax-only -verify -triple=arm-linux-gnueabihf
 // RUN: %clang_cc1 %s -fsyntax-only -verify -triple=aarch64-linux-gnu
+// RUN: %clang_cc1 %s -fsyntax-only -verify -triple=x86_64-pc-linux-gnu
 // expected-no-diagnostics
 #include 
 
@@ -190,7 +191,7 @@
   __attribute__((aligned(1))) long long b : 62;
   char c;
 };
-#if defined(__arm__) || defined(__aarch64__)
+#if defined(__arm__) || defined(__aarch64__) || defined(__x86_64__)
 CHECK_SIZE(struct, g11, 24);
 CHECK_ALIGN(struct, g11, 8);
 CHECK_OFFSET(struct, g11, c, 16);
@@ -218,6 +219,10 @@
 CHECK_SIZE(struct, g13, 16);
 CHECK_ALIGN(struct, g13, 8);
 CHECK_OFFSET(struct, g13, c, 8);
+#elif (__x86_64__)
+CHECK_SIZE(struct, g13, 9);
+CHECK_ALIGN(struct, g13, 1);
+CHECK_OFFSET(struct, g13, c, 8);
 #else
 CHECK_SIZE(struct, g13, 5);
 CHECK_ALIGN(struct, g13, 1);
@@ -233,6 +238,10 @@
 CHECK_SIZE(struct, g14, 16);
 CHECK_ALIGN(struct, g14, 8);
 CHECK_OFFSET(struct, g14, c, 8);
+#elif (__x86_64__)
+CHECK_SIZE(struct, g14, 9);
+CHECK_ALIGN(struct, g14, 1);
+CHECK_OFFSET(struct, g14, c, 8);
 #else
 CHECK_SIZE(struct, g14, 5);
 CHECK_ALIGN(struct, g14, 1);


Index: test/Sema/bitfield-layout.c
===
--- test/Sema/bitfield-layout.c
+++ test/Sema/bitfield-layout.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 %s -fsyntax-only -verify -triple=i686-apple-darwin9
 // RUN: %clang_cc1 %s -fsyntax-only -verify -triple=arm-linux-gnueabihf
 // RUN: %clang_cc1 %s -fsyntax-only -verify -triple=aarch64-linux-gnu
+// RUN: %clang_cc1 %s -fsyntax-only -verify -triple=x86_64-pc-linux-gnu
 // expected-no-diagnostics
 #include 
 
@@ -190,7 +191,7 @@
   __attribute__((aligned(1))) long long b : 62;
   char c;
 };
-#if defined(__arm__) || defined(__aarch64__)
+#if defined(__arm__) || defined(__aarch64__) || defined(__x86_64__)
 CHECK_SIZE(struct, g11, 24);
 CHECK_ALIGN(struct, g11, 8);
 CHECK_OFFSET(struct, g11, c, 16);
@@ -218,6 +219,10 @@
 CHECK_SIZE(struct, g13, 16);
 CHECK_ALIGN(struct, g13, 8);
 CHECK_OFFSET(struct, g13, c, 8);
+#elif (__x86_64__)
+CHECK_SIZE(struct, g13, 9);
+CHECK_ALIGN(struct, g13, 1);
+CHECK_OFFSET(struct, g13, c, 8);
 #else
 CHECK_SIZE(struct, g13, 5);
 CHECK_ALIGN(struct, g13, 1);
@@ -233,6 +238,10 @@
 CHECK_SIZE(struct, g14, 16);
 CHECK_ALIGN(struct, g14, 8);
 CHECK_OFFSET(struct, g14, c, 8);
+#elif (__x86_64__)
+CHECK_SIZE(struct, g14, 9);
+CHECK_ALIGN(struct, g14, 1);
+CHECK_OFFSET(struct, g14, c, 8);
 #else
 CHECK_SIZE(struct, g14, 5);
 CHECK_ALIGN(struct, g14, 1);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >