r262696 - [OPENMP] Simplify handling of clauses with postupdates, NFC.

2016-03-03 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Fri Mar  4 01:21:16 2016
New Revision: 262696

URL: http://llvm.org/viewvc/llvm-project?rev=262696=rev
Log:
[OPENMP] Simplify handling of clauses with postupdates, NFC.

Clauses with post-update expressions always have pre-init statement. So
OMPClauseWithPreInit now is the base for OMPClauseWithPostUpdate.

Modified:
cfe/trunk/include/clang/AST/OpenMPClause.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=262696=262695=262696=diff
==
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Fri Mar  4 01:21:16 2016
@@ -80,7 +80,7 @@ protected:
   /// Set pre-initialization statement for the clause.
   void setPreInitStmt(Stmt *S) { PreInit = S; }
   OMPClauseWithPreInit(const OMPClause *This) : PreInit(nullptr) {
-assert(get(This) && "get is not tuned.");
+assert(get(This) && "get is not tuned for pre-init.");
   }
 
 public:
@@ -94,15 +94,16 @@ public:
 
 /// Class that handles post-update expression for some clauses, like
 /// 'lastprivate', 'reduction' etc.
-class OMPClauseWithPostUpdate {
+class OMPClauseWithPostUpdate : public OMPClauseWithPreInit {
   friend class OMPClauseReader;
   /// Post-update expression for the clause.
   Expr *PostUpdate;
 protected:
   /// Set pre-initialization statement for the clause.
   void setPostUpdateExpr(Expr *S) { PostUpdate = S; }
-  OMPClauseWithPostUpdate(const OMPClause *This) : PostUpdate(nullptr) {
-assert(get(This) && "get is not tuned.");
+  OMPClauseWithPostUpdate(const OMPClause *This)
+  : OMPClauseWithPreInit(This), PostUpdate(nullptr) {
+assert(get(This) && "get is not tuned for post-update.");
   }
 
 public:
@@ -1404,7 +1405,6 @@ public:
 /// with the variables 'a' and 'b'.
 class OMPLastprivateClause final
 : public OMPVarListClause,
-  public OMPClauseWithPreInit,
   public OMPClauseWithPostUpdate,
   private llvm::TrailingObjects {
   // There are 4 additional tail-allocated arrays at the end of the class:
@@ -1439,7 +1439,7 @@ class OMPLastprivateClause final
SourceLocation EndLoc, unsigned N)
   : OMPVarListClause(OMPC_lastprivate, StartLoc,
LParenLoc, EndLoc, N),
-OMPClauseWithPreInit(this), OMPClauseWithPostUpdate(this) {}
+OMPClauseWithPostUpdate(this) {}
 
   /// \brief Build an empty clause.
   ///
@@ -1449,7 +1449,7 @@ class OMPLastprivateClause final
   : OMPVarListClause(
 OMPC_lastprivate, SourceLocation(), SourceLocation(),
 SourceLocation(), N),
-OMPClauseWithPreInit(this), OMPClauseWithPostUpdate(this) {}
+OMPClauseWithPostUpdate(this) {}
 
   /// \brief Get the list of helper expressions for initialization of private
   /// copies for lastprivate variables.
@@ -1665,7 +1665,6 @@ public:
 ///
 class OMPReductionClause final
 : public OMPVarListClause,
-  public OMPClauseWithPreInit,
   public OMPClauseWithPostUpdate,
   private llvm::TrailingObjects {
   friend TrailingObjects;
@@ -1694,8 +1693,8 @@ class OMPReductionClause final
  const DeclarationNameInfo )
   : OMPVarListClause(OMPC_reduction, StartLoc,
  LParenLoc, EndLoc, N),
-OMPClauseWithPreInit(this), OMPClauseWithPostUpdate(this),
-ColonLoc(ColonLoc), QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
+OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
+QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
 
   /// \brief Build an empty clause.
   ///
@@ -1705,8 +1704,7 @@ class OMPReductionClause final
   : OMPVarListClause(OMPC_reduction, SourceLocation(),
  SourceLocation(), 
SourceLocation(),
  N),
-OMPClauseWithPreInit(this), OMPClauseWithPostUpdate(this), ColonLoc(),
-QualifierLoc(), NameInfo() {}
+OMPClauseWithPostUpdate(this), ColonLoc(), QualifierLoc(), NameInfo() 
{}
 
   /// \brief Sets location of ':' symbol in clause.
   void setColonLoc(SourceLocation CL) { ColonLoc = CL; }

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=262696=262695=262696=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ 

r262695 - [index] Distinguish USRs of anonymous enums by using their first enumerator.

2016-03-03 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Fri Mar  4 01:17:53 2016
New Revision: 262695

URL: http://llvm.org/viewvc/llvm-project?rev=262695=rev
Log:
[index] Distinguish USRs of anonymous enums by using their first enumerator.

rdar://24609949.

Modified:
cfe/trunk/lib/Index/IndexingContext.cpp
cfe/trunk/lib/Index/USRGeneration.cpp
cfe/trunk/test/Index/Core/index-source.m
cfe/trunk/test/Index/usrs.m

Modified: cfe/trunk/lib/Index/IndexingContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexingContext.cpp?rev=262695=262694=262695=diff
==
--- cfe/trunk/lib/Index/IndexingContext.cpp (original)
+++ cfe/trunk/lib/Index/IndexingContext.cpp Fri Mar  4 01:17:53 2016
@@ -206,10 +206,6 @@ static const Decl *adjustParent(const De
 if (auto NS = dyn_cast(Parent)) {
   if (NS->isAnonymousNamespace())
 continue;
-} else if (auto EnumD = dyn_cast(Parent)) {
-  // Move enumerators under anonymous enum to the enclosing parent.
-  if (EnumD->getDeclName().isEmpty())
-continue;
 } else if (auto RD = dyn_cast(Parent)) {
   if (RD->isAnonymousStructOrUnion())
 continue;

Modified: cfe/trunk/lib/Index/USRGeneration.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/USRGeneration.cpp?rev=262695=262694=262695=diff
==
--- cfe/trunk/lib/Index/USRGeneration.cpp (original)
+++ cfe/trunk/lib/Index/USRGeneration.cpp Fri Mar  4 01:17:53 2016
@@ -426,7 +426,8 @@ void USRGenerator::VisitObjCPropertyImpl
 void USRGenerator::VisitTagDecl(const TagDecl *D) {
   // Add the location of the tag decl to handle resolution across
   // translation units.
-  if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D)))
+  if (!isa(D) &&
+  ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D)))
 return;
 
   D = D->getCanonicalDecl();
@@ -482,8 +483,16 @@ void USRGenerator::VisitTagDecl(const Ta
   else {
 if (D->isEmbeddedInDeclarator() && !D->isFreeStanding()) {
   printLoc(Out, D->getLocation(), Context->getSourceManager(), true);
-} else
+} else {
   Buf[off] = 'a';
+  if (auto *ED = dyn_cast(D)) {
+// Distinguish USRs of anonymous enums by using their first enumerator.
+auto enum_range = ED->enumerators();
+if (enum_range.begin() != enum_range.end()) {
+  Out << '@' << **enum_range.begin();
+}
+  }
+}
   }
   }
   

Modified: cfe/trunk/test/Index/Core/index-source.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Core/index-source.m?rev=262695=262694=262695=diff
==
--- cfe/trunk/test/Index/Core/index-source.m (original)
+++ cfe/trunk/test/Index/Core/index-source.m Fri Mar  4 01:17:53 2016
@@ -48,3 +48,20 @@ void goo(Base *b) {
 void over_func(int x) __attribute__((overloadable));
 // CHECK: [[@LINE+1]]:6 | function/C | over_func | c:@F@over_func#f# | 
__Z9over_funcf | Decl | rel: 0
 void over_func(float x) __attribute__((overloadable));
+
+// CHECK: [[@LINE+1]]:6 | enum/C | MyEnum | c:@E@MyEnum |  | Def | 
rel: 0
+enum MyEnum {
+  // CHECK: [[@LINE+2]]:3 | enumerator/C | EnumeratorInNamed | 
c:@E@MyEnum@EnumeratorInNamed |  | Def,RelChild | rel: 1
+  // CHECK-NEXT: RelChild | MyEnum | c:@E@MyEnum
+  EnumeratorInNamed
+};
+
+// CHECK: [[@LINE+1]]:1 | enum/C |  | c:@Ea@One |  | Def | 
rel: 0
+enum {
+  // CHECK: [[@LINE+2]]:3 | enumerator/C | One | c:@Ea@One@One |  | 
Def,RelChild | rel: 1
+  // CHECK-NEXT: RelChild |  | c:@Ea@One
+  One,
+  // CHECK: [[@LINE+2]]:3 | enumerator/C | Two | c:@Ea@One@Two |  | 
Def,RelChild | rel: 1
+  // CHECK-NEXT: RelChild |  | c:@Ea@One
+  Two,
+};

Modified: cfe/trunk/test/Index/usrs.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/usrs.m?rev=262695=262694=262695=diff
==
--- cfe/trunk/test/Index/usrs.m (original)
+++ cfe/trunk/test/Index/usrs.m Fri Mar  4 01:17:53 2016
@@ -110,12 +110,12 @@ int test_multi_declaration(void) {
 // CHECK: usrs.m c:usrs.m@F@my_helper Extent=[3:1 - 3:60]
 // CHECK: usrs.m c:usrs.m@95@F@my_helper@x Extent=[3:29 - 3:34]
 // CHECK: usrs.m c:usrs.m@102@F@my_helper@y Extent=[3:36 - 3:41]
-// CHECK: usrs.m c:usrs.m@Ea Extent=[5:1 - 8:2]
-// CHECK: usrs.m c:usrs.m@Ea@ABA Extent=[6:3 - 6:6]
-// CHECK: usrs.m c:usrs.m@Ea@CADABA Extent=[7:3 - 7:9]
-// CHECK: usrs.m c:usrs.m@Ea Extent=[10:1 - 13:2]
-// CHECK: usrs.m c:usrs.m@Ea@FOO Extent=[11:3 - 11:6]
-// CHECK: usrs.m c:usrs.m@Ea@BAR Extent=[12:3 - 12:6]
+// CHECK: usrs.m c:@Ea@ABA Extent=[5:1 - 8:2]
+// CHECK: usrs.m c:@Ea@ABA@ABA Extent=[6:3 - 6:6]
+// CHECK: usrs.m c:@Ea@ABA@CADABA Extent=[7:3 - 7:9]
+// CHECK: usrs.m c:@Ea@FOO Extent=[10:1 - 13:2]
+// CHECK: usrs.m c:@Ea@FOO@FOO Extent=[11:3 - 11:6]
+// CHECK: 

r262694 - [index] Include parameter types in the USRs for C functions marked with 'overloadable' attribute.

2016-03-03 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Fri Mar  4 01:17:48 2016
New Revision: 262694

URL: http://llvm.org/viewvc/llvm-project?rev=262694=rev
Log:
[index] Include parameter types in the USRs for C functions marked with 
'overloadable' attribute.

Modified:
cfe/trunk/lib/Index/USRGeneration.cpp
cfe/trunk/test/Index/Core/index-source.m

Modified: cfe/trunk/lib/Index/USRGeneration.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/USRGeneration.cpp?rev=262694=262693=262694=diff
==
--- cfe/trunk/lib/Index/USRGeneration.cpp (original)
+++ cfe/trunk/lib/Index/USRGeneration.cpp Fri Mar  4 01:17:48 2016
@@ -218,7 +218,8 @@ void USRGenerator::VisitFunctionDecl(con
   D->getDeclName().print(Out, Policy);
 
   ASTContext  = *Context;
-  if (!Ctx.getLangOpts().CPlusPlus || D->isExternC())
+  if ((!Ctx.getLangOpts().CPlusPlus || D->isExternC()) &&
+  !D->hasAttr())
 return;
 
   if (const TemplateArgumentList *

Modified: cfe/trunk/test/Index/Core/index-source.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Core/index-source.m?rev=262694=262693=262694=diff
==
--- cfe/trunk/test/Index/Core/index-source.m (original)
+++ cfe/trunk/test/Index/Core/index-source.m Fri Mar  4 01:17:48 2016
@@ -43,3 +43,8 @@ void goo(Base *b) {
 // CHECK-NOT: ObjectType
 -(ObjectType)getit;
 @end
+
+// CHECK: [[@LINE+1]]:6 | function/C | over_func | c:@F@over_func#I# | 
__Z9over_funci | Decl | rel: 0
+void over_func(int x) __attribute__((overloadable));
+// CHECK: [[@LINE+1]]:6 | function/C | over_func | c:@F@over_func#f# | 
__Z9over_funcf | Decl | rel: 0
+void over_func(float x) __attribute__((overloadable));


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


r262692 - [OpenCL] Refine pipe builtin support

2016-03-03 Thread Xiuli Pan via cfe-commits
Author: pxl
Date: Fri Mar  4 01:11:16 2016
New Revision: 262692

URL: http://llvm.org/viewvc/llvm-project?rev=262692=rev
Log:
[OpenCL] Refine pipe builtin support

Summary:
Refine the type builtin support as the request with
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160201/148637.html

Reviewers: pekka.jaaskelainen, Anastasia, yaxunl

Subscribers: rsmith, cfe-commits

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

Modified:
cfe/trunk/include/clang/Basic/Builtins.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl

Modified: cfe/trunk/include/clang/Basic/Builtins.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=262692=262691=262692=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.h (original)
+++ cfe/trunk/include/clang/Basic/Builtins.h Fri Mar  4 01:11:16 2016
@@ -31,12 +31,12 @@ class QualType;
 class LangOptions;
 
 enum LanguageID {
-  GNU_LANG = 0x1,  // builtin requires GNU mode.
-  C_LANG = 0x2,// builtin for c only.
-  CXX_LANG = 0x4,  // builtin for cplusplus only.
-  OBJC_LANG = 0x8, // builtin for objective-c and objective-c++
-  MS_LANG = 0x10,  // builtin requires MS mode.
-  OCLC_LANG = 0x20,// builtin for OpenCL C only.
+  GNU_LANG = 0x1, // builtin requires GNU mode.
+  C_LANG = 0x2,   // builtin for c only.
+  CXX_LANG = 0x4, // builtin for cplusplus only.
+  OBJC_LANG = 0x8,// builtin for objective-c and objective-c++
+  MS_LANG = 0x10, // builtin requires MS mode.
+  OCLC_LANG = 0x20,   // builtin for OpenCL C only.
   ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.
   ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG,  // builtin requires GNU mode.
   ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG // builtin requires MS mode.

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=262692=262691=262692=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Mar  4 01:11:16 
2016
@@ -7746,7 +7746,7 @@ def err_opencl_type_can_only_be_used_as_
 def err_opencl_builtin_pipe_first_arg : Error<
   "first argument to %0 must be a pipe type">;
 def err_opencl_builtin_pipe_arg_num : Error<
-"invalid number of arguments to function: %0">;
+  "invalid number of arguments to function: %0">;
 def err_opencl_builtin_pipe_invalid_arg : Error<
   "invalid argument type to function %0 (expecting %1)">;
 def err_opencl_builtin_pipe_invalid_access_modifier : Error<

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=262692=262691=262692=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Mar  4 01:11:16 2016
@@ -259,16 +259,9 @@ static bool SemaBuiltinSEHScopeCheck(Sem
   return false;
 }
 
-/// Returns readable name for a call.
-static StringRef getFunctionName(CallExpr *Call) {
-  return cast(Call->getCalleeDecl())->getName();
-}
-
 /// Returns OpenCL access qual.
 static OpenCLAccessAttr *getOpenCLArgAccess(const Decl *D) {
-  if (D->hasAttr())
 return D->getAttr();
-  return nullptr;
 }
 
 /// Returns true if pipe element type is different from the pointer.
@@ -277,7 +270,7 @@ static bool checkOpenCLPipeArg(Sema ,
   // First argument type should always be pipe.
   if (!Arg0->getType()->isPipeType()) {
 S.Diag(Call->getLocStart(), diag::err_opencl_builtin_pipe_first_arg)
-<< getFunctionName(Call) << Arg0->getSourceRange();
+<< Call->getDirectCallee() << Arg0->getSourceRange();
 return true;
   }
   OpenCLAccessAttr *AccessQual =
@@ -286,20 +279,38 @@ static bool checkOpenCLPipeArg(Sema ,
   // OpenCL v2.0 s6.13.16 - The access qualifiers for pipe should only be
   // read_only and write_only, and assumed to be read_only if no qualifier is
   // specified.
-  bool isValid = true;
-  bool ReadOnly = getFunctionName(Call).find("read") != StringRef::npos;
-  if (ReadOnly)
-isValid = AccessQual == nullptr || AccessQual->isReadOnly();
-  else
-isValid = AccessQual != nullptr && AccessQual->isWriteOnly();
-  if (!isValid) {
-const char *AM = ReadOnly ? "read_only" : "write_only";
-S.Diag(Arg0->getLocStart(),
-   diag::err_opencl_builtin_pipe_invalid_access_modifier)
-<< AM << Arg0->getSourceRange();
-return true;
+  switch (Call->getDirectCallee()->getBuiltinID()) {
+  case Builtin::BIread_pipe:
+  case Builtin::BIreserve_read_pipe:
+  case Builtin::BIcommit_read_pipe:
+  case 

r262688 - [X86] Pass __m64 types via SSE registers for GCC compatibility

2016-03-03 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Thu Mar  3 23:26:16 2016
New Revision: 262688

URL: http://llvm.org/viewvc/llvm-project?rev=262688=rev
Log:
[X86] Pass __m64 types via SSE registers for GCC compatibility

For compatibility with GCC, classify __m64 as SSE.
However, clang is a platform compiler for certain targets; retain our
old behavior on those targets: classify __m64 as integer.

This fixes PR26832.

Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGen/3dnow-builtins.c
cfe/trunk/test/CodeGen/x86_64-arguments.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=262688=262687=262688=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu Mar  3 23:26:16 2016
@@ -1857,6 +1857,17 @@ class X86_64ABIInfo : public ABIInfo {
 return !getTarget().getTriple().isOSDarwin();
   }
 
+  /// GCC classifies <1 x long long> as SSE but compatibility with older clang
+  // compilers require us to classify it as INTEGER.
+  bool classifyIntegerMMXAsSSE() const {
+const llvm::Triple  = getTarget().getTriple();
+if (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::PS4)
+  return false;
+if (Triple.isOSFreeBSD() && Triple.getOSMajorVersion() >= 10)
+  return false;
+return true;
+  }
+
   X86AVXABILevel AVXLevel;
   // Some ABIs (e.g. X32 ABI and Native Client OS) use 32 bit pointers on
   // 64-bit hardware.
@@ -2298,15 +2309,20 @@ void X86_64ABIInfo::classify(QualType Ty
   if (EB_Lo != EB_Hi)
 Hi = Lo;
 } else if (Size == 64) {
+  QualType ElementType = VT->getElementType();
+
   // gcc passes <1 x double> in memory. :(
-  if (VT->getElementType()->isSpecificBuiltinType(BuiltinType::Double))
+  if (ElementType->isSpecificBuiltinType(BuiltinType::Double))
 return;
 
-  // gcc passes <1 x long long> as INTEGER.
-  if (VT->getElementType()->isSpecificBuiltinType(BuiltinType::LongLong) ||
-  VT->getElementType()->isSpecificBuiltinType(BuiltinType::ULongLong) 
||
-  VT->getElementType()->isSpecificBuiltinType(BuiltinType::Long) ||
-  VT->getElementType()->isSpecificBuiltinType(BuiltinType::ULong))
+  // gcc passes <1 x long long> as SSE but clang used to unconditionally
+  // pass them as integer.  For platforms where clang is the de facto
+  // platform compiler, we must continue to use integer.
+  if (!classifyIntegerMMXAsSSE() &&
+  (ElementType->isSpecificBuiltinType(BuiltinType::LongLong) ||
+   ElementType->isSpecificBuiltinType(BuiltinType::ULongLong) ||
+   ElementType->isSpecificBuiltinType(BuiltinType::Long) ||
+   ElementType->isSpecificBuiltinType(BuiltinType::ULong)))
 Current = Integer;
   else
 Current = SSE;

Modified: cfe/trunk/test/CodeGen/3dnow-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/3dnow-builtins.c?rev=262688=262687=262688=diff
==
--- cfe/trunk/test/CodeGen/3dnow-builtins.c (original)
+++ cfe/trunk/test/CodeGen/3dnow-builtins.c Thu Mar  3 23:26:16 2016
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-unknown-unknown -target-feature +3dnowa 
-emit-llvm -o - -Werror | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-unknown-unknown -target-feature +3dnowa 
-emit-llvm -o - -Werror | FileCheck %s -check-prefix=GCC -check-prefix=CHECK
+// RUN: %clang_cc1 %s -triple=x86_64-scei-ps4 -target-feature +3dnowa 
-emit-llvm -o - -Werror | FileCheck %s -check-prefix=PS4 -check-prefix=CHECK
 
 // Don't include mm_malloc.h, it's system specific.
 #define __MM_MALLOC_H
@@ -6,151 +7,176 @@
 #include 
 
 __m64 test_m_pavgusb(__m64 m1, __m64 m2) {
-  // CHECK-LABEL: define i64 @test_m_pavgusb
+  // PS4-LABEL: define i64 @test_m_pavgusb
+  // GCC-LABEL: define double @test_m_pavgusb
   // CHECK: @llvm.x86.3dnow.pavgusb
   return _m_pavgusb(m1, m2);
 }
 
 __m64 test_m_pf2id(__m64 m) {
-  // CHECK-LABEL: define i64 @test_m_pf2id
+  // PS4-LABEL: define i64 @test_m_pf2id
+  // GCC-LABEL: define double @test_m_pf2id
   // CHECK: @llvm.x86.3dnow.pf2id
   return _m_pf2id(m);
 }
 
 __m64 test_m_pfacc(__m64 m1, __m64 m2) {
-  // CHECK-LABEL: define i64 @test_m_pfacc
+  // PS4-LABEL: define i64 @test_m_pfacc
+  // GCC-LABEL: define double @test_m_pfacc
   // CHECK: @llvm.x86.3dnow.pfacc
   return _m_pfacc(m1, m2);
 }
 
 __m64 test_m_pfadd(__m64 m1, __m64 m2) {
-  // CHECK-LABEL: define i64 @test_m_pfadd
+  // PS4-LABEL: define i64 @test_m_pfadd
+  // GCC-LABEL: define double @test_m_pfadd
   // CHECK: @llvm.x86.3dnow.pfadd
   return _m_pfadd(m1, m2);
 }
 
 __m64 test_m_pfcmpeq(__m64 m1, __m64 m2) {
-  // CHECK-LABEL: define i64 @test_m_pfcmpeq
+  // PS4-LABEL: define i64 @test_m_pfcmpeq
+  // GCC-LABEL: define double 

r262687 - [VFS] Switch from close to SafelyCloseFileDescriptor

2016-03-03 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Thu Mar  3 23:26:14 2016
New Revision: 262687

URL: http://llvm.org/viewvc/llvm-project?rev=262687=rev
Log:
[VFS] Switch from close to SafelyCloseFileDescriptor

The SafelyCloseFileDescriptor machinery does the right thing in the face
of signals while close will do something platform specific which results
in the FD potentially getting leaked.

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

Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=262687=262686=262687=diff
==
--- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)
+++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Thu Mar  3 23:26:14 2016
@@ -19,6 +19,7 @@
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/Process.h"
 #include "llvm/Support/YAMLParser.h"
 #include "llvm/Config/llvm-config.h"
 #include 
@@ -158,21 +159,10 @@ RealFile::getBuffer(const Twine , i
IsVolatile);
 }
 
-// FIXME: This is terrible, we need this for ::close.
-#if !defined(_MSC_VER) && !defined(__MINGW32__)
-#include 
-#include 
-#else
-#include 
-#ifndef S_ISFIFO
-#define S_ISFIFO(x) (0)
-#endif
-#endif
 std::error_code RealFile::close() {
-  if (::close(FD))
-return std::error_code(errno, std::generic_category());
+  std::error_code EC = sys::Process::SafelyCloseFileDescriptor(FD);
   FD = -1;
-  return std::error_code();
+  return EC;
 }
 
 namespace {


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


Re: [PATCH] D17877: [OpenMP] Base support for target directive codegen on NVPTX device.

2016-03-03 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.


Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3790
@@ -3923,3 +3789,3 @@
   // where DD_ is an ID unique to the file (device and file IDs), PP is the
-  // mangled name of the function that encloses the target region and BB is the
+  // mangled name of the function that encloses the target region, BB is the
   // line number of the target region.

Revert back


Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3796-3808
@@ -3929,13 +3795,15 @@
   unsigned Line;
+  SmallString<256> OutlinedFnName;
   getTargetEntryUniqueInfo(CGM.getContext(), D.getLocStart(), DeviceID, FileID,
Line);
-  SmallString<64> EntryFnName;
   {
-llvm::raw_svector_ostream OS(EntryFnName);
+llvm::raw_svector_ostream OS(OutlinedFnName);
 OS << "__omp_offloading" << llvm::format("_%x", DeviceID)
<< llvm::format("_%x_", FileID) << ParentName << "_l" << Line;
   }
 
+  const CapturedStmt  = *cast(D.getAssociatedStmt());
+
   CodeGenFunction CGF(CGM, true);
-  CGOpenMPTargetRegionInfo CGInfo(CS, CodeGen, EntryFnName);
+  CGOpenMPTargetRegionInfo CGInfo(CS, CodeGen, OutlinedFnName);
   CodeGenFunction::CGCapturedStmtRAII CapInfoRAII(CGF, );

What is the purpose of these massive changes?


Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3918-3919
@@ -3917,4 +3786,1 @@
-
-  // Create a unique name for the entry function using the source location
-  // information of the current target region. The name will be something like:
   //

Restore it back, please.


Comment at: lib/CodeGen/CGOpenMPRuntime.h:50-54
@@ -49,2 +49,7 @@
 class CGOpenMPRuntime {
+protected:
   CodeGenModule 
+
+  enum OpenMPRTLFunction {
+/// \brief Call to void __kmpc_fork_call(ident_t *loc, kmp_int32 argc,
+/// kmpc_micro microtask, ...);

No way!!! Revert it back, please. No need to expose all these stuff in header 
file


Comment at: lib/CodeGen/CGOpenMPRuntime.h:383
@@ -253,2 +382,3 @@
 
+protected:
   /// \brief Creates offloading entry for the provided entry ID \a ID,

Please, gather all 'protected' members in a single 'protected' section


Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:30
@@ +29,3 @@
+void CGOpenMPRuntimeNVPTX::createOffloadEntry(llvm::Constant *ID,
+  llvm::Constant *Addr,
+  uint64_t Size) {

If you expect 'llvm::Function*' here, why you can't change it to 
'llvm::Function*'?


Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:47
@@ +46,3 @@
+  MD->addOperand(llvm::MDNode::get(Ctx, MDVals));
+  return;
+}

Remove, not required


Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:133
@@ +132,3 @@
+
+  CodeGenFunction CGF(CGM, true);
+  CGF.StartFunction(GlobalDecl(), Ctx.VoidTy, WST.WorkerFn, *WST.CGFI, {});

Comment for 'true' value


Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:242
@@ +241,3 @@
+
+void CGOpenMPRuntimeNVPTX::emitEntryFooter(CodeGenFunction ,
+   EntryFunctionState ) {

What about exceptions? Do you plan to support them? If yes, add tests for 
classes with constructors/destructors and exceptions


Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.h:30
@@ +29,3 @@
+
+private:
+  /// \brief Creates offloading entry for the provided entry ID \a ID,

Please, gather all private members in single 'private' section, protected to 
single 'protected' and public to single 'public'


Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.h:36-41
@@ +35,8 @@
+
+  enum OpenMPRTLFunctionNVPTX {
+/// \brief Call to void __kmpc_kernel_init(kmp_int32 omp_handle,
+/// kmp_int32 thread_limit);
+OMPRTL_NVPTX__kmpc_kernel_init = OMPRTL_last + 1,
+  };
+
+  /// \brief Returns specified OpenMP runtime function for the current OpenMP

No way!!! This must go to .cpp file!


Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.h:68-102
@@ +67,37 @@
+
+  /// \brief Get the GPU warp size.
+  llvm::Value *GetNVPTXWarpSize(CodeGenFunction ) {
+CGBuilderTy  = CGF.Builder;
+return Bld.CreateCall(
+llvm::Intrinsic::getDeclaration(
+(), llvm::Intrinsic::nvvm_read_ptx_sreg_warpsize),
+{}, "nvptx_warp_size");
+  }
+
+  /// \brief Get the id of the current thread on the GPU.
+  llvm::Value *GetNVPTXThreadID(CodeGenFunction ) {
+CGBuilderTy  = CGF.Builder;
+return Bld.CreateCall(
+llvm::Intrinsic::getDeclaration(
+(), llvm::Intrinsic::nvvm_read_ptx_sreg_tid_x),
+{}, "nvptx_tid");
+  }
+
+  // \brief Get the maximum number of threads in a block of the GPU.
+  llvm::Value *GetNVPTXNumThreads(CodeGenFunction ) {
+CGBuilderTy  = 

Re: [PATCH] D17874: Switch krait to use -mcpu=cortex-a15 for assembler tool invocations.

2016-03-03 Thread Weiming Zhao via cfe-commits
weimingz added a reviewer: apazos.
weimingz added a comment.

LGTM. Ana, could you take a look too?


http://reviews.llvm.org/D17874



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


Re: [PATCH] D17853: Disable tail-call optimization for X86 interrupt handlers

2016-03-03 Thread Alexey Bataev via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


http://reviews.llvm.org/D17853



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


Re: [PATCH] D17547: [OpenMP] Add support for multidimensional array sections in map clause SEMA.

2016-03-03 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.


Comment at: lib/Sema/SemaOpenMP.cpp:9127
@@ +9126,3 @@
+// whose base type is \a BaseQTy.
+static int CheckArrayExpressionDoesNotReferToUnitySize(Sema ,
+   const Expr *E,

This must return 'bool', not 'int'


http://reviews.llvm.org/D17547



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


r262686 - [index] Ignore ObjCTypeParamDecls during indexing.

2016-03-03 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Thu Mar  3 22:24:32 2016
New Revision: 262686

URL: http://llvm.org/viewvc/llvm-project?rev=262686=rev
Log:
[index] Ignore ObjCTypeParamDecls during indexing.

Modified:
cfe/trunk/lib/Index/IndexingContext.cpp
cfe/trunk/test/Index/Core/index-source.m

Modified: cfe/trunk/lib/Index/IndexingContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexingContext.cpp?rev=262686=262685=262686=diff
==
--- cfe/trunk/lib/Index/IndexingContext.cpp (original)
+++ cfe/trunk/lib/Index/IndexingContext.cpp Thu Mar  3 22:24:32 2016
@@ -103,6 +103,9 @@ bool IndexingContext::isFunctionLocalDec
   if (isa(D))
 return true;
 
+  if (isa(D))
+return true;
+
   if (!D->getParentFunctionOrMethod())
 return false;
 

Modified: cfe/trunk/test/Index/Core/index-source.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Core/index-source.m?rev=262686=262685=262686=diff
==
--- cfe/trunk/test/Index/Core/index-source.m (original)
+++ cfe/trunk/test/Index/Core/index-source.m Thu Mar  3 22:24:32 2016
@@ -38,3 +38,8 @@ void goo(Base *b) {
 // CHECK-NEXT: RelBase | Sub | c:objc(cs)Sub
 @interface Sub : Base
 @end
+
+@interface NSArray : Base
+// CHECK-NOT: ObjectType
+-(ObjectType)getit;
+@end


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


[PATCH] D17874: Switch krait to use -mcpu=cortex-a15 for assembler tool invocations.

2016-03-03 Thread Stephen Hines via cfe-commits
srhines created this revision.
srhines added reviewers: cfe-commits, weimingz.
Herald added a subscriber: aemerson.

Using -no-integrated-as causes -mcpu=krait to be transformed into
-march=armv7-a today. This precludes the assembler from using
instructions like sdiv, which are present for krait. Cortex-a15 is the
closest subset of functionality for krait, so we should switch the
assembler to use that instead.

http://reviews.llvm.org/D17874

Files:
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -8706,12 +8706,12 @@
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
 
 // FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -march=armv7-a  to avoid a lower
+// for now replace it with -mcpu=cortex-a15 to avoid a lower
 // march from being picked in the absence of a cpu flag.
 Arg *A;
 if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
 StringRef(A->getValue()).lower() == "krait")
-  CmdArgs.push_back("-march=armv7-a");
+  CmdArgs.push_back("-mcpu=cortex-a15");
 else
   Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
 Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -8706,12 +8706,12 @@
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
 
 // FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -march=armv7-a  to avoid a lower
+// for now replace it with -mcpu=cortex-a15 to avoid a lower
 // march from being picked in the absence of a cpu flag.
 Arg *A;
 if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
 StringRef(A->getValue()).lower() == "krait")
-  CmdArgs.push_back("-march=armv7-a");
+  CmdArgs.push_back("-mcpu=cortex-a15");
 else
   Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
 Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16949: Fix for: Bug 5941 - improve diagnostic for * vs & confusion

2016-03-03 Thread Ryan Yee via cfe-commits
ryee88 added a comment.

Thanks! I don’t have commit permissions; can you submit for me?


http://reviews.llvm.org/D16949



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


Re: [PATCH] D17764: Add attributes for AMD GPU Tools

2016-03-03 Thread Matt Arsenault via cfe-commits
arsenm added inline comments.


Comment at: lib/CodeGen/CGCall.cpp:1601
@@ +1600,3 @@
+if (CodeGenOpts.AMDGPUToolsInsertNopsOpt)
+  FuncAttrs.addAttribute("amdgpu_tools_insert_nops");
+if (CodeGenOpts.AMDGPUToolsNumReservedVGPROpt)

Yes


http://reviews.llvm.org/D17764



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


Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Nico Weber via cfe-commits
On Thu, Mar 3, 2016 at 4:28 PM, Joerg Sonnenberger via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Thu, Mar 03, 2016 at 02:09:17PM -0800, Nico Weber via cfe-commits wrote:
> > On Thu, Mar 3, 2016 at 1:50 PM, Joerg Sonnenberger via cfe-commits <
> > cfe-commits@lists.llvm.org> wrote:
> >
> > > On Thu, Mar 03, 2016 at 07:39:04PM +, Weiming Zhao via cfe-commits
> > > wrote:
> > > > Change the option name to -ffile-macro-prefix-to-remove
> > >
> > > This still sounds to me like a solution for a very restricted part of a
> > > much more generic problem...
> > >
> >
> > What do you mean?
>
> Storing only the base name of file names is a strict subset of __FILE__
> transformations. As mentioned in the linked GCC PR, other uses are
> creating build location independent output for larger software projects
> etc. For that, reducing to the base name is not an option as it removes
> too much information.
>

But ffile-macro-prefix-to-remove has a general prefix arg, which you can
set to your build dir. This isn't just a "get me the basename" flag (?)


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


Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Mar 03, 2016 at 02:09:17PM -0800, Nico Weber via cfe-commits wrote:
> On Thu, Mar 3, 2016 at 1:50 PM, Joerg Sonnenberger via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> 
> > On Thu, Mar 03, 2016 at 07:39:04PM +, Weiming Zhao via cfe-commits
> > wrote:
> > > Change the option name to -ffile-macro-prefix-to-remove
> >
> > This still sounds to me like a solution for a very restricted part of a
> > much more generic problem...
> >
> 
> What do you mean?

Storing only the base name of file names is a strict subset of __FILE__
transformations. As mentioned in the linked GCC PR, other uses are
creating build location independent output for larger software projects
etc. For that, reducing to the base name is not an option as it removes
too much information.

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


Re: [PATCH] D17183: Make TargetInfo store an actual DataLayout instead of a string.

2016-03-03 Thread Rafael Ávila de Espíndola via cfe-commits
rafael added a subscriber: rafael.
rafael added a comment.

This is awesome!



Comment at: include/clang/CodeGen/BackendUtil.h:38
@@ -37,3 +37,3 @@
  const TargetOptions , const LangOptions ,
- StringRef TDesc, llvm::Module *M, BackendAction 
Action,
- raw_pwrite_stream *OS);
+ llvm::DataLayout TDesc, llvm::Module *M,
+ BackendAction Action, raw_pwrite_stream *OS);

Should TDesc be a reference?


http://reviews.llvm.org/D17183



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


Re: r258504 - Change of UserLabelPrefix default value from "_" to ""

2016-03-03 Thread James Y Knight via cfe-commits
Sorry for not following up here; this will actually be solved in an
entirely different way by http://reviews.llvm.org/D17183

On Thu, Mar 3, 2016 at 5:53 PM, Rafael Espíndola
 wrote:
> As a first patch I think you can just leave every
>
>  UserLabelPrefix = ""
>
> in place.
>
> Cheers,
> Rafael
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15539: [libcxxabi] Reducing stack usage of test

2016-03-03 Thread Marshall Clow via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

Yes, sorry.


http://reviews.llvm.org/D15539



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


Re: [PATCH] D17552: Pass -backend-option to LLVM when there is no target machine

2016-03-03 Thread Yaxun Liu via cfe-commits
yaxunl updated the summary for this revision.
yaxunl added a reviewer: tstellarAMD.
yaxunl removed a subscriber: tstellarAMD.
yaxunl updated this revision to Diff 49781.
yaxunl added a comment.

Add a test for -backend-option with and w/o target machine as suggested by Tom.


http://reviews.llvm.org/D17552

Files:
  lib/CodeGen/BackendUtil.cpp
  test/Frontend/backend-option.c

Index: test/Frontend/backend-option.c
===
--- /dev/null
+++ test/Frontend/backend-option.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 %s -emit-llvm -backend-option -time-passes -o - 2>&1 | 
FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -backend-option -time-passes -o - -triple 
spir-unknown-unknown 2>&1 | FileCheck %s
+// CHECK: Pass execution timing report
+
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -97,6 +97,9 @@
 return PerFunctionPasses;
   }
 
+  /// Set LLVM command line options passed through -backend-option.
+  void setCommandLineOpts();
+
   void CreatePasses(FunctionInfoIndex *FunctionIndex);
 
   /// Generates the TargetMachine.
@@ -444,6 +447,24 @@
   PMBuilder.populateModulePassManager(*MPM);
 }
 
+void EmitAssemblyHelper::setCommandLineOpts() {
+  SmallVector BackendArgs;
+  BackendArgs.push_back("clang"); // Fake program name.
+  if (!CodeGenOpts.DebugPass.empty()) {
+BackendArgs.push_back("-debug-pass");
+BackendArgs.push_back(CodeGenOpts.DebugPass.c_str());
+  }
+  if (!CodeGenOpts.LimitFloatPrecision.empty()) {
+BackendArgs.push_back("-limit-float-precision");
+BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str());
+  }
+  for (const std::string  : CodeGenOpts.BackendOptions)
+BackendArgs.push_back(BackendOption.c_str());
+  BackendArgs.push_back(nullptr);
+  llvm::cl::ParseCommandLineOptions(BackendArgs.size() - 1,
+BackendArgs.data());
+}
+
 TargetMachine *EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) {
   // Create the TargetMachine for generating code.
   std::string Error;
@@ -466,22 +487,6 @@
   assert(CodeModel != ~0u && "invalid code model!");
   llvm::CodeModel::Model CM = static_cast(CodeModel);
 
-  SmallVector BackendArgs;
-  BackendArgs.push_back("clang"); // Fake program name.
-  if (!CodeGenOpts.DebugPass.empty()) {
-BackendArgs.push_back("-debug-pass");
-BackendArgs.push_back(CodeGenOpts.DebugPass.c_str());
-  }
-  if (!CodeGenOpts.LimitFloatPrecision.empty()) {
-BackendArgs.push_back("-limit-float-precision");
-BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str());
-  }
-  for (const std::string  : CodeGenOpts.BackendOptions)
-BackendArgs.push_back(BackendOption.c_str());
-  BackendArgs.push_back(nullptr);
-  llvm::cl::ParseCommandLineOptions(BackendArgs.size() - 1,
-BackendArgs.data());
-
   std::string FeaturesStr =
   llvm::join(TargetOpts.Features.begin(), TargetOpts.Features.end(), ",");
 
@@ -620,6 +625,8 @@
   raw_pwrite_stream *OS) {
   TimeRegion Region(llvm::TimePassesIsEnabled ?  : nullptr);
 
+  setCommandLineOpts();
+
   bool UsesCodeGen = (Action != Backend_EmitNothing &&
   Action != Backend_EmitBC &&
   Action != Backend_EmitLL);


Index: test/Frontend/backend-option.c
===
--- /dev/null
+++ test/Frontend/backend-option.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 %s -emit-llvm -backend-option -time-passes -o - 2>&1 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -backend-option -time-passes -o - -triple spir-unknown-unknown 2>&1 | FileCheck %s
+// CHECK: Pass execution timing report
+
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -97,6 +97,9 @@
 return PerFunctionPasses;
   }
 
+  /// Set LLVM command line options passed through -backend-option.
+  void setCommandLineOpts();
+
   void CreatePasses(FunctionInfoIndex *FunctionIndex);
 
   /// Generates the TargetMachine.
@@ -444,6 +447,24 @@
   PMBuilder.populateModulePassManager(*MPM);
 }
 
+void EmitAssemblyHelper::setCommandLineOpts() {
+  SmallVector BackendArgs;
+  BackendArgs.push_back("clang"); // Fake program name.
+  if (!CodeGenOpts.DebugPass.empty()) {
+BackendArgs.push_back("-debug-pass");
+BackendArgs.push_back(CodeGenOpts.DebugPass.c_str());
+  }
+  if (!CodeGenOpts.LimitFloatPrecision.empty()) {
+BackendArgs.push_back("-limit-float-precision");
+BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str());
+  }
+  for (const std::string  : CodeGenOpts.BackendOptions)
+BackendArgs.push_back(BackendOption.c_str());
+  BackendArgs.push_back(nullptr);
+  llvm::cl::ParseCommandLineOptions(BackendArgs.size() - 1,
+   

Re: r258504 - Change of UserLabelPrefix default value from "_" to ""

2016-03-03 Thread Rafael Espíndola via cfe-commits
As a first patch I think you can just leave every

 UserLabelPrefix = ""

in place.

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


Re: [PATCH] D17784: Check if LLVM_PREFIX is defined before using it.

2016-03-03 Thread Chandler Carruth via cfe-commits
chandlerc added a comment.

In http://reviews.llvm.org/D17784#367601, @kparzysz wrote:

> This seemed fine to me, but at the second thought, the lines 2610-2613 in the 
> original should be removed.


I agree. I think using LLVM_PREFIX here in any capacity is incorrect.


http://reviews.llvm.org/D17784



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


Re: [PATCH] D17582: [OPENMP] firstprivate and private clauses of teams, host codegeneration

2016-03-03 Thread Carlo Bertolli via cfe-commits
carlo.bertolli closed this revision.
carlo.bertolli added a comment.

Committed revision 262663.


Repository:
  rL LLVM

http://reviews.llvm.org/D17582



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


r262663 - [OPENMP] firstprivate and private clauses of teams, host codegeneration

2016-03-03 Thread Carlo Bertolli via cfe-commits
Author: cbertol
Date: Thu Mar  3 16:09:40 2016
New Revision: 262663

URL: http://llvm.org/viewvc/llvm-project?rev=262663=rev
Log:
[OPENMP] firstprivate and private clauses of teams, host codegeneration

Add code generation support for firstprivate and private clauses of teams on 
the host. Add extensive regression tests including lambda functions and vla 
testing.

http://reviews.llvm.org/D17582


Added:
cfe/trunk/test/OpenMP/teams_firstprivate_codegen.cpp
cfe/trunk/test/OpenMP/teams_private_codegen.cpp
Modified:
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp

Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=262663=262662=262663=diff
==
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Thu Mar  3 16:09:40 2016
@@ -45,10 +45,25 @@ class OMPLexicalScope {
 }
   }
 
+  class PostUpdateCleanup final : public EHScopeStack::Cleanup {
+const OMPExecutableDirective 
+
+  public:
+PostUpdateCleanup(const OMPExecutableDirective ) : S(S) {}
+
+void Emit(CodeGenFunction , Flags /*flags*/) override {
+  if (!CGF.HaveInsertPoint())
+return;
+  (void)S;
+  // TODO: add cleanups for clauses that require post update.
+}
+  };
+
 public:
   OMPLexicalScope(CodeGenFunction , const OMPExecutableDirective )
   : Scope(CGF, S.getSourceRange()) {
 emitPreInitStmt(CGF, S);
+CGF.EHStack.pushCleanup(NormalAndEHCleanup, S);
   }
 };
 } // namespace
@@ -2755,6 +2770,8 @@ void CodeGenFunction::EmitOMPTeamsDirect
   // Emit parallel region as a standalone region.
   auto & = [](CodeGenFunction ) {
 OMPPrivateScope PrivateScope(CGF);
+(void)CGF.EmitOMPFirstprivateClause(S, PrivateScope);
+CGF.EmitOMPPrivateClause(S, PrivateScope);
 (void)PrivateScope.Privatize();
 CGF.EmitStmt(cast(S.getAssociatedStmt())->getCapturedStmt());
   };

Added: cfe/trunk/test/OpenMP/teams_firstprivate_codegen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_firstprivate_codegen.cpp?rev=262663=auto
==
--- cfe/trunk/test/OpenMP/teams_firstprivate_codegen.cpp (added)
+++ cfe/trunk/test/OpenMP/teams_firstprivate_codegen.cpp Thu Mar  3 16:09:40 
2016
@@ -0,0 +1,289 @@
+// Test host codegen.
+// RUN: %clang_cc1 -DLAMBDA -verify -fopenmp -x c++ -std=c++11 -triple 
powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm %s 
-o - | FileCheck %s --check-prefix LAMBDA --check-prefix LAMBDA-64
+// RUN: %clang_cc1 -DLAMBDA -fopenmp -x c++ -std=c++11 -triple 
powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-pch -o 
%t %s
+// RUN: %clang_cc1 -DLAMBDA -fopenmp -x c++ -triple 
powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -std=c++11 
-include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix LAMBDA 
--check-prefix LAMBDA-64
+// RUN: %clang_cc1 -DLAMBDA -verify -fopenmp -x c++ -std=c++11 -triple 
i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-llvm %s -o - | 
FileCheck %s --check-prefix LAMBDA --check-prefix LAMBDA-32
+// RUN: %clang_cc1 -DLAMBDA -fopenmp -x c++ -std=c++11 -triple 
i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1 -DLAMBDA -fopenmp -x c++ -std=c++11 -triple 
i386-unknown-unknown -omptargets=i386-pc-linux-gnu -std=c++11 -include-pch %t 
-verify %s -emit-llvm -o - | FileCheck %s --check-prefix LAMBDA --check-prefix 
LAMBDA-32
+
+// RUN: %clang_cc1  -verify -fopenmp -x c++ -std=c++11 -triple 
powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm %s 
-o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64
+// RUN: %clang_cc1  -fopenmp -x c++ -std=c++11 -triple 
powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-pch -o 
%t %s
+// RUN: %clang_cc1  -fopenmp -x c++ -triple powerpc64le-unknown-unknown 
-omptargets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s 
-emit-llvm -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64
+// RUN: %clang_cc1  -verify -fopenmp -x c++ -std=c++11 -triple 
i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-llvm %s -o - | 
FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
+// RUN: %clang_cc1  -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown 
-omptargets=i386-pc-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1  -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown 
-omptargets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm 
-o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
+
+// RUN: %clang_cc1 -DARRAY  -verify -fopenmp -x c++ -std=c++11 -triple 
powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm %s 
-o - | FileCheck %s --check-prefix ARRAY --check-prefix ARRAY-64
+// RUN: 

Re: [PATCH] D17784: Check if LLVM_PREFIX is defined before using it.

2016-03-03 Thread Krzysztof Parzyszek via cfe-commits
kparzysz added a comment.

This seemed fine to me, but at the second thought, the lines 2610-2613 in the 
original should be removed.


http://reviews.llvm.org/D17784



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


Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Nico Weber via cfe-commits
On Thu, Mar 3, 2016 at 1:50 PM, Joerg Sonnenberger via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Thu, Mar 03, 2016 at 07:39:04PM +, Weiming Zhao via cfe-commits
> wrote:
> > Change the option name to -ffile-macro-prefix-to-remove
>
> This still sounds to me like a solution for a very restricted part of a
> much more generic problem...
>

What do you mean?


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


Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Mar 03, 2016 at 07:39:04PM +, Weiming Zhao via cfe-commits wrote:
> Change the option name to -ffile-macro-prefix-to-remove

This still sounds to me like a solution for a very restricted part of a
much more generic problem...

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


r262659 - [analyzer] ObjCDeallocChecker: Only check for nil-out when type is retainable.

2016-03-03 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Thu Mar  3 15:38:39 2016
New Revision: 262659

URL: http://llvm.org/viewvc/llvm-project?rev=262659=rev
Log:
[analyzer] ObjCDeallocChecker: Only check for nil-out when type is retainable.

This fixes a crash when setting a property of struct type in -dealloc.

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
cfe/trunk/test/Analysis/DeallocMissingRelease.m

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp?rev=262659=262658=262659=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp Thu Mar  3 
15:38:39 2016
@@ -860,9 +860,13 @@ ObjCDeallocChecker::getValueReleasedByNi
   if (!ReceiverVal.isValid())
 return nullptr;
 
-  // Is the first argument nil?
   if (M.getNumArgs() == 0)
 return nullptr;
+
+  if (!M.getArgExpr(0)->getType()->isObjCRetainableType())
+return nullptr;
+
+  // Is the first argument nil?
   SVal Arg = M.getArgSVal(0);
   ProgramStateRef notNilState, nilState;
   std::tie(notNilState, nilState) =

Modified: cfe/trunk/test/Analysis/DeallocMissingRelease.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/DeallocMissingRelease.m?rev=262659=262658=262659=diff
==
--- cfe/trunk/test/Analysis/DeallocMissingRelease.m (original)
+++ cfe/trunk/test/Analysis/DeallocMissingRelease.m Thu Mar  3 15:38:39 2016
@@ -664,6 +664,25 @@ void ReleaseMe(id arg);
 @end
 #endif
 
+struct SomeStruct {
+  int f;
+};
+@interface ZeroOutStructWithSetter : NSObject
+  @property(assign) struct SomeStruct s;
+@end
+
+@implementation ZeroOutStructWithSetter
+- (void)dealloc {
+  struct SomeStruct zeroedS;
+  zeroedS.f = 0;
+
+  self.s = zeroedS;
+#if NON_ARC
+  [super dealloc];
+#endif
+}
+@end
+
 #if NON_ARC
 @interface ReleaseIvarInArray : NSObject {
   NSObject *_array[3];


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


[clang-tools-extra] r262654 - Fix two minor syntax issues in the documentation

2016-03-03 Thread Sylvestre Ledru via cfe-commits
Author: sylvestre
Date: Thu Mar  3 14:54:26 2016
New Revision: 262654

URL: http://llvm.org/viewvc/llvm-project?rev=262654=rev
Log:
Fix two minor syntax issues in the documentation

Modified:

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-deprecated-headers.rst

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst?rev=262654=262653=262654=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-forward-declaration-namespace.rst
 Thu Mar  3 14:54:26 2016
@@ -10,6 +10,7 @@ declaration/definition with the same nam
 the forward declaration is in a potentially wrong namespace.
 
 .. code:: c++
+
   namespace na { struct A; }
   namespace nb { struct A {}; }
   nb::A a;

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-deprecated-headers.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-deprecated-headers.rst?rev=262654=262653=262654=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-deprecated-headers.rst 
(original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-deprecated-headers.rst 
Thu Mar  3 14:54:26 2016
@@ -1,7 +1,7 @@
 .. title:: clang-tidy - modernize-deprecated-headers
 
 modernize-deprecated-headers
-==
+
 
 Some headers from C library were deprecated in C++ and are no longer welcome in
 C++ codebases. For more details refer to the C++ 14 Standard [depr.c.headers]


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


[clang-tools-extra] r262655 - fix some minor typos in the doc

2016-03-03 Thread Sylvestre Ledru via cfe-commits
Author: sylvestre
Date: Thu Mar  3 14:57:16 2016
New Revision: 262655

URL: http://llvm.org/viewvc/llvm-project?rev=262655=rev
Log:
fix some minor typos in the doc

Modified:

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-integer-assignment.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/readability-implicit-bool-cast.rst
clang-tools-extra/trunk/docs/pp-trace.rst

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-integer-assignment.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-integer-assignment.rst?rev=262655=262654=262655=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-integer-assignment.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-string-integer-assignment.rst
 Thu Mar  3 14:57:16 2016
@@ -11,7 +11,7 @@ following assignment operator of ``std::
 
   basic_string& operator=( CharT ch );
 
-Numeric types can be implicity casted to character types.
+Numeric types can be implicitly casted to character types.
 
 .. code:: c++
 

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-implicit-bool-cast.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/readability-implicit-bool-cast.rst?rev=262655=262654=262655=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-implicit-bool-cast.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/readability-implicit-bool-cast.rst
 Thu Mar  3 14:57:16 2016
@@ -26,11 +26,11 @@ bool cast:
 
 This code is the result of unsuccessful refactoring, where type of ``m_foo``
 changed from ``bool`` to ``int``. The programmer forgot to change all
-occurences of ``bool``, and the remaining code is no longer correct, yet it
+occurrences of ``bool``, and the remaining code is no longer correct, yet it
 still compiles without any visible warnings.
 
 In addition to issuing warnings, FixIt hints are provided to help solve
-the reported issues. This can be used for improving readabilty of code, for 
example:
+the reported issues. This can be used for improving readability of code, for 
example:
 
 .. code:: c++
 
@@ -95,5 +95,5 @@ Some additional accommodations are made
  - ``false`` literal cast to pointer is detected,
  - instead of ``nullptr`` literal, ``0`` is proposed as replacement.
 
-Occurences of implicit casts inside macros and template instantiations are
+Occurrences of implicit casts inside macros and template instantiations are
 deliberately ignored, as it is not clear how to deal with such cases.

Modified: clang-tools-extra/trunk/docs/pp-trace.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/pp-trace.rst?rev=262655=262654=262655=diff
==
--- clang-tools-extra/trunk/docs/pp-trace.rst (original)
+++ clang-tools-extra/trunk/docs/pp-trace.rst Thu Mar  3 14:57:16 2016
@@ -10,7 +10,7 @@ pp-trace User's Manual
 :program:`pp-trace` is a standalone tool that traces preprocessor
 activity.  It's also used as a test of Clang's PPCallbacks interface.
 It runs a given source file through the Clang preprocessor, displaying
-selected information from callback functions overidden in a
+selected information from callback functions overridden in a
 `PPCallbacks `_
 derivation.  The output is in a high-level YAML format, described in
 :ref:`OutputFormat`.


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


Re: [PATCH] D17552: Pass -backend-option to LLVM when there is no target machine

2016-03-03 Thread Tom Stellard via cfe-commits
tstellarAMD added a comment.

Do you have a test case for this?


http://reviews.llvm.org/D17552



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


Re: r262576 - Caught and fixed a typo in r262572.

2016-03-03 Thread Sean Callanan via cfe-commits
Nico,

the tests for ASTImporter (currently, test/ASTMerge) are currently set up to do 
an AST merge and check that certain errors occur.  I don’t believe they 
actually go and code-gen, which would have caught this.

I think investing in better ASTImporter testing is a great goal, but right now 
LLDB is actually the most comprehensive validation suite for the ASTImporter 
I’m aware of.

Sean

> On Mar 2, 2016, at 11:04 PM, Nico Weber  wrote:
> 
> Is it possible to test this?
> 
> On Mar 2, 2016 6:26 PM, "Sean Callanan via cfe-commits" 
> > wrote:
> Author: spyffe
> Date: Wed Mar  2 20:22:05 2016
> New Revision: 262576
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=262576=rev 
> 
> Log:
> Caught and fixed a typo in r262572.
> 
> I should have checked and imported D's in-class initializer.
> Instead I accidentally used ToField's in-class initializer,
> which is always NULL so ToField will never get one.
> 
> 
> 
> Modified:
> cfe/trunk/lib/AST/ASTImporter.cpp
> 
> Modified: cfe/trunk/lib/AST/ASTImporter.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=262576=262575=262576=diff
>  
> 
> ==
> --- cfe/trunk/lib/AST/ASTImporter.cpp (original)
> +++ cfe/trunk/lib/AST/ASTImporter.cpp Wed Mar  2 20:22:05 2016
> @@ -3038,7 +3038,7 @@ Decl *ASTNodeImporter::VisitFieldDecl(Fi
>   D->getInClassInitStyle());
>ToField->setAccess(D->getAccess());
>ToField->setLexicalDeclContext(LexicalDC);
> -  if (Expr *FromInitializer = ToField->getInClassInitializer()) {
> +  if (Expr *FromInitializer = D->getInClassInitializer()) {
>  Expr *ToInitializer = Importer.Import(FromInitializer);
>  if (ToInitializer)
>ToField->setInClassInitializer(ToInitializer);
> 
> 
> ___
> 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] D17148: [OPENMP] Basic teams directive implementation

2016-03-03 Thread Carlo Bertolli via cfe-commits
carlo.bertolli closed this revision.
carlo.bertolli added a comment.

Committed revision 262652.


Repository:
  rL LLVM

http://reviews.llvm.org/D17148



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


r262652 - Add code generation for teams directive inside target region

2016-03-03 Thread Carlo Bertolli via cfe-commits
Author: cbertol
Date: Thu Mar  3 14:34:23 2016
New Revision: 262652

URL: http://llvm.org/viewvc/llvm-project?rev=262652=rev
Log:
Add code generation for teams directive inside target region

Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/test/OpenMP/teams_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=262652=262651=262652=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu Mar  3 14:34:23 2016
@@ -537,6 +537,12 @@ enum OpenMPRTLFunction {
   // Call to kmp_int32 __kmpc_cancel(ident_t *loc, kmp_int32 global_tid,
   // kmp_int32 cncl_kind);
   OMPRTL__kmpc_cancel,
+  // Call to void __kmpc_push_num_teams(ident_t *loc, kmp_int32 global_tid,
+  // kmp_int32 num_teams, kmp_int32 thread_limit);
+  OMPRTL__kmpc_push_num_teams,
+  /// \brief Call to void __kmpc_fork_teams(ident_t *loc, kmp_int32 argc,
+  /// kmpc_micro microtask, ...);
+  OMPRTL__kmpc_fork_teams,
 
   //
   // Offloading related calls
@@ -625,7 +631,7 @@ static Address createIdentFieldGEP(CodeG
   return CGF.Builder.CreateStructGEP(Addr, Field, Offset, Name);
 }
 
-llvm::Value *CGOpenMPRuntime::emitParallelOutlinedFunction(
+llvm::Value *CGOpenMPRuntime::emitParallelOrTeamsOutlinedFunction(
 const OMPExecutableDirective , const VarDecl *ThreadIDVar,
 OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy ) {
   assert(ThreadIDVar->getType()->isPointerType() &&
@@ -1205,6 +1211,26 @@ CGOpenMPRuntime::createRuntimeFunction(u
 RTLFn = CGM.CreateRuntimeFunction(FnTy, "__kmpc_cancel");
 break;
   }
+  case OMPRTL__kmpc_push_num_teams: {
+// Build void kmpc_push_num_teams (ident_t loc, kmp_int32 global_tid,
+// kmp_int32 num_teams, kmp_int32 num_threads)
+llvm::Type *TypeParams[] = {getIdentTyPointerTy(), CGM.Int32Ty, 
CGM.Int32Ty,
+CGM.Int32Ty};
+llvm::FunctionType *FnTy =
+llvm::FunctionType::get(CGM.Int32Ty, TypeParams, /*isVarArg*/ false);
+RTLFn = CGM.CreateRuntimeFunction(FnTy, "__kmpc_push_num_teams");
+break;
+  }
+  case OMPRTL__kmpc_fork_teams: {
+// Build void __kmpc_fork_teams(ident_t *loc, kmp_int32 argc, kmpc_micro
+// microtask, ...);
+llvm::Type *TypeParams[] = {getIdentTyPointerTy(), CGM.Int32Ty,
+getKmpc_MicroPointerTy()};
+llvm::FunctionType *FnTy =
+llvm::FunctionType::get(CGM.VoidTy, TypeParams, /*isVarArg*/ true);
+RTLFn = CGM.CreateRuntimeFunction(FnTy, "__kmpc_fork_teams");
+break;
+  }
   case OMPRTL__tgt_target: {
 // Build int32_t __tgt_target(int32_t device_id, void *host_ptr, int32_t
 // arg_num, void** args_base, void **args, size_t *arg_sizes, int32_t
@@ -4604,3 +4630,43 @@ llvm::Function *CGOpenMPRuntime::emitReg
   // compilation unit.
   return createOffloadingBinaryDescriptorRegistration();
 }
+
+void CGOpenMPRuntime::emitTeamsCall(CodeGenFunction ,
+const OMPExecutableDirective ,
+SourceLocation Loc,
+llvm::Value *OutlinedFn,
+ArrayRef CapturedVars) {
+  if (!CGF.HaveInsertPoint())
+return;
+
+  auto *RTLoc = emitUpdateLocation(CGF, Loc);
+  CodeGenFunction::RunCleanupsScope Scope(CGF);
+
+  // Build call __kmpc_fork_teams(loc, n, microtask, var1, .., varn);
+  llvm::Value *Args[] = {
+  RTLoc,
+  CGF.Builder.getInt32(CapturedVars.size()), // Number of captured vars
+  CGF.Builder.CreateBitCast(OutlinedFn, getKmpc_MicroPointerTy())};
+  llvm::SmallVector RealArgs;
+  RealArgs.append(std::begin(Args), std::end(Args));
+  RealArgs.append(CapturedVars.begin(), CapturedVars.end());
+
+  auto RTLFn = createRuntimeFunction(OMPRTL__kmpc_fork_teams);
+  CGF.EmitRuntimeCall(RTLFn, RealArgs);
+}
+
+void CGOpenMPRuntime::emitNumTeamsClause(CodeGenFunction ,
+ llvm::Value *NumTeams,
+ llvm::Value *ThreadLimit,
+ SourceLocation Loc) {
+  if (!CGF.HaveInsertPoint())
+return;
+
+  auto *RTLoc = emitUpdateLocation(CGF, Loc);
+
+  // Build call __kmpc_push_num_teamss(, global_tid, num_teams, 
thread_limit)
+  llvm::Value *PushNumTeamsArgs[] = {
+  RTLoc, getThreadID(CGF, Loc), NumTeams, ThreadLimit};
+  CGF.EmitRuntimeCall(createRuntimeFunction(OMPRTL__kmpc_push_num_teams),
+  PushNumTeamsArgs);
+}

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h?rev=262652=262651=262652=diff

[PATCH] D17865: Add replacement = "xxx" to DeprecatedAttr.

2016-03-03 Thread Manman Ren via cfe-commits
manmanren created this revision.
manmanren added reviewers: dexonsmith, rjmccall.
manmanren added a subscriber: cfe-commits.

This can be used to display Fix-Its.
We only add this to GNU attributes. Since it now has two optional arguments, 
and the common parsing does not handle "replacement = ", we use custom parsing 
for DeprecatedAttr.

http://reviews.llvm.org/D17865

Files:
  include/clang/Basic/Attr.td
  include/clang/Parse/Parser.h
  lib/Lex/PPMacroExpansion.cpp
  lib/Parse/ParseDecl.cpp
  lib/Parse/Parser.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/Sema/attr-availability-replacement.c
  test/SemaCXX/cxx11-attr-print.cpp

Index: test/SemaCXX/cxx11-attr-print.cpp
===
--- test/SemaCXX/cxx11-attr-print.cpp
+++ test/SemaCXX/cxx11-attr-print.cpp
@@ -10,12 +10,15 @@
 // CHECK: int z {{\[}}[gnu::aligned(4)]];
 int z [[gnu::aligned(4)]];
 
-// CHECK: __attribute__((deprecated("warning")));
+// CHECK: __attribute__((deprecated("warning", "")));
 int a __attribute__((deprecated("warning")));
 
-// CHECK: int b {{\[}}[gnu::deprecated("warning")]];
+// CHECK: int b {{\[}}[gnu::deprecated("warning", "")]];
 int b [[gnu::deprecated("warning")]];
 
+// CHECK: __attribute__((deprecated("", "")));
+int c __attribute__((deprecated));
+
 // CHECK: int cxx11_alignas alignas(4);
 alignas(4) int cxx11_alignas;
 
Index: test/Sema/attr-availability-replacement.c
===
--- test/Sema/attr-availability-replacement.c
+++ test/Sema/attr-availability-replacement.c
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -verify -fsyntax-only %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: cp %s %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fixit %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -Werror %t
+
+#if !__has_feature(attribute_deprecated_with_replacement)
+#error "Missing __has_feature"
+#endif
+
+void f_8(int) __attribute__((deprecated(replacement="new8"))); // expected-note {{'f_8' has been explicitly marked deprecated here}}
+void new8(int);
+void test() {
+  f_8(0); // expected-warning{{'f_8' is deprecated}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:6}:"new8"
+}
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -5068,7 +5068,18 @@
 !(Attr.hasScope() && Attr.getScopeName()->isStr("gnu")))
   S.Diag(Attr.getLoc(), diag::ext_deprecated_attr_is_a_cxx14_extension);
 
-  handleAttrWithMessage(S, D, Attr);
+  // Handle the cases where the attribute has a text message or a replacement
+  // string, or both.
+  StringRef Str, Replacement;
+  if ((Attr.isArgExpr(0) && Attr.getArgAsExpr(0) &&
+   !S.checkStringLiteralArgumentAttr(Attr, 0, Str))||
+  (Attr.isArgExpr(1) && Attr.getArgAsExpr(1) &&
+   !S.checkStringLiteralArgumentAttr(Attr, 1, Replacement)))
+return;
+
+  D->addAttr(::new (S.Context) DeprecatedAttr(Attr.getRange(), S.Context, Str,
+  Replacement,
+  Attr.getAttributeSpellingListIndex()));
 }
 
 static void handleNoSanitizeAttr(Sema , Decl *D, const AttributeList ) {
@@ -6126,18 +6137,35 @@
 break;
   }
 
+  CharSourceRange UseRange;
+  StringRef Replacement;
+  if (K == Sema::AD_Deprecation) {
+if (auto attr = D->getAttr())
+  Replacement = attr->getReplacement();
+
+if (!Replacement.empty())
+  UseRange =
+  CharSourceRange::getCharRange(Loc, S.getLocForEndOfToken(Loc));
+  }
+
   if (!Message.empty()) {
-S.Diag(Loc, diag_message) << D << Message;
+S.Diag(Loc, diag_message) << D << Message
+  << (UseRange.isValid() ?
+  FixItHint::CreateReplacement(UseRange, Replacement) : FixItHint());
 if (ObjCProperty)
   S.Diag(ObjCProperty->getLocation(), diag::note_property_attribute)
   << ObjCProperty->getDeclName() << property_note_select;
   } else if (!UnknownObjCClass) {
-S.Diag(Loc, diag) << D;
+S.Diag(Loc, diag) << D
+  << (UseRange.isValid() ?
+  FixItHint::CreateReplacement(UseRange, Replacement) : FixItHint());
 if (ObjCProperty)
   S.Diag(ObjCProperty->getLocation(), diag::note_property_attribute)
   << ObjCProperty->getDeclName() << property_note_select;
   } else {
-S.Diag(Loc, diag_fwdclass_message) << D;
+S.Diag(Loc, diag_fwdclass_message) << D
+  << (UseRange.isValid() ?
+  FixItHint::CreateReplacement(UseRange, Replacement) : FixItHint());
 S.Diag(UnknownObjCClass->getLocation(), diag::note_forward_class);
   }
 
Index: lib/Parse/Parser.cpp
===
--- lib/Parse/Parser.cpp
+++ lib/Parse/Parser.cpp
@@ -492,6 +492,7 @@
   Ident_obsoleted = nullptr;
   Ident_unavailable = nullptr;
   Ident_strict = 

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Weiming Zhao via cfe-commits
weimingz updated the summary for this revision.
weimingz updated this revision to Diff 49762.
weimingz added a comment.

Change the option name to -ffile-macro-prefix-to-remove


http://reviews.llvm.org/D17741

Files:
  include/clang/Driver/Options.td
  include/clang/Lex/Preprocessor.h
  include/clang/Lex/PreprocessorOptions.h
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Lex/PPMacroExpansion.cpp
  test/Lexer/file_basename.c

Index: test/Lexer/file_basename.c
===
--- /dev/null
+++ test/Lexer/file_basename.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -E %s | FileCheck %s --check-prefix=ALL --check-prefix=DEFAULT
+
+// RUN: %clang_cc1 -E -ffile-macro-prefix-to-remove=__ALL_DIR__ %s | FileCheck %s --check-prefix=ALL --check-prefix=NO-DIR
+// RUN:%clang -E -ffile-macro-prefix-to-remove=__ALL_DIR__ %s | FileCheck %s --check-prefix=ALL --check-prefix=NO-DIR
+
+// RUN: %clang_cc1 -E -ffile-macro-prefix-to-remove=%s %s | FileCheck %s --check-prefix=ALL --check-prefix=REMOVE-ALL
+// RUN: %clang -E -ffile-macro-prefix-to-remove=%s %s | FileCheck %s --check-prefix=ALL --check-prefix=REMOVE-ALL
+
+// RUN: %clang_cc1 -E -ffile-macro-prefix-to-remove=%s.xyz %s | FileCheck %s --check-prefix=ALL --check-prefix=MISMATCH
+// RUN: %clang -E -ffile-macro-prefix-to-remove= %s | FileCheck %s --check-prefix=ALL --check-prefix=MISMATCH
+
+const char *filename (const char *name) {
+  // ALL:  static const char this_file_basename[] = "file_basename.c";
+  static const char this_file_basename[] = __CLANG_FILE_BASENAME__;
+  // DEFAULT: static const char this_file[] = "{{.*}}/Lexer/file_basename.c";
+  // NO-DIR:  static const char this_file[] = "file_basename.c";
+  // REMOVE-ALL: static const char this_file[] = "";
+  // MISMATCH: static const char this_file[] = "{{.*}}/Lexer/file_basename.c";
+  static const char this_file[] = __FILE__;
+  return this_file;
+}
Index: lib/Lex/PPMacroExpansion.cpp
===
--- lib/Lex/PPMacroExpansion.cpp
+++ lib/Lex/PPMacroExpansion.cpp
@@ -12,7 +12,6 @@
 //
 //===--===//
 
-#include "clang/Lex/Preprocessor.h"
 #include "clang/Basic/Attributes.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceManager.h"
@@ -22,12 +21,15 @@
 #include "clang/Lex/LexDiagnostic.h"
 #include "clang/Lex/MacroArgs.h"
 #include "clang/Lex/MacroInfo.h"
+#include "clang/Lex/Preprocessor.h"
+#include "clang/Lex/PreprocessorOptions.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Format.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 #include 
 #include 
@@ -292,6 +294,8 @@
 void Preprocessor::RegisterBuiltinMacros() {
   Ident__LINE__ = RegisterBuiltinMacro(*this, "__LINE__");
   Ident__FILE__ = RegisterBuiltinMacro(*this, "__FILE__");
+  Ident__CLANG_FILE_BASENAME__ =
+  RegisterBuiltinMacro(*this, "__CLANG_FILE_BASENAME__");
   Ident__DATE__ = RegisterBuiltinMacro(*this, "__DATE__");
   Ident__TIME__ = RegisterBuiltinMacro(*this, "__TIME__");
   Ident__COUNTER__ = RegisterBuiltinMacro(*this, "__COUNTER__");
@@ -1509,7 +1513,8 @@
 // __LINE__ expands to a simple numeric value.
 OS << (PLoc.isValid()? PLoc.getLine() : 1);
 Tok.setKind(tok::numeric_constant);
-  } else if (II == Ident__FILE__ || II == Ident__BASE_FILE__) {
+  } else if (II == Ident__FILE__ || II == Ident__BASE_FILE__ ||
+ II == Ident__CLANG_FILE_BASENAME__) {
 // C99 6.10.8: "__FILE__: The presumed name of the current source file (a
 // character string literal)". This can be affected by #line.
 PresumedLoc PLoc = SourceMgr.getPresumedLoc(Tok.getLocation());
@@ -1522,15 +1527,30 @@
 PLoc = SourceMgr.getPresumedLoc(NextLoc);
 if (PLoc.isInvalid())
   break;
-
 NextLoc = PLoc.getIncludeLoc();
   }
 }
 
 // Escape this filename.  Turn '\' -> '\\' '"' -> '\"'
 SmallString<128> FN;
 if (PLoc.isValid()) {
-  FN += PLoc.getFilename();
+  const std::string  =
+  getPreprocessorOpts().__FILE__PrefixToRemove;
+  StringRef Filename(PLoc.getFilename());
+
+  if (II == Ident__CLANG_FILE_BASENAME__)
+FN += llvm::sys::path::filename(Filename);
+  else if (II == Ident__FILE__ && !PrefixToRemove.empty()) {
+if (PrefixToRemove == "__ALL_DIR__") {
+  FN += llvm::sys::path::filename(Filename);
+}
+else if (Filename.find(PrefixToRemove) == 0)
+  FN += Filename.substr(PrefixToRemove.size());
+else
+  FN += Filename;
+  } else
+FN += Filename;
+
   Lexer::Stringify(FN);
   OS << '"' << FN << '"';
 }
Index: lib/Frontend/CompilerInvocation.cpp

Re: [PATCH] D17811: [clang-tidy] Add check to detect dangling references in value handlers.

2016-03-03 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment.

In http://reviews.llvm.org/D17811#366482, @Eugene.Zelenko wrote:

> Does it make http://reviews.llvm.org/D17772 obsolete?


Yes. The other patch has already been abandoned.


http://reviews.llvm.org/D17811



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


r262641 - [OpenCL] Improve diagnostics of address spaces for variables in function

2016-03-03 Thread Anastasia Stulova via cfe-commits
Author: stulova
Date: Thu Mar  3 12:38:40 2016
New Revision: 262641

URL: http://llvm.org/viewvc/llvm-project?rev=262641=rev
Log:
[OpenCL] Improve diagnostics of address spaces for variables in function

 - Prevent local variables to be declared in global AS
 - Diagnose AS of local variables with an extern storage class
   as if they would be in a program scope

Review: http://reviews.llvm.org/D17345


Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Parser/opencl-storage-class.cl
cfe/trunk/test/SemaOpenCL/storageclass-cl20.cl
cfe/trunk/test/SemaOpenCL/storageclass.cl

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=262641=262640=262641=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Mar  3 12:38:40 
2016
@@ -7683,8 +7683,8 @@ def err_opencl_ptrptr_kernel_param : Err
   "kernel parameter cannot be declared as a pointer to a pointer">;
 def err_opencl_private_ptr_kernel_param : Error<
   "kernel parameter cannot be declared as a pointer to the __private address 
space">;
-def err_opencl_non_kernel_variable : Error<
-  "non-kernel function variable cannot be declared in %0 address space">;
+def err_opencl_function_variable : Error<
+  "%select{non-kernel function|function scope}0 variable cannot be declared in 
%1 address space">;
 def err_static_function_scope : Error<
   "variables in function scope cannot be declared static">;
 def err_opencl_bitfields : Error<
@@ -7712,7 +7712,7 @@ def err_sampler_argument_required : Erro
 def err_wrong_sampler_addressspace: Error<
   "sampler type cannot be used with the __local and __global address space 
qualifiers">;
 def err_opencl_global_invalid_addr_space : Error<
-  "program scope variable must reside in %0 address space">;
+  "%select{program scope|static local|extern}0 variable must reside in %1 
address space">;
 def err_missing_actual_pipe_type : Error<
   "missing actual type specifier for pipe">;
 def err_reference_pipe_type : Error <

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=262641=262640=262641=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Mar  3 12:38:40 2016
@@ -6633,34 +6633,26 @@ void Sema::CheckVariableDeclarationType(
 // OpenCL v2.0 s6.5.1 - Variables defined at program scope and static
 // variables inside a function can also be declared in the global
 // address space.
-if (NewVD->isFileVarDecl()) {
+if (NewVD->isFileVarDecl() || NewVD->isStaticLocal() ||
+NewVD->hasExternalStorage()) {
   if (!T->isSamplerT() &&
   !(T.getAddressSpace() == LangAS::opencl_constant ||
 (T.getAddressSpace() == LangAS::opencl_global &&
  getLangOpts().OpenCLVersion == 200))) {
+int Scope = NewVD->isStaticLocal() | NewVD->hasExternalStorage() << 1;
 if (getLangOpts().OpenCLVersion == 200)
   Diag(NewVD->getLocation(), 
diag::err_opencl_global_invalid_addr_space)
-  << "global or constant";
+  << Scope << "global or constant";
 else
   Diag(NewVD->getLocation(), 
diag::err_opencl_global_invalid_addr_space)
-  << "constant";
+  << Scope << "constant";
 NewVD->setInvalidDecl();
 return;
   }
 } else {
-  // OpenCL v2.0 s6.5.1 - Variables defined at program scope and static
-  // variables inside a function can also be declared in the global
-  // address space.
-  if (NewVD->isStaticLocal() &&
-  !(T.getAddressSpace() == LangAS::opencl_constant ||
-(T.getAddressSpace() == LangAS::opencl_global &&
- getLangOpts().OpenCLVersion == 200))) {
-if (getLangOpts().OpenCLVersion == 200)
-  Diag(NewVD->getLocation(), 
diag::err_opencl_global_invalid_addr_space)
-  << "global or constant";
-else
-  Diag(NewVD->getLocation(), 
diag::err_opencl_global_invalid_addr_space)
-  << "constant";
+  if (T.getAddressSpace() == LangAS::opencl_global) {
+Diag(NewVD->getLocation(), diag::err_opencl_function_variable)
+<< 1 /*is any function*/ << "global";
 NewVD->setInvalidDecl();
 return;
   }
@@ -6671,11 +6663,11 @@ void Sema::CheckVariableDeclarationType(
 FunctionDecl *FD = getCurFunctionDecl();
 if (FD && !FD->hasAttr()) {
   if (T.getAddressSpace() == LangAS::opencl_constant)
-Diag(NewVD->getLocation(), diag::err_opencl_non_kernel_variable)
-<< "constant";
+ 

Re: [PATCH] D17444: PR26672: [MSVC] Clang does not recognize "static_assert" keyword in C mode

2016-03-03 Thread Aaron Ballman via cfe-commits
On Thu, Mar 3, 2016 at 12:06 PM, David Majnemer
 wrote:
>
>
> On Thu, Mar 3, 2016 at 7:52 AM, Aaron Ballman 
> wrote:
>>
>> On Thu, Mar 3, 2016 at 10:43 AM, Andrey Bokhanko
>>  wrote:
>> > Now I'm completely confused... :-)
>> >
>> > Can we rely that this MS engineer has enough authority to declare this
>> > to be a bug?
>>
>> He's on the compiler team, so yes.
>>
>> > And more importantly -- is MS willing to fix the [supposed] bug in
>> > future MSVC compilers? I frankly don't think so...
>>
>> We can only guess what Microsoft is going to do and when. However, we
>> do not aim to be bug for bug compatible with MSVC unless there's very
>> good reason to do so, and I've yet to see any justification to warrant
>> that for this bug. Further, there's additional burden. If Microsoft
>> fixes this bug, are we going to then update our code to only support
>> it in a certain range of -fms-compatibility-version values? Or are we
>> going to have a compatibility hack that Microsoft doesn't have? etc.
>
>
> Here is my thinking:
> If there is code out there in a wild that depends on this, then we should
> take this patch.

That was what I meant by "justification". I would say it has to be
reasonably compelling code (win32 headers, boost, some other major
library) as that's our usual bar for these sort of bug-for-bug
compatible things, as I understand it.

> Once Microsoft releases a compiler which supports the conforming behavior,
> we should limit it's scope to a specific range of versions.
> We've done this in the past for things like _Atomic.

Agreed, we have a way forward if we need it. I mostly just want to
avoid the burden of supporting that because this is sufficiently weird
(being a non-conforming keyword).

~Aaron

>
>>
>>
>> > Either way, it's up to Reid to decide what to do. Reid?
>>
>> It is not solely up to Reid to decide what to do. It's up to us as a
>> community as to what we want to support and maintain long-term and
>> that requires some amount of consensus. Also, Reid is not the only
>> Windows maintainer. ;-)
>>
>> ~Aaron
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17852: Added formatAndApplyAllReplacements that works on multiple files in libTooling.

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


Comment at: include/clang/Tooling/Core/Replacement.h:237
@@ +236,3 @@
+/// related to the same file entry are put into the same vector.
+FileToReplacementsMap groupReplacementsByFile(const Replacements ,
+  FileManager );

Hm... I am not sure here. I think I would implement this entirely without 
FileManager or FileEntries, just based on the names of the file. I guess you 
are worried about different paths leading to the same FileEntry?


Comment at: include/clang/Tooling/ReplacementsFormat.h:1
@@ +1,2 @@
+//===-- ReplacementsFormat.h -- Format code changed by replacements -*- C++ 
-*//
+//

I think this can happily live in Refactoring.h/cpp for now.


Comment at: include/clang/Tooling/ReplacementsFormat.h:40
@@ +39,3 @@
+   Rewriter ,
+   const format::FormatStyle );
+

This is probably a pre-existing issue in formatReplacements, but I think 
conceptually it might be wrong to hand in the Style. I think it might be a 
better idea to use clang::format::getStyle() with the filename stored inside of 
the replacement to get the style that should actually be used for any given 
change. Not sure whether we'd also want the capability to overwrite this. 
Manuel, what do you think?


http://reviews.llvm.org/D17852



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


Re: [PATCH] D17547: [OpenMP] Add support for multidimensional array sections in map clause SEMA.

2016-03-03 Thread Samuel Antao via cfe-commits
sfantao added inline comments.


Comment at: lib/Sema/SemaOpenMP.cpp:9071
@@ +9070,3 @@
+/// 0 if it is inconclusive.
+static int CheckArrayExpressionReferToWholeSize(Sema , const Expr *E,
+QualType BaseQTy) {

ABataev wrote:
> Don't use 'int' as a result of the functions, add enumeric and use it.
I changed this back to bool and reverted the sense given that I am only taking 
any action if something is proved NOT to be whole or unity.


Comment at: lib/Sema/SemaOpenMP.cpp:9127
@@ +9126,3 @@
+// if it is inconclusive.
+static int CheckArrayExpressionReferToUnitySize(Sema , const Expr *E,
+QualType BaseQTy) {

ABataev wrote:
> Again, use enum as a return result
Using bool instead with reverted sense.


http://reviews.llvm.org/D17547



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


Re: [PATCH] D17547: [OpenMP] Add support for multidimensional array sections in map clause SEMA.

2016-03-03 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 49749.
sfantao marked 4 inline comments as done.
sfantao added a comment.

- Remove extra braces and revert the sense of the whole/unity array section 
check.


http://reviews.llvm.org/D17547

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/target_map_messages.cpp

Index: test/OpenMP/target_map_messages.cpp
===
--- test/OpenMP/target_map_messages.cpp
+++ test/OpenMP/target_map_messages.cpp
@@ -1,4 +1,21 @@
-// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 200 %s
+// RUN: %clang_cc1 -DCCODE -verify -fopenmp -ferror-limit 200 -x c %s
+#ifdef CCODE
+void foo(int arg) {
+  const int n = 0;
+
+  double marr[10][10][10];
+
+  #pragma omp target map(marr[2][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+  #pragma omp target map(marr[:][0:][:])
+  {}
+  #pragma omp target map(marr[:][1:][:]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+  #pragma omp target map(marr[:][n:][:])
+  {}
+}
+#else
 template 
 struct SA {
   static int ss;
@@ -82,17 +99,120 @@
 void SAclient(int arg) {
   SA s;
   s.func(arg); // expected-note {{in instantiation of member function}}
+  double marr[10][10][10];
+  double marr2[5][10][1];
+  double mvla[5][arg][10];
+  double ***mptr;
+  const int n = 0;
+  const int m = 1;
+  double mvla2[5][arg][m+n+10];
 
   SB *p;
 
   SD u;
   SC r(p),t(p);
   #pragma omp target map(r)
   {}
+  #pragma omp target map(marr[2][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+  #pragma omp target map(marr[:][0:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+  #pragma omp target map(marr[2][3][0:2])
+  {}
+  #pragma omp target map(marr[:][:][:])
+  {}
+  #pragma omp target map(marr[:2][:][:])
+  {}
+  #pragma omp target map(marr[arg:][:][:])
+  {}
+  #pragma omp target map(marr[arg:])
+  {}
+  #pragma omp target map(marr[arg:][:arg][:]) // correct if arg is the size of dimension 2
+  {}
+  #pragma omp target map(marr[:arg][:])
+  {}
+  #pragma omp target map(marr[:arg][n:])
+  {}
+  #pragma omp target map(marr[:][:arg][n:]) // correct if arg is the size of  dimension 2
+  {}
+  #pragma omp target map(marr[:][:m][n:]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+  #pragma omp target map(marr[n:m][:arg][n:])
+  {}
+  #pragma omp target map(marr[:2][:1][:]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+  #pragma omp target map(marr[:2][1:][:]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+  #pragma omp target map(marr[:2][:][:1]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+  #pragma omp target map(marr[:2][:][1:]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+  #pragma omp target map(marr[:1][:2][:])
+  {}
+  #pragma omp target map(marr[:1][0][:])
+  {}
+  #pragma omp target map(marr[:arg][:2][:]) // correct if arg is 1
+  {}
+  #pragma omp target map(marr[:1][3:1][:2])
+  {}
+  #pragma omp target map(marr[:1][3:arg][:2]) // correct if arg is 1
+  {}
+  #pragma omp target map(marr[:1][3:2][:2]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+  #pragma omp target map(marr[:2][:10][:])
+  {}
+  #pragma omp target map(marr[:2][:][:5+5])
+  {}
+  #pragma omp target map(marr[:2][2+2-4:][0:5+5])
+  {}
+
+  #pragma omp target map(marr[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+  #pragma omp target map(marr2[:1][:2][0])
+  {}
+
+  #pragma omp target map(mvla[:1][:][0]) // correct if the size of dimension 2 is 1.
+  {}
+  #pragma omp target map(mvla[:2][:arg][:]) // correct if arg is the size of dimension 2.
+  {}
+  #pragma omp target map(mvla[:1][:2][0]) // expected-error {{array section does not specify contiguous storage}}
+   {}
+  #pragma omp target map(mvla[1][2:arg][:])
+  {}
+  #pragma omp target map(mvla[:1][:][:])
+  {}
+  #pragma omp target map(mvla2[:1][:2][:11])
+  {}
+  #pragma omp target map(mvla2[:1][:2][:10]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+
+  #pragma omp target map(mptr[:2][2+2-4:1][0:5+5]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+  #pragma omp target map(mptr[:1][:2-1][2:4-3])
+  {}
+  #pragma omp target map(mptr[:1][:arg][2:4-3]) // correct if arg is 1.
+  {}
+  #pragma omp target map(mptr[:1][:2-1][0:2])
+  {}
+  #pragma omp target map(mptr[:1][:2][0:2]) // expected-error {{array section does not specify contiguous storage}}
+  {}
+  #pragma omp target map(mptr[:1][:][0:2]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
+  {}
+  

r262630 - clang-format: Use stable_sort when sorting #includes.

2016-03-03 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Thu Mar  3 11:34:14 2016
New Revision: 262630

URL: http://llvm.org/viewvc/llvm-project?rev=262630=rev
Log:
clang-format: Use stable_sort when sorting #includes.

Otherwise, clang-format can output useless replacements in the presence
of identical #includes

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

Modified: cfe/trunk/lib/Format/Format.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=262630=262629=262630=diff
==
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Thu Mar  3 11:34:14 2016
@@ -1844,10 +1844,11 @@ static void sortIncludes(const FormatSty
   SmallVector Indices;
   for (unsigned i = 0, e = Includes.size(); i != e; ++i)
 Indices.push_back(i);
-  std::sort(Indices.begin(), Indices.end(), [&](unsigned LHSI, unsigned RHSI) {
-return std::tie(Includes[LHSI].Category, Includes[LHSI].Filename) <
-   std::tie(Includes[RHSI].Category, Includes[RHSI].Filename);
-  });
+  std::stable_sort(
+  Indices.begin(), Indices.end(), [&](unsigned LHSI, unsigned RHSI) {
+return std::tie(Includes[LHSI].Category, Includes[LHSI].Filename) <
+   std::tie(Includes[RHSI].Category, Includes[RHSI].Filename);
+  });
 
   // If the #includes are out of order, we generate a single replacement fixing
   // the entire block. Otherwise, no replacement is generated.

Modified: cfe/trunk/unittests/Format/SortIncludesTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/SortIncludesTest.cpp?rev=262630=262629=262630=diff
==
--- cfe/trunk/unittests/Format/SortIncludesTest.cpp (original)
+++ cfe/trunk/unittests/Format/SortIncludesTest.cpp Thu Mar  3 11:34:14 2016
@@ -20,8 +20,12 @@ namespace {
 
 class SortIncludesTest : public ::testing::Test {
 protected:
-  std::string sort(llvm::StringRef Code, StringRef FileName = "input.cpp") {
-std::vector Ranges(1, tooling::Range(0, Code.size()));
+  std::vector GetCodeRange(StringRef Code) {
+return std::vector(1, tooling::Range(0, Code.size()));
+  }
+
+  std::string sort(StringRef Code, StringRef FileName = "input.cpp") {
+auto Ranges = GetCodeRange(Code);
 std::string Sorted =
 applyAllReplacements(Code, sortIncludes(Style, Code, Ranges, 
FileName));
 return applyAllReplacements(Sorted,
@@ -29,8 +33,7 @@ protected:
   }
 
   unsigned newCursor(llvm::StringRef Code, unsigned Cursor) {
-std::vector Ranges(1, tooling::Range(0, Code.size()));
-sortIncludes(Style, Code, Ranges, "input.cpp", );
+sortIncludes(Style, Code, GetCodeRange(Code), "input.cpp", );
 return Cursor;
   }
 
@@ -47,6 +50,17 @@ TEST_F(SortIncludesTest, BasicSorting) {
  "#include \"b.h\"\n"));
 }
 
+TEST_F(SortIncludesTest, NoReplacementsForValidIncludes) {
+  // Identical #includes have led to a failure with an unstable sort.
+  std::string Code = "#include \n"
+ "#include \n"
+ "#include \n"
+ "#include \n"
+ "#include \n"
+ "#include \n";
+  EXPECT_TRUE(sortIncludes(Style, Code, GetCodeRange(Code), "a.cc").empty());
+}
+
 TEST_F(SortIncludesTest, SupportClangFormatOff) {
   EXPECT_EQ("#include \n"
 "#include \n"


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


[PATCH] D17853: Disable tail-call optimization for X86 interrupt handlers

2016-03-03 Thread Amjad Aboud via cfe-commits
aaboud created this revision.
aaboud added reviewers: hjl.tools, DavidKreitzer, ABataev.
aaboud added a subscriber: cfe-commits.

Resolved Bug 26414.
https://llvm.org/bugs/show_bug.cgi?id=26414

Since interrupt handler must be returned with iretq, tail call can't be used.


http://reviews.llvm.org/D17853

Files:
  lib/CodeGen/CGCall.cpp
  test/CodeGen/attr-x86-interrupt.c

Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1451,6 +1451,7 @@
 
   const Decl *TargetDecl = CalleeInfo.getCalleeDecl();
 
+  bool HasAnyX86InterruptAttr = false;
   // FIXME: handle sseregparm someday...
   if (TargetDecl) {
 if (TargetDecl->hasAttr())
@@ -1488,6 +1489,7 @@
 if (TargetDecl->hasAttr())
   RetAttrs.addAttribute(llvm::Attribute::NonNull);
 
+HasAnyX86InterruptAttr = TargetDecl->hasAttr();
 HasOptnone = TargetDecl->hasAttr();
   }
 
@@ -1527,10 +1529,11 @@
 }
 
 bool DisableTailCalls =
-CodeGenOpts.DisableTailCalls ||
+CodeGenOpts.DisableTailCalls || HasAnyX86InterruptAttr ||
 (TargetDecl && TargetDecl->hasAttr());
-FuncAttrs.addAttribute("disable-tail-calls",
-   llvm::toStringRef(DisableTailCalls));
+FuncAttrs.addAttribute(
+"disable-tail-calls",
+llvm::toStringRef(DisableTailCalls));
 
 FuncAttrs.addAttribute("less-precise-fpmad",
llvm::toStringRef(CodeGenOpts.LessPreciseFPMAD));
Index: test/CodeGen/attr-x86-interrupt.c
===
--- test/CodeGen/attr-x86-interrupt.c
+++ test/CodeGen/attr-x86-interrupt.c
@@ -15,12 +15,20 @@
 // X86_64_LINUX: @llvm.used = appending global [2 x i8*] [i8* bitcast (void 
(i32*, i64)* @foo7 to i8*), i8* bitcast (void (i32*)* @foo8 to i8*)], section 
"llvm.metadata"
 // X86_64_LINUX: define x86_intrcc void @foo7(i32* %{{.+}}, i64 %{{.+}})
 // X86_64_LINUX: define x86_intrcc void @foo8(i32* %{{.+}})
+// X86_64_LINUX: "disable-tail-calls"="true"
+// X86_64_LINUX-NOT: "disable-tail-calls"="false"
 // X86_LINUX: @llvm.used = appending global [2 x i8*] [i8* bitcast (void 
(i32*, i32)* @foo7 to i8*), i8* bitcast (void (i32*)* @foo8 to i8*)], section 
"llvm.metadata"
 // X86_LINUX: define x86_intrcc void @foo7(i32* %{{.+}}, i32 %{{.+}})
 // X86_LINUX: define x86_intrcc void @foo8(i32* %{{.+}})
+// X86_LINUX: "disable-tail-calls"="true"
+// X86_LINUX-NOT: "disable-tail-calls"="false"
 // X86_64_WIN: @llvm.used = appending global [2 x i8*] [i8* bitcast (void 
(i32*, i64)* @foo7 to i8*), i8* bitcast (void (i32*)* @foo8 to i8*)], section 
"llvm.metadata"
 // X86_64_WIN: define x86_intrcc void @foo7(i32* %{{.+}}, i64 %{{.+}})
 // X86_64_WIN: define x86_intrcc void @foo8(i32* %{{.+}})
+// X86_64_Win: "disable-tail-calls"="true"
+// X86_64_Win-NOT: "disable-tail-calls"="false"
 // X86_WIN: @llvm.used = appending global [2 x i8*] [i8* bitcast (void (i32*, 
i32)* @foo7 to i8*), i8* bitcast (void (i32*)* @foo8 to i8*)], section 
"llvm.metadata"
 // X86_WIN: define x86_intrcc void @foo7(i32* %{{.+}}, i32 %{{.+}})
 // X86_WIN: define x86_intrcc void @foo8(i32* %{{.+}})
+// X86_Win: "disable-tail-calls"="true"
+// X86_Win-NOT: "disable-tail-calls"="false"


Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1451,6 +1451,7 @@
 
   const Decl *TargetDecl = CalleeInfo.getCalleeDecl();
 
+  bool HasAnyX86InterruptAttr = false;
   // FIXME: handle sseregparm someday...
   if (TargetDecl) {
 if (TargetDecl->hasAttr())
@@ -1488,6 +1489,7 @@
 if (TargetDecl->hasAttr())
   RetAttrs.addAttribute(llvm::Attribute::NonNull);
 
+HasAnyX86InterruptAttr = TargetDecl->hasAttr();
 HasOptnone = TargetDecl->hasAttr();
   }
 
@@ -1527,10 +1529,11 @@
 }
 
 bool DisableTailCalls =
-CodeGenOpts.DisableTailCalls ||
+CodeGenOpts.DisableTailCalls || HasAnyX86InterruptAttr ||
 (TargetDecl && TargetDecl->hasAttr());
-FuncAttrs.addAttribute("disable-tail-calls",
-   llvm::toStringRef(DisableTailCalls));
+FuncAttrs.addAttribute(
+"disable-tail-calls",
+llvm::toStringRef(DisableTailCalls));
 
 FuncAttrs.addAttribute("less-precise-fpmad",
llvm::toStringRef(CodeGenOpts.LessPreciseFPMAD));
Index: test/CodeGen/attr-x86-interrupt.c
===
--- test/CodeGen/attr-x86-interrupt.c
+++ test/CodeGen/attr-x86-interrupt.c
@@ -15,12 +15,20 @@
 // X86_64_LINUX: @llvm.used = appending global [2 x i8*] [i8* bitcast (void (i32*, i64)* @foo7 to i8*), i8* bitcast (void (i32*)* @foo8 to i8*)], section "llvm.metadata"
 // X86_64_LINUX: define x86_intrcc void @foo7(i32* %{{.+}}, i64 %{{.+}})
 // X86_64_LINUX: define x86_intrcc void @foo8(i32* %{{.+}})
+// X86_64_LINUX: 

Re: [clang-tools-extra] r262615 - [clang-tidy] Do not emit warnings from misc-suspicious-semicolon when the compilation fails.

2016-03-03 Thread Alexander Kornienko via cfe-commits
Thank you!

On Thu, Mar 3, 2016 at 2:48 PM, Gábor Horváth  wrote:

> Thank you for the suggestions. This should be addressed in r262618.
>
> On 3 March 2016 at 14:42, Alexander Kornienko  wrote:
>
>>
>>
>> On Thu, Mar 3, 2016 at 2:08 PM, Gabor Horvath via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: xazax
>>> Date: Thu Mar  3 07:08:11 2016
>>> New Revision: 262615
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=262615=rev
>>> Log:
>>> [clang-tidy] Do not emit warnings from misc-suspicious-semicolon when
>>> the compilation fails.
>>>
>>> Added:
>>>
>>> clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
>>> Modified:
>>> clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
>>>
>>> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst
>>>
>>> Modified:
>>> clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp?rev=262615=262614=262615=diff
>>>
>>> ==
>>> --- clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
>>> (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
>>> Thu Mar  3 07:08:11 2016
>>> @@ -7,8 +7,8 @@
>>>  //
>>>
>>>  
>>> //===--===//
>>>
>>> -#include "../utils/LexerUtils.h"
>>>  #include "SuspiciousSemicolonCheck.h"
>>> +#include "../utils/LexerUtils.h"
>>>  #include "clang/AST/ASTContext.h"
>>>  #include "clang/ASTMatchers/ASTMatchFinder.h"
>>>
>>> @@ -30,6 +30,9 @@ void SuspiciousSemicolonCheck::registerM
>>>  }
>>>
>>>  void SuspiciousSemicolonCheck::check(const MatchFinder::MatchResult
>>> ) {
>>> +  if (Result.Context->getDiagnostics().hasErrorOccurred())
>>> +return;
>>> +
>>>const auto *Semicolon = Result.Nodes.getNodeAs("semi");
>>>SourceLocation LocStart = Semicolon->getLocStart();
>>>
>>>
>>> Modified:
>>> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst?rev=262615=262614=262615=diff
>>>
>>> ==
>>> ---
>>> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst
>>> (original)
>>> +++
>>> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst
>>> Thu Mar  3 07:08:11 2016
>>> @@ -11,7 +11,7 @@ intentional.
>>>
>>>.. code-block:: c++
>>>
>>> -if(x < y);
>>> +if (x < y);
>>>  {
>>>x++;
>>>  }
>>> @@ -22,7 +22,7 @@ the first line, and `x` will be incremen
>>>
>>>.. code-block:: c++
>>>
>>> -while((line = readLine(file)) != NULL);
>>> +while ((line = readLine(file)) != NULL);
>>>processLine(line);
>>>
>>>  As a result of this code, `processLine()` will only be called once,
>>> when the
>>> @@ -32,7 +32,7 @@ the code indicates the intention of the
>>>
>>>.. code-block:: c++
>>>
>>> -if(x >= y);
>>> +if (x >= y);
>>>  x -= y;
>>>
>>>  While the indentation does not imply any nesting, there is simply no
>>> valid
>>> @@ -45,7 +45,7 @@ line. For example:
>>>
>>>.. code-block:: c++
>>>
>>> -while(readWhitespace());
>>> +while (readWhitespace());
>>>Token t = readNextToken();
>>>
>>>  Here the second line is indented in a way that suggests that it is
>>> meant to be
>>> @@ -56,14 +56,14 @@ Either remove the indentation from the s
>>>
>>>.. code-block:: c++
>>>
>>> -while(readWhitespace());
>>> +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())
>>> +while (readWhitespace())
>>>;
>>>
>>>Token t = readNextToken();
>>>
>>> Added:
>>> clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp?rev=262615=auto
>>>
>>> ==
>>> ---
>>> clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
>>> (added)
>>> +++
>>> clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
>>> Thu Mar  3 07:08:11 2016
>>> @@ -0,0 +1,13 @@
>>> +// RUN: clang-tidy %s -checks="-*,misc-suspicious-semicolon" -- 2>&1 >
>>> %t
>>> +// RUN: FileCheck --input-file=%t %s
>>>
>>
>> Please pipe the output to FileCheck instead of redirecting it to a
>> temporary file.
>>
>>
>>> +
>>> +// Note: This test verifies that, the checker does not emit any warning
>>> for
>>> +//   files 

Re: [PATCH] D17849: [clang-tidy] Make 'modernize-use-nullptr' check work on multiple nested implicit cast expressions.

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

LG


Repository:
  rL LLVM

http://reviews.llvm.org/D17849



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


Re: [PATCH] D17816: [PPC] FE support for generating VSX [negated] absolute value instructions

2016-03-03 Thread Nemanja Ivanovic via cfe-commits
nemanjai added a comment.

All of my comments are just nits and shouldn't hold up approval. As far as I 
can tell this looks fine, but I'll let the LGTM come from Kit or Hal.



Comment at: lib/Headers/altivec.h:136
@@ -131,3 +135,3 @@
 
 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
 static vector double __ATTRS_o_ai vec_abs(vector double __a) {

amehsan wrote:
> nemanjai wrote:
> > I thought we were going to change the guard here to __VSX__ rather than 
> > __POWER8_VECTOR.
> I want to go through the file separately, check for similar inaccuracies, and 
> fix everything of that kind in one separate commit. This may also require 
> moving test cases between different files. So I do not want to mix it with 
> another submission.
That would be great! Thank you.


Comment at: test/CodeGen/builtins-ppc-altivec.c:84
@@ +83,3 @@
+// CHECK-LE: store <4 x float> %{{.*}}, <4 x float>* @vf
+// CHECK-NOALTIVEC: error: use of undeclared identifier 'vf'
+// CHECK-NOALTIVEC: vf = vec_abs(vf) 

amehsan wrote:
> nemanjai wrote:
> > I am not recommending you change anything here, just want to point out that 
> > there's a potential concern with adding diagnostic test cases in with 
> > functional ones (and yes, I know we have lots of this already). Namely, the 
> > concern is that the diagnostic may go away as we add more code to the test 
> > case and the particular error you're looking for goes past the error 
> > threshold (I think the default is 20 errors).
> Would it address your concern if I add "-ferror-limit 0" to the command line?
I think that's a great idea and good general guidance for test cases of this 
type. BTW, no need to post another review for this - just change it in the 
commit once this patch is approved.


Comment at: test/CodeGen/builtins-ppc-p8vector.c:76
@@ -75,5 +75,3 @@
   res_vd = vec_abs(vda);
-// CHECK: store <2 x i64> , 
<2 x i64>*
-// CHECK: and <2 x i64>
-// CHECK-LE: store <2 x i64> , <2 x i64>*
-// CHECK-LE: and <2 x i64>
+// CHECK: call <2 x double> @llvm.fabs.v2f64(<2 x double> %{{[0-9]*}})
+// CHECK: store <2 x double> %{{.*}}, <2 x double>* @res_vd

amehsan wrote:
> nemanjai wrote:
> > I think that without asserts, clang sometimes gives temporary variables 
> > names rather than numbers. I'd recommend getting rid of the regex for the 
> > argument to @llvm.fabs.* so that you don't get into a weird situation where 
> > some build bot somewhere fails due to this change.
> That pattern is used in other tests. (You can see that in the one right above 
> this one.) But I am fine with changing it to a more general regex like 
> {{.*}}. (I can also remove it but I really wanted to close the parenthesis :)
I see what you mean, it's in the previous CHECK pattern. You should be safe 
keeping this in. However, I'd recommend that you try a build without asserts 
(especially for FE changes) just to make sure things don't behave differently. 
The only reason I bring it up is because I've been burned by that before :).


http://reviews.llvm.org/D17816



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


Re: [PATCH] D17444: PR26672: [MSVC] Clang does not recognize "static_assert" keyword in C mode

2016-03-03 Thread David Majnemer via cfe-commits
On Thu, Mar 3, 2016 at 7:52 AM, Aaron Ballman 
wrote:

> On Thu, Mar 3, 2016 at 10:43 AM, Andrey Bokhanko
>  wrote:
> > Now I'm completely confused... :-)
> >
> > Can we rely that this MS engineer has enough authority to declare this
> > to be a bug?
>
> He's on the compiler team, so yes.
>
> > And more importantly -- is MS willing to fix the [supposed] bug in
> > future MSVC compilers? I frankly don't think so...
>
> We can only guess what Microsoft is going to do and when. However, we
> do not aim to be bug for bug compatible with MSVC unless there's very
> good reason to do so, and I've yet to see any justification to warrant
> that for this bug. Further, there's additional burden. If Microsoft
> fixes this bug, are we going to then update our code to only support
> it in a certain range of -fms-compatibility-version values? Or are we
> going to have a compatibility hack that Microsoft doesn't have? etc.
>

Here is my thinking:
If there is code out there in a wild that depends on this, then we should
take this patch.
Once Microsoft releases a compiler which supports the conforming behavior,
we should limit it's scope to a specific range of versions.
We've done this in the past for things like _Atomic.


>
> > Either way, it's up to Reid to decide what to do. Reid?
>
> It is not solely up to Reid to decide what to do. It's up to us as a
> community as to what we want to support and maintain long-term and
> that requires some amount of consensus. Also, Reid is not the only
> Windows maintainer. ;-)
>
> ~Aaron
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r262625 - [OpenMP] Code generation for teams - kernel launching

2016-03-03 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Thu Mar  3 10:20:23 2016
New Revision: 262625

URL: http://llvm.org/viewvc/llvm-project?rev=262625=rev
Log:
[OpenMP] Code generation for teams - kernel launching

Summary:
This patch implements the launching of a target region in the presence of a 
nested teams region, i.e calls tgt_target_teams with the required arguments 
gathered from the enclosed teams directive.

The actual codegen of the region enclosed by the teams construct will be 
contributed in a separate patch.

Reviewers: hfinkel, arpith-jacob, kkwli0, carlo.bertolli, ABataev

Subscribers: cfe-commits, caomhin, fraggamuffin

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

Added:
cfe/trunk/test/OpenMP/teams_codegen.cpp
Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=262625=262624=262625=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu Mar  3 10:20:23 2016
@@ -252,6 +252,70 @@ private:
   StringRef HelperName;
 };
 
+static void EmptyCodeGen(CodeGenFunction &) {
+  llvm_unreachable("No codegen for expressions");
+}
+/// \brief API for generation of expressions captured in a innermost OpenMP
+/// region.
+class CGOpenMPInnerExprInfo : public CGOpenMPInlinedRegionInfo {
+public:
+  CGOpenMPInnerExprInfo(CodeGenFunction , const CapturedStmt )
+  : CGOpenMPInlinedRegionInfo(CGF.CapturedStmtInfo, EmptyCodeGen,
+  OMPD_unknown,
+  /*HasCancel=*/false),
+PrivScope(CGF) {
+// Make sure the globals captured in the provided statement are local by
+// using the privatization logic. We assume the same variable is not
+// captured more than once.
+for (auto  : CS.captures()) {
+  if (!C.capturesVariable() && !C.capturesVariableByCopy())
+continue;
+
+  const VarDecl *VD = C.getCapturedVar();
+  if (VD->isLocalVarDeclOrParm())
+continue;
+
+  DeclRefExpr DRE(const_cast(VD),
+  /*RefersToEnclosingVariableOrCapture=*/false,
+  VD->getType().getNonReferenceType(), VK_LValue,
+  SourceLocation());
+  PrivScope.addPrivate(VD, [, ]() -> Address {
+return CGF.EmitLValue().getAddress();
+  });
+}
+(void)PrivScope.Privatize();
+  }
+
+  /// \brief Lookup the captured field decl for a variable.
+  const FieldDecl *lookup(const VarDecl *VD) const override {
+if (auto *FD = CGOpenMPInlinedRegionInfo::lookup(VD))
+  return FD;
+return nullptr;
+  }
+
+  /// \brief Emit the captured statement body.
+  void EmitBody(CodeGenFunction , const Stmt *S) override {
+llvm_unreachable("No body for expressions");
+  }
+
+  /// \brief Get a variable or parameter for storing global thread id
+  /// inside OpenMP construct.
+  const VarDecl *getThreadIDVariable() const override {
+llvm_unreachable("No thread id for expressions");
+  }
+
+  /// \brief Get the name of the capture helper.
+  StringRef getHelperName() const override {
+llvm_unreachable("No helper name for expressions");
+  }
+
+  static bool classof(const CGCapturedStmtInfo *Info) { return false; }
+
+private:
+  /// Private scope to capture global variables.
+  CodeGenFunction::OMPPrivateScope PrivScope;
+};
+
 /// \brief RAII for emitting code of OpenMP constructs.
 class InlinedOpenMPRegionRAII {
   CodeGenFunction 
@@ -481,6 +545,10 @@ enum OpenMPRTLFunction {
   // arg_num, void** args_base, void **args, size_t *arg_sizes, int32_t
   // *arg_types);
   OMPRTL__tgt_target,
+  // Call to int32_t __tgt_target_teams(int32_t device_id, void *host_ptr,
+  // int32_t arg_num, void** args_base, void **args, size_t *arg_sizes,
+  // int32_t *arg_types, int32_t num_teams, int32_t thread_limit);
+  OMPRTL__tgt_target_teams,
   // Call to void __tgt_register_lib(__tgt_bin_desc *desc);
   OMPRTL__tgt_register_lib,
   // Call to void __tgt_unregister_lib(__tgt_bin_desc *desc);
@@ -1153,6 +1221,24 @@ CGOpenMPRuntime::createRuntimeFunction(u
 RTLFn = CGM.CreateRuntimeFunction(FnTy, "__tgt_target");
 break;
   }
+  case OMPRTL__tgt_target_teams: {
+// Build int32_t __tgt_target_teams(int32_t device_id, void *host_ptr,
+// int32_t arg_num, void** args_base, void **args, size_t *arg_sizes,
+// int32_t *arg_types, int32_t num_teams, int32_t thread_limit);
+llvm::Type *TypeParams[] = {CGM.Int32Ty,
+CGM.VoidPtrTy,
+CGM.Int32Ty,
+CGM.VoidPtrPtrTy,
+CGM.VoidPtrPtrTy,
+CGM.SizeTy->getPointerTo(),
+CGM.Int32Ty->getPointerTo(),
+

[PATCH] D17852: Added formatAndApplyAllReplacements that works on multiple files in libTooling.

2016-03-03 Thread Eric Liu via cfe-commits
ioeric created this revision.
ioeric added reviewers: klimek, djasper.
ioeric added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

formatAndApplyAllReplacements takes a set of Replacements, applies them on a
Rewriter, and reformats the changed code.

http://reviews.llvm.org/D17852

Files:
  include/clang/Basic/SourceManager.h
  include/clang/Format/Format.h
  include/clang/Tooling/Core/Replacement.h
  include/clang/Tooling/ReplacementsFormat.h
  lib/Format/Format.cpp
  lib/Tooling/CMakeLists.txt
  lib/Tooling/Core/Replacement.cpp
  lib/Tooling/ReplacementsFormat.cpp
  unittests/Format/FormatTest.cpp
  unittests/Tooling/CMakeLists.txt
  unittests/Tooling/RefactoringTest.cpp

Index: unittests/Tooling/RefactoringTest.cpp
===
--- unittests/Tooling/RefactoringTest.cpp
+++ unittests/Tooling/RefactoringTest.cpp
@@ -18,11 +18,13 @@
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Format/Format.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendAction.h"
 #include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "clang/Tooling/Refactoring.h"
+#include "clang/Tooling/ReplacementsFormat.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Support/Path.h"
@@ -166,6 +168,41 @@
   EXPECT_EQ("z", Context.getRewrittenText(IDz));
 }
 
+TEST_F(ReplacementTest, MultipleFilesReplaceAndFormat) {
+  // Column limit is 20.
+  std::string Code1 = "Long *a =\n"
+  "new Long();\n"
+  "long x = 1;";
+  std::string Expected1 = "auto a = new Long();\n"
+  "long x =\n"
+  "12345678901;";
+  std::string Code2 = "int x = 123;\n"
+  "int y = 0;";
+  std::string Expected2 = "int x =\n"
+  "1234567890123;\n"
+  "int y = 10;";
+  FileID ID1 = Context.createInMemoryFile("format_1.cpp", Code1);
+  FileID ID2 = Context.createInMemoryFile("format_2.cpp", Code2);
+
+  tooling::Replacements Replaces;
+  // Scrambled the order of replacements.
+  Replaces.insert(tooling::Replacement(
+  Context.Sources, Context.getLocation(ID2, 1, 12), 0, "4567890123"));
+  Replaces.insert(tooling::Replacement(
+  Context.Sources, Context.getLocation(ID1, 1, 1), 6, "auto "));
+  Replaces.insert(tooling::Replacement(
+  Context.Sources, Context.getLocation(ID2, 2, 9), 1, "10"));
+  Replaces.insert(tooling::Replacement(
+  Context.Sources, Context.getLocation(ID1, 3, 10), 1, "12345678901"));
+
+  format::FormatStyle Style = format::getLLVMStyle();
+  Style.ColumnLimit = 20; // Set column limit to 20 to increase readibility.
+
+  EXPECT_TRUE(formatAndApplyAllReplacements(Replaces, Context.Rewrite, Style));
+  EXPECT_EQ(Expected1, Context.getRewrittenText(ID1));
+  EXPECT_EQ(Expected2, Context.getRewrittenText(ID2));
+}
+
 TEST(ShiftedCodePositionTest, FindsNewCodePosition) {
   Replacements Replaces;
   Replaces.insert(Replacement("", 0, 1, ""));
Index: unittests/Tooling/CMakeLists.txt
===
--- unittests/Tooling/CMakeLists.txt
+++ unittests/Tooling/CMakeLists.txt
@@ -24,6 +24,7 @@
   clangAST
   clangASTMatchers
   clangBasic
+  clangFormat
   clangFrontend
   clangLex
   clangRewrite
Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -11215,7 +11215,8 @@
 
   format::FormatStyle Style = format::getLLVMStyle();
   Style.ColumnLimit = 20; // Set column limit to 20 to increase readibility.
-  EXPECT_EQ(Expected, applyAllReplacementsAndFormat(Code, Replaces, Style));
+  EXPECT_EQ(Expected, applyAllReplacements(
+  Code, formatReplacements(Code, Replaces, Style)));
 }
 
 } // end namespace
Index: lib/Tooling/ReplacementsFormat.cpp
===
--- /dev/null
+++ lib/Tooling/ReplacementsFormat.cpp
@@ -0,0 +1,49 @@
+//===--- ReplacementFormat.cpp - Format code changed by replacemnts ---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// \file
+// \brief This file implements functions that reformat code changed by
+// replacements.
+//
+//===--===//
+
+#include "clang/Tooling/ReplacementsFormat.h"
+
+#include "clang/Basic/SourceManager.h"
+
+namespace clang {
+namespace tooling {
+
+bool formatAndApplyAllReplacements(const Replacements ,
+  

Re: [PATCH] D17444: PR26672: [MSVC] Clang does not recognize "static_assert" keyword in C mode

2016-03-03 Thread Aaron Ballman via cfe-commits
I spoke with a Microsoft compiler engineer who said this is most
likely a bug that static_assert works in C mode in MSVC. Based on
that, I would strongly prefer to not accept this patch.

~Aaron

On Wed, Mar 2, 2016 at 9:33 PM, Aaron Ballman  wrote:
> I will talk to someone about this tomorrow to see if I can get a
> better feel, thank you for the reminder.
>
> ~Aaron
>
> On Wed, Mar 2, 2016 at 8:44 PM, Reid Kleckner via cfe-commits
>  wrote:
>> rnk accepted this revision.
>> rnk added a comment.
>> This revision is now accepted and ready to land.
>>
>> lgtm
>>
>>
>> http://reviews.llvm.org/D17444
>>
>>
>>
>> ___
>> 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] D17761: Added applyAllReplacementsAndFormat that works for multiple files.

2016-03-03 Thread Eric Liu via cfe-commits
ioeric abandoned this revision.
ioeric added a comment.

Start a new revision to put applyAllReplacementsAndFormat into non-core 
libTooling .


http://reviews.llvm.org/D17761



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


Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Hal Finkel via cfe-commits
hfinkel added a subscriber: hfinkel.
hfinkel added a comment.

In http://reviews.llvm.org/D17741#367113, @weimingz wrote:

> Add "-f__FILE__-prefix-to-remove" flag to support the trim of the prefix.
>  Passing special value __ALL_DIR__  to remove all dir parts.
>
> For example FILE is /a/b/c
>  -f__FILE__-prefix-to-remove=/a/ will cause FILE be expanded to b/c


I *really* don't like having `__FILE__` in the option name. That will look 
visually disjointing on the command line. How about: 
`-ffile-macro-prefix-to-remove`?


http://reviews.llvm.org/D17741



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


Re: [PATCH] D17816: [PPC] FE support for generating VSX [negated] absolute value instructions

2016-03-03 Thread amehsan via cfe-commits
amehsan added inline comments.


Comment at: lib/Headers/altivec.h:136
@@ -131,3 +135,3 @@
 
 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
 static vector double __ATTRS_o_ai vec_abs(vector double __a) {

nemanjai wrote:
> I thought we were going to change the guard here to __VSX__ rather than 
> __POWER8_VECTOR.
I want to go through the file separately, check for similar inaccuracies, and 
fix everything of that kind in one separate commit. This may also require 
moving test cases between different files. So I do not want to mix it with 
another submission.


Comment at: test/CodeGen/builtins-ppc-altivec.c:8
@@ +7,3 @@
+// RUN:  -o - | FileCheck %s -check-prefix=CHECK-LE
+// RUN: not %clang_cc1 -triple powerpc64le-unknown-unknown -emit-llvm %s \
+// RUN: -o - 2>&1 | FileCheck %s -check-prefix=CHECK-NOALTIVEC

nemanjai wrote:
> I would have thought that we already have a diagnostic test case for the 
> missing -faltivec, but if we don't, thanks for adding it.
No we don't. I spent some time looking for it in the existing test cases and 
did not find anything.


Comment at: test/CodeGen/builtins-ppc-altivec.c:84
@@ +83,3 @@
+// CHECK-LE: store <4 x float> %{{.*}}, <4 x float>* @vf
+// CHECK-NOALTIVEC: error: use of undeclared identifier 'vf'
+// CHECK-NOALTIVEC: vf = vec_abs(vf) 

nemanjai wrote:
> I am not recommending you change anything here, just want to point out that 
> there's a potential concern with adding diagnostic test cases in with 
> functional ones (and yes, I know we have lots of this already). Namely, the 
> concern is that the diagnostic may go away as we add more code to the test 
> case and the particular error you're looking for goes past the error 
> threshold (I think the default is 20 errors).
Would it address your concern if I add "-ferror-limit 0" to the command line?


Comment at: test/CodeGen/builtins-ppc-p8vector.c:76
@@ -75,5 +75,3 @@
   res_vd = vec_abs(vda);
-// CHECK: store <2 x i64> , 
<2 x i64>*
-// CHECK: and <2 x i64>
-// CHECK-LE: store <2 x i64> , <2 x i64>*
-// CHECK-LE: and <2 x i64>
+// CHECK: call <2 x double> @llvm.fabs.v2f64(<2 x double> %{{[0-9]*}})
+// CHECK: store <2 x double> %{{.*}}, <2 x double>* @res_vd

nemanjai wrote:
> I think that without asserts, clang sometimes gives temporary variables names 
> rather than numbers. I'd recommend getting rid of the regex for the argument 
> to @llvm.fabs.* so that you don't get into a weird situation where some build 
> bot somewhere fails due to this change.
That pattern is used in other tests. (You can see that in the one right above 
this one.) But I am fine with changing it to a more general regex like {{.*}}. 
(I can also remove it but I really wanted to close the parenthesis :)


http://reviews.llvm.org/D17816



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


Re: [PATCH] D17784: Check if LLVM_PREFIX is defined before using it.

2016-03-03 Thread Krzysztof Parzyszek via cfe-commits
kparzysz added a comment.

This seemed fine to me, but at the second thought, the lines 2610-2613 in the 
original should be removed.


http://reviews.llvm.org/D17784



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


r262619 - [ARM] Add Clang targeting for ARMv8-M Baseline/Mainline

2016-03-03 Thread Bradley Smith via cfe-commits
Author: brasmi01
Date: Thu Mar  3 07:52:22 2016
New Revision: 262619

URL: http://llvm.org/viewvc/llvm-project?rev=262619=rev
Log:
[ARM] Add Clang targeting for ARMv8-M Baseline/Mainline

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/arm-alignment.c
cfe/trunk/test/Driver/arm-cortex-cpus.c
cfe/trunk/test/Driver/arm-features.c
cfe/trunk/test/Preprocessor/arm-target-features.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=262619=262618=262619=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Mar  3 07:52:22 2016
@@ -4536,7 +4536,8 @@ class ARMTargetInfo : public TargetInfo
   }
 
   bool supportsThumb2() const {
-return CPUAttr.equals("6T2") || ArchVersion >= 7;
+return CPUAttr.equals("6T2") ||
+   (ArchVersion >= 7 && !CPUAttr.equals("8M_BASE"));
   }
 
   StringRef getCPUAttr() const {
@@ -4563,6 +4564,10 @@ class ARMTargetInfo : public TargetInfo
   return "8_1A";
 case llvm::ARM::AK_ARMV8_2A:
   return "8_2A";
+case llvm::ARM::AK_ARMV8MBaseline:
+  return "8M_BASE";
+case llvm::ARM::AK_ARMV8MMainline:
+  return "8M_MAIN";
 }
   }
 
@@ -4852,13 +4857,14 @@ public:
 
 // __ARM_ARCH_ISA_ARM is defined to 1 if the core supports the ARM ISA.  It
 // is not defined for the M-profile.
-// NOTE that the deffault profile is assumed to be 'A'
-if (CPUProfile.empty() || CPUProfile != "M")
+// NOTE that the default profile is assumed to be 'A'
+if (CPUProfile.empty() || ArchProfile != llvm::ARM::PK_M)
   Builder.defineMacro("__ARM_ARCH_ISA_ARM", "1");
 
-// __ARM_ARCH_ISA_THUMB is defined to 1 if the core supporst the original
-// Thumb ISA (including v6-M).  It is set to 2 if the core supports the
-// Thumb-2 ISA as found in the v6T2 architecture and all v7 architecture.
+// __ARM_ARCH_ISA_THUMB is defined to 1 if the core supports the original
+// Thumb ISA (including v6-M and v8-M Baseline).  It is set to 2 if the
+// core supports the Thumb-2 ISA as found in the v6T2 architecture and all
+// v7 and v8 architectures excluding v8-M Baseline.
 if (supportsThumb2())
   Builder.defineMacro("__ARM_ARCH_ISA_THUMB", "2");
 else if (supportsThumb())
@@ -4978,7 +4984,7 @@ public:
 Builder.defineMacro("__ARM_SIZEOF_MINIMAL_ENUM",
 Opts.ShortEnums ? "1" : "4");
 
-if (ArchVersion >= 6 && CPUAttr != "6M") {
+if (ArchVersion >= 6 && CPUAttr != "6M" && CPUAttr != "8M_BASE") {
   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
   Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=262619=262618=262619=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Mar  3 07:52:22 2016
@@ -963,6 +963,10 @@ static void getARMTargetFeatures(const T
   // No v6M core supports unaligned memory access (v6M ARM ARM A3.2).
   if (Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6m)
 D.Diag(diag::err_target_unsupported_unaligned) << "v6m";
+  // v8M Baseline follows on from v6M, so doesn't support unaligned memory
+  // access either.
+  else if (Triple.getSubArch() == 
llvm::Triple::SubArchType::ARMSubArch_v8m_baseline)
+D.Diag(diag::err_target_unsupported_unaligned) << "v8m.base";
 } else
   Features.push_back("+strict-align");
   } else {

Modified: cfe/trunk/test/Driver/arm-alignment.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-alignment.c?rev=262619=262618=262619=diff
==
--- cfe/trunk/test/Driver/arm-alignment.c (original)
+++ cfe/trunk/test/Driver/arm-alignment.c Thu Mar  3 07:52:22 2016
@@ -83,11 +83,13 @@
 // CHECK-ALIGNED-ARM: "-target-feature" "+strict-align"
 // CHECK-ALIGNED-AARCH64: "-target-feature" "+strict-align"
 
-// Make sure that v6M cores always trigger the unsupported aligned accesses 
error
-// for all supported architecture triples.
+// Make sure that v6M cores and v8M Baseline always trigger the unsupported
+// aligned accesses error for all supported architecture triples.
 // RUN: not %clang -c -target thumbv6m-none-gnueabi -mcpu=cortex-m0 
-munaligned-access %s 2>&1 | \
 // RUN:   FileCheck --check-prefix CHECK-UNALIGN-NOT-SUPPORTED %s
 // RUN: not %clang -c -target thumb-none-gnueabi -mcpu=cortex-m0 
-munaligned-access %s 2>&1 | \
 // RUN:   FileCheck --check-prefix CHECK-UNALIGN-NOT-SUPPORTED %s
+// RUN: not %clang -c -target 

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

2016-03-03 Thread Bradley Smith via cfe-commits
bsmith closed this revision.
bsmith added a comment.

Committed as r262619.


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


Re: [clang-tools-extra] r262615 - [clang-tidy] Do not emit warnings from misc-suspicious-semicolon when the compilation fails.

2016-03-03 Thread Gábor Horváth via cfe-commits
Thank you for the suggestions. This should be addressed in r262618.

On 3 March 2016 at 14:42, Alexander Kornienko  wrote:

>
>
> On Thu, Mar 3, 2016 at 2:08 PM, Gabor Horvath via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: xazax
>> Date: Thu Mar  3 07:08:11 2016
>> New Revision: 262615
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=262615=rev
>> Log:
>> [clang-tidy] Do not emit warnings from misc-suspicious-semicolon when the
>> compilation fails.
>>
>> Added:
>>
>> clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
>> Modified:
>> clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
>>
>> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst
>>
>> Modified:
>> clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp?rev=262615=262614=262615=diff
>>
>> ==
>> --- clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
>> (original)
>> +++ clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
>> Thu Mar  3 07:08:11 2016
>> @@ -7,8 +7,8 @@
>>  //
>>
>>  
>> //===--===//
>>
>> -#include "../utils/LexerUtils.h"
>>  #include "SuspiciousSemicolonCheck.h"
>> +#include "../utils/LexerUtils.h"
>>  #include "clang/AST/ASTContext.h"
>>  #include "clang/ASTMatchers/ASTMatchFinder.h"
>>
>> @@ -30,6 +30,9 @@ void SuspiciousSemicolonCheck::registerM
>>  }
>>
>>  void SuspiciousSemicolonCheck::check(const MatchFinder::MatchResult
>> ) {
>> +  if (Result.Context->getDiagnostics().hasErrorOccurred())
>> +return;
>> +
>>const auto *Semicolon = Result.Nodes.getNodeAs("semi");
>>SourceLocation LocStart = Semicolon->getLocStart();
>>
>>
>> Modified:
>> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst
>> URL:
>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst?rev=262615=262614=262615=diff
>>
>> ==
>> ---
>> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst
>> (original)
>> +++
>> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst
>> Thu Mar  3 07:08:11 2016
>> @@ -11,7 +11,7 @@ intentional.
>>
>>.. code-block:: c++
>>
>> -if(x < y);
>> +if (x < y);
>>  {
>>x++;
>>  }
>> @@ -22,7 +22,7 @@ the first line, and `x` will be incremen
>>
>>.. code-block:: c++
>>
>> -while((line = readLine(file)) != NULL);
>> +while ((line = readLine(file)) != NULL);
>>processLine(line);
>>
>>  As a result of this code, `processLine()` will only be called once, when
>> the
>> @@ -32,7 +32,7 @@ the code indicates the intention of the
>>
>>.. code-block:: c++
>>
>> -if(x >= y);
>> +if (x >= y);
>>  x -= y;
>>
>>  While the indentation does not imply any nesting, there is simply no
>> valid
>> @@ -45,7 +45,7 @@ line. For example:
>>
>>.. code-block:: c++
>>
>> -while(readWhitespace());
>> +while (readWhitespace());
>>Token t = readNextToken();
>>
>>  Here the second line is indented in a way that suggests that it is meant
>> to be
>> @@ -56,14 +56,14 @@ Either remove the indentation from the s
>>
>>.. code-block:: c++
>>
>> -while(readWhitespace());
>> +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())
>> +while (readWhitespace())
>>;
>>
>>Token t = readNextToken();
>>
>> Added:
>> clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp?rev=262615=auto
>>
>> ==
>> ---
>> clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
>> (added)
>> +++
>> clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
>> Thu Mar  3 07:08:11 2016
>> @@ -0,0 +1,13 @@
>> +// RUN: clang-tidy %s -checks="-*,misc-suspicious-semicolon" -- 2>&1 > %t
>> +// RUN: FileCheck --input-file=%t %s
>>
>
> Please pipe the output to FileCheck instead of redirecting it to a
> temporary file.
>
>
>> +
>> +// Note: This test verifies that, the checker does not emit any warning
>> for
>> +//   files that do not compile.
>> +
>> +bool g();
>> +
>> +void f() {
>> +  if (g());
>> +  // CHECK-NOT: :[[@LINE-1]]:11: warning: potentially unintended
>> semicolon [misc-suspicious-semicolon]
>>
>
> Please make the check line more broad for more tolerance 

[clang-tools-extra] r262618 - [clang-tidy] Improve the robustness of a test.

2016-03-03 Thread Gabor Horvath via cfe-commits
Author: xazax
Date: Thu Mar  3 07:43:23 2016
New Revision: 262618

URL: http://llvm.org/viewvc/llvm-project?rev=262618=rev
Log:
[clang-tidy] Improve the robustness of a test.

Modified:
clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp?rev=262618=262617=262618=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp 
Thu Mar  3 07:43:23 2016
@@ -1,5 +1,4 @@
-// RUN: clang-tidy %s -checks="-*,misc-suspicious-semicolon" -- 2>&1 > %t
-// RUN: FileCheck --input-file=%t %s
+// RUN: clang-tidy %s -checks="-*,misc-suspicious-semicolon" -- 2>&1 | 
FileCheck %s
 
 // Note: This test verifies that, the checker does not emit any warning for
 //   files that do not compile.
@@ -8,6 +7,6 @@ bool g();
 
 void f() {
   if (g());
-  // CHECK-NOT: :[[@LINE-1]]:11: warning: potentially unintended semicolon 
[misc-suspicious-semicolon]
+  // CHECK-NOT: [misc-suspicious-semicolon]
   int a
 }


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


r262617 - [CLANG][AVX512][BUILTIN] movddup{128|256|512}

2016-03-03 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Thu Mar  3 07:43:05 2016
New Revision: 262617

URL: http://llvm.org/viewvc/llvm-project?rev=262617=rev
Log:
[CLANG][AVX512][BUILTIN] movddup{128|256|512}

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


Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/lib/Headers/avx512vlintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c
cfe/trunk/test/CodeGen/avx512vl-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=262617=262616=262617=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Thu Mar  3 07:43:05 2016
@@ -1716,6 +1716,9 @@ TARGET_BUILTIN(__builtin_ia32_movdquhi12
 TARGET_BUILTIN(__builtin_ia32_movdquhi256_mask, 
"V16sV16sV16sUs","","avx512bw,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_movdquqi128_mask, 
"V16cV16cV16cUs","","avx512bw,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_movdquqi256_mask, 
"V32cV32cV32cUi","","avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_movddup512_mask, "V8dV8dV8dUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movddup128_mask, "V2dV2dV2dUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_movddup256_mask, "V4dV4dV4dUc","","avx512vl")
 
 #undef BUILTIN
 #undef TARGET_BUILTIN

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=262617=262616=262617=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Thu Mar  3 07:43:05 2016
@@ -3668,6 +3668,34 @@ _mm512_mask_store_epi64 (void *__P, __mm
 }
 
 
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_movedup_pd (__m512d __A)
+{
+  return (__m512d) __builtin_ia32_movddup512_mask ((__v8df) __A,
+   (__v8df)
+   _mm512_undefined_pd (),
+   (__mmask8) -1);
+}
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_mask_movedup_pd (__m512d __W, __mmask8 __U, __m512d __A)
+{
+  return (__m512d) __builtin_ia32_movddup512_mask ((__v8df) __A,
+   (__v8df) __W,
+   (__mmask8) __U);
+}
+
+static __inline__ __m512d __DEFAULT_FN_ATTRS
+_mm512_maskz_movedup_pd (__mmask8 __U, __m512d __A)
+{
+  return (__m512d) __builtin_ia32_movddup512_mask ((__v8df) __A,
+   (__v8df)
+   _mm512_setzero_pd (),
+   (__mmask8) __U);
+}
+
+
 #undef __DEFAULT_FN_ATTRS
 
 #endif // __AVX512FINTRIN_H

Modified: cfe/trunk/lib/Headers/avx512vlintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlintrin.h?rev=262617=262616=262617=diff
==
--- cfe/trunk/lib/Headers/avx512vlintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlintrin.h Thu Mar  3 07:43:05 2016
@@ -5978,6 +5978,39 @@ _mm256_mask_store_epi64 (void *__P, __mm
   (__mmask8) __U);
 }
 
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_mask_movedup_pd (__m128d __W, __mmask8 __U, __m128d __A)
+{
+  return (__m128d) __builtin_ia32_movddup128_mask ((__v2df) __A,
+   (__v2df) __W,
+   (__mmask8) __U);
+}
+
+static __inline__ __m128d __DEFAULT_FN_ATTRS
+_mm_maskz_movedup_pd (__mmask8 __U, __m128d __A)
+{
+  return (__m128d) __builtin_ia32_movddup128_mask ((__v2df) __A,
+   (__v2df)
+   _mm_setzero_pd (),
+   (__mmask8) __U);
+}
+
+static __inline__ __m256d __DEFAULT_FN_ATTRS
+_mm256_mask_movedup_pd (__m256d __W, __mmask8 __U, __m256d __A)
+{
+  return (__m256d) __builtin_ia32_movddup256_mask ((__v4df) __A,
+   (__v4df) __W,
+   (__mmask8) __U);
+}
+
+static __inline__ __m256d __DEFAULT_FN_ATTRS
+_mm256_maskz_movedup_pd (__mmask8 __U, __m256d __A)
+{
+  return (__m256d) __builtin_ia32_movddup256_mask ((__v4df) __A,
+   (__v4df)
+  _mm256_setzero_pd (),
+   (__mmask8) __U);
+}
 
 #undef __DEFAULT_FN_ATTRS
 #undef __DEFAULT_FN_ATTRS_BOTH

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=262617=262616=262617=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Thu Mar  3 07:43:05 2016
@@ -2346,3 +2346,22 @@ void test_mm512_mask_store_epi64(void *_
   return _mm512_mask_store_epi64(__P, __U, __A); 
 }
 
+__m512d test_mm512_movedup_pd(__m512d __A) {
+  // CHECK-LABEL: @test_mm512_movedup_pd
+  // CHECK: @llvm.x86.avx512.mask.movddup.512
+  return _mm512_movedup_pd(__A); 
+}
+
+__m512d test_mm512_mask_movedup_pd(__m512d __W, __mmask8 

Re: [clang-tools-extra] r262615 - [clang-tidy] Do not emit warnings from misc-suspicious-semicolon when the compilation fails.

2016-03-03 Thread Alexander Kornienko via cfe-commits
On Thu, Mar 3, 2016 at 2:08 PM, Gabor Horvath via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: xazax
> Date: Thu Mar  3 07:08:11 2016
> New Revision: 262615
>
> URL: http://llvm.org/viewvc/llvm-project?rev=262615=rev
> Log:
> [clang-tidy] Do not emit warnings from misc-suspicious-semicolon when the
> compilation fails.
>
> Added:
>
> clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
> Modified:
> clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
>
> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst
>
> Modified:
> clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp?rev=262615=262614=262615=diff
>
> ==
> --- clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
> (original)
> +++ clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
> Thu Mar  3 07:08:11 2016
> @@ -7,8 +7,8 @@
>  //
>
>  
> //===--===//
>
> -#include "../utils/LexerUtils.h"
>  #include "SuspiciousSemicolonCheck.h"
> +#include "../utils/LexerUtils.h"
>  #include "clang/AST/ASTContext.h"
>  #include "clang/ASTMatchers/ASTMatchFinder.h"
>
> @@ -30,6 +30,9 @@ void SuspiciousSemicolonCheck::registerM
>  }
>
>  void SuspiciousSemicolonCheck::check(const MatchFinder::MatchResult
> ) {
> +  if (Result.Context->getDiagnostics().hasErrorOccurred())
> +return;
> +
>const auto *Semicolon = Result.Nodes.getNodeAs("semi");
>SourceLocation LocStart = Semicolon->getLocStart();
>
>
> Modified:
> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst?rev=262615=262614=262615=diff
>
> ==
> ---
> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst
> (original)
> +++
> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst
> Thu Mar  3 07:08:11 2016
> @@ -11,7 +11,7 @@ intentional.
>
>.. code-block:: c++
>
> -if(x < y);
> +if (x < y);
>  {
>x++;
>  }
> @@ -22,7 +22,7 @@ the first line, and `x` will be incremen
>
>.. code-block:: c++
>
> -while((line = readLine(file)) != NULL);
> +while ((line = readLine(file)) != NULL);
>processLine(line);
>
>  As a result of this code, `processLine()` will only be called once, when
> the
> @@ -32,7 +32,7 @@ the code indicates the intention of the
>
>.. code-block:: c++
>
> -if(x >= y);
> +if (x >= y);
>  x -= y;
>
>  While the indentation does not imply any nesting, there is simply no valid
> @@ -45,7 +45,7 @@ line. For example:
>
>.. code-block:: c++
>
> -while(readWhitespace());
> +while (readWhitespace());
>Token t = readNextToken();
>
>  Here the second line is indented in a way that suggests that it is meant
> to be
> @@ -56,14 +56,14 @@ Either remove the indentation from the s
>
>.. code-block:: c++
>
> -while(readWhitespace());
> +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())
> +while (readWhitespace())
>;
>
>Token t = readNextToken();
>
> Added:
> clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp?rev=262615=auto
>
> ==
> ---
> clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
> (added)
> +++
> clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
> Thu Mar  3 07:08:11 2016
> @@ -0,0 +1,13 @@
> +// RUN: clang-tidy %s -checks="-*,misc-suspicious-semicolon" -- 2>&1 > %t
> +// RUN: FileCheck --input-file=%t %s
>

Please pipe the output to FileCheck instead of redirecting it to a
temporary file.


> +
> +// Note: This test verifies that, the checker does not emit any warning
> for
> +//   files that do not compile.
> +
> +bool g();
> +
> +void f() {
> +  if (g());
> +  // CHECK-NOT: :[[@LINE-1]]:11: warning: potentially unintended
> semicolon [misc-suspicious-semicolon]
>

Please make the check line more broad for more tolerance to bugs and
changes to the check. Just match the core of the message or even just the
check name.


> +  int a
> +}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>

r262616 - [OpenCL] Apply missing restrictions for Blocks in OpenCL v2.0

2016-03-03 Thread Anastasia Stulova via cfe-commits
Author: stulova
Date: Thu Mar  3 07:33:19 2016
New Revision: 262616

URL: http://llvm.org/viewvc/llvm-project?rev=262616=rev
Log:
[OpenCL] Apply missing restrictions for Blocks in OpenCL v2.0

Applying the following restrictions for block types in OpenCL (v2.0 s6.12.5):
 - __block storage class is disallowed
 - every block declaration must be const qualified and initialized
 - a block can't be used as a return type of a function
 - a blocks can't be used to declare a structure or union field
 - extern speficier is disallowed

Corrected image and sampler types diagnostics with struct and unions.

Review: http://reviews.llvm.org/D16928


Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/CodeGen/blocks-opencl.cl
cfe/trunk/test/SemaOpenCL/event_t.cl
cfe/trunk/test/SemaOpenCL/invalid-block.cl
cfe/trunk/test/SemaOpenCL/invalid-kernel-parameters.cl
cfe/trunk/test/SemaOpenCL/sampler_t.cl

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=262616=262615=262616=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Mar  3 07:33:19 
2016
@@ -623,8 +623,8 @@ def err_opencl_half_declaration : Error<
   "declaring variable of type %0 is not allowed">;
 def err_opencl_half_param : Error<
   "declaring function parameter of type %0 is not allowed; did you forget * 
?">;
-def err_opencl_half_return : Error<
-  "declaring function return value of type %0 is not allowed; did you forget * 
?">;
+def err_opencl_invalid_return : Error<
+  "declaring function return value of type %0 is not allowed %select{; did you 
forget * ?|}1">;
 def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
 def warn_pragma_options_align_reset_failed : Warning<
   "#pragma options align=reset failed: %0">,
@@ -7701,8 +7701,8 @@ def note_illegal_field_declared_here : N
   "field of illegal %select{type|pointer type}0 %1 declared here">;
 def err_event_t_global_var : Error<
   "the event_t type cannot be used to declare a program scope variable">;
-def err_event_t_struct_field : Error<
-  "the event_t type cannot be used to declare a structure or union field">;
+def err_opencl_type_struct_or_union_field : Error<
+  "the %0 type cannot be used to declare a structure or union field">;
 def err_event_t_addr_space_qual : Error<
   "the event_t type can only be used with __private address space qualifier">;
 def err_expected_kernel_void_return_type : Error<
@@ -7764,6 +7764,14 @@ def err_opencl_multiple_access_qualifier
 def err_opencl_unknown_type_specifier : Error<
   "OpenCL does not support the '%0' %select{type qualifier|storage class 
specifier}1">;
 
+// OpenCL v2.0 s6.12.5 Blocks restrictions
+def err_opencl_block_storage_type : Error<
+  "the __block storage type is not permitted">;
+def err_opencl_invalid_block_declaration : Error<
+  "invalid block variable declaration - must be %select{const 
qualified|initialized}0">;
+def err_opencl_extern_block_declaration : Error<
+  "invalid block variable declaration - using 'extern' storage class is 
disallowed">;
+
 } // end of sema category
 
 let CategoryName = "OpenMP Issue" in {

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=262616=262615=262616=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Mar  3 07:33:19 2016
@@ -6585,7 +6585,7 @@ void Sema::CheckVariableDeclarationType(
 return;
   }
 
-  // OpenCL v1.2 s6.8 -- The static qualifier is valid only in program
+  // OpenCL v1.2 s6.8 - The static qualifier is valid only in program
   // scope.
   if (getLangOpts().OpenCLVersion == 120 &&
   !getOpenCLOptions().cl_clang_storage_class_specifiers &&
@@ -6595,12 +6595,44 @@ void Sema::CheckVariableDeclarationType(
 return;
   }
 
-  // OpenCL v1.2 s6.5 - All program scope variables must be declared in the
-  // __constant address space.
-  // OpenCL v2.0 s6.5.1 - Variables defined at program scope and static
-  // variables inside a function can also be declared in the global
-  // address space.
   if (getLangOpts().OpenCL) {
+// OpenCL v2.0 s6.12.5 - The __block storage type is not supported.
+if (NewVD->hasAttr()) {
+  Diag(NewVD->getLocation(), diag::err_opencl_block_storage_type);
+  return;
+}
+
+if (T->isBlockPointerType()) {
+  // OpenCL v2.0 s6.12.5 - Any block declaration must be const qualified 
and
+  // can't use 'extern' storage class.
+  if (!T.isConstQualified()) {
+Diag(NewVD->getLocation(), 

Re: r261372 - [modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a single

2016-03-03 Thread Richard Smith via cfe-commits
On 3 Mar 2016 3:18 a.m., "Argyrios Kyrtzidis via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:
>
> Mind if we keep -fmodule-implementation-of as an alias so that we can
gradually transition to -fmodule-name ?

Sure, no problem.

> > On Feb 19, 2016, at 2:25 PM, Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:
> >
> > Author: rsmith
> > Date: Fri Feb 19 16:25:36 2016
> > New Revision: 261372
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=261372=rev
> > Log:
> > [modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a
single
> > option. Previously these options could both be used to specify that you
were
> > compiling the implementation file of a module, with a different set of
minor
> > bugs in each case.
> >
> > This change removes -fmodule-implementation-of, and instead tracks a
flag to
> > determine whether we're currently building a module. -fmodule-name now
behaves
> > the same way that -fmodule-implementation-of previously did.
> >
> > Modified:
> >cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> >cfe/trunk/include/clang/Basic/LangOptions.def
> >cfe/trunk/include/clang/Basic/LangOptions.h
> >cfe/trunk/include/clang/Driver/CC1Options.td
> >cfe/trunk/include/clang/Driver/Options.td
> >cfe/trunk/include/clang/Lex/ModuleMap.h
> >cfe/trunk/lib/Basic/LangOptions.cpp
> >cfe/trunk/lib/Driver/Tools.cpp
> >cfe/trunk/lib/Frontend/ASTUnit.cpp
> >cfe/trunk/lib/Frontend/CompilerInstance.cpp
> >cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> >cfe/trunk/lib/Frontend/FrontendActions.cpp
> >cfe/trunk/lib/Lex/ModuleMap.cpp
> >cfe/trunk/lib/Lex/PPDirectives.cpp
> >cfe/trunk/lib/Lex/PPMacroExpansion.cpp
> >cfe/trunk/lib/Lex/Preprocessor.cpp
> >cfe/trunk/lib/Sema/SemaDecl.cpp
> >cfe/trunk/lib/Sema/SemaDeclObjC.cpp
> >cfe/trunk/test/Modules/Inputs/explicit-build/a.h
> >cfe/trunk/test/Modules/explicit-build.cpp
> >cfe/trunk/test/Modules/implementation-of-module.m
> >cfe/trunk/test/Modules/import-self.m
> >
> > Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> > URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=261372=261371=261372=diff
> >
==
> > --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
> > +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Fri Feb 19
16:25:36 2016
> > @@ -210,10 +210,6 @@ def err_test_module_file_extension_versi
> >   "test module file extension '%0' has different version (%1.%2) than
expected "
> >   "(%3.%4)">;
> >
> > -def err_conflicting_module_names : Error<
> > -  "conflicting module names specified: '-fmodule-name=%0' and "
> > -  "'-fmodule-implementation-of %1'">;
> > -
> > def err_missing_vfs_overlay_file : Error<
> >   "virtual filesystem overlay file '%0' not found">, DefaultFatal;
> > def err_invalid_vfs_overlay : Error<
> >
> > Modified: cfe/trunk/include/clang/Basic/LangOptions.def
> > URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=261372=261371=261372=diff
> >
==
> > --- cfe/trunk/include/clang/Basic/LangOptions.def (original)
> > +++ cfe/trunk/include/clang/Basic/LangOptions.def Fri Feb 19 16:25:36
2016
> > @@ -127,6 +127,7 @@ BENIGN_LANGOPT(EmitAllDecls  , 1, 0,
> > LANGOPT(MathErrno , 1, 1, "errno support for math functions")
> > BENIGN_LANGOPT(HeinousExtensions , 1, 0, "Extensions that we really
don't like and may be ripped out at any time")
> > LANGOPT(Modules   , 1, 0, "modules extension to C")
> > +BENIGN_LANGOPT(CompilingModule, 1, 0, "compiling a module interface")
> > COMPATIBLE_LANGOPT(ModulesDeclUse, 1, 0, "require declaration of
module uses")
> > LANGOPT(ModulesSearchAll  , 1, 1, "search even non-imported modules to
find unresolved references")
> > COMPATIBLE_LANGOPT(ModulesStrictDeclUse, 1, 0, "require declaration of
module uses and all headers to be in modules")
> >
> > Modified: cfe/trunk/include/clang/Basic/LangOptions.h
> > URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=261372=261371=261372=diff
> >
==
> > --- cfe/trunk/include/clang/Basic/LangOptions.h (original)
> > +++ cfe/trunk/include/clang/Basic/LangOptions.h Fri Feb 19 16:25:36 2016
> > @@ -92,14 +92,12 @@ public:
> >   /// If none is specified, abort (GCC-compatible behaviour).
> >   std::string OverflowHandler;
> >
> > -  /// \brief The name of the current module.
> > +  /// \brief The name of the current module, of which the main source
file
> > +  /// is a part. If CompilingModule is set, we are compiling the
interface
> > +  /// of this module, otherwise we are compiling an implementation
file of
> > +  /// it.
> >   std::string 

Re: [PATCH] D16139: [MIPS] initFeatureMap() to handle empty string argument

2016-03-03 Thread Daniel Sanders via cfe-commits
dsanders accepted this revision.
dsanders added a comment.

Thanks. LGTM


Repository:
  rL LLVM

http://reviews.llvm.org/D16139



___
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-03-03 Thread Gábor Horváth via cfe-commits
xazax.hun added a comment.

The comments should be addressed in: http://reviews.llvm.org/rL262615


Repository:
  rL LLVM

http://reviews.llvm.org/D16535



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


[clang-tools-extra] r262615 - [clang-tidy] Do not emit warnings from misc-suspicious-semicolon when the compilation fails.

2016-03-03 Thread Gabor Horvath via cfe-commits
Author: xazax
Date: Thu Mar  3 07:08:11 2016
New Revision: 262615

URL: http://llvm.org/viewvc/llvm-project?rev=262615=rev
Log:
[clang-tidy] Do not emit warnings from misc-suspicious-semicolon when the 
compilation fails.

Added:
clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst

Modified: clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp?rev=262615=262614=262615=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/misc/SuspiciousSemicolonCheck.cpp Thu 
Mar  3 07:08:11 2016
@@ -7,8 +7,8 @@
 //
 
//===--===//
 
-#include "../utils/LexerUtils.h"
 #include "SuspiciousSemicolonCheck.h"
+#include "../utils/LexerUtils.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 
@@ -30,6 +30,9 @@ void SuspiciousSemicolonCheck::registerM
 }
 
 void SuspiciousSemicolonCheck::check(const MatchFinder::MatchResult ) {
+  if (Result.Context->getDiagnostics().hasErrorOccurred())
+return;
+
   const auto *Semicolon = Result.Nodes.getNodeAs("semi");
   SourceLocation LocStart = Semicolon->getLocStart();
 

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst?rev=262615=262614=262615=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst 
(original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-suspicious-semicolon.rst 
Thu Mar  3 07:08:11 2016
@@ -11,7 +11,7 @@ intentional.
 
   .. code-block:: c++
 
-if(x < y);
+if (x < y);
 {
   x++;
 }
@@ -22,7 +22,7 @@ the first line, and `x` will be incremen
 
   .. code-block:: c++
 
-while((line = readLine(file)) != NULL);
+while ((line = readLine(file)) != NULL);
   processLine(line);
 
 As a result of this code, `processLine()` will only be called once, when the
@@ -32,7 +32,7 @@ the code indicates the intention of the
 
   .. code-block:: c++
 
-if(x >= y);
+if (x >= y);
 x -= y;
 
 While the indentation does not imply any nesting, there is simply no valid
@@ -45,7 +45,7 @@ line. For example:
 
   .. code-block:: c++
 
-while(readWhitespace());
+while (readWhitespace());
   Token t = readNextToken();
 
 Here the second line is indented in a way that suggests that it is meant to be
@@ -56,14 +56,14 @@ Either remove the indentation from the s
 
   .. code-block:: c++
 
-while(readWhitespace());
+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())
+while (readWhitespace())
   ;
 
   Token t = readNextToken();

Added: 
clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp?rev=262615=auto
==
--- clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp 
(added)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-suspicious-semicolon-fail.cpp 
Thu Mar  3 07:08:11 2016
@@ -0,0 +1,13 @@
+// RUN: clang-tidy %s -checks="-*,misc-suspicious-semicolon" -- 2>&1 > %t
+// RUN: FileCheck --input-file=%t %s
+
+// Note: This test verifies that, the checker does not emit any warning for
+//   files that do not compile.
+
+bool g();
+
+void f() {
+  if (g());
+  // CHECK-NOT: :[[@LINE-1]]:11: warning: potentially unintended semicolon 
[misc-suspicious-semicolon]
+  int a
+}


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


Re: [PATCH] D17446: ASTMatchers: add new statement/decl matchers

2016-03-03 Thread Aleksei Sidorin via cfe-commits
a.sidorin updated this revision to Diff 49727.
a.sidorin marked 15 inline comments as done.
a.sidorin added a comment.

Add more comments; resolve issues pointed on review.


http://reviews.llvm.org/D17446

Files:
  docs/LibASTMatchersReference.html
  include/clang/ASTMatchers/ASTMatchers.h
  include/clang/ASTMatchers/ASTMatchersInternal.h
  lib/ASTMatchers/Dynamic/Registry.cpp
  unittests/AST/MatchVerifier.h
  unittests/ASTMatchers/ASTMatchersTest.cpp
  unittests/ASTMatchers/ASTMatchersTest.h

Index: unittests/ASTMatchers/ASTMatchersTest.h
===
--- unittests/ASTMatchers/ASTMatchersTest.h
+++ unittests/ASTMatchers/ASTMatchersTest.h
@@ -126,6 +126,13 @@
 }
 
 template 
+testing::AssertionResult matchesC99(const std::string ,
+const T ) {
+  return matchesConditionally(Code, AMatcher, true, "-std=c99",
+  FileContentMappings(), "input.c");
+}
+
+template 
 testing::AssertionResult notMatchesC(const std::string ,
  const T ) {
   return matchesConditionally(Code, AMatcher, false, "", FileContentMappings(),
Index: unittests/ASTMatchers/ASTMatchersTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -1209,7 +1209,12 @@
   EXPECT_TRUE(matches("void f() { while(true) { continue; } }",
   continueStmt()));
   EXPECT_TRUE(matches("void f() { goto FOO; FOO: ;}", gotoStmt()));
-  EXPECT_TRUE(matches("void f() { goto FOO; FOO: ;}", labelStmt()));
+  EXPECT_TRUE(matches("void f() { goto FOO; FOO: ;}",
+  labelStmt(
+hasDeclaration(
+  labelDecl(hasName("FOO"));
+  EXPECT_TRUE(matches("void f() { FOO: ; void *ptr = & goto *ptr; }",
+  addrLabelExpr()));
   EXPECT_TRUE(matches("void f() { return; }", returnStmt()));
 }
 
@@ -2522,6 +2527,82 @@
   EXPECT_TRUE(matches("int* i = __null;", gnuNullExpr()));
 }
 
+TEST(Matcher, AtomicExpr) {
+  EXPECT_TRUE(matches("void foo() { int *ptr; __atomic_load_n(ptr, 1); }",
+  atomicExpr()));
+}
+
+TEST(Matcher, Initializers) {
+  const char *ToMatch = "void foo() { struct point { double x; double y; };"
+"  struct point ptarray[10] = "
+"  { [2].y = 1.0, [2].x = 2.0, [0].x = 1.0 }; }";
+  EXPECT_TRUE(matchesConditionally(
+ToMatch,
+initListExpr(
+  has(
+cxxConstructExpr(
+  requiresZeroInitialization())),
+  has(
+initListExpr(
+  hasType(asString("struct point")),
+  has(floatLiteral(equals(1.0))),
+  has(implicitValueInitExpr(
+hasType(asString("double")),
+  has(
+initListExpr(
+  hasType(asString("struct point")),
+  has(floatLiteral(equals(2.0))),
+  has(floatLiteral(equals(1.0)
+), true, "-std=gnu++98"));
+
+  EXPECT_TRUE(matchesC99(ToMatch,
+ initListExpr(
+   hasSyntacticForm(
+ initListExpr(
+   has(
+ designatedInitExpr(
+   designatorCountIs(2),
+   has(floatLiteral(
+ equals(1.0))),
+   has(integerLiteral(
+ equals(2),
+   has(
+ designatedInitExpr(
+   designatorCountIs(2),
+   has(floatLiteral(
+ equals(2.0))),
+   has(integerLiteral(
+ equals(2),
+   has(
+ designatedInitExpr(
+   designatorCountIs(2),
+   has(floatLiteral(
+ equals(1.0))),
+   has(integerLiteral(
+ equals(0)
+   );
+}
+
+TEST(Matcher, ParenListExpr) {
+  EXPECT_TRUE(
+matches(
+  "  template class foo { void bar() { foo X(*this); } }; ",
+  varDecl(hasInitializer(parenListExpr(has(unaryOperator()));
+}
+
+TEST(Matcher, StmtExpr) {
+  EXPECT_TRUE(matches("void declToImport() { int C = ({int X=4; X;}); }",
+  varDecl(hasInitializer(stmtExpr();
+}
+

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

2016-03-03 Thread Richard Barton via cfe-commits
richard.barton.arm added a subscriber: richard.barton.arm.
richard.barton.arm added a comment.

Hi Bradley

This matches the GCC targeting options:
https://sourceware.org/ml/binutils/2015-12/msg00295.html
https://sourceware.org/ml/binutils/2015-12/msg00296.html

The code changes LGTM. I think as this patch has been available since late 
January enough time has passed for others to comment. So you should commit.


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


r262611 - Fixing a checkfile error in avx512vlbw-builtins.c

2016-03-03 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Thu Mar  3 06:17:50 2016
New Revision: 262611

URL: http://llvm.org/viewvc/llvm-project?rev=262611=rev
Log:
Fixing a checkfile error in avx512vlbw-builtins.c

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


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

Modified: cfe/trunk/test/CodeGen/avx512vlbw-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512vlbw-builtins.c?rev=262611=262610=262611=diff
==
--- cfe/trunk/test/CodeGen/avx512vlbw-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512vlbw-builtins.c Thu Mar  3 06:17:50 2016
@@ -1959,49 +1959,49 @@ __m256i test_mm256_maskz_slli_epi16(__mm
 
 __m128i test_mm_mask_mov_epi16(__m128i __W, __mmask8 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_mask_mov_epi16
-  // CHECK: @llvm.x86.avx512.mask.mov.128
+  // CHECK: @llvm.x86.avx512.mask.movu.w.128
   return _mm_mask_mov_epi16(__W, __U, __A); 
 }
 
 __m128i test_mm_maskz_mov_epi16(__mmask8 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_maskz_mov_epi16
-  // CHECK: @llvm.x86.avx512.mask.mov.128
+  // CHECK: @llvm.x86.avx512.mask.movu.w.128
   return _mm_maskz_mov_epi16(__U, __A); 
 }
 
 __m256i test_mm256_mask_mov_epi16(__m256i __W, __mmask16 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_mask_mov_epi16
-  // CHECK: @llvm.x86.avx512.mask.mov.256
+  // CHECK: @llvm.x86.avx512.mask.movu.w.256
   return _mm256_mask_mov_epi16(__W, __U, __A); 
 }
 
 __m256i test_mm256_maskz_mov_epi16(__mmask16 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_maskz_mov_epi16
-  // CHECK: @llvm.x86.avx512.mask.mov.256
+  // CHECK: @llvm.x86.avx512.mask.movu.w.256
   return _mm256_maskz_mov_epi16(__U, __A); 
 }
 
 __m128i test_mm_mask_mov_epi8(__m128i __W, __mmask16 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_mask_mov_epi8
-  // CHECK: @llvm.x86.avx512.mask.mov.128
+  // CHECK: @llvm.x86.avx512.mask.movu.b.128
   return _mm_mask_mov_epi8(__W, __U, __A); 
 }
 
 __m128i test_mm_maskz_mov_epi8(__mmask16 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_maskz_mov_epi8
-  // CHECK: @llvm.x86.avx512.mask.mov.128
+  // CHECK: @llvm.x86.avx512.mask.movu.b.128
   return _mm_maskz_mov_epi8(__U, __A); 
 }
 
 __m256i test_mm256_mask_mov_epi8(__m256i __W, __mmask32 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_mask_mov_epi8
-  // CHECK: @llvm.x86.avx512.mask.mov.256
+  // CHECK: @llvm.x86.avx512.mask.movu.b.256
   return _mm256_mask_mov_epi8(__W, __U, __A); 
 }
 
 __m256i test_mm256_maskz_mov_epi8(__mmask32 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_maskz_mov_epi8
-  // CHECK: @llvm.x86.avx512.mask.mov.256
+  // CHECK: @llvm.x86.avx512.mask.movu.b.256
   return _mm256_maskz_mov_epi8(__U, __A); 
 }
 


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


[libcxx] r262610 - Fix for PR26812: possible overflow issue in std::allocator::allocate

2016-03-03 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Thu Mar  3 06:04:39 2016
New Revision: 262610

URL: http://llvm.org/viewvc/llvm-project?rev=262610=rev
Log:
Fix for PR26812: possible overflow issue in std::allocator::allocate

Added:

libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
Modified:
libcxx/trunk/include/memory

Modified: libcxx/trunk/include/memory
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=262610=262609=262610=diff
==
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Thu Mar  3 06:04:39 2016
@@ -1726,7 +1726,15 @@ public:
 _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const 
_NOEXCEPT
 {return _VSTD::addressof(__x);}
 _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, 
allocator::const_pointer = 0)
-{return static_cast(_VSTD::__allocate(__n * sizeof(_Tp)));}
+{
+if (__n > max_size())
+#ifndef _LIBCPP_NO_EXCEPTIONS
+throw bad_alloc();
+#else
+assert(!"allocator::allocate::bad_alloc");
+#endif
+return static_cast(_VSTD::__allocate(__n * sizeof(_Tp)));
+}
 _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT
 {_VSTD::__deallocate((void*)__p);}
 _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
@@ -1817,7 +1825,15 @@ public:
 _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const 
_NOEXCEPT
 {return _VSTD::addressof(__x);}
 _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, 
allocator::const_pointer = 0)
-{return static_cast(_VSTD::__allocate(__n * sizeof(_Tp)));}
+{
+if (__n > max_size())
+#ifndef _LIBCPP_NO_EXCEPTIONS
+throw bad_alloc();
+#else
+assert(!"allocator::allocate::bad_alloc");
+#endif
+return static_cast(_VSTD::__allocate(__n * sizeof(_Tp)));
+}
 _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT
 {_VSTD::__deallocate((void*)__p);}
 _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT

Added: 
libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp?rev=262610=auto
==
--- 
libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
 (added)
+++ 
libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
 Thu Mar  3 06:04:39 2016
@@ -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.
+//
+//===--===//
+
+// 
+
+// allocator:
+// pointer allocate(size_type n, allocator::const_pointer hint=0);
+
+#include 
+#include 
+
+template 
+void test_max(size_t count)
+{
+std::allocator a;
+try { a.allocate( count ); }
+catch ( const std::bad_alloc &) { return ; }
+assert (false);
+}
+
+int main()
+{
+{  // Bug 26812 -- allocating too large
+typedef double T;
+std::allocator a;
+test_max (a.max_size() + 1);// just barely too large
+test_max (a.max_size() * 2);// significantly too 
large
+test_max (((size_t) -1) / sizeof(T) + 1);   // multiply will 
overflow
+test_max ((size_t) -1); // way too large
+}
+
+{
+typedef const double T;
+std::allocator a;
+test_max (a.max_size() + 1);// just barely too large
+test_max (a.max_size() * 2);// significantly too 
large
+test_max (((size_t) -1) / sizeof(T) + 1);   // multiply will 
overflow
+test_max ((size_t) -1); // way too large
+}
+}


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


r262609 - [CLANG][AVX512][BUILTIN] movdqu{qi|hi} {128|256|512}

2016-03-03 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Thu Mar  3 05:34:52 2016
New Revision: 262609

URL: http://llvm.org/viewvc/llvm-project?rev=262609=rev
Log:
[CLANG][AVX512][BUILTIN] movdqu{qi|hi} {128|256|512}

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



Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512bwintrin.h
cfe/trunk/lib/Headers/avx512vlbwintrin.h
cfe/trunk/test/CodeGen/avx512bw-builtins.c
cfe/trunk/test/CodeGen/avx512vlbw-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=262609=262608=262609=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Thu Mar  3 05:34:52 2016
@@ -1710,6 +1710,12 @@ TARGET_BUILTIN(__builtin_ia32_movdqa64lo
 TARGET_BUILTIN(__builtin_ia32_movdqa64load256_mask, 
"V4LLivC*V4LLiUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_movdqa64store128_mask, 
"vV2LLi*V2LLiUc","","avx512f")
 TARGET_BUILTIN(__builtin_ia32_movdqa64store256_mask, 
"vV4LLi*V4LLiUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movdquhi512_mask, "V32sV32sV32sUi","","avx512bw")
+TARGET_BUILTIN(__builtin_ia32_movdquqi512_mask, 
"V64cV64cV64cULLi","","avx512bw")
+TARGET_BUILTIN(__builtin_ia32_movdquhi128_mask, 
"V8sV8sV8sUc","","avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_movdquhi256_mask, 
"V16sV16sV16sUs","","avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_movdquqi128_mask, 
"V16cV16cV16cUs","","avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_movdquqi256_mask, 
"V32cV32cV32cUi","","avx512bw,avx512vl")
 
 #undef BUILTIN
 #undef TARGET_BUILTIN

Modified: cfe/trunk/lib/Headers/avx512bwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=262609=262608=262609=diff
==
--- cfe/trunk/lib/Headers/avx512bwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512bwintrin.h Thu Mar  3 05:34:52 2016
@@ -1880,6 +1880,43 @@ __builtin_ia32_psrlwi512_mask ((__v32hi)
   (__mmask32)( __U));\
 })
 
+
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_mov_epi16 (__m512i __W, __mmask32 __U, __m512i __A)
+{
+  return (__m512i) __builtin_ia32_movdquhi512_mask ((__v32hi) __A,
+(__v32hi) __W,
+(__mmask32) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_mov_epi16 (__mmask32 __U, __m512i __A)
+{
+  return (__m512i) __builtin_ia32_movdquhi512_mask ((__v32hi) __A,
+(__v32hi)
+_mm512_setzero_hi (),
+(__mmask32) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_mov_epi8 (__m512i __W, __mmask64 __U, __m512i __A)
+{
+  return (__m512i) __builtin_ia32_movdquqi512_mask ((__v64qi) __A,
+(__v64qi) __W,
+(__mmask64) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_mov_epi8 (__mmask64 __U, __m512i __A)
+{
+  return (__m512i) __builtin_ia32_movdquqi512_mask ((__v64qi) __A,
+(__v64qi)
+_mm512_setzero_hi (),
+(__mmask64) __U);
+}
+
+
 #undef __DEFAULT_FN_ATTRS
 
 #endif

Modified: cfe/trunk/lib/Headers/avx512vlbwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlbwintrin.h?rev=262609=262608=262609=diff
==
--- cfe/trunk/lib/Headers/avx512vlbwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlbwintrin.h Thu Mar  3 05:34:52 2016
@@ -2848,6 +2848,77 @@ __builtin_ia32_psrlwi256_mask ((__v16hi)
 })
 
 
+
+
+static __inline__ __m128i __DEFAULT_FN_ATTRS
+_mm_mask_mov_epi16 (__m128i __W, __mmask8 __U, __m128i __A)
+{
+  return (__m128i) __builtin_ia32_movdquhi128_mask ((__v8hi) __A,
+(__v8hi) __W,
+(__mmask8) __U);
+}
+
+static __inline__ __m128i __DEFAULT_FN_ATTRS
+_mm_maskz_mov_epi16 (__mmask8 __U, __m128i __A)
+{
+  return (__m128i) __builtin_ia32_movdquhi128_mask ((__v8hi) __A,
+(__v8hi)
+_mm_setzero_hi (),
+(__mmask8) __U);
+}
+
+static __inline__ __m256i __DEFAULT_FN_ATTRS
+_mm256_mask_mov_epi16 (__m256i __W, __mmask16 __U, __m256i __A)
+{
+  return (__m256i) __builtin_ia32_movdquhi256_mask ((__v16hi) __A,
+(__v16hi) __W,
+(__mmask16) __U);
+}
+
+static __inline__ __m256i __DEFAULT_FN_ATTRS
+_mm256_maskz_mov_epi16 (__mmask16 __U, __m256i __A)
+{
+  return (__m256i) __builtin_ia32_movdquhi256_mask ((__v16hi) __A,
+(__v16hi)
+_mm256_setzero_si256 (),
+(__mmask16) __U);
+}
+
+static __inline__ __m128i __DEFAULT_FN_ATTRS
+_mm_mask_mov_epi8 (__m128i __W, __mmask16 __U, __m128i __A)
+{
+  return (__m128i) __builtin_ia32_movdquqi128_mask 

Re: [PATCH] D15267: For MS ABI, emit dllexport friend functions defined inline in class

2016-03-03 Thread Stephan Bergmann via cfe-commits
sberg added a comment.

Can you please push this, I do not have commit access. Thanks


http://reviews.llvm.org/D15267



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


Re: [PATCH] D16628: clang-cl: support __cdecl-on-struct anachronism

2016-03-03 Thread Stephan Bergmann via cfe-commits
sberg added a comment.

Can you please push this, I do not have commit access.  Thanks


http://reviews.llvm.org/D16628



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


Re: [PATCH] D17762: Fix an assertion failure in setPointOfInstantiation.

2016-03-03 Thread Benjamin Kramer via cfe-commits
bkramer added a comment.

This doesn't look right to me. Aborting tree transform on a bad source location 
seems just wrong. Where is the invalid source location coming from? Also the 
backtrace seems related to typo correction, maybe the bug is there?


Repository:
  rL LLVM

http://reviews.llvm.org/D17762



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


r262606 - Tweak CMakeLists not for libclang to depend on the variable CLANG_TOOL_EXTRA_BUILD.

2016-03-03 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Thu Mar  3 05:09:43 2016
New Revision: 262606

URL: http://llvm.org/viewvc/llvm-project?rev=262606=rev
Log:
Tweak CMakeLists not for libclang to depend on the variable 
CLANG_TOOL_EXTRA_BUILD.

Modified:
cfe/trunk/tools/CMakeLists.txt
cfe/trunk/tools/libclang/CMakeLists.txt

Modified: cfe/trunk/tools/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CMakeLists.txt?rev=262606=262605=262606=diff
==
--- cfe/trunk/tools/CMakeLists.txt (original)
+++ cfe/trunk/tools/CMakeLists.txt Thu Mar  3 05:09:43 2016
@@ -7,7 +7,6 @@ add_clang_subdirectory(clang-format-vs)
 add_clang_subdirectory(clang-fuzzer)
 
 add_clang_subdirectory(c-index-test)
-add_clang_subdirectory(libclang)
 
 if(CLANG_ENABLE_ARCMT)
   add_clang_subdirectory(arcmt-test)
@@ -26,3 +25,6 @@ endif()
 # to keep the primary Clang repository small and focused.
 # It also may be included by LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR.
 add_llvm_external_project(clang-tools-extra extra)
+
+# libclang may require clang-tidy in clang-tools-extra.
+add_clang_subdirectory(libclang)

Modified: cfe/trunk/tools/libclang/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CMakeLists.txt?rev=262606=262605=262606=diff
==
--- cfe/trunk/tools/libclang/CMakeLists.txt (original)
+++ cfe/trunk/tools/libclang/CMakeLists.txt Thu Mar  3 05:09:43 2016
@@ -47,7 +47,7 @@ if (CLANG_ENABLE_ARCMT)
   list(APPEND LIBS clangARCMigrate)
 endif ()
 
-if (CLANG_TOOL_EXTRA_BUILD)
+if (TARGET clangTidyPlugin)
   add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
   list(APPEND LIBS clangTidyPlugin)
 endif ()


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


[clang-tools-extra] r262605 - [docs] Fix docs to work with doxygen 1.8.11

2016-03-03 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Thu Mar  3 04:45:59 2016
New Revision: 262605

URL: http://llvm.org/viewvc/llvm-project?rev=262605=rev
Log:
[docs] Fix docs to work with doxygen 1.8.11

Added:
clang-tools-extra/trunk/docs/doxygen-mainpage.dox
Removed:
clang-tools-extra/trunk/docs/doxygen.intro
Modified:
clang-tools-extra/trunk/docs/doxygen.cfg.in

Added: clang-tools-extra/trunk/docs/doxygen-mainpage.dox
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/doxygen-mainpage.dox?rev=262605=auto
==
--- clang-tools-extra/trunk/docs/doxygen-mainpage.dox (added)
+++ clang-tools-extra/trunk/docs/doxygen-mainpage.dox Thu Mar  3 04:45:59 2016
@@ -0,0 +1,9 @@
+/// \mainpage clang-tools
+///
+/// \section main_intro Introduction
+/// Welcome to clang tools.
+///
+/// This documentation describes the **internal** software that makes
+/// up clang tools, not the **external** use of clang tools. For
+/// usage instructions, please see the programmer's guide or reference
+/// manual.

Modified: clang-tools-extra/trunk/docs/doxygen.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/doxygen.cfg.in?rev=262605=262604=262605=diff
==
--- clang-tools-extra/trunk/docs/doxygen.cfg.in (original)
+++ clang-tools-extra/trunk/docs/doxygen.cfg.in Thu Mar  3 04:45:59 2016
@@ -751,7 +751,7 @@ INPUT  = \
  @abs_srcdir@/../modularize \
  @abs_srcdir@/../pp-trace \
  @abs_srcdir@/../tool-template \
- @abs_srcdir@/doxygen.intro
+ @abs_srcdir@/doxygen-mainpage.dox
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -1797,18 +1797,6 @@ GENERATE_XML   = NO
 
 XML_OUTPUT = xml
 
-# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by 
a
-# validating XML parser to check the syntax of the XML files.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
-# validating XML parser to check the syntax of the XML files.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_DTD=
-
 # If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
 # listings (including syntax highlighting and cross-referencing information) to
 # the XML output. Note that enabling this will significantly increase the size

Removed: clang-tools-extra/trunk/docs/doxygen.intro
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/doxygen.intro?rev=262604=auto
==
--- clang-tools-extra/trunk/docs/doxygen.intro (original)
+++ clang-tools-extra/trunk/docs/doxygen.intro (removed)
@@ -1,9 +0,0 @@
-/// @mainpage clang-tools
-///
-/// @section main_intro Introduction
-/// Welcome to clang tools.
-///
-/// This documentation describes the @b internal software that makes
-/// up clang tools, not the @b external use of clang tools. For
-/// usage instructions, please see the programmer's guide or reference
-/// manual.


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


r262604 - [docs] Add missing file

2016-03-03 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Thu Mar  3 04:44:10 2016
New Revision: 262604

URL: http://llvm.org/viewvc/llvm-project?rev=262604=rev
Log:
[docs] Add missing file

Added:
cfe/trunk/docs/doxygen-mainpage.dox

Added: cfe/trunk/docs/doxygen-mainpage.dox
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/doxygen-mainpage.dox?rev=262604=auto
==
--- cfe/trunk/docs/doxygen-mainpage.dox (added)
+++ cfe/trunk/docs/doxygen-mainpage.dox Thu Mar  3 04:44:10 2016
@@ -0,0 +1,15 @@
+/// \mainpage clang
+///
+/// \section main_intro Introduction
+/// Welcome to the clang project.
+///
+/// This documentation describes the **internal** software that makes
+/// up clang, not the **external** use of clang. There are no instructions
+/// here on how to use clang, only the APIs that make up the software. For
+/// usage instructions, please see the programmer's guide or reference
+/// manual.
+///
+/// \section main_caveat Caveat
+/// This documentation is generated directly from the source code with doxygen.
+/// Since clang is constantly under active development, what you're about to
+/// read is out of date!


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


Re: [PATCH] D17762: Fix an assertion failure in setPointOfInstantiation.

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

friendly ping.


Repository:
  rL LLVM

http://reviews.llvm.org/D17762



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


r262603 - [docs] Updated doxygen files to work well with doxygen 1.8.11

2016-03-03 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Thu Mar  3 04:42:46 2016
New Revision: 262603

URL: http://llvm.org/viewvc/llvm-project?rev=262603=rev
Log:
[docs] Updated doxygen files to work well with doxygen 1.8.11

Doxygen 1.8.11 doesn't seem to like files with ".intro" extension by default.

Removed:
cfe/trunk/docs/doxygen.intro
Modified:
cfe/trunk/docs/doxygen.cfg.in

Modified: cfe/trunk/docs/doxygen.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/doxygen.cfg.in?rev=262603=262602=262603=diff
==
--- cfe/trunk/docs/doxygen.cfg.in (original)
+++ cfe/trunk/docs/doxygen.cfg.in Thu Mar  3 04:42:46 2016
@@ -745,7 +745,7 @@ WARN_LOGFILE   =
 
 INPUT  = @abs_srcdir@/../include \
  @abs_srcdir@/../lib \
- @abs_srcdir@/doxygen.intro
+ @abs_srcdir@/doxygen-mainpage.dox
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -1791,18 +1791,6 @@ GENERATE_XML   = NO
 
 XML_OUTPUT = xml
 
-# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by 
a
-# validating XML parser to check the syntax of the XML files.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
-# validating XML parser to check the syntax of the XML files.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_DTD=
-
 # If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
 # listings (including syntax highlighting and cross-referencing information) to
 # the XML output. Note that enabling this will significantly increase the size

Removed: cfe/trunk/docs/doxygen.intro
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/doxygen.intro?rev=262602=auto
==
--- cfe/trunk/docs/doxygen.intro (original)
+++ cfe/trunk/docs/doxygen.intro (removed)
@@ -1,15 +0,0 @@
-/// @mainpage clang
-///
-/// @section main_intro Introduction
-/// Welcome to the clang project.
-///
-/// This documentation describes the @b internal software that makes 
-/// up clang, not the @b external use of clang. There are no instructions
-/// here on how to use clang, only the APIs that make up the software. For 
-/// usage instructions, please see the programmer's guide or reference 
-/// manual.
-///
-/// @section main_caveat Caveat 
-/// This documentation is generated directly from the source code with 
doxygen. 
-/// Since clang is constantly under active development, what you're about to
-/// read is out of date!


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


Re: [PATCH] D17845: [ASTImporter] Import "implicit" attribute of FunctionDecls

2016-03-03 Thread Pavel Labath via cfe-commits
labath added a subscriber: lldb-commits.
labath added a comment.

I noticed this while debugging an importing issue in LLDB.

I am not sure if I have selected the right reviewer, and also how/if to test 
this...


http://reviews.llvm.org/D17845



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


[PATCH] D17845: [ASTImporter] Import "implicit" attribute of FunctionDecls

2016-03-03 Thread Pavel Labath via cfe-commits
labath created this revision.
labath added a reviewer: akyrtzi.
labath added a subscriber: cfe-commits.

ASTImporter was importing this attribute only on destructor and constructor 
decls, as they take
it in the constructor, but other decls can have this attribute as well, notably 
the global
operator new. Make sure we import the attribute on all FunctionDecls.

http://reviews.llvm.org/D17845

Files:
  lib/AST/ASTImporter.cpp

Index: lib/AST/ASTImporter.cpp
===
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -2922,6 +2922,7 @@
   ToFunction->setVirtualAsWritten(D->isVirtualAsWritten());
   ToFunction->setTrivial(D->isTrivial());
   ToFunction->setPure(D->isPure());
+  ToFunction->setImplicit(D->isImplicit());
   Importer.Imported(D, ToFunction);
 
   // Set the parameters.


Index: lib/AST/ASTImporter.cpp
===
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -2922,6 +2922,7 @@
   ToFunction->setVirtualAsWritten(D->isVirtualAsWritten());
   ToFunction->setTrivial(D->isTrivial());
   ToFunction->setPure(D->isPure());
+  ToFunction->setImplicit(D->isImplicit());
   Importer.Imported(D, ToFunction);
 
   // Set the parameters.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r262598 - [CLANG][AVX512][BUILTIN] movdqa{32|64}{load|store|}{128|256|512}

2016-03-03 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Thu Mar  3 03:26:01 2016
New Revision: 262598

URL: http://llvm.org/viewvc/llvm-project?rev=262598=rev
Log:
[CLANG][AVX512][BUILTIN] movdqa{32|64}{load|store|}{128|256|512}

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


Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/lib/Headers/avx512vlintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c
cfe/trunk/test/CodeGen/avx512vl-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=262598=262597=262598=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Thu Mar  3 03:26:01 2016
@@ -1697,6 +1697,19 @@ TARGET_BUILTIN(__builtin_ia32_psrlw128_m
 TARGET_BUILTIN(__builtin_ia32_psrlw256_mask, 
"V16sV16sV8sV16sUs","","avx512bw,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_psrlwi128_mask, 
"V8sV8sIiV8sUc","","avx512bw,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_psrlwi256_mask, 
"V16sV16sIiV16sUs","","avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_movdqa32load512_mask, 
"V16ivC*V16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movdqa32store512_mask, 
"vV16i*V16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movdqa64_512_mask, 
"V8LLiV8LLiV8LLiUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movdqa64load512_mask, 
"V8LLivC*V8LLiUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movdqa64store512_mask, 
"vV8LLi*V8LLiUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movdqa32store128_mask, "vV4i*V4iUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movdqa32store256_mask, "vV8i*V8iUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movdqa64_128_mask, 
"V2LLiV2LLiV2LLiUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_movdqa64_256_mask, 
"V4LLiV4LLiV4LLiUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_movdqa64load128_mask, 
"V2LLivC*V2LLiUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_movdqa64load256_mask, 
"V4LLivC*V4LLiUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_movdqa64store128_mask, 
"vV2LLi*V2LLiUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_movdqa64store256_mask, 
"vV4LLi*V4LLiUc","","avx512f")
 
 #undef BUILTIN
 #undef TARGET_BUILTIN

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=262598=262597=262598=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Thu Mar  3 03:26:01 2016
@@ -3602,6 +3602,72 @@ __builtin_ia32_psrlqi512_mask ((__v8di)(
   (__mmask8)( __U));\
 })
 
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_load_epi32 (__m512i __W, __mmask16 __U, void const *__P)
+{
+  return (__m512i) __builtin_ia32_movdqa32load512_mask ((const __v16si *) __P,
+  (__v16si) __W,
+  (__mmask16) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_load_epi32 (__mmask16 __U, void const *__P)
+{
+  return (__m512i) __builtin_ia32_movdqa32load512_mask ((const __v16si *) __P,
+  (__v16si)
+  _mm512_setzero_si512 (),
+  (__mmask16) __U);
+}
+
+static __inline__ void __DEFAULT_FN_ATTRS
+_mm512_mask_store_epi32 (void *__P, __mmask16 __U, __m512i __A)
+{
+  __builtin_ia32_movdqa32store512_mask ((__v16si *) __P, (__v16si) __A,
+  (__mmask16) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_mov_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
+{
+  return (__m512i) __builtin_ia32_movdqa64_512_mask ((__v8di) __A,
+ (__v8di) __W,
+ (__mmask8) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_mov_epi64 (__mmask8 __U, __m512i __A)
+{
+  return (__m512i) __builtin_ia32_movdqa64_512_mask ((__v8di) __A,
+ (__v8di)
+ _mm512_setzero_si512 (),
+ (__mmask8) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_load_epi64 (__m512i __W, __mmask8 __U, void const *__P)
+{
+  return (__m512i) __builtin_ia32_movdqa64load512_mask ((const __v8di *) __P,
+  (__v8di) __W,
+  (__mmask8) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_load_epi64 (__mmask8 __U, void const *__P)
+{
+  return (__m512i) __builtin_ia32_movdqa64load512_mask ((const __v8di *) __P,
+  (__v8di)
+  _mm512_setzero_si512 (),
+  (__mmask8) __U);
+}
+
+static __inline__ void __DEFAULT_FN_ATTRS
+_mm512_mask_store_epi64 (void *__P, __mmask8 __U, __m512i __A)
+{
+  __builtin_ia32_movdqa64store512_mask ((__v8di *) __P, (__v8di) __A,
+  (__mmask8) __U);
+}
+
+
 #undef __DEFAULT_FN_ATTRS
 
 #endif // __AVX512FINTRIN_H

Modified: 

Re: [PATCH] D17816: [PPC] FE support for generating VSX [negated] absolute value instructions

2016-03-03 Thread Nemanja Ivanovic via cfe-commits
nemanjai added inline comments.


Comment at: lib/Headers/altivec.h:136
@@ -131,3 +135,3 @@
 
 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
 static vector double __ATTRS_o_ai vec_abs(vector double __a) {

I thought we were going to change the guard here to __VSX__ rather than 
__POWER8_VECTOR.


Comment at: test/CodeGen/builtins-ppc-altivec.c:3
@@ +2,3 @@
+// RUN: %clang_cc1 -faltivec -triple powerpc-unknown-unknown -emit-llvm %s \
+// RUN: -o - | FileCheck %s
+// RUN: %clang_cc1 -faltivec -triple powerpc64-unknown-unknown -emit-llvm %s \

Just a minor nit. Please indent the continuation lines for readability.


Comment at: test/CodeGen/builtins-ppc-altivec.c:8
@@ +7,3 @@
+// RUN:  -o - | FileCheck %s -check-prefix=CHECK-LE
+// RUN: not %clang_cc1 -triple powerpc64le-unknown-unknown -emit-llvm %s \
+// RUN: -o - 2>&1 | FileCheck %s -check-prefix=CHECK-NOALTIVEC

I would have thought that we already have a diagnostic test case for the 
missing -faltivec, but if we don't, thanks for adding it.


Comment at: test/CodeGen/builtins-ppc-altivec.c:84
@@ +83,3 @@
+// CHECK-LE: store <4 x float> %{{.*}}, <4 x float>* @vf
+// CHECK-NOALTIVEC: error: use of undeclared identifier 'vf'
+// CHECK-NOALTIVEC: vf = vec_abs(vf) 

I am not recommending you change anything here, just want to point out that 
there's a potential concern with adding diagnostic test cases in with 
functional ones (and yes, I know we have lots of this already). Namely, the 
concern is that the diagnostic may go away as we add more code to the test case 
and the particular error you're looking for goes past the error threshold (I 
think the default is 20 errors).


Comment at: test/CodeGen/builtins-ppc-p8vector.c:76
@@ -75,5 +75,3 @@
   res_vd = vec_abs(vda);
-// CHECK: store <2 x i64> , 
<2 x i64>*
-// CHECK: and <2 x i64>
-// CHECK-LE: store <2 x i64> , <2 x i64>*
-// CHECK-LE: and <2 x i64>
+// CHECK: call <2 x double> @llvm.fabs.v2f64(<2 x double> %{{[0-9]*}})
+// CHECK: store <2 x double> %{{.*}}, <2 x double>* @res_vd

I think that without asserts, clang sometimes gives temporary variables names 
rather than numbers. I'd recommend getting rid of the regex for the argument to 
@llvm.fabs.* so that you don't get into a weird situation where some build bot 
somewhere fails due to this change.


http://reviews.llvm.org/D17816



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


Re: [PATCH] D17808: [libclang] Link clang-tidy plugin into libclang if present.

2016-03-03 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL262596: [libclang] Link clang-tidy plugin into libclang if 
present. (authored by d0k).

Changed prior to commit:
  http://reviews.llvm.org/D17808?vs=49616=49719#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17808

Files:
  cfe/trunk/tools/libclang/CIndex.cpp
  cfe/trunk/tools/libclang/CMakeLists.txt

Index: cfe/trunk/tools/libclang/CMakeLists.txt
===
--- cfe/trunk/tools/libclang/CMakeLists.txt
+++ cfe/trunk/tools/libclang/CMakeLists.txt
@@ -47,6 +47,11 @@
   list(APPEND LIBS clangARCMigrate)
 endif ()
 
+if (CLANG_TOOL_EXTRA_BUILD)
+  add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
+  list(APPEND LIBS clangTidyPlugin)
+endif ()
+
 find_library(DL_LIBRARY_PATH dl)
 if (DL_LIBRARY_PATH)
   list(APPEND LIBS dl)
Index: cfe/trunk/tools/libclang/CIndex.cpp
===
--- cfe/trunk/tools/libclang/CIndex.cpp
+++ cfe/trunk/tools/libclang/CIndex.cpp
@@ -7933,3 +7933,10 @@
 OS << "--\n";
   }
 }
+
+#ifdef CLANG_TOOL_EXTRA_BUILD
+// This anchor is used to force the linker to link the clang-tidy plugin.
+extern volatile int ClangTidyPluginAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED ClangTidyPluginAnchorDestination =
+ClangTidyPluginAnchorSource;
+#endif


Index: cfe/trunk/tools/libclang/CMakeLists.txt
===
--- cfe/trunk/tools/libclang/CMakeLists.txt
+++ cfe/trunk/tools/libclang/CMakeLists.txt
@@ -47,6 +47,11 @@
   list(APPEND LIBS clangARCMigrate)
 endif ()
 
+if (CLANG_TOOL_EXTRA_BUILD)
+  add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
+  list(APPEND LIBS clangTidyPlugin)
+endif ()
+
 find_library(DL_LIBRARY_PATH dl)
 if (DL_LIBRARY_PATH)
   list(APPEND LIBS dl)
Index: cfe/trunk/tools/libclang/CIndex.cpp
===
--- cfe/trunk/tools/libclang/CIndex.cpp
+++ cfe/trunk/tools/libclang/CIndex.cpp
@@ -7933,3 +7933,10 @@
 OS << "--\n";
   }
 }
+
+#ifdef CLANG_TOOL_EXTRA_BUILD
+// This anchor is used to force the linker to link the clang-tidy plugin.
+extern volatile int ClangTidyPluginAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED ClangTidyPluginAnchorDestination =
+ClangTidyPluginAnchorSource;
+#endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17807: [clang-tidy] Add "clang-tidy as a clang plugin" skeleton.

2016-03-03 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL262595: [clang-tidy] Add "clang-tidy as a clang plugin" 
skeleton. (authored by d0k).

Changed prior to commit:
  http://reviews.llvm.org/D17807?vs=49615=49718#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17807

Files:
  clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
  clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h
  clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt
  clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp
  clang-tools-extra/trunk/test/CMakeLists.txt
  clang-tools-extra/trunk/test/clang-tidy/basic.cpp

Index: clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp
===
--- clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp
+++ clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp
@@ -0,0 +1,122 @@
+//===- ClangTidyPlugin.cpp - clang-tidy as a clang plugin -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "../ClangTidy.h"
+#include "../ClangTidyModule.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/FrontendPluginRegistry.h"
+#include "clang/Frontend/MultiplexConsumer.h"
+
+namespace clang {
+namespace tidy {
+
+/// The core clang tidy plugin action. This just provides the AST consumer and
+/// command line flag parsing for using clang-tidy as a clang plugin.
+class ClangTidyPluginAction : public PluginASTAction {
+  /// Wrapper to grant the context the same lifetime as the action. We use
+  /// MultiplexConsumer to avoid writing out all the forwarding methods.
+  class WrapConsumer : public MultiplexConsumer {
+std::unique_ptr Context;
+
+  public:
+WrapConsumer(std::unique_ptr Context,
+ std::vector Consumer)
+: MultiplexConsumer(std::move(Consumer)), Context(std::move(Context)) {}
+  };
+
+public:
+  std::unique_ptr CreateASTConsumer(CompilerInstance ,
+ StringRef File) override {
+// Insert the current diagnostics engine.
+Context->setDiagnosticsEngine(());
+
+// Create the AST consumer.
+ClangTidyASTConsumerFactory Factory(*Context);
+std::vector Vec;
+Vec.push_back(Factory.CreateASTConsumer(Compiler, File));
+
+return llvm::make_unique(std::move(Context), std::move(Vec));
+  }
+
+  bool ParseArgs(const CompilerInstance &,
+ const std::vector ) override {
+ClangTidyGlobalOptions GlobalOptions;
+ClangTidyOptions DefaultOptions;
+ClangTidyOptions OverrideOptions;
+
+// Parse the extra command line args.
+// FIXME: This is very limited at the moment.
+for (StringRef Arg : Args)
+  if (Arg.startswith("-checks="))
+OverrideOptions.Checks = Arg.substr(strlen("-checks="));
+
+auto Options = llvm::make_unique(
+GlobalOptions, DefaultOptions, OverrideOptions);
+Context = llvm::make_unique(std::move(Options));
+return true;
+  }
+
+private:
+  std::unique_ptr Context;
+};
+} // namespace tidy
+} // namespace clang
+
+// This anchor is used to force the linker to link in the generated object file
+// and thus register the clang-tidy plugin.
+volatile int ClangTidyPluginAnchorSource = 0;
+
+static clang::FrontendPluginRegistry::Add
+X("clang-tidy", "clang-tidy");
+
+namespace clang {
+namespace tidy {
+
+// This anchor is used to force the linker to link the CERTModule.
+extern volatile int CERTModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED CERTModuleAnchorDestination =
+CERTModuleAnchorSource;
+
+// This anchor is used to force the linker to link the LLVMModule.
+extern volatile int LLVMModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination =
+LLVMModuleAnchorSource;
+
+// This anchor is used to force the linker to link the CppCoreGuidelinesModule.
+extern volatile int CppCoreGuidelinesModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED CppCoreGuidelinesModuleAnchorDestination =
+CppCoreGuidelinesModuleAnchorSource;
+
+// This anchor is used to force the linker to link the GoogleModule.
+extern volatile int GoogleModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED GoogleModuleAnchorDestination =
+GoogleModuleAnchorSource;
+
+// This anchor is used to force the linker to link the MiscModule.
+extern volatile int MiscModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED MiscModuleAnchorDestination =
+MiscModuleAnchorSource;
+
+// This anchor is used to force the linker to link the ModernizeModule.
+extern volatile int ModernizeModuleAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED ModernizeModuleAnchorDestination =
+

r262596 - [libclang] Link clang-tidy plugin into libclang if present.

2016-03-03 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu Mar  3 02:58:18 2016
New Revision: 262596

URL: http://llvm.org/viewvc/llvm-project?rev=262596=rev
Log:
[libclang] Link clang-tidy plugin into libclang if present.

This is a sad workaround for the lack of plugin support in libclang. Depends
on D17807, a tools-extra change that also contains the test case.

This is designed to be easy to remove again if libclang ever grows proper
plugin support.

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

Modified:
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/CMakeLists.txt

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=262596=262595=262596=diff
==
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Thu Mar  3 02:58:18 2016
@@ -7933,3 +7933,10 @@ cxindex::Logger::~Logger() {
 OS << "--\n";
   }
 }
+
+#ifdef CLANG_TOOL_EXTRA_BUILD
+// This anchor is used to force the linker to link the clang-tidy plugin.
+extern volatile int ClangTidyPluginAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED ClangTidyPluginAnchorDestination =
+ClangTidyPluginAnchorSource;
+#endif

Modified: cfe/trunk/tools/libclang/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CMakeLists.txt?rev=262596=262595=262596=diff
==
--- cfe/trunk/tools/libclang/CMakeLists.txt (original)
+++ cfe/trunk/tools/libclang/CMakeLists.txt Thu Mar  3 02:58:18 2016
@@ -47,6 +47,11 @@ if (CLANG_ENABLE_ARCMT)
   list(APPEND LIBS clangARCMigrate)
 endif ()
 
+if (CLANG_TOOL_EXTRA_BUILD)
+  add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
+  list(APPEND LIBS clangTidyPlugin)
+endif ()
+
 find_library(DL_LIBRARY_PATH dl)
 if (DL_LIBRARY_PATH)
   list(APPEND LIBS dl)


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


[clang-tools-extra] r262595 - [clang-tidy] Add "clang-tidy as a clang plugin" skeleton.

2016-03-03 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu Mar  3 02:58:12 2016
New Revision: 262595

URL: http://llvm.org/viewvc/llvm-project?rev=262595=rev
Log:
[clang-tidy] Add "clang-tidy as a clang plugin" skeleton.

This doesn't really do much at the moment. You can load it via libclang
and set the -checks via an extra command line argument as illustrated in
the test case. Support for other options (including headers check) is
currently missing. Also when using this with libclang some checks may
not work with the precompiled preamble in place.

This can be used to easily show clang-tidy warnings in an editor
integration as all that's needed is adding command line flags that are
passed into libclang. Warnings and FixIts are exposed via the existing
CXDiagnostic machinery.

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

Added:
clang-tools-extra/trunk/clang-tidy/plugin/
clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h
clang-tools-extra/trunk/test/CMakeLists.txt
clang-tools-extra/trunk/test/clang-tidy/basic.cpp

Modified: clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/CMakeLists.txt?rev=262595=262594=262595=diff
==
--- clang-tools-extra/trunk/clang-tidy/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/CMakeLists.txt Thu Mar  3 02:58:12 2016
@@ -26,6 +26,7 @@ add_clang_library(clangTidy
   )
 
 add_subdirectory(tool)
+add_subdirectory(plugin)
 add_subdirectory(cert)
 add_subdirectory(llvm)
 add_subdirectory(cppcoreguidelines)

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h?rev=262595=262594=262595=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.h Thu Mar  3 
02:58:12 2016
@@ -221,6 +221,7 @@ public:
 private:
   // Calls setDiagnosticsEngine() and storeError().
   friend class ClangTidyDiagnosticConsumer;
+  friend class ClangTidyPluginAction;
 
   /// \brief Sets the \c DiagnosticsEngine so that Diagnostics can be generated
   /// correctly.

Added: clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt?rev=262595=auto
==
--- clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt (added)
+++ clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt Thu Mar  3 
02:58:12 2016
@@ -0,0 +1,20 @@
+add_clang_library(clangTidyPlugin
+  ClangTidyPlugin.cpp
+
+  LINK_LIBS
+  clangAST
+  clangASTMatchers
+  clangBasic
+  clangFrontend
+  clangSema
+  clangTidy
+  clangTidyCERTModule
+  clangTidyCppCoreGuidelinesModule
+  clangTidyGoogleModule
+  clangTidyLLVMModule
+  clangTidyMiscModule
+  clangTidyModernizeModule
+  clangTidyPerformanceModule
+  clangTidyReadabilityModule
+  clangTooling
+  )

Added: clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp?rev=262595=auto
==
--- clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp (added)
+++ clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp Thu Mar  3 
02:58:12 2016
@@ -0,0 +1,122 @@
+//===- ClangTidyPlugin.cpp - clang-tidy as a clang plugin 
-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "../ClangTidy.h"
+#include "../ClangTidyModule.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/FrontendPluginRegistry.h"
+#include "clang/Frontend/MultiplexConsumer.h"
+
+namespace clang {
+namespace tidy {
+
+/// The core clang tidy plugin action. This just provides the AST consumer and
+/// command line flag parsing for using clang-tidy as a clang plugin.
+class ClangTidyPluginAction : public PluginASTAction {
+  /// Wrapper to grant the context the same lifetime as the action. We use
+  /// MultiplexConsumer to avoid writing out all the forwarding methods.
+  class WrapConsumer : public MultiplexConsumer {
+std::unique_ptr Context;
+
+  public:
+WrapConsumer(std::unique_ptr Context,
+ std::vector Consumer)
+   

r262593 - [Clang][AVX512][BUILTIN] Adding PSRL{W|WI}{128|256|512}

2016-03-03 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Thu Mar  3 02:55:20 2016
New Revision: 262593

URL: http://llvm.org/viewvc/llvm-project?rev=262593=rev
Log:
[Clang][AVX512][BUILTIN] Adding PSRL{W|WI}{128|256|512}

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


Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512bwintrin.h
cfe/trunk/lib/Headers/avx512vlbwintrin.h
cfe/trunk/test/CodeGen/avx512bw-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=262593=262592=262593=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Thu Mar  3 02:55:20 2016
@@ -1691,6 +1691,12 @@ TARGET_BUILTIN(__builtin_ia32_psraw128_m
 TARGET_BUILTIN(__builtin_ia32_psraw256_mask, 
"V16sV16sV8sV16sUs","","avx512bw,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_psrawi128_mask, 
"V8sV8sIiV8sUc","","avx512bw,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_psrawi256_mask, 
"V16sV16sIiV16sUs","","avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_psrlw512_mask, "V32sV32sV8sV32sUi","","avx512bw")
+TARGET_BUILTIN(__builtin_ia32_psrlwi512_mask, "V32sV32sIiV32sUi","","avx512bw")
+TARGET_BUILTIN(__builtin_ia32_psrlw128_mask, 
"V8sV8sV8sV8sUc","","avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_psrlw256_mask, 
"V16sV16sV8sV16sUs","","avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_psrlwi128_mask, 
"V8sV8sIiV8sUc","","avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_psrlwi256_mask, 
"V16sV16sIiV16sUs","","avx512bw,avx512vl")
 
 #undef BUILTIN
 #undef TARGET_BUILTIN

Modified: cfe/trunk/lib/Headers/avx512bwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=262593=262592=262593=diff
==
--- cfe/trunk/lib/Headers/avx512bwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512bwintrin.h Thu Mar  3 02:55:20 2016
@@ -1829,6 +1829,57 @@ __builtin_ia32_psrawi512_mask ((__v32hi)
   (__mmask32)( __U));\
 })
 
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_srl_epi16 (__m512i __A, __m128i __B)
+{
+  return (__m512i) __builtin_ia32_psrlw512_mask ((__v32hi) __A,
+ (__v8hi) __B,
+ (__v32hi)
+ _mm512_setzero_hi (),
+ (__mmask32) -1);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_srl_epi16 (__m512i __W, __mmask32 __U, __m512i __A,
+   __m128i __B)
+{
+  return (__m512i) __builtin_ia32_psrlw512_mask ((__v32hi) __A,
+ (__v8hi) __B,
+ (__v32hi) __W,
+ (__mmask32) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_srl_epi16 (__mmask32 __U, __m512i __A, __m128i __B)
+{
+  return (__m512i) __builtin_ia32_psrlw512_mask ((__v32hi) __A,
+ (__v8hi) __B,
+ (__v32hi)
+ _mm512_setzero_hi (),
+ (__mmask32) __U);
+}
+
+#define _mm512_srli_epi16( __A, __imm) __extension__ ({ \
+__builtin_ia32_psrlwi512_mask ((__v32hi)( __A),( __imm),\
+  (__v32hi)\
+  _mm512_setzero_hi (),\
+  (__mmask32) -1);\
+})
+
+#define _mm512_mask_srli_epi16( __W, __U, __A, __imm) __extension__ ({ \
+__builtin_ia32_psrlwi512_mask ((__v32hi)( __A),( __imm),\
+  (__v32hi)( __W),\
+  (__mmask32)( __U));\
+})
+
+#define _mm512_maskz_srli_epi16( __U, __A, __imm) __extension__ ({ \
+__builtin_ia32_psrlwi512_mask ((__v32hi)( __A),( __imm),\
+  (__v32hi)\
+  _mm512_setzero_hi (),\
+  (__mmask32)( __U));\
+})
+
 #undef __DEFAULT_FN_ATTRS
 
 #endif

Modified: cfe/trunk/lib/Headers/avx512vlbwintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlbwintrin.h?rev=262593=262592=262593=diff
==
--- cfe/trunk/lib/Headers/avx512vlbwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlbwintrin.h Thu Mar  3 02:55:20 2016
@@ -2781,6 +2781,73 @@ __builtin_ia32_psrawi256_mask ((__v16hi)
   (__mmask16)( __U));\
 })
 
+static __inline__ __m128i __DEFAULT_FN_ATTRS
+_mm_mask_srl_epi16 (__m128i __W, __mmask8 __U, __m128i __A,
+__m128i __B)
+{
+  return (__m128i) __builtin_ia32_psrlw128_mask ((__v8hi) __A,
+ (__v8hi) __B,
+ (__v8hi) __W,
+ (__mmask8) __U);
+}
+
+static __inline__ __m128i __DEFAULT_FN_ATTRS
+_mm_maskz_srl_epi16 (__mmask8 __U, __m128i __A, __m128i __B)
+{
+  return (__m128i) __builtin_ia32_psrlw128_mask ((__v8hi) __A,
+ (__v8hi) __B,
+ (__v8hi)
+ _mm_setzero_si128 (),
+ (__mmask8) __U);
+}
+
+static __inline__ __m256i __DEFAULT_FN_ATTRS
+_mm256_mask_srl_epi16 (__m256i __W, __mmask16 __U, __m256i __A,
+   __m128i __B)
+{
+  return 

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Weiming Zhao via cfe-commits
weimingz updated this revision to Diff 49713.
weimingz added a comment.

Add "-f__FILE__-prefix-to-remove" flag to support the trim of the prefix.
Passing special value __ALL_DIR__  to remove all dir parts.

For example FILE is /a/b/c
-f__FILE__-prefix-to-remove=/a/ will cause FILE be expanded to b/c


http://reviews.llvm.org/D17741

Files:
  include/clang/Driver/Options.td
  include/clang/Lex/Preprocessor.h
  include/clang/Lex/PreprocessorOptions.h
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Lex/PPMacroExpansion.cpp
  test/Lexer/file_basename.c

Index: test/Lexer/file_basename.c
===
--- /dev/null
+++ test/Lexer/file_basename.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -E %s | FileCheck %s --check-prefix=ALL --check-prefix=DEFAULT
+
+// RUN: %clang_cc1 -E -f__FILE__-prefix-to-remove=__ALL_DIR__ %s | FileCheck %s --check-prefix=ALL --check-prefix=NO-DIR
+// RUN:%clang -E -f__FILE__-prefix-to-remove=__ALL_DIR__ %s | FileCheck %s --check-prefix=ALL --check-prefix=NO-DIR
+
+// RUN: %clang_cc1 -E -f__FILE__-prefix-to-remove=%s %s | FileCheck %s --check-prefix=ALL --check-prefix=REMOVE-ALL
+// RUN: %clang -E -f__FILE__-prefix-to-remove=%s %s | FileCheck %s --check-prefix=ALL --check-prefix=REMOVE-ALL
+
+// RUN: %clang_cc1 -E -f__FILE__-prefix-to-remove=%s.xyz %s | FileCheck %s --check-prefix=ALL --check-prefix=MISMATCH
+// RUN: %clang -E -f__FILE__-prefix-to-remove= %s | FileCheck %s --check-prefix=ALL --check-prefix=MISMATCH
+
+const char *filename (const char *name) {
+  // ALL:  static const char this_file_basename[] = "file_basename.c";
+  static const char this_file_basename[] = __CLANG_FILE_BASENAME__;
+  // DEFAULT: static const char this_file[] = "{{.*}}/Lexer/file_basename.c";
+  // NO-DIR:  static const char this_file[] = "file_basename.c";
+  // REMOVE-ALL: static const char this_file[] = "";
+  // MISMATCH: static const char this_file[] = "{{.*}}/Lexer/file_basename.c";
+  static const char this_file[] = __FILE__;
+  return this_file;
+}
Index: lib/Lex/PPMacroExpansion.cpp
===
--- lib/Lex/PPMacroExpansion.cpp
+++ lib/Lex/PPMacroExpansion.cpp
@@ -12,7 +12,6 @@
 //
 //===--===//
 
-#include "clang/Lex/Preprocessor.h"
 #include "clang/Basic/Attributes.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceManager.h"
@@ -22,12 +21,15 @@
 #include "clang/Lex/LexDiagnostic.h"
 #include "clang/Lex/MacroArgs.h"
 #include "clang/Lex/MacroInfo.h"
+#include "clang/Lex/Preprocessor.h"
+#include "clang/Lex/PreprocessorOptions.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Format.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 #include 
 #include 
@@ -292,6 +294,8 @@
 void Preprocessor::RegisterBuiltinMacros() {
   Ident__LINE__ = RegisterBuiltinMacro(*this, "__LINE__");
   Ident__FILE__ = RegisterBuiltinMacro(*this, "__FILE__");
+  Ident__CLANG_FILE_BASENAME__ =
+  RegisterBuiltinMacro(*this, "__CLANG_FILE_BASENAME__");
   Ident__DATE__ = RegisterBuiltinMacro(*this, "__DATE__");
   Ident__TIME__ = RegisterBuiltinMacro(*this, "__TIME__");
   Ident__COUNTER__ = RegisterBuiltinMacro(*this, "__COUNTER__");
@@ -1509,7 +1513,8 @@
 // __LINE__ expands to a simple numeric value.
 OS << (PLoc.isValid()? PLoc.getLine() : 1);
 Tok.setKind(tok::numeric_constant);
-  } else if (II == Ident__FILE__ || II == Ident__BASE_FILE__) {
+  } else if (II == Ident__FILE__ || II == Ident__BASE_FILE__ ||
+ II == Ident__CLANG_FILE_BASENAME__) {
 // C99 6.10.8: "__FILE__: The presumed name of the current source file (a
 // character string literal)". This can be affected by #line.
 PresumedLoc PLoc = SourceMgr.getPresumedLoc(Tok.getLocation());
@@ -1522,15 +1527,28 @@
 PLoc = SourceMgr.getPresumedLoc(NextLoc);
 if (PLoc.isInvalid())
   break;
-
 NextLoc = PLoc.getIncludeLoc();
   }
 }
 
 // Escape this filename.  Turn '\' -> '\\' '"' -> '\"'
 SmallString<128> FN;
 if (PLoc.isValid()) {
-  FN += PLoc.getFilename();
+  const std::string  =
+  getPreprocessorOpts().__FILE__PrefixToRemove;
+  StringRef Filename(PLoc.getFilename());
+  if (II == Ident__CLANG_FILE_BASENAME__)
+FN += llvm::sys::path::filename(Filename);
+  else if (II == Ident__FILE__ && !PrefixToRemove.empty()) {
+if (PrefixToRemove == "__ALL_DIR__")
+  FN += llvm::sys::path::filename(Filename);
+else if (Filename.find(PrefixToRemove) == 0)
+  FN += Filename.substr(PrefixToRemove.size());
+else
+  FN += Filename;
+  } else
+FN += Filename;
+
   Lexer::Stringify(FN);
  

Re: r261372 - [modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a single

2016-03-03 Thread Argyrios Kyrtzidis via cfe-commits
Mind if we keep -fmodule-implementation-of as an alias so that we can gradually 
transition to -fmodule-name ?

> On Feb 19, 2016, at 2:25 PM, Richard Smith via cfe-commits 
>  wrote:
> 
> Author: rsmith
> Date: Fri Feb 19 16:25:36 2016
> New Revision: 261372
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=261372=rev
> Log:
> [modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a single
> option. Previously these options could both be used to specify that you were
> compiling the implementation file of a module, with a different set of minor
> bugs in each case.
> 
> This change removes -fmodule-implementation-of, and instead tracks a flag to
> determine whether we're currently building a module. -fmodule-name now behaves
> the same way that -fmodule-implementation-of previously did.
> 
> Modified:
>cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
>cfe/trunk/include/clang/Basic/LangOptions.def
>cfe/trunk/include/clang/Basic/LangOptions.h
>cfe/trunk/include/clang/Driver/CC1Options.td
>cfe/trunk/include/clang/Driver/Options.td
>cfe/trunk/include/clang/Lex/ModuleMap.h
>cfe/trunk/lib/Basic/LangOptions.cpp
>cfe/trunk/lib/Driver/Tools.cpp
>cfe/trunk/lib/Frontend/ASTUnit.cpp
>cfe/trunk/lib/Frontend/CompilerInstance.cpp
>cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>cfe/trunk/lib/Frontend/FrontendActions.cpp
>cfe/trunk/lib/Lex/ModuleMap.cpp
>cfe/trunk/lib/Lex/PPDirectives.cpp
>cfe/trunk/lib/Lex/PPMacroExpansion.cpp
>cfe/trunk/lib/Lex/Preprocessor.cpp
>cfe/trunk/lib/Sema/SemaDecl.cpp
>cfe/trunk/lib/Sema/SemaDeclObjC.cpp
>cfe/trunk/test/Modules/Inputs/explicit-build/a.h
>cfe/trunk/test/Modules/explicit-build.cpp
>cfe/trunk/test/Modules/implementation-of-module.m
>cfe/trunk/test/Modules/import-self.m
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=261372=261371=261372=diff
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Fri Feb 19 
> 16:25:36 2016
> @@ -210,10 +210,6 @@ def err_test_module_file_extension_versi
>   "test module file extension '%0' has different version (%1.%2) than 
> expected "
>   "(%3.%4)">;
> 
> -def err_conflicting_module_names : Error<
> -  "conflicting module names specified: '-fmodule-name=%0' and "
> -  "'-fmodule-implementation-of %1'">;
> -
> def err_missing_vfs_overlay_file : Error<
>   "virtual filesystem overlay file '%0' not found">, DefaultFatal;
> def err_invalid_vfs_overlay : Error<
> 
> Modified: cfe/trunk/include/clang/Basic/LangOptions.def
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=261372=261371=261372=diff
> ==
> --- cfe/trunk/include/clang/Basic/LangOptions.def (original)
> +++ cfe/trunk/include/clang/Basic/LangOptions.def Fri Feb 19 16:25:36 2016
> @@ -127,6 +127,7 @@ BENIGN_LANGOPT(EmitAllDecls  , 1, 0,
> LANGOPT(MathErrno , 1, 1, "errno support for math functions")
> BENIGN_LANGOPT(HeinousExtensions , 1, 0, "Extensions that we really don't 
> like and may be ripped out at any time")
> LANGOPT(Modules   , 1, 0, "modules extension to C")
> +BENIGN_LANGOPT(CompilingModule, 1, 0, "compiling a module interface")
> COMPATIBLE_LANGOPT(ModulesDeclUse, 1, 0, "require declaration of module 
> uses")
> LANGOPT(ModulesSearchAll  , 1, 1, "search even non-imported modules to find 
> unresolved references")
> COMPATIBLE_LANGOPT(ModulesStrictDeclUse, 1, 0, "require declaration of module 
> uses and all headers to be in modules")
> 
> Modified: cfe/trunk/include/clang/Basic/LangOptions.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=261372=261371=261372=diff
> ==
> --- cfe/trunk/include/clang/Basic/LangOptions.h (original)
> +++ cfe/trunk/include/clang/Basic/LangOptions.h Fri Feb 19 16:25:36 2016
> @@ -92,14 +92,12 @@ public:
>   /// If none is specified, abort (GCC-compatible behaviour).
>   std::string OverflowHandler;
> 
> -  /// \brief The name of the current module.
> +  /// \brief The name of the current module, of which the main source file
> +  /// is a part. If CompilingModule is set, we are compiling the interface
> +  /// of this module, otherwise we are compiling an implementation file of
> +  /// it.
>   std::string CurrentModule;
> 
> -  /// \brief The name of the module that the translation unit is an
> -  /// implementation of. Prevents semantic imports, but does not otherwise
> -  /// treat this as the CurrentModule.
> -  std::string ImplementationOfModule;
> -
>