Re: [PATCH] D17958: [clang-tidy] Make 'modernize-use-nullptr' check ignores NULL marcos used in other macros.

2016-03-10 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Adding Benjamin as a reviewer, since I'm on vacation.


Repository:
  rL LLVM

http://reviews.llvm.org/D17958



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


Re: [PATCH] D18073: Add memory allocating functions

2016-03-10 Thread Alexander Riccio via cfe-commits
ariccio added a comment.

In http://reviews.llvm.org/D18073#372697, @zaks.anna wrote:

> Since we are adding support for so many new APIs that are only available on 
> Windows, could you please condition checking them only when we build for 
> Windows. You probably can look and Language Options to figure that out.


Is there a problem with checking  them on linux/OSX also?

> Also, we should not duplicate all of our tests. Instead, we should add a 
> single test per added API checking that it is modeling the operation we think 
> it should model.


So should I dump the _dbg versions from the tests?


http://reviews.llvm.org/D18073



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


Re: [PATCH] D17990: [clang-tidy] minor improvements in modernise-deprecated-headers check

2016-03-10 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

> + {"iso646.h", "ciso646"},

>  Just delete #includes of this one.  does nothing.




> + {"stdalign.h", "cstdalign"},

>  + {"stdbool.h", "cstdbool"},

>  We should just delete these two includes. These headers do nothing in C++.


These don't seem to be addressed. Can you at least leave a FIXME in the code 
and in the test?


http://reviews.llvm.org/D17990



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


Re: [PATCH] D17981: [clang-tidy] Fix clang-tidy to support parsing of assembly statements.

2016-03-10 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Also, should we do this for all Clang tools?


http://reviews.llvm.org/D17981



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


Re: [PATCH] D17981: [clang-tidy] Fix clang-tidy to support parsing of assembly statements.

2016-03-10 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

If this issue is specific to MS inline asm, then the additional dependencies 
should only be added, when we care about MS inline asm (windows builds only?).


http://reviews.llvm.org/D17981



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


Re: [PATCH] D18071: CodeGen: Mark runtime functions with reserved names as unnamed_addr.

2016-03-10 Thread John McCall via cfe-commits
rjmccall added a comment.

The underscore check seems over-broad; we support a lot of language dialects 
and runtimes besides the Itanium C++ runtime.  This would be both more 
conservative and more convincing if it were constrained to the functions that 
we expect to put in v-tables.


http://reviews.llvm.org/D18071



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


r263194 - Removing the friend declaration was not a good idea.

2016-03-10 Thread John McCall via cfe-commits
Author: rjmccall
Date: Thu Mar 10 23:03:01 2016
New Revision: 263194

URL: http://llvm.org/viewvc/llvm-project?rev=263194=rev
Log:
Removing the friend declaration was not a good idea.

Modified:
cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h

Modified: cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h?rev=263194=263193=263194=diff
==
--- cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h (original)
+++ cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h Thu Mar 10 23:03:01 2016
@@ -507,6 +507,7 @@ public:
 
   // Friending class TrailingObjects is apparently not good enough for MSVC,
   // so these have to be public.
+  friend class TrailingObjects;
   size_t numTrailingObjects(OverloadToken) const {
 return NumArgs + 1;
   }


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


r263193 - Speculatively attempt to fix the MSVC build by making some

2016-03-10 Thread John McCall via cfe-commits
Author: rjmccall
Date: Thu Mar 10 22:55:21 2016
New Revision: 263193

URL: http://llvm.org/viewvc/llvm-project?rev=263193=rev
Log:
Speculatively attempt to fix the MSVC build by making some
methods non-private.

Modified:
cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h

Modified: cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h?rev=263193=263192=263193=diff
==
--- cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h (original)
+++ cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h Thu Mar 10 22:55:21 2016
@@ -492,14 +492,6 @@ class CGFunctionInfo final
 return getTrailingObjects();
   }
 
-  size_t numTrailingObjects(OverloadToken) const {
-return NumArgs + 1;
-  }
-  size_t numTrailingObjects(OverloadToken) const {
-return (HasExtParameterInfos ? NumArgs : 0);
-  }
-  friend class TrailingObjects;
-
   CGFunctionInfo() : Required(RequiredArgs::All) {}
 
 public:
@@ -513,6 +505,15 @@ public:
 RequiredArgs required);
   void operator delete(void *p) { ::operator delete(p); }
 
+  // Friending class TrailingObjects is apparently not good enough for MSVC,
+  // so these have to be public.
+  size_t numTrailingObjects(OverloadToken) const {
+return NumArgs + 1;
+  }
+  size_t numTrailingObjects(OverloadToken) const {
+return (HasExtParameterInfos ? NumArgs : 0);
+  }
+
   typedef const ArgInfo *const_arg_iterator;
   typedef ArgInfo *arg_iterator;
 


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


Re: [PATCH] D18052: Add tests for ARM Cortex-R8

2016-03-10 Thread Renato Golin via cfe-commits
rengolin accepted this revision.
rengolin added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


http://reviews.llvm.org/D18052



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


r263192 - Add a coerce-and-expand ABIArgInfo as a generalization of some

2016-03-10 Thread John McCall via cfe-commits
Author: rjmccall
Date: Thu Mar 10 22:30:43 2016
New Revision: 263192

URL: http://llvm.org/viewvc/llvm-project?rev=263192=rev
Log:
Add a coerce-and-expand ABIArgInfo as a generalization of some
of the things we do with Expand / Direct.

NFC for now, but this will be used by swiftcall expansion.

Modified:
cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
cfe/trunk/lib/CodeGen/CGBuilder.h
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/TargetInfo.cpp

Modified: cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h?rev=263192=263191=263192=diff
==
--- cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h (original)
+++ cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h Thu Mar 10 22:30:43 2016
@@ -19,15 +19,11 @@
 #include "clang/AST/CanonicalType.h"
 #include "clang/AST/CharUnits.h"
 #include "clang/AST/Type.h"
+#include "llvm/IR/DerivedTypes.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/Support/TrailingObjects.h"
 #include 
 
-namespace llvm {
-  class Type;
-  class StructType;
-}
-
 namespace clang {
 class Decl;
 
@@ -64,6 +60,12 @@ public:
 /// are all scalar types or are themselves expandable types.
 Expand,
 
+/// CoerceAndExpand - Only valid for aggregate argument types. The
+/// structure should be expanded into consecutive arguments corresponding
+/// to the non-array elements of the type stored in CoerceToType.
+/// Array elements in the type are assumed to be padding and skipped.
+CoerceAndExpand,
+
 /// InAlloca - Pass the argument directly using the LLVM inalloca 
attribute.
 /// This is similar to indirect with byval, except it only applies to
 /// arguments stored in memory and forbids any implicit copies.  When
@@ -75,8 +77,11 @@ public:
   };
 
 private:
-  llvm::Type *TypeData; // isDirect() || isExtend()
-  llvm::Type *PaddingType;
+  llvm::Type *TypeData; // canHaveCoerceToType()
+  union {
+llvm::Type *PaddingType; // canHavePaddingType()
+llvm::Type *UnpaddedCoerceAndExpandType; // isCoerceAndExpand()
+  };
   union {
 unsigned DirectOffset; // isDirect() || isExtend()
 unsigned IndirectAlign;// isIndirect()
@@ -91,8 +96,22 @@ private:
   bool InReg : 1;   // isDirect() || isExtend() || isIndirect()
   bool CanBeFlattened: 1;   // isDirect()
 
+  bool canHavePaddingType() const {
+return isDirect() || isExtend() || isIndirect() || isExpand();
+  }
+  void setPaddingType(llvm::Type *T) {
+assert(canHavePaddingType());
+PaddingType = T;
+  }
+
+  void setUnpaddedCoerceToType(llvm::Type *T) {
+assert(isCoerceAndExpand());
+UnpaddedCoerceAndExpandType = T;
+  }
+
   ABIArgInfo(Kind K)
-  : PaddingType(nullptr), TheKind(K), PaddingInReg(false), InReg(false) {}
+  : TheKind(K), PaddingInReg(false), InReg(false) {
+  }
 
 public:
   ABIArgInfo()
@@ -104,8 +123,8 @@ public:
   bool CanBeFlattened = true) {
 auto AI = ABIArgInfo(Direct);
 AI.setCoerceToType(T);
-AI.setDirectOffset(Offset);
 AI.setPaddingType(Padding);
+AI.setDirectOffset(Offset);
 AI.setCanBeFlattened(CanBeFlattened);
 return AI;
   }
@@ -117,6 +136,7 @@ public:
   static ABIArgInfo getExtend(llvm::Type *T = nullptr) {
 auto AI = ABIArgInfo(Extend);
 AI.setCoerceToType(T);
+AI.setPaddingType(nullptr);
 AI.setDirectOffset(0);
 return AI;
   }
@@ -151,7 +171,9 @@ public:
 return AI;
   }
   static ABIArgInfo getExpand() {
-return ABIArgInfo(Expand);
+auto AI = ABIArgInfo(Expand);
+AI.setPaddingType(nullptr);
+return AI;
   }
   static ABIArgInfo getExpandWithPadding(bool PaddingInReg,
  llvm::Type *Padding) {
@@ -161,6 +183,54 @@ public:
 return AI;
   }
 
+  /// \param unpaddedCoerceToType The coerce-to type with padding elements
+  ///   removed, canonicalized to a single element if it would otherwise
+  ///   have exactly one element.
+  static ABIArgInfo getCoerceAndExpand(llvm::StructType *coerceToType,
+   llvm::Type *unpaddedCoerceToType) {
+#ifndef NDEBUG
+// Sanity checks on unpaddedCoerceToType.
+
+// Assert that we only have a struct type if there are multiple elements.
+auto unpaddedStruct = dyn_cast(unpaddedCoerceToType);
+assert(!unpaddedStruct || unpaddedStruct->getNumElements() != 1);
+
+// Assert that all the non-padding elements have a corresponding element
+// in the unpadded type.
+unsigned unpaddedIndex = 0;
+for (auto eltType : coerceToType->elements()) {
+  if (isPaddingForCoerceAndExpand(eltType)) continue;
+  if (unpaddedStruct) {
+assert(unpaddedStruct->getElementType(unpaddedIndex) == eltType);
+  } else {
+assert(unpaddedIndex == 0 && unpaddedCoerceToType == eltType);
+  }
+  

r263191 - Preserve ExtParameterInfos into CGFunctionInfo.

2016-03-10 Thread John McCall via cfe-commits
Author: rjmccall
Date: Thu Mar 10 22:30:31 2016
New Revision: 263191

URL: http://llvm.org/viewvc/llvm-project?rev=263191=rev
Log:
Preserve ExtParameterInfos into CGFunctionInfo.

As part of this, make the function-arrangement interfaces
a little simpler and more semantic.

NFC.

Modified:
cfe/trunk/include/clang/AST/CanonicalType.h
cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
cfe/trunk/lib/CodeGen/CGAtomic.cpp
cfe/trunk/lib/CodeGen/CGBlocks.cpp
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
cfe/trunk/lib/CodeGen/CGException.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp
cfe/trunk/lib/CodeGen/CodeGenTypes.h
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp

Modified: cfe/trunk/include/clang/AST/CanonicalType.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CanonicalType.h?rev=263191=263190=263191=diff
==
--- cfe/trunk/include/clang/AST/CanonicalType.h (original)
+++ cfe/trunk/include/clang/AST/CanonicalType.h Thu Mar 10 22:30:31 2016
@@ -484,6 +484,9 @@ struct CanProxyAdaptor, 
getExtParameterInfos)
   CanQualType getParamType(unsigned i) const {
 return CanQualType::CreateUnsafe(this->getTypePtr()->getParamType(i));
   }

Modified: cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h?rev=263191=263190=263191=diff
==
--- cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h (original)
+++ cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h Thu Mar 10 22:30:31 2016
@@ -343,8 +343,10 @@ struct CGFunctionInfoArgInfo {
 /// function definition.
 class CGFunctionInfo final
 : public llvm::FoldingSetNode,
-  private llvm::TrailingObjects {
+  private llvm::TrailingObjects {
   typedef CGFunctionInfoArgInfo ArgInfo;
+  typedef FunctionProtoType::ExtParameterInfo ExtParameterInfo;
 
   /// The LLVM::CallingConv to use for this function (as specified by the
   /// user).
@@ -378,7 +380,8 @@ class CGFunctionInfo final
   /// The struct representing all arguments passed in memory.  Only used when
   /// passing non-trivial types with inalloca.  Not part of the profile.
   llvm::StructType *ArgStruct;
-  unsigned ArgStructAlign;
+  unsigned ArgStructAlign : 31;
+  unsigned HasExtParameterInfos : 1;
 
   unsigned NumArgs;
 
@@ -389,7 +392,19 @@ class CGFunctionInfo final
 return getTrailingObjects();
   }
 
-  size_t numTrailingObjects(OverloadToken) { return NumArgs + 1; }
+  ExtParameterInfo *getExtParameterInfosBuffer() {
+return getTrailingObjects();
+  }
+  const ExtParameterInfo *getExtParameterInfosBuffer() const{
+return getTrailingObjects();
+  }
+
+  size_t numTrailingObjects(OverloadToken) const {
+return NumArgs + 1;
+  }
+  size_t numTrailingObjects(OverloadToken) const {
+return (HasExtParameterInfos ? NumArgs : 0);
+  }
   friend class TrailingObjects;
 
   CGFunctionInfo() : Required(RequiredArgs::All) {}
@@ -399,6 +414,7 @@ public:
 bool instanceMethod,
 bool chainCall,
 const FunctionType::ExtInfo ,
+ArrayRef paramInfos,
 CanQualType resultType,
 ArrayRef argTypes,
 RequiredArgs required);
@@ -472,6 +488,16 @@ public:
   ABIArgInfo () { return getArgsBuffer()[0].info; }
   const ABIArgInfo () const { return getArgsBuffer()[0].info; }
 
+  ArrayRef getExtParameterInfos() const {
+if (!HasExtParameterInfos) return {};
+return llvm::makeArrayRef(getExtParameterInfosBuffer(), NumArgs);
+  }
+  ExtParameterInfo getExtParameterInfo(unsigned argIndex) const {
+assert(argIndex <= NumArgs);
+if (!HasExtParameterInfos) return ExtParameterInfo();
+return getExtParameterInfos()[argIndex];
+  }
+
   /// \brief Return true if this function uses inalloca arguments.
   bool usesInAlloca() const { return ArgStruct; }
 
@@ -494,6 +520,11 @@ public:
 ID.AddBoolean(HasRegParm);
 ID.AddInteger(RegParm);
 ID.AddInteger(Required.getOpaqueData());
+ID.AddBoolean(HasExtParameterInfos);
+if (HasExtParameterInfos) {
+  for (auto paramInfo : getExtParameterInfos())
+ID.AddInteger(paramInfo.getOpaqueValue());
+}
 getReturnType().Profile(ID);

Re: [PATCH] D17963: [OPENMP] Codegen for teams directive for NVPTX

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

LG



Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.h:32-59
@@ +31,30 @@
+  /// \param ThreadLimit An integer expression of threads.
+  virtual void emitNumTeamsClause(CodeGenFunction , const Expr *NumTeams,
+  const Expr *ThreadLimit, SourceLocation Loc);
+
+  /// \brief Emits inlined function for the specified OpenMP parallel
+  //  directive but an inlined function for teams.
+  /// \a D. This outlined function has type void(*)(kmp_int32 *ThreadID,
+  /// kmp_int32 BoundID, struct context_vars*).
+  /// \param D OpenMP directive.
+  /// \param ThreadIDVar Variable for thread id in the current OpenMP region.
+  /// \param InnermostKind Kind of innermost directive (for simple directives 
it
+  /// is a directive itself, for combined - its innermost directive).
+  /// \param CodeGen Code generation sequence for the \a D directive.
+  virtual llvm::Value *emitParallelOrTeamsOutlinedFunction(
+  const OMPExecutableDirective , const VarDecl *ThreadIDVar,
+  OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy );
+
+  /// \brief Emits code for teams call of the \a OutlinedFn with
+  /// variables captured in a record which address is stored in \a
+  /// CapturedStruct.
+  /// \param OutlinedFn Outlined function to be run by team masters. Type of
+  /// this function is void(*)(kmp_int32 *, kmp_int32, struct context_vars*).
+  /// \param CapturedVars A pointer to the record with the references to
+  /// variables used in \a OutlinedFn function.
+  ///
+  virtual void emitTeamsCall(CodeGenFunction ,
+ const OMPExecutableDirective ,
+ SourceLocation Loc, llvm::Value *OutlinedFn,
+ ArrayRef CapturedVars);
+

Remove 'virtual' and add 'override' at the end of each function


Repository:
  rL LLVM

http://reviews.llvm.org/D17963



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


[PATCH] D18076: Improve Visual Studio visualizations of llvm::PointerUnion by increasing type correctness

2016-03-10 Thread Mike Spertus via cfe-commits
mspertus created this revision.
mspertus added reviewers: aaron.ballman, zturner.
mspertus added a subscriber: cfe-commits.

The Visual Studio native visualizer in llvm.natvis displays the actual pointer 
in a PointerUnion as a void *. E.g.

clang::Type const *: 0x02c4a880

Which doesn't make clear what the type looks like. With this change, we will 
display an actual Type *, resulting in a much better visualization that makes 
it clear that the clang::Type is a PointerType representing "Int *"

clang::Type const *: 0x02c4a880 PointerType: BuiltinType: Int *

(Note, the above uses an upcoming visualizer for clang::PointerType because 
that is my test case, but that is orthogonal to this change).

http://reviews.llvm.org/D18076

Files:
  llvm.natvis

Index: llvm.natvis
===
--- llvm.natvis
+++ llvm.natvis
@@ -54,8 +54,8 @@
   
 
   
-{"$T1", s8b} {(void*)(Val.Value  
Val.PointerBitMask)}
-{"$T2", s8b} {(void*)(Val.Value  
Val.PointerBitMask)}
+{"$T1", s8b}: {($T1)(Val.Value  
Val.PointerBitMask)}
+{"$T2", s8b}: {($T2)(Val.Value  
Val.PointerBitMask)}
 
   ($T1)(Val.Value  Val.PointerBitMask)
   ($T2)(Val.Value  Val.PointerBitMask)


Index: llvm.natvis
===
--- llvm.natvis
+++ llvm.natvis
@@ -54,8 +54,8 @@
   
 
   
-{"$T1", s8b} {(void*)(Val.Value  Val.PointerBitMask)}
-{"$T2", s8b} {(void*)(Val.Value  Val.PointerBitMask)}
+{"$T1", s8b}: {($T1)(Val.Value  Val.PointerBitMask)}
+{"$T2", s8b}: {($T2)(Val.Value  Val.PointerBitMask)}
 
   ($T1)(Val.Value  Val.PointerBitMask)
   ($T2)(Val.Value  Val.PointerBitMask)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-03-10 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Looks mostly good, a few nits.



Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:82
@@ +81,3 @@
+? std::string{R"lit()")lit"}
+: (")" + Delimiter + R"(")")) != StringRef::npos;
+}

LegalizeAdulthood wrote:
> aaron.ballman wrote:
> > This is a wonderful demonstration of why I hate raw string literals on 
> > shorter strings. I had to stare at that raw string for quite some time to 
> > figure it out. :-(
> I used a raw string literal here because that's what this check would have 
> recommended on this code :-).
> 
> However, your feedback is useful.  If I subsequently enhance this check with 
> a parameter that says the minimum length a string literal must have before it 
> is to be transformed into a raw string literal and the default value for that 
> parameter is something like 5, would that address your concern?
That (a way to configure some thresholds of "sensitivity" of this check, so it 
doesn't change `"\""` to `R"(")"` etc.) is roughly what I suggested a while 
ago, and we decided that this can be addressed in a follow up.


Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:98
@@ +97,3 @@
+}
+
+} // namespace

> Working with the hard-coded list of delimiters is no more or less efficient 
> than the general algorithm that I 
> implemented, so efficiency is not the concern here.

The other concern is:

>> IMO, we don't need a universal algorithm that will hardly ever go further 
>> than the second iteration, and even in 
>> this case would produce a result that's likely undesirable (as I said, 
>> R"lit0()lit0" is not what I would want to 
>> see in my code).

However, given the low probability of this scenario, I don't want to waste more 
of our time on this. The current algorithm is good enough for the first version.


Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:104
@@ +103,3 @@
+: ClangTidyCheck(Name, Context),
+  DelimiterStem{Options.get("DelimiterStem", "lit")} {}
+

AFAIU, braced initializers in constructor initializer lists are not supported 
on MSVC 2013.


Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:104
@@ +103,3 @@
+: ClangTidyCheck(Name, Context),
+  DelimiterStem{Options.get("DelimiterStem", "lit")} {}
+

alexfh wrote:
> AFAIU, braced initializers in constructor initializer lists are not supported 
> on MSVC 2013.
> Then the documentation needs to be updated. (Actually I couldn't find any 
> documentation on these flags and how they relate to each other because they 
> use preprocessor hell to generate bitfields in a structure.)

As with most things in open source, the documentation is missing, since nobody 
yet needed it strongly enough to write it.

If you feel it's worth your time, send a patch to whoever maintains Clang 
frontend code these days. The documentation should go somewhere around 
include/clang/Frontend/LangStandards.def:115 or 
include/clang/Basic/LangOptions.def:77.


http://reviews.llvm.org/D16529



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


Re: [PATCH] D18073: Add memory allocating functions

2016-03-10 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Since we are adding support for so many new APIs that are only available on 
Windows, could you please condition checking them only when we build for 
Windows. You probably can look and Language Options to figure that out.

Also, we should not duplicate all of our tests. Instead, we should add a single 
test per added API checking that it is modeling the operation we think it 
should model.


http://reviews.llvm.org/D18073



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


[PATCH] D18073: Add memory allocating functions

2016-03-10 Thread Alexander Riccio via cfe-commits
ariccio created this revision.
ariccio added reviewers: zaks.anna, dcoughlin, aaron.ballman.
ariccio added a subscriber: cfe-commits.

As discussed...

http://reviews.llvm.org/D18073

Files:
  llvm/tools/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  llvm/tools/clang/test/Analysis/malloc.c

Index: llvm/tools/clang/test/Analysis/malloc.c
===
--- llvm/tools/clang/test/Analysis/malloc.c
+++ llvm/tools/clang/test/Analysis/malloc.c
@@ -31,12 +31,50 @@
 wchar_t *wcsdup(const wchar_t *s);
 char *strndup(const char *s, size_t n);
 int memcmp(const void *s1, const void *s2, size_t n);
+char *tempnam(const char *dir, const char *pfx);
 
+
 // Windows variants
 char *_strdup(const char *strSource);
 wchar_t *_wcsdup(const wchar_t *strSource);
+unsigned char *_mbsdup(const unsigned char *strSource);
+
 void *_alloca(size_t size);
 
+char *_tempnam(const char *dir, const char *prefix);
+wchar_t *_wtempnam(const wchar_t *dir, const wchar_t *prefix);
+
+
+void *_calloc_dbg(size_t num, size_t size, int blockType,
+  const char *filename, int linenumber);
+
+char *_strdup_dbg(const char *strSource, int blockType,
+  const char *filename, int linenumber);
+
+wchar_t *_wcsdup_dbg(const wchar_t *strSource, int blockType,
+ const char *filename, int linenumber);
+
+unsigned char *_mbsdup_dbg(const unsigned char *strSource, int blockType,
+   const char *filename, int linenumber);
+
+char *_tempnam_dbg(const char *dir, const char *prefix, int blockType,
+   const char *filename, int linenumber);
+
+wchar_t *_wtempnam_dbg(const wchar_t *dir, const wchar_t *prefix,
+   int blockType, const char *filename, int linenumber);
+
+
+
+// Very frequently used debug versions
+void _free_dbg(void *userData, int blockType);
+void _malloc_dbg(size_t size, int blockType, const char *filename,
+ int linenumber);
+
+void *_realloc_dbg(void *userData, size_t newSize,
+   int blockType, const char *filename, int linenumber);
+
+
+
 void myfoo(int *p);
 void myfooint(int p);
 char *fooRetPtr();
@@ -291,25 +329,37 @@
 }
 
 void CheckUseZeroAllocated6() {
+  int *p = _calloc_dbg(0, 2, 0, __FILE__, __LINE__);
+  *p = 1; // expected-warning {{Use of zero-allocated memory}}
+  free(p);
+}
+
+void CheckUseZeroAllocated7() {
   int *p = calloc(2, 0);
   *p = 1; // expected-warning {{Use of zero-allocated memory}}
   free(p);
 }
 
-void CheckUseZeroAllocated7() {
+void CheckUseZeroAllocated8() {
+  int *p = _calloc_dbg(2, 0, 0, __FILE__, __LINE__);
+  *p = 1; // expected-warning {{Use of zero-allocated memory}}
+  free(p);
+}
+
+void CheckUseZeroAllocated9() {
   int *p = realloc(0, 0);
   *p = 1; // expected-warning {{Use of zero-allocated memory}}
   free(p);
 }
 
-void CheckUseZeroAllocated8() {
+void CheckUseZeroAllocated10() {
   int *p = malloc(8);
   int *q = realloc(p, 0);
   *q = 1; // expected-warning {{Use of zero-allocated memory}}
   free(q);
 }
 
-void CheckUseZeroAllocated9() {
+void CheckUseZeroAllocated11() {
   int *p = realloc(0, 0);
   int *q = realloc(p, 0);
   *q = 1; // expected-warning {{Use of zero-allocated memory}}
@@ -690,6 +740,12 @@
   return; // expected-warning{{Potential leak of memory pointed to by 'buf'}}
 }
 
+// This tests that calloc() buffers need to be freed
+void callocNoFreeDbg () {
+  char *buf = _calloc_dbg(2,2, 0, __FILE__, __LINE__);
+  return; // expected-warning{{Potential leak of memory pointed to by 'buf'}}
+}
+
 // These test that calloc() buffers are zeroed by default
 char callocZeroesGood () {
 	char *buf = calloc(2,2);
@@ -700,6 +756,16 @@
 	return result; // no-warning
 }
 
+// These test that calloc() buffers are zeroed by default
+char callocZeroesGoodDbg () {
+	char *buf = _calloc_dbg(2,2,0, __FILE__, __LINE__);
+	char result = buf[3]; // no-warning
+	if (buf[1] == 0) {
+	  free(buf);
+	}
+	return result; // no-warning
+}
+
 char callocZeroesBad () {
 	char *buf = calloc(2,2);
 	char result = buf[3]; // no-warning
@@ -709,6 +775,15 @@
 	return result; // expected-warning{{Potential leak of memory pointed to by 'buf'}}
 }
 
+char callocZeroesBadDbg () {
+	char *buf = _calloc_dbg(2,2, 0, __FILE__, __LINE__);
+	char result = buf[3]; // no-warning
+	if (buf[1] != 0) {
+	  free(buf); // expected-warning{{never executed}}
+	}
+	return result; // expected-warning{{Potential leak of memory pointed to by 'buf'}}
+}
+
 void nullFree() {
   int *p = 0;
   free(p); // no warning - a nop
@@ -1126,6 +1201,26 @@
   s2[validIndex + 1] = 'b';
 } // expected-warning {{Potential leak of memory pointed to by}}
 
+void testWinMbsdup(const unsigned char *s, unsigned validIndex) {
+  unsigned char *s2 = _mbsdup(s);
+  s2[validIndex + 1] = 'b';
+} // expected-warning {{Potential leak of memory pointed to by}}
+
+void testWinMbsdupDbg(const unsigned char *s, unsigned validIndex) {
+  unsigned char *s2 = 

Re: [PATCH] D17482: [clang-tidy] Allow tests to verify changes made to header files

2016-03-10 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Sorry for leaving this without attention for a while.

I'm somewhat concerned about this change. It's adding a certain level of 
complexity, but doesn't cover some less trivial cases like handling of multiple 
headers. Can you take a look at existing tests and say how many times this 
feature is going to be used, if it gets added to the testing script?

Thank you!



Comment at: test/clang-tidy/check_clang_tidy.py:122
@@ -40,2 +121,3 @@
   parser.add_argument('-resource-dir')
+  parser.add_argument('--header-filter')
   parser.add_argument('input_file_name')

The name of the flag might be confusing, since it doesn't have the same meaning 
as the clang-tidy flag with the same name. The clang-tidy `--header-filter` 
flag is a regular expression, but this one is a single header filename.


http://reviews.llvm.org/D17482



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


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

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

LG. Thank you for one more awesome check!



Comment at: clang-tidy/misc/DanglingHandleCheck.cpp:25
@@ +24,3 @@
+std::vector parseClasses(StringRef Option) {
+  SmallVector Classes;
+  Option.split(Classes, HandleClassesDelimiter);

> That one is filtering the characters using isAlphanumeric.

Maybe it shouldn't ;)

Anyways, we have to converge all these, but it's not important to do it in this 
patch.


Comment at: clang-tidy/misc/DanglingHandleCheck.cpp:117
@@ +116,3 @@
+void DanglingHandleCheck::registerMatchersForVariables(MatchFinder* Finder) {
+  const auto IsAHandle = isAHandle();
+  const auto ConvertedHandle = handleFromTemporaryValue(IsAHandle);

It's fine for a follow up, if it's more convenient to you.


http://reviews.llvm.org/D17811



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


Re: [PATCH] D17360: [cfi] Fix handling of sanitize trap/recover flags in the cross-DSO CFI mode.

2016-03-10 Thread Evgeniy Stepanov via cfe-commits
eugenis closed this revision.
eugenis added a comment.

r263180, thanks for the review!


Repository:
  rL LLVM

http://reviews.llvm.org/D17360



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


r263170 - libclang python bindings: Fix for bug 26394

2016-03-10 Thread Jonathan Coe via cfe-commits
Author: jbcoe
Date: Thu Mar 10 17:29:45 2016
New Revision: 263170

URL: http://llvm.org/viewvc/llvm-project?rev=263170=rev
Log:
libclang python bindings: Fix for bug 26394

Summary:
https://llvm.org/bugs/show_bug.cgi?id=26394 reports that clang's python 
bindings tests are failing.

I can confirm that the bug exists and that the proposed fix is good.

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

Modified:
cfe/trunk/bindings/python/clang/cindex.py

Modified: cfe/trunk/bindings/python/clang/cindex.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=263170=263169=263170=diff
==
--- cfe/trunk/bindings/python/clang/cindex.py (original)
+++ cfe/trunk/bindings/python/clang/cindex.py Thu Mar 10 17:29:45 2016
@@ -2383,7 +2383,7 @@ class TranslationUnit(ClangObject):
 functions above. __init__ is only called internally.
 """
 assert isinstance(index, Index)
-
+self.index = index
 ClangObject.__init__(self, ptr)
 
 def __del__(self):


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


Re: [PATCH] D15469: Expose cxx constructor and method properties through libclang and python bindings.

2016-03-10 Thread Jonathan B Coe via cfe-commits
jbcoe added a comment.

I don't know if it's at all helpful but I get the following output from 
llvm-lit on the failing test file. There's no mention of a function `foo` at 
all:

  [startedTranslationUnit]
  [enteredMainFile]: 
/Users/jon/DEV/llvm-git-svn/tools/clang/test/Index/index-file.cpp
  [indexDeclaration]: kind: type-alias | name: MyTypeAlias | USR: 
c:@MyTypeAlias | lang: C++ | cursor: TypeAliasDecl=MyTypeAlias:1:7 (Definition) 
| loc: 1:7 | semantic-container: [TU]
  [indexDeclaration]: kind: function-template | name: Allocate | USR: 
c:@FT@>1#TAllocate | lang: C++ | cursor: FunctionDecl=Allocate:4:28 
(Definition) | loc: 4:28 | semantic-container
  [indexDeclaration]: kind: namespace | name: rdar14063074 | USR: 
c:@N@rdar14063074 | lang: C++ | cursor: Namespace=rdar14063074:8:11 
(Definition) | loc: 8:11 | semantic-container: [T
  [indexDeclaration]: kind: c++-class-template | name: TS | USR: 
c:@N@rdar14063074@ST>1#T@TS | lang: C++ | cursor: StructDecl=TS:10:8 
(Definition) | loc: 10:8 | semantic-container: [r
  [indexDeclaration]: kind: struct-template-spec | name: TS | USR: 
c:@N@rdar14063074@S@TS>#I | lang: C++ | cursor: StructDecl=TS:11:8 (Definition) 
[Specialization of TS:10:8] | loc: 1
  [indexDeclaration]: kind: function-template | name: tfoo | USR: 
c:@N@rdar14063074@FT@>1#Ttfoo#v# | lang: C++ | cursor: FunctionDecl=tfoo:14:6 
(Definition) | loc: 14:6 | semantic-con
  [indexDeclaration]: kind: function-template-spec | name: tfoo | USR: 
c:@N@rdar14063074@F@tfoo<#I># | lang: C++ | cursor: FunctionDecl=tfoo:15:6 
(Definition) [Specialization of tfoo:
  [indexDeclaration]: kind: namespace | name: crash1 | USR: c:@N@crash1 | lang: 
C++ | cursor: Namespace=crash1:18:11 (Definition) | loc: 18:11 | 
semantic-container: [TU] | lexical-con
  [indexDeclaration]: kind: c++-class-template | name: A | USR: 
c:@N@crash1@ST>1#T@A | lang: C++ | cursor: ClassDecl=A:19:28 (Definition) | 
loc: 19:28 | semantic-container: [crash1:18
  [indexDeclaration]: kind: c++-instance-method | name: meth | USR: 
c:@N@crash1@ST>1#T@A@F@meth# | lang: C++ | cursor: CXXMethod=meth:21:8 | loc: 
21:8 | semantic-container: [A:19:28] 
  [indexDeclaration]: kind: c++-instance-method | name: meth | USR: 
c:@N@crash1@S@A>#I@F@meth# | lang: C++ | cursor: CXXMethod=meth:23:26 
[Specialization of meth:21:8] | loc: 23:26 | 
  [indexEntityReference]: kind: c++-class-template | name: A | USR: 
c:@N@crash1@ST>1#T@A | lang: C++ | cursor: TemplateRef=A:19:28 | loc: 23:18 | 
:: kind: c++-instance-method 
  [indexDeclaration]: kind: c++-class | name: B | USR: c:@S@B | lang: C++ | 
cursor: ClassDecl=B:27:7 (Definition) | loc: 27:7 | semantic-container: [TU] | 
lexical-container: [TU] | is
  [indexDeclaration]: kind: field | name: x_ | USR: c:@S@B@FI@x_ | lang: C++ | 
cursor: FieldDecl=x_:28:15 (Definition) (mutable) | loc: 28:15 | 
semantic-container: [B:27:7] | lexical-
  [indexDeclaration]: kind: field | name: y_ | USR: c:@S@B@FI@y_ | lang: C++ | 
cursor: FieldDecl=y_:29:7 (Definition) | loc: 29:7 | semantic-container: 
[B:27:7] | lexical-container: [
  [indexDeclaration]: kind: constructor | name: B | USR: c:@S@B@F@B# | lang: 
C++ | cursor: CXXConstructor=B:31:3 (default constructor) (defaulted) | loc: 
31:3 | semantic-container: [B
  [indexDeclaration]: kind: constructor | name: B | USR: c:@S@B@F@B#I# | lang: 
C++ | cursor: CXXConstructor=B:32:3 (converting constructor) | loc: 32:3 | 
semantic-container: [B:27:7] 
  [indexDeclaration]: kind: constructor | name: B | USR: c:@S@B@F@B#d# | lang: 
C++ | cursor: CXXConstructor=B:33:12 | loc: 33:12 | semantic-container: 
[B:27:7] | lexical-container: [B
  [indexDeclaration]: kind: constructor | name: B | USR: c:@S@B@F@B#&1$@S@B# | 
lang: C++ | cursor: CXXConstructor=B:34:3 (copy constructor) (converting 
constructor) | loc: 34:3 | sema
  [indexEntityReference]: kind: c++-class | name: B | USR: c:@S@B | lang: C++ | 
cursor: TypeRef=class B:27:7 | loc: 34:11 | :: kind: constructor | 
name: B | USR: c:@S@B@F@B#&1
  [indexDeclaration]: kind: constructor | name: B | USR: c:@S@B@F@B#&&$@S@B# | 
lang: C++ | cursor: CXXConstructor=B:35:3 (move constructor) (converting 
constructor) | loc: 35:3 | sema
  [indexEntityReference]: kind: c++-class | name: B | USR: c:@S@B | lang: C++ | 
cursor: TypeRef=class B:27:7 | loc: 35:5 | :: kind: constructor | name: 
B | USR: c:@S@B@F@B#&&$
  [indexDeclaration]: kind: c++-class | name: C | USR: c:@S@C | lang: C++ | 
cursor: ClassDecl=C:39:7 (Definition) | loc: 39:7 | semantic-container: [TU] | 
lexical-container: [TU] | is
  [indexDeclaration]: kind: constructor | name: C | USR: c:@S@C@F@C#&1$@S@C# | 
lang: C++ | cursor: CXXConstructor=C:40:12 (copy constructor) | loc: 40:12 | 
semantic-container: [C:39:7
  [indexEntityReference]: kind: c++-class | name: C | USR: c:@S@C | lang: C++ | 
cursor: TypeRef=class C:39:7 | loc: 40:20 | :: kind: constructor | 
name: C | USR: c:@S@C@F@C#&1
  [diagnostic]: 

Re: [PATCH] D18051: [CUDA] Provide CUDA's vector types implemented using clang's vector extension.

2016-03-10 Thread Hal Finkel via cfe-commits
[+Richard] 

- Original Message -

> From: "Artem Belevich" 
> To: reviews+d18051+public+fb9c7f3f37ff8...@reviews.llvm.org
> Cc: "Justin Lebar" , "Jingyue Wu"
> , "Hal Finkel" , "cfe-commits"
> 
> Sent: Thursday, March 10, 2016 6:38:21 PM
> Subject: Re: [PATCH] D18051: [CUDA] Provide CUDA's vector types
> implemented using clang's vector extension.

> There were ambiguities in overload resolution between vector types
> and their base types. I.e. if I had

> void foo(int);
> void foo(int3);

> then call foo(3) was ambiguous.
> It wasn't clear whether this extension is supposed to work in C++ at
> all.

I'm pretty sure that the vector types are supposed to work in C++, and they 
have different manglings, so that behavior seems like either bug or a missing 
desirable feature. Richard, what do you think? 

Thanks again, 
Hal 

> On Thu, Mar 10, 2016 at 4:05 PM, Hal Finkel < hfin...@anl.gov >
> wrote:

> > hfinkel added a subscriber: hfinkel.
> 
> > hfinkel added a comment.
> 

> > In http://reviews.llvm.org/D18051#372490 , @tra wrote:
> 

> > > Ugh. Found more problems with using vector types in C++.
> > > Abandoning
> > > the idea.
> 

> > I'm curious, what problems?
> 

> > http://reviews.llvm.org/D18051
> 

> --

> --Artem Belevich
-- 

Hal Finkel 
Assistant Computational Scientist 
Leadership Computing Facility 
Argonne National Laboratory 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18051: [CUDA] Provide CUDA's vector types implemented using clang's vector extension.

2016-03-10 Thread Artem Belevich via cfe-commits
There were ambiguities in overload resolution between vector types and
their base types. I.e. if I had

void foo(int);
void foo(int3);

then call foo(3) was ambiguous.
It wasn't clear whether this extension is supposed to work in C++ at all.





On Thu, Mar 10, 2016 at 4:05 PM, Hal Finkel  wrote:

> hfinkel added a subscriber: hfinkel.
> hfinkel added a comment.
>
> In http://reviews.llvm.org/D18051#372490, @tra wrote:
>
> > Ugh. Found more problems with using vector types in C++. Abandoning the
> idea.
>
>
> I'm curious, what problems?
>
>
> http://reviews.llvm.org/D18051
>
>
>
>


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


Re: [PATCH] D15469: Expose cxx constructor and method properties through libclang and python bindings.

2016-03-10 Thread Jonathan B Coe via cfe-commits
jbcoe added a comment.

@skalinichev I get the same failure as you. This patch is old now, all tests 
used to pass. Can you see what is wrong with the test logic?


http://reviews.llvm.org/D15469



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


Re: r262851 - Module Debugging: Fix a crash when emitting debug info for nested tag types

2016-03-10 Thread David Blaikie via cfe-commits
Not sure if it's worth it, but you might be able to abort the loop if you
ever reach a namespace (or anything that's not a tag decl maybe? Not sure
about function local types)

On Thu, Mar 10, 2016 at 4:09 PM, Adrian Prantl  wrote:

>
> On Mar 10, 2016, at 3:21 PM, David Blaikie  wrote:
>
> OK, so the idea is that when you see that a tag definition, skip it if any
> parent is incomplete - because when the parent's definition is complete,
> you'll emit all its children anyway?
>
>
> Yes. If there’s a more direct way top achieve this without walking the
> declcontext, that would be even better of course.
>
> -- adrian
>
>
> On Thu, Mar 10, 2016 at 8:19 AM, Adrian Prantl  wrote:
>
>>
>> > On Mar 9, 2016, at 5:22 PM, David Blaikie  wrote:
>> >
>> > Is this bug only reachable with modules debug info?
>>
>> Yes, it’s in ObjectFilePCHContainerOperations.cpp, which is only used
>> while building a PCH or module with -gmodules.
>>
>> > Could you describe the nature of the fix (not quite clear to me just by
>> looking at it)
>>
>> In the ASTConsumer callback for a finished TagDecl, we check whether the
>> DeclContext is complete and only try to emit debug info for the Decl if the
>> DeclContext is available.
>>
>> -- adrian
>>
>> >
>> > On Mon, Mar 7, 2016 at 12:58 PM, Adrian Prantl via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>> > Author: adrian
>> > Date: Mon Mar  7 14:58:52 2016
>> > New Revision: 262851
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=262851=rev
>> > Log:
>> > Module Debugging: Fix a crash when emitting debug info for nested tag
>> types
>> > whose DeclContext is not yet complete by deferring their emission.
>> >
>> > rdar://problem/24918680
>> >
>> > Modified:
>> > cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>> > cfe/trunk/test/Modules/Inputs/DebugCXX.h
>> > cfe/trunk/test/Modules/ModuleDebugInfo.cpp
>> >
>> > Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=262851=262850=262851=diff
>> >
>> ==
>> > --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
>> (original)
>> > +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Mar
>> 7 14:58:52 2016
>> > @@ -201,6 +201,15 @@ public:
>> >  if (D->getName().empty())
>> >return;
>> >
>> > +// Defer tag decls until their declcontext is complete.
>> > +auto *DeclCtx = D->getDeclContext();
>> > +while (DeclCtx) {
>> > +  if (auto *D = dyn_cast(DeclCtx))
>> > +if (!D->isCompleteDefinition())
>> > +  return;
>> > +  DeclCtx = DeclCtx->getParent();
>> > +}
>> > +
>> >  DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx);
>> >  DTV.TraverseDecl(D);
>> >  Builder->UpdateCompletedType(D);
>> >
>> > Modified: cfe/trunk/test/Modules/Inputs/DebugCXX.h
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugCXX.h?rev=262851=262850=262851=diff
>> >
>> ==
>> > --- cfe/trunk/test/Modules/Inputs/DebugCXX.h (original)
>> > +++ cfe/trunk/test/Modules/Inputs/DebugCXX.h Mon Mar  7 14:58:52 2016
>> > @@ -72,3 +72,14 @@ namespace {
>> >  struct InAnonymousNamespace { int i; };
>> >}
>> >  }
>> > +
>> > +class Base;
>> > +class A {
>> > +  virtual Base *getParent() const;
>> > +};
>> > +class Base {};
>> > +class Derived : Base {
>> > +  class B : A {
>> > +Derived *getParent() const override;
>> > +  };
>> > +};
>> >
>> > Modified: cfe/trunk/test/Modules/ModuleDebugInfo.cpp
>> > URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=262851=262850=262851=diff
>> >
>> ==
>> > --- cfe/trunk/test/Modules/ModuleDebugInfo.cpp (original)
>> > +++ cfe/trunk/test/Modules/ModuleDebugInfo.cpp Mon Mar  7 14:58:52 2016
>> > @@ -71,6 +71,13 @@
>> >  // CHECK-NOT:  name:
>> >  // CHECK-SAME: identifier: "_ZTS13TypedefStruct")
>> >
>> > +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "Derived",
>> > +// CHECK-SAME: identifier: "_ZTS7Derived")
>> > +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "B", scope:
>> !"_ZTS7Derived",
>> > +// CHECK-SAME: elements: ![[B_MBRS:.*]], vtableHolder:
>> !"_ZTS1A"
>> > +// CHECK: ![[B_MBRS]] = !{{{.*}}, ![[GET_PARENT:.*]]}
>> > +// CHECK: ![[GET_PARENT]] = !DISubprogram(name: "getParent"
>> > +
>> >  // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstatiation"
>> >  // no mangled name here yet.
>> >
>> >
>> >
>> > ___
>> > cfe-commits mailing list
>> > cfe-commits@lists.llvm.org
>> > 

Re: [PATCH] D17865: Add an optional string argument to DeprecatedAttr for Fix-It.

2016-03-10 Thread Manman Ren via cfe-commits
manmanren added inline comments.


Comment at: utils/TableGen/ClangAttrEmitter.cpp:1234
@@ +1233,3 @@
+if ((Spelling == "deprecated" || Spelling == "gnu::deprecated") &&
+Variety != "GNU" && index == 1)
+  continue;

This does not look pretty. Maybe we can implement a function 
writeDeprecatedValue that can skip the second argument if it is empty?


http://reviews.llvm.org/D17865



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


Re: [PATCH] D17865: Add an optional string argument to DeprecatedAttr for Fix-It.

2016-03-10 Thread Manman Ren via cfe-commits
manmanren retitled this revision from "Add replacement = "xxx" to 
DeprecatedAttr." to "Add an optional string argument to DeprecatedAttr for 
Fix-It.".
manmanren updated this revision to Diff 50374.

http://reviews.llvm.org/D17865

Files:
  include/clang/Basic/Attr.td
  lib/Lex/PPMacroExpansion.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/SemaCXX/attr-deprecated-replacement-error.cpp
  test/SemaCXX/attr-deprecated-replacement-fixit.cpp
  test/SemaCXX/cxx11-attr-print.cpp
  utils/TableGen/ClangAttrEmitter.cpp

Index: utils/TableGen/ClangAttrEmitter.cpp
===
--- utils/TableGen/ClangAttrEmitter.cpp
+++ utils/TableGen/ClangAttrEmitter.cpp
@@ -1228,6 +1228,11 @@
   unsigned index = 0;
   for (const auto  : Args) {
 if (arg->isFake()) continue;
+// Only GNU deprecated has an optional fixit argument at the second
+// position.
+if ((Spelling == "deprecated" || Spelling == "gnu::deprecated") &&
+Variety != "GNU" && index == 1)
+  continue;
 if (index++) OS << ", ";
 arg->writeValue(OS);
   }
Index: test/SemaCXX/cxx11-attr-print.cpp
===
--- test/SemaCXX/cxx11-attr-print.cpp
+++ test/SemaCXX/cxx11-attr-print.cpp
@@ -10,12 +10,18 @@
 // 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")]];
 int b [[gnu::deprecated("warning")]];
 
+// CHECK: __attribute__((deprecated("", "")));
+int c __attribute__((deprecated));
+
+// CHECK: int d {{\[}}[deprecated("warning")]];
+int d [[deprecated("warning")]];
+
 // CHECK: int cxx11_alignas alignas(4);
 alignas(4) int cxx11_alignas;
 
Index: test/SemaCXX/attr-deprecated-replacement-fixit.cpp
===
--- test/SemaCXX/attr-deprecated-replacement-fixit.cpp
+++ test/SemaCXX/attr-deprecated-replacement-fixit.cpp
@@ -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("message", "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: test/SemaCXX/attr-deprecated-replacement-error.cpp
===
--- test/SemaCXX/attr-deprecated-replacement-error.cpp
+++ test/SemaCXX/attr-deprecated-replacement-error.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -verify -fsyntax-only -std=c++11 -fms-extensions %s
+
+#if !__has_feature(attribute_deprecated_with_replacement)
+#error "Missing __has_feature"
+#endif
+
+int a1 [[deprecated("warning", "fixit")]]; // expected-error{{'deprecated' attribute takes no more than 1 argument}}
+int a2 [[deprecated("warning", 1)]]; // expected-error{{'deprecated' attribute takes no more than 1 argument}}
+
+int b1 [[gnu::deprecated("warning", "fixit")]]; // expected-error{{'deprecated' attribute takes no more than 1 argument}}
+int b2 [[gnu::deprecated("warning", 1)]]; // expected-error{{'deprecated' attribute takes no more than 1 argument}}
+
+__declspec(deprecated("warning", "fixit")) int c1; // expected-error{{'deprecated' attribute takes no more than 1 argument}}
+__declspec(deprecated("warning", 1)) int c2; // expected-error{{'deprecated' attribute takes no more than 1 argument}}
+
+int d1 __attribute__((deprecated("warning", "fixit")));
+int d2 __attribute__((deprecated("warning", 1))); // expected-error{{'deprecated' attribute requires a string}}
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -5127,12 +5127,27 @@
 }
   }
 
+  // Handle the cases where the attribute has a text message.
+  StringRef Str, Replacement;
+  if (Attr.isArgExpr(0) && Attr.getArgAsExpr(0) &&
+  !S.checkStringLiteralArgumentAttr(Attr, 0, Str))
+return;
+
+  // Only support a single optional message for Declspec and CXX11.
+  if (Attr.isDeclspecAttribute() || Attr.isCXX11Attribute())
+checkAttributeAtMostNumArgs(S, Attr, 1);
+  else if (Attr.isArgExpr(1) && Attr.getArgAsExpr(1) &&
+   !S.checkStringLiteralArgumentAttr(Attr, 1, Replacement))
+return;
+
+  D->addAttr(::new (S.Context) 

r263175 - Add doxygen comments to avxintrin.h's intrinsics.

2016-03-10 Thread Ekaterina Romanova via cfe-commits
Author: kromanova
Date: Thu Mar 10 18:05:54 2016
New Revision: 263175

URL: http://llvm.org/viewvc/llvm-project?rev=263175=rev
Log:
Add doxygen comments to avxintrin.h's intrinsics.
Only around 25% of the intrinsics in this file are documented here. The patches 
for the other half will be sent out later.

The doxygen comments are automatically generated based on Sony's intrinsics 
document.

I got an OK from Eric Christopher to commit doxygen comments without prior code 
review upstream.


Modified:
cfe/trunk/lib/Headers/avxintrin.h

Modified: cfe/trunk/lib/Headers/avxintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avxintrin.h?rev=263175=263174=263175=diff
==
--- cfe/trunk/lib/Headers/avxintrin.h (original)
+++ cfe/trunk/lib/Headers/avxintrin.h Thu Mar 10 18:05:54 2016
@@ -47,168 +47,610 @@ typedef long long __m256i __attribute__(
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("avx")))
 
 /* Arithmetic */
+/// \brief Adds two 256-bit vectors of [4 x double].
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VADDPD / ADDPD instruction.
+///
+/// \param __a
+///A 256-bit vector of [4 x double] containing one of the source operands.
+/// \param __b
+///A 256-bit vector of [4 x double] containing one of the source operands.
+/// \returns A 256-bit vector of [4 x double] containing the sums of both
+///operands.
 static __inline __m256d __DEFAULT_FN_ATTRS
 _mm256_add_pd(__m256d __a, __m256d __b)
 {
   return __a+__b;
 }
 
+/// \brief Adds two 256-bit vectors of [8 x float].
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VADDPS / ADDPS instruction.
+///
+/// \param __a
+///A 256-bit vector of [8 x float] containing one of the source operands.
+/// \param __b
+///A 256-bit vector of [8 x float] containing one of the source operands.
+/// \returns A 256-bit vector of [8 x float] containing the sums of both
+///operands.
 static __inline __m256 __DEFAULT_FN_ATTRS
 _mm256_add_ps(__m256 __a, __m256 __b)
 {
   return __a+__b;
 }
 
+/// \brief Subtracts two 256-bit vectors of [4 x double].
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VSUBPD / SUBPD instruction.
+///
+/// \param __a
+///A 256-bit vector of [4 x double] containing the minuend.
+/// \param __b
+///A 256-bit vector of [4 x double] containing the subtrahend.
+/// \returns A 256-bit vector of [4 x double] containing the differences 
between
+///both operands.
 static __inline __m256d __DEFAULT_FN_ATTRS
 _mm256_sub_pd(__m256d __a, __m256d __b)
 {
   return __a-__b;
 }
 
+/// \brief Subtracts two 256-bit vectors of [8 x float].
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VSUBPS / SUBPS instruction.
+///
+/// \param __a
+///A 256-bit vector of [8 x float] containing the minuend.
+/// \param __b
+///A 256-bit vector of [8 x float] containing the subtrahend.
+/// \returns A 256-bit vector of [8 x float] containing the differences between
+///both operands.
 static __inline __m256 __DEFAULT_FN_ATTRS
 _mm256_sub_ps(__m256 __a, __m256 __b)
 {
   return __a-__b;
 }
 
+/// \brief Adds the even-indexed values and subtracts the odd-indexed values of
+///two 256-bit vectors of [4 x double].
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VADDSUBPD / ADDSUBPD instruction.
+///
+/// \param __a
+///A 256-bit vector of [4 x double] containing the left source operand.
+/// \param __b
+///A 256-bit vector of [4 x double] containing the right source operand.
+/// \returns A 256-bit vector of [4 x double] containing the alternating sums
+///and differences between both operands.
 static __inline __m256d __DEFAULT_FN_ATTRS
 _mm256_addsub_pd(__m256d __a, __m256d __b)
 {
   return (__m256d)__builtin_ia32_addsubpd256((__v4df)__a, (__v4df)__b);
 }
 
+/// \brief Adds the even-indexed values and subtracts the odd-indexed values of
+///two 256-bit vectors of [8 x float].
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VADDSUBPS / ADDSUBPS instruction.
+///
+/// \param __a
+///A 256-bit vector of [8 x float] containing the left source operand.
+/// \param __b
+///A 256-bit vector of [8 x float] containing the right source operand.
+/// \returns A 256-bit vector of [8 x float] containing the alternating sums 
and
+///differences between both operands.
 static __inline __m256 __DEFAULT_FN_ATTRS
 _mm256_addsub_ps(__m256 __a, __m256 __b)
 {
   return (__m256)__builtin_ia32_addsubps256((__v8sf)__a, (__v8sf)__b);
 }
 
+/// \brief Divides two 256-bit vectors of [4 x double].
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c VDIVPD / DIVPD instruction.
+///
+/// \param __a
+///A 256-bit vector of [4 x double] containing the dividend.
+/// \param __b
+///A 256-bit vector of [4 x double] containing the divisor.

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

2016-03-10 Thread Manman Ren via cfe-commits
manmanren added a comment.

Uploading a new patch addressing Aaron's comments:
1> Add an optional string argument for fix-it, instead of the original proposal 
of named argument `Replacement = "xxx"`
This actually simplifies the patch a lot
2> Add testing cases to make sure we don't accept a fix-it argument for 
declspec, c++11 attribute, gnu namespace attribute
3> Change AST printing to make sure we only dump the fix-it argument for gnu 
style attribute

Cheers,
Manman


http://reviews.llvm.org/D17865



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


Re: r262851 - Module Debugging: Fix a crash when emitting debug info for nested tag types

2016-03-10 Thread Adrian Prantl via cfe-commits

> On Mar 10, 2016, at 3:21 PM, David Blaikie  wrote:
> 
> OK, so the idea is that when you see that a tag definition, skip it if any 
> parent is incomplete - because when the parent's definition is complete, 
> you'll emit all its children anyway?

Yes. If there’s a more direct way top achieve this without walking the 
declcontext, that would be even better of course.

-- adrian
> 
> On Thu, Mar 10, 2016 at 8:19 AM, Adrian Prantl  > wrote:
> 
> > On Mar 9, 2016, at 5:22 PM, David Blaikie  > > wrote:
> >
> > Is this bug only reachable with modules debug info?
> 
> Yes, it’s in ObjectFilePCHContainerOperations.cpp, which is only used while 
> building a PCH or module with -gmodules.
> 
> > Could you describe the nature of the fix (not quite clear to me just by 
> > looking at it)
> 
> In the ASTConsumer callback for a finished TagDecl, we check whether the 
> DeclContext is complete and only try to emit debug info for the Decl if the 
> DeclContext is available.
> 
> -- adrian
> 
> >
> > On Mon, Mar 7, 2016 at 12:58 PM, Adrian Prantl via cfe-commits 
> > > wrote:
> > Author: adrian
> > Date: Mon Mar  7 14:58:52 2016
> > New Revision: 262851
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=262851=rev 
> > 
> > Log:
> > Module Debugging: Fix a crash when emitting debug info for nested tag types
> > whose DeclContext is not yet complete by deferring their emission.
> >
> > rdar://problem/24918680
> >
> > Modified:
> > cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
> > cfe/trunk/test/Modules/Inputs/DebugCXX.h
> > cfe/trunk/test/Modules/ModuleDebugInfo.cpp
> >
> > Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
> > URL: 
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=262851=262850=262851=diff
> >  
> > 
> > ==
> > --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Mar  7 
> > 14:58:52 2016
> > @@ -201,6 +201,15 @@ public:
> >  if (D->getName().empty())
> >return;
> >
> > +// Defer tag decls until their declcontext is complete.
> > +auto *DeclCtx = D->getDeclContext();
> > +while (DeclCtx) {
> > +  if (auto *D = dyn_cast(DeclCtx))
> > +if (!D->isCompleteDefinition())
> > +  return;
> > +  DeclCtx = DeclCtx->getParent();
> > +}
> > +
> >  DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx);
> >  DTV.TraverseDecl(D);
> >  Builder->UpdateCompletedType(D);
> >
> > Modified: cfe/trunk/test/Modules/Inputs/DebugCXX.h
> > URL: 
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugCXX.h?rev=262851=262850=262851=diff
> >  
> > 
> > ==
> > --- cfe/trunk/test/Modules/Inputs/DebugCXX.h (original)
> > +++ cfe/trunk/test/Modules/Inputs/DebugCXX.h Mon Mar  7 14:58:52 2016
> > @@ -72,3 +72,14 @@ namespace {
> >  struct InAnonymousNamespace { int i; };
> >}
> >  }
> > +
> > +class Base;
> > +class A {
> > +  virtual Base *getParent() const;
> > +};
> > +class Base {};
> > +class Derived : Base {
> > +  class B : A {
> > +Derived *getParent() const override;
> > +  };
> > +};
> >
> > Modified: cfe/trunk/test/Modules/ModuleDebugInfo.cpp
> > URL: 
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=262851=262850=262851=diff
> >  
> > 
> > ==
> > --- cfe/trunk/test/Modules/ModuleDebugInfo.cpp (original)
> > +++ cfe/trunk/test/Modules/ModuleDebugInfo.cpp Mon Mar  7 14:58:52 2016
> > @@ -71,6 +71,13 @@
> >  // CHECK-NOT:  name:
> >  // CHECK-SAME: identifier: "_ZTS13TypedefStruct")
> >
> > +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "Derived",
> > +// CHECK-SAME: identifier: "_ZTS7Derived")
> > +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "B", scope: 
> > !"_ZTS7Derived",
> > +// CHECK-SAME: elements: ![[B_MBRS:.*]], vtableHolder: 
> > !"_ZTS1A"
> > +// CHECK: ![[B_MBRS]] = !{{{.*}}, ![[GET_PARENT:.*]]}
> > +// CHECK: ![[GET_PARENT]] = !DISubprogram(name: "getParent"
> > +
> >  // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: 

Re: [PATCH] D18051: [CUDA] Provide CUDA's vector types implemented using clang's vector extension.

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

In http://reviews.llvm.org/D18051#372490, @tra wrote:

> Ugh. Found more problems with using vector types in C++. Abandoning the idea.


I'm curious, what problems?


http://reviews.llvm.org/D18051



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


r263172 - Print strict in Availability attribute when it is on.

2016-03-10 Thread Manman Ren via cfe-commits
Author: mren
Date: Thu Mar 10 17:54:12 2016
New Revision: 263172

URL: http://llvm.org/viewvc/llvm-project?rev=263172=rev
Log:
Print strict in Availability attribute when it is on.

Modified:
cfe/trunk/test/Sema/attr-print.c
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/test/Sema/attr-print.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-print.c?rev=263172=263171=263172=diff
==
--- cfe/trunk/test/Sema/attr-print.c (original)
+++ cfe/trunk/test/Sema/attr-print.c Thu Mar 10 17:54:12 2016
@@ -32,3 +32,6 @@ int * __uptr __ptr32 p32_3;
 
 // CHECK: int * __sptr * __ptr32 ppsp32;
 int * __sptr * __ptr32 ppsp32;
+
+// CHECK: __attribute__((availability(macosx, strict, introduced=10.6)));
+void f6(int) __attribute__((availability(macosx,strict,introduced=10.6)));

Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=263172=263171=263172=diff
==
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Thu Mar 10 17:54:12 2016
@@ -1103,6 +1103,7 @@ createArgument(const Record , String
 
 static void writeAvailabilityValue(raw_ostream ) {
   OS << "\" << getPlatform()->getName();\n"
+ << "  if (getStrict()) OS << \", strict\";\n"
  << "  if (!getIntroduced().empty()) OS << \", introduced=\" << 
getIntroduced();\n"
  << "  if (!getDeprecated().empty()) OS << \", deprecated=\" << 
getDeprecated();\n"
  << "  if (!getObsoleted().empty()) OS << \", obsoleted=\" << 
getObsoleted();\n"


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


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

2016-03-10 Thread Jonathan B Coe via cfe-commits
jbcoe added inline comments.


Comment at: test/clang-tidy/misc-dangling-handle.cpp:86
@@ +85,3 @@
+  // CHECK-MESSAGES: [[@LINE-1]]:20: warning: std::basic_string_view outlives
+
+  view1 = std::string();

Thanks.


http://reviews.llvm.org/D17811



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


r263171 - Add has_feature objc_class_property.

2016-03-10 Thread Manman Ren via cfe-commits
Author: mren
Date: Thu Mar 10 17:51:03 2016
New Revision: 263171

URL: http://llvm.org/viewvc/llvm-project?rev=263171=rev
Log:
Add has_feature objc_class_property.

rdar://23891898

Modified:
cfe/trunk/lib/Lex/PPMacroExpansion.cpp
cfe/trunk/test/SemaObjC/objc-class-property.m

Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=263171=263170=263171=diff
==
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Thu Mar 10 17:51:03 2016
@@ -1127,6 +1127,7 @@ static bool HasFeature(const Preprocesso
   .Case("objc_bridge_id_on_typedefs", true)
   .Case("objc_generics", LangOpts.ObjC2)
   .Case("objc_generics_variance", LangOpts.ObjC2)
+  .Case("objc_class_property", LangOpts.ObjC2)
   // C11 features
   .Case("c_alignas", LangOpts.C11)
   .Case("c_alignof", LangOpts.C11)

Modified: cfe/trunk/test/SemaObjC/objc-class-property.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/objc-class-property.m?rev=263171=263170=263171=diff
==
--- cfe/trunk/test/SemaObjC/objc-class-property.m (original)
+++ cfe/trunk/test/SemaObjC/objc-class-property.m Thu Mar 10 17:51:03 2016
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 
+#if !__has_feature(objc_class_property)
+#error does not support class property
+#endif
+
 @interface Root
 -(id) alloc;
 -(id) init;


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


Re: [PATCH] D17226: libclang python bindings: Fix for bug 26394

2016-03-10 Thread Jonathan B Coe via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL263170: libclang python bindings: Fix for bug 26394 
(authored by jbcoe).

Changed prior to commit:
  http://reviews.llvm.org/D17226?vs=47874=50369#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17226

Files:
  cfe/trunk/bindings/python/clang/cindex.py

Index: cfe/trunk/bindings/python/clang/cindex.py
===
--- cfe/trunk/bindings/python/clang/cindex.py
+++ cfe/trunk/bindings/python/clang/cindex.py
@@ -2383,7 +2383,7 @@
 functions above. __init__ is only called internally.
 """
 assert isinstance(index, Index)
-
+self.index = index
 ClangObject.__init__(self, ptr)
 
 def __del__(self):


Index: cfe/trunk/bindings/python/clang/cindex.py
===
--- cfe/trunk/bindings/python/clang/cindex.py
+++ cfe/trunk/bindings/python/clang/cindex.py
@@ -2383,7 +2383,7 @@
 functions above. __init__ is only called internally.
 """
 assert isinstance(index, Index)
-
+self.index = index
 ClangObject.__init__(self, ptr)
 
 def __del__(self):
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r262851 - Module Debugging: Fix a crash when emitting debug info for nested tag types

2016-03-10 Thread David Blaikie via cfe-commits
OK, so the idea is that when you see that a tag definition, skip it if any
parent is incomplete - because when the parent's definition is complete,
you'll emit all its children anyway?

On Thu, Mar 10, 2016 at 8:19 AM, Adrian Prantl  wrote:

>
> > On Mar 9, 2016, at 5:22 PM, David Blaikie  wrote:
> >
> > Is this bug only reachable with modules debug info?
>
> Yes, it’s in ObjectFilePCHContainerOperations.cpp, which is only used
> while building a PCH or module with -gmodules.
>
> > Could you describe the nature of the fix (not quite clear to me just by
> looking at it)
>
> In the ASTConsumer callback for a finished TagDecl, we check whether the
> DeclContext is complete and only try to emit debug info for the Decl if the
> DeclContext is available.
>
> -- adrian
>
> >
> > On Mon, Mar 7, 2016 at 12:58 PM, Adrian Prantl via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> > Author: adrian
> > Date: Mon Mar  7 14:58:52 2016
> > New Revision: 262851
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=262851=rev
> > Log:
> > Module Debugging: Fix a crash when emitting debug info for nested tag
> types
> > whose DeclContext is not yet complete by deferring their emission.
> >
> > rdar://problem/24918680
> >
> > Modified:
> > cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
> > cfe/trunk/test/Modules/Inputs/DebugCXX.h
> > cfe/trunk/test/Modules/ModuleDebugInfo.cpp
> >
> > Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=262851=262850=262851=diff
> >
> ==
> > --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Mar
> 7 14:58:52 2016
> > @@ -201,6 +201,15 @@ public:
> >  if (D->getName().empty())
> >return;
> >
> > +// Defer tag decls until their declcontext is complete.
> > +auto *DeclCtx = D->getDeclContext();
> > +while (DeclCtx) {
> > +  if (auto *D = dyn_cast(DeclCtx))
> > +if (!D->isCompleteDefinition())
> > +  return;
> > +  DeclCtx = DeclCtx->getParent();
> > +}
> > +
> >  DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx);
> >  DTV.TraverseDecl(D);
> >  Builder->UpdateCompletedType(D);
> >
> > Modified: cfe/trunk/test/Modules/Inputs/DebugCXX.h
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugCXX.h?rev=262851=262850=262851=diff
> >
> ==
> > --- cfe/trunk/test/Modules/Inputs/DebugCXX.h (original)
> > +++ cfe/trunk/test/Modules/Inputs/DebugCXX.h Mon Mar  7 14:58:52 2016
> > @@ -72,3 +72,14 @@ namespace {
> >  struct InAnonymousNamespace { int i; };
> >}
> >  }
> > +
> > +class Base;
> > +class A {
> > +  virtual Base *getParent() const;
> > +};
> > +class Base {};
> > +class Derived : Base {
> > +  class B : A {
> > +Derived *getParent() const override;
> > +  };
> > +};
> >
> > Modified: cfe/trunk/test/Modules/ModuleDebugInfo.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=262851=262850=262851=diff
> >
> ==
> > --- cfe/trunk/test/Modules/ModuleDebugInfo.cpp (original)
> > +++ cfe/trunk/test/Modules/ModuleDebugInfo.cpp Mon Mar  7 14:58:52 2016
> > @@ -71,6 +71,13 @@
> >  // CHECK-NOT:  name:
> >  // CHECK-SAME: identifier: "_ZTS13TypedefStruct")
> >
> > +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "Derived",
> > +// CHECK-SAME: identifier: "_ZTS7Derived")
> > +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "B", scope:
> !"_ZTS7Derived",
> > +// CHECK-SAME: elements: ![[B_MBRS:.*]], vtableHolder:
> !"_ZTS1A"
> > +// CHECK: ![[B_MBRS]] = !{{{.*}}, ![[GET_PARENT:.*]]}
> > +// CHECK: ![[GET_PARENT]] = !DISubprogram(name: "getParent"
> > +
> >  // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstatiation"
> >  // no mangled name here yet.
> >
> >
> >
> > ___
> > 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] D18051: [CUDA] Provide CUDA's vector types implemented using clang's vector extension.

2016-03-10 Thread Artem Belevich via cfe-commits
tra abandoned this revision.
tra added a comment.

Ugh. Found more problems with using vector types in C++. Abandoning the idea.


http://reviews.llvm.org/D18051



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


r263168 - Reenable asm-errors.c

2016-03-10 Thread Nico Weber via cfe-commits
Author: nico
Date: Thu Mar 10 16:40:02 2016
New Revision: 263168

URL: http://llvm.org/viewvc/llvm-project?rev=263168=rev
Log:
Reenable asm-errors.c

r134811 made the test pass and reenabled it, but r134831
accidentally disabled it again due to a bad merge.

Modified:
cfe/trunk/test/CodeGen/asm-errors.c

Modified: cfe/trunk/test/CodeGen/asm-errors.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/asm-errors.c?rev=263168=263167=263168=diff
==
--- cfe/trunk/test/CodeGen/asm-errors.c (original)
+++ cfe/trunk/test/CodeGen/asm-errors.c Thu Mar 10 16:40:02 2016
@@ -1,8 +1,7 @@
 // REQUIRES: x86-registered-target
 
-// RUN: true
-// UN: not %clang_cc1 -triple i386-apple-darwin10 -emit-obj %s -o /dev/null > 
%t 2>&1
-// UN: FileCheck %s < %t
+// RUN: not %clang_cc1 -triple i386-apple-darwin10 -emit-obj %s -o /dev/null > 
%t 2>&1
+// RUN: FileCheck %s < %t
 // RUN: %clang_cc1 -triple i386-apple-darwin10 -emit-llvm-bc %s -o %t.bc
 // RUN: %clang_cc1 -triple i386-apple-darwin10 -emit-obj %t.bc -o /dev/null 
2>&1 | \
 // RUN:   FileCheck --check-prefix=CRASH-REPORT %s


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


Re: [PATCH] D17360: [cfi] Fix handling of sanitize trap/recover flags in the cross-DSO CFI mode.

2016-03-10 Thread Peter Collingbourne via cfe-commits
pcc accepted this revision.
pcc added a comment.
This revision is now accepted and ready to land.

LGTM



Comment at: lib/CodeGen/CGExpr.cpp:2484-2485
@@ -2483,3 +2483,4 @@
   CheckRecoverableKind RecoverKind = getRecoverableKind(Checked[0].second);
   // In cross-DSO CFI mode this code is used to generate __cfi_check_fail, 
which
   // includes all checks, even those that are not in SanOpts.
+  assert(SanOpts.has(Checked[0].second));

You can remove this comment now.


Comment at: lib/CodeGen/CGExpr.cpp:2677
@@ -2677,1 +2676,3 @@
+else
+  EmitTrapCheck(Cond);
   }

I mentioned failing open, but yes, it's probably better to fail closed.


Repository:
  rL LLVM

http://reviews.llvm.org/D17360



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


Re: [PATCH] D17360: [cfi] Fix handling of sanitize trap/recover flags in the cross-DSO CFI mode.

2016-03-10 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

ping


Repository:
  rL LLVM

http://reviews.llvm.org/D17360



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


Re: [PATCH] D17469: [libcxx] Add deployment knobs to tests (for Apple platforms)

2016-03-10 Thread Duncan P. N. Exon Smith via cfe-commits
dexonsmith added a subscriber: dexonsmith.
dexonsmith added a comment.

Does anyone have a problem with this direction?  I have commits to
follow that get tests green when run against various releases of OSX
but I need this in place first.


http://reviews.llvm.org/D17469



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


Re: [PATCH] D17469: [libcxx] Add deployment knobs to tests (for Apple platforms)

2016-03-10 Thread Duncan P. N. Exon Smith via cfe-commits
Does anyone have a problem with this direction?  I have commits to
follow that get tests green when run against various releases of OSX
but I need this in place first.

> On 2016-Feb-19, at 17:59, Duncan P. N. Exon Smith via cfe-commits 
>  wrote:
> 
> dexonsmith created this revision.
> dexonsmith added reviewers: EricWF, mclow.lists.
> dexonsmith added a subscriber: cfe-commits.
> 
> The tests for libc++ specify `-target` on the command-line to the
> compiler, but this is problematic for a few reasons.
> 
> Firstly, the `-target` option isn't supported on Apple platforms.  Parts
> of the triple get dropped and ignored.  Instead, software should be
> compiled with a combination of the `-arch` and `-m-version-min`
> options.
> 
> Secondly, the generic "darwin" target references a kernel version
> instead of a platform version.  Each platform has its own independent
> versions (with different versions of libc++.1.dylib), independent of the
> version of the Darwin kernel.
> 
> This commit adds support to the LIT infrastructure for testing against
> Apple platforms using `-arch` and `-platform` options.
> 
> - If the host is not on OS X, or the compiler type is not `clang` or
>  `apple-clang`, then this commit has NFC.
> 
> - If the host is on OS X and `--param=target_triple=...` is specified,
>  then a warning is emitted to use arch and platform instead.  Besides
>  the warning, there's NFC.
> 
> - If the host is on OS X and *no* target-triple is specified, then use
>  the new deployment target logic.  This uses two new lit parameters,
>  `--param=arch=` and `--param=platform=`.  ``
>  has the form `[]`.
> 
>- By default, arch is auto-detected from `clang -dumpmachine`, and
>  platform is "macosx".
>- If the platform doesn't have a version:
>- For "macosx", the version is auto-detected from the host
>  system using `sw_vers`.  This may give a different version
>  than the SDK, since new SDKs can be installed on older hosts.
>- Otherwise, the version is auto-detected from the SDK version
>  using `xcrun --show-sdk-path`.
>- `-arch  -m-version-min=` is added to the
>  compiler flags.
>- The target triple is computed as `-apple-`.  It is
>  *not* passed to clang, but it is available for XFAIL and
>  UNSUPPORTED (as is `with_system_cxx_lib=`).
>- For convenience, `apple-darwin` and `-apple-darwin` are
>  added to the set of available features.
> 
> There were a number of tests marked to XFAIL on `x86_64-apple-darwin11`
> and `x86_64-apple-darwin12`.  I updated these to
> `x86_64-apple-macosx10.7` and `x86_64-apple-macosx10.8`.
> 
> 
> http://reviews.llvm.org/D17469
> 
> Files:
>  test/libcxx/test/config.py
>  test/libcxx/test/target_info.py
>  test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp
>  
> test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
>  
> test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
>  
> test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
>  
> test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
>  
> test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp
>  
> test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp
>  
> test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp
>  test/std/re/re.traits/translate_nocase.pass.cpp
>  test/std/strings/string.conversions/stof.pass.cpp
>  test/std/strings/string.conversions/stol.pass.cpp
>  test/std/strings/string.conversions/stoll.pass.cpp
>  test/std/strings/string.conversions/stoul.pass.cpp
>  test/std/strings/string.conversions/stoull.pass.cpp
>  test/std/thread/futures/futures.future_error/what.pass.cpp
>  
> test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp
>  
> test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp
>  
> test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp
>  
> test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
>  
> test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp
>  
> test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp
>  
> test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp
>  
> test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp
>  
> test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp
>  
> 

Re: [PATCH] D18051: [CUDA] Provide CUDA's vector types implemented using clang's vector extension.

2016-03-10 Thread Justin Lebar via cfe-commits
jlebar added inline comments.


Comment at: lib/Headers/__clang_cuda_runtime_wrapper.h:72
@@ -71,1 +71,3 @@
 
+#if defined(CUDA_VECTOR_TYPES)
+// Prevent inclusion of CUDA's vector_types.h

The compiler driver is responsible for enabling/disabling language extensions, 
and for choosing exactly which dialect we accept.  It's also responsible for 
deciding which optimizations to use.  This fits in all of those ways.

Moreover, again, -Dfoo won't appear in --help, so, from a user's perspective, 
is undiscoverable.  In the event that they do discover it somehow, there's no 
documentation attached to the flag.

I am not aware of any switches built into clang that rely on -D.  If you really 
want to do it this way, can you point me to prior art?


Comment at: lib/Headers/__clang_cuda_vector_types.h:81
@@ +80,3 @@
+  : x(__x), y(__y), z(__z) {}
+  __attribute__((host, device)) explicit dim3(uint3 __a)
+  : x(__a.x), y(__a.y), z(__a.z) {}

Huh, apparently we do want to use the reserved namespace?

If so, this logic applies very strongly to a -D, which is going to be far more 
user-visible than the arg names here.


Comment at: lib/Headers/__clang_cuda_vector_types.h:83
@@ +82,3 @@
+  : x(__a.x), y(__a.y), z(__a.z) {}
+  __attribute__((host, device)) operator uint3(void) { return {x, y, z}; }
+};

If I'm understanding correctly, you're saying that if we have

  struct dim3 {
dim3(unsigned, unsigned, unsigned);
dim3(uint3);
  };

  void foo(dim3);

that the call

  uint3 x;
  foo(x);

is ambiguous, because it could call either dim3 constructor overload?

That is bizarre, but if so, do we need the dim3(uint3) constructor at all?


http://reviews.llvm.org/D18051



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


Re: [PATCH] D18051: [CUDA] Provide CUDA's vector types implemented using clang's vector extension.

2016-03-10 Thread Artem Belevich via cfe-commits
tra added inline comments.


Comment at: lib/Headers/__clang_cuda_runtime_wrapper.h:72
@@ -71,1 +71,3 @@
 
+#if defined(CUDA_VECTOR_TYPES)
+// Prevent inclusion of CUDA's vector_types.h

jlebar wrote:
> Hm, this is a surprising (to me) way of controlling this feature.  Can we use 
> a -f flag instead?  Even if all that -f flag does is define something 
> (although in this case I'd suggest giving it a longer name so it's harder to 
> collide with it).
> 
> -fsomething would be more discoverable and canonical, I think, and would be 
> easier to document.
I want to tweak end-user's view of CUDA headers which has nothing to do with 
compiler, IMO.


Comment at: lib/Headers/__clang_cuda_vector_types.h:76
@@ +75,3 @@
+
+__attribute__((host,device))
+struct dim3 {

jlebar wrote:
> I thought host/device attributes weren't needed on classes, only functions?
Ugh. Removed.


Comment at: lib/Headers/__clang_cuda_vector_types.h:80
@@ +79,3 @@
+  __attribute__((host, device))
+  dim3(unsigned __x = 1, unsigned __y = 1, unsigned __z = 1)
+  : x(__x), y(__y), z(__z) {}

jlebar wrote:
> Nit: double underscore is a little weird here, and sort of needlessly 
> competes with the language-reserved __ identifier namespace.  Could we just 
> use one underscore?
I'm following the change Eric made to other headers in r260647 so that all 
arguments use __.


Comment at: lib/Headers/__clang_cuda_vector_types.h:82
@@ +81,3 @@
+  : x(__x), y(__y), z(__z) {}
+  __attribute__((host, device)) explicit dim3(uint3 __a)
+  : x(__a.x), y(__a.y), z(__a.z) {}

jlebar wrote:
> nvidia's version of this function is not explicit -- is this difference 
> intentional?
That's due to the way vector types are their base types with attribute. Without 
explicit dim3 variant, compiler can't disambiguate between 
dim3(int=1,int=1,int=1) and dim3(uint3 which is int w/ attribute).


Comment at: lib/Headers/__clang_cuda_vector_types.h:84
@@ +83,3 @@
+  : x(__a.x), y(__a.y), z(__a.z) {}
+  __attribute__((host, device)) operator uint3(void) { return {x, y, z}; }
+};

jlebar wrote:
> This requires C++11 -- is that intentional?
It looks that way, but it does not need c++11. [[ 
http://clang.llvm.org/docs/LanguageExtensions.html#vector-literals | Vector 
literals ]] allow brace initializers w/o requiring c++11. 


http://reviews.llvm.org/D18051



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


Re: [PATCH] D18051: [CUDA] Provide CUDA's vector types implemented using clang's vector extension.

2016-03-10 Thread Artem Belevich via cfe-commits
tra updated this revision to Diff 50341.
tra marked an inline comment as done.
tra added a comment.

Removed unneeded struct attributes.


http://reviews.llvm.org/D18051

Files:
  lib/Headers/CMakeLists.txt
  lib/Headers/__clang_cuda_runtime_wrapper.h
  lib/Headers/__clang_cuda_vector_types.h
  lib/Headers/cuda_builtin_vars.h

Index: lib/Headers/cuda_builtin_vars.h
===
--- lib/Headers/cuda_builtin_vars.h
+++ lib/Headers/cuda_builtin_vars.h
@@ -24,9 +24,11 @@
 #ifndef __CUDA_BUILTIN_VARS_H
 #define __CUDA_BUILTIN_VARS_H
 
+#if !defined(CUDA_VECTOR_TYPES)
 // Forward declares from vector_types.h.
 struct uint3;
 struct dim3;
+#endif
 
 // The file implements built-in CUDA variables using __declspec(property).
 // https://msdn.microsoft.com/en-us/library/yhfk0thd.aspx
Index: lib/Headers/__clang_cuda_vector_types.h
===
--- /dev/null
+++ lib/Headers/__clang_cuda_vector_types.h
@@ -0,0 +1,86 @@
+/*=== __clang_cuda_vector_types.h - CUDA vector types -===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+
+#ifndef __CLANG_CUDA_VECTOR_TYPES_H__
+#define __CLANG_CUDA_VECTOR_TYPES_H__
+
+typedef char char1 __attribute__((ext_vector_type(1)));
+typedef char char2 __attribute__((ext_vector_type(2)));
+typedef char char3 __attribute__((ext_vector_type(3)));
+typedef char char4 __attribute__((ext_vector_type(4)));
+typedef unsigned char uchar1 __attribute__((ext_vector_type(1)));
+typedef unsigned char uchar2 __attribute__((ext_vector_type(2)));
+typedef unsigned char uchar3 __attribute__((ext_vector_type(3)));
+typedef unsigned char uchar4 __attribute__((ext_vector_type(4)));
+typedef short short1 __attribute__((ext_vector_type(1)));
+typedef short short2 __attribute__((ext_vector_type(2)));
+typedef short short3 __attribute__((ext_vector_type(3)));
+typedef short short4 __attribute__((ext_vector_type(4)));
+typedef unsigned short ushort1 __attribute__((ext_vector_type(1)));
+typedef unsigned short ushort2 __attribute__((ext_vector_type(2)));
+typedef unsigned short ushort3 __attribute__((ext_vector_type(3)));
+typedef unsigned short ushort4 __attribute__((ext_vector_type(4)));
+typedef int int1 __attribute__((ext_vector_type(1)));
+typedef int int2 __attribute__((ext_vector_type(2)));
+typedef int int3 __attribute__((ext_vector_type(3)));
+typedef int int4 __attribute__((ext_vector_type(4)));
+typedef unsigned int uint1 __attribute__((ext_vector_type(1)));
+typedef unsigned int uint2 __attribute__((ext_vector_type(2)));
+typedef unsigned int uint3 __attribute__((ext_vector_type(3)));
+typedef unsigned int uint4 __attribute__((ext_vector_type(4)));
+typedef long long1 __attribute__((ext_vector_type(1)));
+typedef long long2 __attribute__((ext_vector_type(2)));
+typedef long long3 __attribute__((ext_vector_type(3)));
+typedef long long4 __attribute__((ext_vector_type(4)));
+typedef unsigned long ulong1 __attribute__((ext_vector_type(1)));
+typedef unsigned long ulong2 __attribute__((ext_vector_type(2)));
+typedef unsigned long ulong3 __attribute__((ext_vector_type(3)));
+typedef unsigned long ulong4 __attribute__((ext_vector_type(4)));
+typedef long long longlong1 __attribute__((ext_vector_type(1)));
+typedef long long longlong2 __attribute__((ext_vector_type(2)));
+typedef long long longlong3 __attribute__((ext_vector_type(3)));
+typedef long long longlong4 __attribute__((ext_vector_type(4)));
+typedef unsigned long long ulonglong1 __attribute__((ext_vector_type(1)));
+typedef unsigned long long ulonglong2 __attribute__((ext_vector_type(2)));
+typedef unsigned long long ulonglong3 __attribute__((ext_vector_type(3)));
+typedef unsigned long long ulonglong4 __attribute__((ext_vector_type(4)));
+typedef float float1 __attribute__((ext_vector_type(1)));
+typedef 

Re: [PATCH] D17482: [clang-tidy] Allow tests to verify changes made to header files

2016-03-10 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

Another week without reviews...

These changes were already split from a previous changeset without being 
reviewed properly.

Squeak squeak squeak.


http://reviews.llvm.org/D17482



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


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

2016-03-10 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

I do not have commit access, so I will need someone to commit this for me.

Patch by Richard Thomson

thanks.



Comment at: clang-tidy/modernize/RawStringLiteralCheck.cpp:82
@@ +81,3 @@
+? std::string{R"lit()")lit"}
+: (")" + Delimiter + R"(")")) != StringRef::npos;
+}

aaron.ballman wrote:
> This is a wonderful demonstration of why I hate raw string literals on 
> shorter strings. I had to stare at that raw string for quite some time to 
> figure it out. :-(
I used a raw string literal here because that's what this check would have 
recommended on this code :-).

However, your feedback is useful.  If I subsequently enhance this check with a 
parameter that says the minimum length a string literal must have before it is 
to be transformed into a raw string literal and the default value for that 
parameter is something like 5, would that address your concern?


http://reviews.llvm.org/D16529



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


Re: [PATCH] D17981: [clang-tidy] Fix clang-tidy to support parsing of assembly statements.

2016-03-10 Thread Reid Kleckner via cfe-commits
rnk added a comment.

This will definitely work, but it will substantially increase the size of 
clang-tidy:
$ du -cksh bin/clang-tidy.exe bin/clang.exe
21M bin/clang-tidy.exe
47M bin/clang.exe
68M total

The difference is mostly from the backends, and that's with only the X86 and 
ARM backends enabled.

Alex, how should clang-tidy behave when it sees MS inline asm? If we ignore the 
error about not finding a registered target, then we treat the asm statement as 
empty. This may cause false positives where clang-tidy doesn't see Decl uses 
from inline asm, but that may be acceptable, since they mostly come from system 
headers.


http://reviews.llvm.org/D17981



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


Re: [PATCH] D18051: [CUDA] Provide CUDA's vector types implemented using clang's vector extension.

2016-03-10 Thread Justin Lebar via cfe-commits
jlebar added inline comments.


Comment at: lib/Headers/__clang_cuda_runtime_wrapper.h:72
@@ -71,1 +71,3 @@
 
+#if defined(CUDA_VECTOR_TYPES)
+// Prevent inclusion of CUDA's vector_types.h

Hm, this is a surprising (to me) way of controlling this feature.  Can we use a 
-f flag instead?  Even if all that -f flag does is define something (although 
in this case I'd suggest giving it a longer name so it's harder to collide with 
it).

-fsomething would be more discoverable and canonical, I think, and would be 
easier to document.


Comment at: lib/Headers/__clang_cuda_vector_types.h:76
@@ +75,3 @@
+
+__attribute__((host,device))
+struct dim3 {

I thought host/device attributes weren't needed on classes, only functions?


Comment at: lib/Headers/__clang_cuda_vector_types.h:80
@@ +79,3 @@
+  __attribute__((host, device))
+  dim3(unsigned __x = 1, unsigned __y = 1, unsigned __z = 1)
+  : x(__x), y(__y), z(__z) {}

Nit: double underscore is a little weird here, and sort of needlessly competes 
with the language-reserved __ identifier namespace.  Could we just use one 
underscore?


Comment at: lib/Headers/__clang_cuda_vector_types.h:82
@@ +81,3 @@
+  : x(__x), y(__y), z(__z) {}
+  __attribute__((host, device)) explicit dim3(uint3 __a)
+  : x(__a.x), y(__a.y), z(__a.z) {}

nvidia's version of this function is not explicit -- is this difference 
intentional?


Comment at: lib/Headers/__clang_cuda_vector_types.h:84
@@ +83,3 @@
+  : x(__a.x), y(__a.y), z(__a.z) {}
+  __attribute__((host, device)) operator uint3(void) { return {x, y, z}; }
+};

This requires C++11 -- is that intentional?


http://reviews.llvm.org/D18051



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


Re: [PATCH] D17286: Make FreeBSD and NetBSD use CLANG_DEFAULT_CXX_STDLIB

2016-03-10 Thread Jonas Hahnfeld via cfe-commits
Hahnfeld added a comment.

In http://reviews.llvm.org/D17286#372290, @dim wrote:

> If nobody objects, I will commit this.


I can do so myself but would would like to hear from @joerg first


http://reviews.llvm.org/D17286



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


Re: [PATCH] D17286: Make FreeBSD and NetBSD use CLANG_DEFAULT_CXX_STDLIB

2016-03-10 Thread Dimitry Andric via cfe-commits
dim accepted this revision.
dim added a reviewer: dim.
dim added a comment.
This revision is now accepted and ready to land.

If nobody objects, I will commit this.


http://reviews.llvm.org/D17286



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


Re: [PATCH] D18011: [modules] Diagnose insufficient privileges when trying to load the modulemap

2016-03-10 Thread Davide Italiano via cfe-commits
davide added a comment.

Hmm, I think you're right. It's not actually that silent (it fails with a fatal 
error when trying to load/read).
That said, I think it might still be valuable to emit a diagnostic -- Richard 
what do you think?

I noticed you reported a very similar problem here: 
https://llvm.org/bugs/show_bug.cgi?id=20468

Also, I looked at the code more closely and I think the right place to diagnose 
this would be `lib/Frontend/FrontendAction.cpp`, in `BeginSourceFile`, around 
line 390, and not where I'm diagnosing it right now. Thoughts?


http://reviews.llvm.org/D18011



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


Buildbot numbers for week of 2/28/2016 - 3/05/2016

2016-03-10 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 2/28/2016 - 3/05/2016.

Thanks

Galina


"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green):

 buildername| builds |
changes | status change ratio
++-+-
 lldb-windows7-android  | 96 |
49 |51.0
 libcxx-libcxxabi-x86_64-linux-debian   |  2
|   1 |50.0
 clang-native-aarch64-full  | 19
|   9 |47.4
 perf-x86_64-penryn-O3-polly| 74 |
34 |45.9
 clang-ppc64le-linux-lnt| 78 |
30 |38.5
 lldb-x86_64-darwin-13.4|117 |
38 |32.5
 lldb-x86_64-ubuntu-14.04-android   |118 |
34 |28.8
 sanitizer-x86_64-linux | 87 |
24 |27.6
 clang-cmake-aarch64-full   | 37 |
10 |27.0
 clang-ppc64le-linux-multistage | 33
|   6 |18.2
 sanitizer-ppc64le-linux| 49
|   8 |16.3
 llvm-clang-lld-x86_64-debian-fast  |188 |
26 |13.8
 clang-x64-ninja-win7   |171 |
23 |13.5
 sanitizer-x86_64-linux-bootstrap   | 50
|   6 |12.0
 clang-x86-win2008-selfhost |138 |
16 |11.6
 clang-x86_64-debian-fast   |141 |
15 |10.6
 clang-ppc64be-linux-multistage |113 |
12 |10.6
 perf-x86_64-penryn-O3-polly-parallel-fast  |236 |
25 |10.6
 clang-cmake-mipsel | 19
|   2 |10.5
 clang-ppc64be-linux-lnt|191 |
18 | 9.4
 clang-s390x-linux  |283 |
26 | 9.2
 sanitizer-ppc64be-linux| 87
|   8 | 9.2
 clang-ppc64le-linux|201 |
18 | 9.0
 clang-ppc64be-linux|228 |
20 | 8.8
 clang-cmake-armv7-a15-selfhost-neon| 28
|   2 | 7.1
 clang-bpf-build|297 |
20 | 6.7
 lldb-x86_64-ubuntu-14.04-cmake |214 |
14 | 6.5
 clang-cmake-thumbv7-a15|192 |
12 | 6.3
 clang-cmake-mips   | 97
|   6 | 6.2
 clang-atom-d525-fedora-rel | 97
|   6 | 6.2
 clang-cmake-armv7-a15  |164 |
10 | 6.1
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   |372 |
20 | 5.4
 sanitizer-x86_64-linux-fast|197 |
10 | 5.1
 clang-cmake-aarch64-42vma  |158
|   8 | 5.1
 clang-hexagon-elf  |289 |
14 | 4.8
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast |372 |
18 | 4.8
 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only  | 23
|   1 | 4.3
 perf-x86_64-penryn-O3-polly-before-vectorizer  | 23
|   1 | 4.3
 clang-cmake-aarch64-quick  |145
|   6 | 4.1
 clang-cmake-armv7-a15-full |104
|   4 | 3.8
 llvm-mips-linux| 60
|   2 | 3.3
 llvm-hexagon-elf   |197
|   6 | 3.0
 lldb-amd64-ninja-netbsd7   |143
|   4 | 2.8
 sanitizer-windows  |343
|   9 | 2.6
 perf-x86_64-penryn-O3-polly-fast   | 40
|   1 | 2.5
 perf-x86_64-penryn-O3-polly-unprofitable   |218
|   5 | 2.3
 sanitizer-x86_64-linux-fuzzer 

Buildbot numbers for week of 2/21/2016 - 2/27/2016

2016-03-10 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the week of 2/21/2016 - 2/27/2016.

Thanks

Galina


"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green):

 buildername   | builds |
changes | status change ratio
---++-+-
 sanitizer-x86_64-linux|116 |
54 |46.6
 clang-ppc64le-linux-lnt   | 93 |
39 |41.9
 lldb-windows7-android |137 |
41 |29.9
 clang-cmake-mipsel| 21 |
6 |28.6
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions |  7 |
2 |28.6
 lldb-x86_64-darwin-13.4   |118 |
33 |28.0
 lldb-x86_64-ubuntu-14.04-android  |120 |
32 |26.7
 clang-cmake-armv7-a15-selfhost| 38 |
10 |26.3
 clang-native-aarch64-full | 18 |
4 |22.2
 libcxx-libcxxabi-arm-linux|  9 |
2 |22.2
 clang-cmake-aarch64-full  | 41 |
9 |22.0
 sanitizer-ppc64le-linux   | 58 |
10 |17.2
 clang-cmake-armv7-a15-selfhost-neon   | 25 |
4 |16.0
 clang-x86_64-debian-fast  |138 |
21 |15.2
 clang-ppc64be-linux-multistage|148 |
22 |14.9
 clang-ppc64le-linux   |206 |
30 |14.6
 llvm-clang-lld-x86_64-debian-fast |186 |
26 |14.0
 clang-x64-ninja-win7  |194 |
26 |13.4
 perf-x86_64-penryn-O3-polly   |160 |
21 |13.1
 clang-cmake-thumbv7-a15-full-sh   | 24 |
3 |12.5
 lld-x86_64-win7   |217 |
26 |12.0
 llvm-mips-linux   | 51 |
6 |11.8
 lldb-x86_64-ubuntu-14.04-cmake|226 |
26 |11.5
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast| 92 |
10 |10.9
 clang-x86-win2008-selfhost|128 |
14 |10.9
 sanitizer-x86_64-linux-bootstrap  | 56 |
6 |10.7
 sanitizer-ppc64be-linux   |117 |
12 |10.3
 clang-s390x-linux |283 |
28 | 9.9
 clang-ppc64be-linux   |285 |
28 | 9.8
 clang-cmake-aarch64-42vma |181 |
17 | 9.4
 clang-cmake-armv7-a15-full|120 |
11 | 9.2
 sanitizer-x86_64-linux-fast   |181 |
16 | 8.8
 clang-cmake-aarch64-quick |159 |
14 | 8.8
 clang-cmake-thumbv7-a15   |208 |
18 | 8.7
 clang-ppc64be-linux-lnt   |232 |
20 | 8.6
 clang-atom-d525-fedora-rel|120 |
10 | 8.3
 sanitizer-windows |363 |
30 | 8.3
 clang-bpf-build   |297 |
24 | 8.1
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast  |375 |
30 | 8.0
 clang-cmake-armv7-a15 |185 |
14 | 7.6
 lldb-x86-windows-msvc2015 |214 |
16 | 7.5
 sanitizer-x86_64-linux-autoconf   |315 |
22 | 7.0
 sanitizer-x86_64-linux-fuzzer |202 |
14 | 6.9
 clang-native-arm-lnt  |117 |
8 | 6.8
 lldb-amd64-ninja-netbsd7  |159 |
10 | 6.3
 clang-hexagon-elf |288 |
18 | 6.3
 lldb-x86_64-ubuntu-14.04-buildserver  |150 |
8 | 5.3
 perf-x86_64-penryn-O3 |150 |
7 | 4.7
 

Re: r262881 - P0188R1: add support for standard [[fallthrough]] attribute. This is almost

2016-03-10 Thread Richard Smith via cfe-commits
On Thu, Mar 10, 2016 at 10:47 AM, Nico Weber  wrote:
> On Wed, Mar 9, 2016 at 6:44 PM, Nico Weber  wrote:
>>
>> On Tue, Mar 8, 2016 at 12:18 PM, Nico Weber  wrote:
>>>
>>> On Tue, Mar 8, 2016 at 2:10 PM, Richard Smith 
>>> wrote:

 On Tue, Mar 8, 2016 at 11:04 AM, Nico Weber  wrote:
 > On Tue, Mar 8, 2016 at 1:49 PM, Richard Smith 
 > wrote:
 >>
 >> On Tue, Mar 8, 2016 at 9:05 AM, Nico Weber 
 >> wrote:
 >> > This causes clang to warn on
 >> >
 >> >   default: assert (false); HB_FALLTHROUGH;
 >>
 >> What follows this? (A case label?) What warning is being produced?
 >
 >
 > A case label. Full snippet:
 >
 > https://code.google.com/p/chromium/codesearch#chromium/src/third_party/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc=142
 >
 > Full warning (from
 >
 > https://build.chromium.org/p/chromium.fyi/builders/ClangToTMac%20%28dbg%29/builds/4497/steps/compile/logs/stdio):
 >
 > ../../third_party/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc:142:30:
 > error:
 > fallthrough annotation in unreachable code
 > [-Werror,-Wimplicit-fallthrough]
 > default: assert (false); HB_FALLTHROUGH;
 >  ^
 > ../../third_party/harfbuzz-ng/src/hb-private.hh:140:26: note: expanded
 > from
 > macro 'HB_FALLTHROUGH'
 > #  define HB_FALLTHROUGH [[clang::fallthrough]]
 >
 > As far as I know, we don't opt in to -Wimplicit-fallthrough (and I
 > don't see
 > a flag on the commandline of the failing compile; also available at
 > the
 > above link.)

 OK, I see what's going wrong. Half of -Wimplicit-fallthrough is off by
 default, half of it is on by default. We used to do the CFG-based
 analysis only if the warning was enabled (because otherwise it would
 never produce any messages), and this change makes us also do the
 analysis when the warning is disabled but there are [[fallthrough]];
 statements in the function (it promotes the "misplaced
 [[fallthrough]];" diagnostic from warning to error, so we need the
 analysis if the attribute is present). This change should have had no
 impact on -Wimplicit-fallthrough (either the warning was disabled so
 no diagnostics are produced before and after, or the warning was
 enabled so the same diagnostics are produced before and after), but
 apparently when we ask "is this warning enabled?" and the warning
 group contains multiple diagnostics, we don't check them all...

 There's an easy fix for clang: warn_fallthrough_attr_unreachable
 should be marked DefaultIgnore.
>>>
>>>
>>> Sounds good. Are you doing that? Want me to do that?
>>
>>
>> ^ ping
>
>
> I gave this a shot in r263138.

Thanks, sorry for the delay. I added a test for your fix in r263155.

>>
>>
>>>
>>>

 (Though that chromium code would still
 produce diagnostics -- with or without this change -- if you build
 with -Wimplicit-fallthrough and -DNDEBUG, so maybe you do need a
 different macro for that case regardless.)

 >> > The fallthrough needs to be there for release builds, but now it
 >> > must
 >> > not be
 >> > there for debug builds. I suppose this means projects now need an
 >> > UNREACHED_CASE macro that expands to assert(false) in debug and to
 >> > fallthrough in release (with clang; and to something else with
 >> > other
 >> > compilers)?
 >> >
 >> > On Mon, Mar 7, 2016 at 7:32 PM, Richard Smith via cfe-commits
 >> >  wrote:
 >> >>
 >> >> Author: rsmith
 >> >> Date: Mon Mar  7 18:32:55 2016
 >> >> New Revision: 262881
 >> >>
 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=262881=rev
 >> >> Log:
 >> >> P0188R1: add support for standard [[fallthrough]] attribute. This
 >> >> is
 >> >> almost
 >> >> exactly the same as clang's existing [[clang::fallthrough]]
 >> >> attribute,
 >> >> which
 >> >> has been updated to have the same semantics. The one significant
 >> >> difference
 >> >> is that [[fallthrough]] is ill-formed if it's not used immediately
 >> >> before
 >> >> a
 >> >> switch label (even when -Wimplicit-fallthrough is disabled). To
 >> >> support
 >> >> that,
 >> >> we now build a CFG of any function that uses a '[[fallthrough]];'
 >> >> statement
 >> >> to check.
 >> >>
 >> >> In passing, fix some bugs with our support for statement
 >> >> attributes --
 >> >> in
 >> >> particular, diagnose their use on declarations, rather than
 >> >> asserting.
 >> >>
 >> >> Modified:
 >> >> cfe/trunk/include/clang/AST/Attr.h
 >> >> cfe/trunk/include/clang/Basic/Attr.td
 >> >> 

r263155 - Add test for r263138.

2016-03-10 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Thu Mar 10 13:22:21 2016
New Revision: 263155

URL: http://llvm.org/viewvc/llvm-project?rev=263155=rev
Log:
Add test for r263138.

Added:
cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp

Added: cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp?rev=263155=auto
==
--- cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp 
(added)
+++ cfe/trunk/test/SemaCXX/switch-implicit-fallthrough-off-by-default.cpp Thu 
Mar 10 13:22:21 2016
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -DUNREACHABLE=1 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -DUNREACHABLE=0 
-Wimplicit-fallthrough %s
+
+void fallthrough(int n) {
+  switch (n) {
+  case 1:
+if (UNREACHABLE)
+  return;
+[[fallthrough]]; // expected-no-diagnostics, only checked when 
UNREACHABLE=0
+  case 2:
+break;
+  }
+}


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


Re: [PATCH] D15314: Fix a bug in unavailable checking

2016-03-10 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL263149: Add TreatUnavailableAsInvalid for the 
verification-only mode in InitListChecker. (authored by mren).

Changed prior to commit:
  http://reviews.llvm.org/D15314?vs=48228=50312#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15314

Files:
  cfe/trunk/include/clang/Sema/Initialization.h
  cfe/trunk/include/clang/Sema/Sema.h
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/lib/Sema/SemaExpr.cpp
  cfe/trunk/lib/Sema/SemaInit.cpp
  cfe/trunk/test/SemaObjC/Inputs/arc-system-header.h
  cfe/trunk/test/SemaObjC/arc-system-header.m

Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -9524,7 +9524,9 @@
 if (VDecl->isInvalidDecl())
   return;
 
-InitializationSequence InitSeq(*this, Entity, Kind, Args);
+InitializationSequence InitSeq(*this, Entity, Kind, Args,
+   /*TopLevelOfInitList=*/false,
+   /*TreatUnavailableAsInvalid=*/false);
 ExprResult Result = InitSeq.Perform(*this, Entity, Kind, Args, );
 if (Result.isInvalid()) {
   VDecl->setInvalidDecl();
Index: cfe/trunk/lib/Sema/SemaInit.cpp
===
--- cfe/trunk/lib/Sema/SemaInit.cpp
+++ cfe/trunk/lib/Sema/SemaInit.cpp
@@ -238,6 +238,7 @@
   Sema 
   bool hadError;
   bool VerifyOnly; // no diagnostics, no structure building
+  bool TreatUnavailableAsInvalid; // Used only in VerifyOnly mode.
   llvm::DenseMap SyntacticToSemantic;
   InitListExpr *FullyStructuredList;
 
@@ -320,7 +321,8 @@
   static ExprResult PerformEmptyInit(Sema ,
  SourceLocation Loc,
  const InitializedEntity ,
- bool VerifyOnly);
+ bool VerifyOnly,
+ bool TreatUnavailableAsInvalid);
 
   // Explanation on the "FillWithNoInit" mode:
   //
@@ -360,7 +362,8 @@
 
 public:
   InitListChecker(Sema , const InitializedEntity ,
-  InitListExpr *IL, QualType , bool VerifyOnly);
+  InitListExpr *IL, QualType , bool VerifyOnly,
+  bool TreatUnavailableAsInvalid);
   bool HadError() { return hadError; }
 
   // @brief Retrieves the fully-structured initializer list used for
@@ -373,7 +376,8 @@
 ExprResult InitListChecker::PerformEmptyInit(Sema ,
  SourceLocation Loc,
  const InitializedEntity ,
- bool VerifyOnly) {
+ bool VerifyOnly,
+ bool TreatUnavailableAsInvalid) {
   InitializationKind Kind = InitializationKind::CreateValue(Loc, Loc, Loc,
 true);
   MultiExprArg SubInit;
@@ -443,7 +447,8 @@
 InitSeq.InitializeFrom(
 SemaRef, Entity,
 InitializationKind::CreateValue(Loc, Loc, Loc, true),
-MultiExprArg(), /*TopLevelOfInitList=*/false);
+MultiExprArg(), /*TopLevelOfInitList=*/false,
+TreatUnavailableAsInvalid);
 // Emit a warning for this.  System header warnings aren't shown
 // by default, but people working on system headers should see it.
 if (!VerifyOnly) {
@@ -480,7 +485,8 @@
   SourceLocation Loc) {
   assert(VerifyOnly &&
  "CheckEmptyInitializable is only inteded for verification mode.");
-  if (PerformEmptyInit(SemaRef, Loc, Entity, /*VerifyOnly*/true).isInvalid())
+  if (PerformEmptyInit(SemaRef, Loc, Entity, /*VerifyOnly*/true,
+   TreatUnavailableAsInvalid).isInvalid())
 hadError = true;
 }
 
@@ -497,7 +503,8 @@
 ExprResult BaseInit =
 FillWithNoInit ? new (SemaRef.Context) NoInitExpr(Base.getType())
: PerformEmptyInit(SemaRef, ILE->getLocEnd(), BaseEntity,
-  /*VerifyOnly*/ false);
+  /*VerifyOnly*/ false,
+  TreatUnavailableAsInvalid);
 if (BaseInit.isInvalid()) {
   hadError = true;
   return;
@@ -572,7 +579,8 @@
 }
 
 ExprResult MemberInit = PerformEmptyInit(SemaRef, Loc, MemberEntity,
- /*VerifyOnly*/false);
+ /*VerifyOnly*/false,
+ TreatUnavailableAsInvalid);
 if (MemberInit.isInvalid()) {
   hadError = true;
   return;
@@ -709,7 +717,8 @@
   else {
 ExprResult ElementInit = PerformEmptyInit(SemaRef, ILE->getLocEnd(),

r263149 - Add TreatUnavailableAsInvalid for the verification-only mode in InitListChecker.

2016-03-10 Thread Manman Ren via cfe-commits
Author: mren
Date: Thu Mar 10 12:53:19 2016
New Revision: 263149

URL: http://llvm.org/viewvc/llvm-project?rev=263149=rev
Log:
Add TreatUnavailableAsInvalid for the verification-only mode in InitListChecker.

Given the following test case:
typedef struct {
  const char *name;
  id field;
} Test9;
extern void doSomething(Test9 arg);
void test9() {
  Test9 foo2 = {0, 0};
  doSomething(foo2);
}
With a release compiler, we don't emit any message and silently ignore the
variable "foo2". With an assert compiler, we get an assertion failure.

The root cause —
Back in r140457 we gave InitListChecker a verification-only mode, and will use
CanUseDecl instead of DiagnoseUseOfDecl for verification-only mode.

These two functions handle unavailable issues differently:
In Sema::CanUseDecl, we say the decl is invalid when the Decl is unavailable and
the current context is available.

In Sema::DiagnoseUseOfDecl, we say the decl is usable by ignoring the return
code of DiagnoseAvailabilityOfDecl

So with an assert build, we will hit an assertion in diagnoseListInit
assert(DiagnoseInitList.HadError() &&
   "Inconsistent init list check result.");

The fix ---
If we follow what is implemented in CanUseDecl and treat Decls with
unavailable issues as invalid, the variable decl of “foo2” will be marked as
invalid. Since unavailable checking is processed in delayed diagnostics
(r197627), we will silently ignore the diagnostics when we find out that
the variable decl is invalid.

We add a flag "TreatUnavailableAsInvalid" for the verification-only mode.
For overload resolution, we want to say decls with unavailable issues are
invalid; but for everything else, we should say they are valid and
emit diagnostics. Depending on the value of the flag, CanUseDecl
can return different values for unavailable issues.

rdar://23557300
Differential Revision: http://reviews.llvm.org/D15314

Modified:
cfe/trunk/include/clang/Sema/Initialization.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/test/SemaObjC/Inputs/arc-system-header.h
cfe/trunk/test/SemaObjC/arc-system-header.m

Modified: cfe/trunk/include/clang/Sema/Initialization.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Initialization.h?rev=263149=263148=263149=diff
==
--- cfe/trunk/include/clang/Sema/Initialization.h (original)
+++ cfe/trunk/include/clang/Sema/Initialization.h Thu Mar 10 12:53:19 2016
@@ -886,14 +886,17 @@ public:
   /// \param TopLevelOfInitList true if we are initializing from an expression
   ///at the top level inside an initializer list. This disallows
   ///narrowing conversions in C++11 onwards.
+  /// \param TreatUnavailableAsInvalid true if we want to treat unavailable
+  ///as invalid.
   InitializationSequence(Sema , 
  const InitializedEntity ,
  const InitializationKind ,
  MultiExprArg Args,
- bool TopLevelOfInitList = false);
+ bool TopLevelOfInitList = false,
+ bool TreatUnavailableAsInvalid = true);
   void InitializeFrom(Sema , const InitializedEntity ,
   const InitializationKind , MultiExprArg Args,
-  bool TopLevelOfInitList);
+  bool TopLevelOfInitList, bool TreatUnavailableAsInvalid);
 
   ~InitializationSequence();
   

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=263149=263148=263149=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu Mar 10 12:53:19 2016
@@ -3555,7 +3555,7 @@ public:
   
//======//
   // Expression Parsing Callbacks: SemaExpr.cpp.
 
-  bool CanUseDecl(NamedDecl *D);
+  bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid);
   bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc,
  const ObjCInterfaceDecl *UnknownObjCClass=nullptr,
  bool ObjCPropertyAccess=false);

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=263149=263148=263149=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Mar 10 12:53:19 2016
@@ -9524,7 +9524,9 @@ void Sema::AddInitializerToDecl(Decl *Re
 if (VDecl->isInvalidDecl())
   return;
 
-InitializationSequence InitSeq(*this, Entity, Kind, Args);
+InitializationSequence InitSeq(*this, Entity, Kind, 

Re: r262881 - P0188R1: add support for standard [[fallthrough]] attribute. This is almost

2016-03-10 Thread Nico Weber via cfe-commits
On Wed, Mar 9, 2016 at 6:44 PM, Nico Weber  wrote:

> On Tue, Mar 8, 2016 at 12:18 PM, Nico Weber  wrote:
>
>> On Tue, Mar 8, 2016 at 2:10 PM, Richard Smith 
>> wrote:
>>
>>> On Tue, Mar 8, 2016 at 11:04 AM, Nico Weber  wrote:
>>> > On Tue, Mar 8, 2016 at 1:49 PM, Richard Smith 
>>> wrote:
>>> >>
>>> >> On Tue, Mar 8, 2016 at 9:05 AM, Nico Weber 
>>> wrote:
>>> >> > This causes clang to warn on
>>> >> >
>>> >> >   default: assert (false); HB_FALLTHROUGH;
>>> >>
>>> >> What follows this? (A case label?) What warning is being produced?
>>> >
>>> >
>>> > A case label. Full snippet:
>>> >
>>> https://code.google.com/p/chromium/codesearch#chromium/src/third_party/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc=142
>>> >
>>> > Full warning (from
>>> >
>>> https://build.chromium.org/p/chromium.fyi/builders/ClangToTMac%20%28dbg%29/builds/4497/steps/compile/logs/stdio
>>> ):
>>> >
>>> > ../../third_party/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc:142:30:
>>> error:
>>> > fallthrough annotation in unreachable code
>>> [-Werror,-Wimplicit-fallthrough]
>>> > default: assert (false); HB_FALLTHROUGH;
>>> >  ^
>>> > ../../third_party/harfbuzz-ng/src/hb-private.hh:140:26: note: expanded
>>> from
>>> > macro 'HB_FALLTHROUGH'
>>> > #  define HB_FALLTHROUGH [[clang::fallthrough]]
>>> >
>>> > As far as I know, we don't opt in to -Wimplicit-fallthrough (and I
>>> don't see
>>> > a flag on the commandline of the failing compile; also available at the
>>> > above link.)
>>>
>>> OK, I see what's going wrong. Half of -Wimplicit-fallthrough is off by
>>> default, half of it is on by default. We used to do the CFG-based
>>> analysis only if the warning was enabled (because otherwise it would
>>> never produce any messages), and this change makes us also do the
>>> analysis when the warning is disabled but there are [[fallthrough]];
>>> statements in the function (it promotes the "misplaced
>>> [[fallthrough]];" diagnostic from warning to error, so we need the
>>> analysis if the attribute is present). This change should have had no
>>> impact on -Wimplicit-fallthrough (either the warning was disabled so
>>> no diagnostics are produced before and after, or the warning was
>>> enabled so the same diagnostics are produced before and after), but
>>> apparently when we ask "is this warning enabled?" and the warning
>>> group contains multiple diagnostics, we don't check them all...
>>>
>>> There's an easy fix for clang: warn_fallthrough_attr_unreachable
>>> should be marked DefaultIgnore.
>>
>>
>> Sounds good. Are you doing that? Want me to do that?
>>
>
> ^ ping
>

I gave this a shot in r263138.


>
>
>>
>>
>>> (Though that chromium code would still
>>> produce diagnostics -- with or without this change -- if you build
>>> with -Wimplicit-fallthrough and -DNDEBUG, so maybe you do need a
>>> different macro for that case regardless.)
>>>
>>> >> > The fallthrough needs to be there for release builds, but now it
>>> must
>>> >> > not be
>>> >> > there for debug builds. I suppose this means projects now need an
>>> >> > UNREACHED_CASE macro that expands to assert(false) in debug and to
>>> >> > fallthrough in release (with clang; and to something else with other
>>> >> > compilers)?
>>> >> >
>>> >> > On Mon, Mar 7, 2016 at 7:32 PM, Richard Smith via cfe-commits
>>> >> >  wrote:
>>> >> >>
>>> >> >> Author: rsmith
>>> >> >> Date: Mon Mar  7 18:32:55 2016
>>> >> >> New Revision: 262881
>>> >> >>
>>> >> >> URL: http://llvm.org/viewvc/llvm-project?rev=262881=rev
>>> >> >> Log:
>>> >> >> P0188R1: add support for standard [[fallthrough]] attribute. This
>>> is
>>> >> >> almost
>>> >> >> exactly the same as clang's existing [[clang::fallthrough]]
>>> attribute,
>>> >> >> which
>>> >> >> has been updated to have the same semantics. The one significant
>>> >> >> difference
>>> >> >> is that [[fallthrough]] is ill-formed if it's not used immediately
>>> >> >> before
>>> >> >> a
>>> >> >> switch label (even when -Wimplicit-fallthrough is disabled). To
>>> support
>>> >> >> that,
>>> >> >> we now build a CFG of any function that uses a '[[fallthrough]];'
>>> >> >> statement
>>> >> >> to check.
>>> >> >>
>>> >> >> In passing, fix some bugs with our support for statement
>>> attributes --
>>> >> >> in
>>> >> >> particular, diagnose their use on declarations, rather than
>>> asserting.
>>> >> >>
>>> >> >> Modified:
>>> >> >> cfe/trunk/include/clang/AST/Attr.h
>>> >> >> cfe/trunk/include/clang/Basic/Attr.td
>>> >> >> cfe/trunk/include/clang/Basic/AttrDocs.td
>>> >> >> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>> >> >> cfe/trunk/include/clang/Sema/AttributeList.h
>>> >> >> cfe/trunk/include/clang/Sema/ScopeInfo.h
>>> >> >> cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
>>> >> >> cfe/trunk/lib/Sema/AttributeList.cpp
>>> >> >> 

r263138 - Make remaining ImplicitFallthrough warning DefaultIgnore.

2016-03-10 Thread Nico Weber via cfe-commits
Author: nico
Date: Thu Mar 10 12:42:37 2016
New Revision: 263138

URL: http://llvm.org/viewvc/llvm-project?rev=263138=rev
Log:
Make remaining ImplicitFallthrough warning DefaultIgnore.

Follow-up to r262881, which caused this to fire more often.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=263138=263137=263138=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Mar 10 12:42:37 
2016
@@ -7327,7 +7327,7 @@ def err_fallthrough_attr_invalid_placeme
   "fallthrough annotation does not directly precede switch label">;
 def warn_fallthrough_attr_unreachable : Warning<
   "fallthrough annotation in unreachable code">,
-  InGroup;
+  InGroup, DefaultIgnore;
 
 def warn_unreachable_default : Warning<
   "default label in switch which covers all enumeration values">,


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


Re: [PATCH] D18052: Add tests for ARM Cortex-R8

2016-03-10 Thread Pablo Barrio via cfe-commits
pbarrio added a comment.

Hello, could you please review these tests for Cortex-R8?

By the way Renato, thank you for the review on the LLVM side.


http://reviews.llvm.org/D18052



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


[PATCH] D18052: Add tests for ARM Cortex-R8

2016-03-10 Thread Pablo Barrio via cfe-commits
pbarrio created this revision.
pbarrio added reviewers: javed.absar, rengolin.
pbarrio added a subscriber: cfe-commits.
pbarrio added a dependency: D17925: [ARM] Add Cortex-R8 to target parser and 
tablegen.
Herald added subscribers: rengolin, aemerson.

Add command-line tests for ARM Cortex-R8. Depends on D17925.

http://reviews.llvm.org/D18052

Files:
  test/Driver/arm-cortex-cpus.c

Index: test/Driver/arm-cortex-cpus.c
===
--- test/Driver/arm-cortex-cpus.c
+++ test/Driver/arm-cortex-cpus.c
@@ -433,6 +433,7 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4f -mbig-endian -### -c 
%s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r5 -mbig-endian -### -c 
%s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 -mbig-endian -### -c 
%s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s
+// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r8 -mbig-endian -### -c 
%s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s
 // CHECK-BE-CPUV7R: "-cc1"{{.*}} "-triple" "armebv7r-{{.*}}
 
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4 -mthumb -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s
@@ -443,6 +444,7 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4f -mlittle-endian 
-mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r5 -mlittle-endian 
-mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 -mlittle-endian 
-mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s
+// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r8 -mlittle-endian 
-mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s
 // CHECK-CPUV7R-THUMB: "-cc1"{{.*}} "-triple" "thumbv7r-{{.*}}
 
 // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-r4 -mthumb -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s
@@ -453,6 +455,7 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4f -mbig-endian -mthumb 
-### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r5 -mbig-endian -mthumb 
-### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 -mbig-endian -mthumb 
-### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s
+// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r8 -mbig-endian -mthumb 
-### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s
 // CHECK-BE-CPUV7R-THUMB: "-cc1"{{.*}} "-triple" "thumbebv7r-{{.*}}
 
 // RUN: %clang -target arm -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-CPUV8A %s


Index: test/Driver/arm-cortex-cpus.c
===
--- test/Driver/arm-cortex-cpus.c
+++ test/Driver/arm-cortex-cpus.c
@@ -433,6 +433,7 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4f -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r5 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s
+// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r8 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s
 // CHECK-BE-CPUV7R: "-cc1"{{.*}} "-triple" "armebv7r-{{.*}}
 
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s
@@ -443,6 +444,7 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4f -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r5 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s
+// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r8 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s
 // CHECK-CPUV7R-THUMB: "-cc1"{{.*}} "-triple" "thumbv7r-{{.*}}
 
 // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-r4 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s
@@ -453,6 +455,7 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4f -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r5 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 

[PATCH] D18051: [CUDA] Provide CUDA's vector types implemented using clang's vector extension.

2016-03-10 Thread Artem Belevich via cfe-commits
tra created this revision.
tra added reviewers: jlebar, jingyue.
tra added a subscriber: cfe-commits.

This provides substantial performance boost on some benchmarks
(~25% on SHOC's FFT) due to vectorized loads/stores.

Unfortunately existing CUDA headers and user code occasionally
take pointer to vector fields which clang does not allow, so
we can't use vector types by default.

While vectorized types help in some cases, they may lower
performance in cases when user reads/writes only part of the vector as
Clang currently generates code to always load/store complete vector.
It may also create data races if user code assumed that parts of the
same vector can be safely changed from different threads.

For now control this feature via -DCUDA_VECTOR_TYPES and let user
choose whether to use Clang's vectorized types or CUDA's
non-vectorized ones.

http://reviews.llvm.org/D18051

Files:
  lib/Headers/CMakeLists.txt
  lib/Headers/__clang_cuda_runtime_wrapper.h
  lib/Headers/__clang_cuda_vector_types.h
  lib/Headers/cuda_builtin_vars.h

Index: lib/Headers/cuda_builtin_vars.h
===
--- lib/Headers/cuda_builtin_vars.h
+++ lib/Headers/cuda_builtin_vars.h
@@ -24,9 +24,11 @@
 #ifndef __CUDA_BUILTIN_VARS_H
 #define __CUDA_BUILTIN_VARS_H
 
+#if !defined(CUDA_VECTOR_TYPES)
 // Forward declares from vector_types.h.
 struct uint3;
 struct dim3;
+#endif
 
 // The file implements built-in CUDA variables using __declspec(property).
 // https://msdn.microsoft.com/en-us/library/yhfk0thd.aspx
Index: lib/Headers/__clang_cuda_vector_types.h
===
--- /dev/null
+++ lib/Headers/__clang_cuda_vector_types.h
@@ -0,0 +1,87 @@
+/*=== __clang_cuda_vector_types.h - CUDA vector types -===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===---===
+ */
+
+#ifndef __CLANG_CUDA_VECTOR_TYPES_H__
+#define __CLANG_CUDA_VECTOR_TYPES_H__
+
+typedef char char1 __attribute__((ext_vector_type(1)));
+typedef char char2 __attribute__((ext_vector_type(2)));
+typedef char char3 __attribute__((ext_vector_type(3)));
+typedef char char4 __attribute__((ext_vector_type(4)));
+typedef unsigned char uchar1 __attribute__((ext_vector_type(1)));
+typedef unsigned char uchar2 __attribute__((ext_vector_type(2)));
+typedef unsigned char uchar3 __attribute__((ext_vector_type(3)));
+typedef unsigned char uchar4 __attribute__((ext_vector_type(4)));
+typedef short short1 __attribute__((ext_vector_type(1)));
+typedef short short2 __attribute__((ext_vector_type(2)));
+typedef short short3 __attribute__((ext_vector_type(3)));
+typedef short short4 __attribute__((ext_vector_type(4)));
+typedef unsigned short ushort1 __attribute__((ext_vector_type(1)));
+typedef unsigned short ushort2 __attribute__((ext_vector_type(2)));
+typedef unsigned short ushort3 __attribute__((ext_vector_type(3)));
+typedef unsigned short ushort4 __attribute__((ext_vector_type(4)));
+typedef int int1 __attribute__((ext_vector_type(1)));
+typedef int int2 __attribute__((ext_vector_type(2)));
+typedef int int3 __attribute__((ext_vector_type(3)));
+typedef int int4 __attribute__((ext_vector_type(4)));
+typedef unsigned int uint1 __attribute__((ext_vector_type(1)));
+typedef unsigned int uint2 __attribute__((ext_vector_type(2)));
+typedef unsigned int uint3 __attribute__((ext_vector_type(3)));
+typedef unsigned int uint4 __attribute__((ext_vector_type(4)));
+typedef long long1 __attribute__((ext_vector_type(1)));
+typedef long long2 __attribute__((ext_vector_type(2)));
+typedef long long3 __attribute__((ext_vector_type(3)));
+typedef long long4 __attribute__((ext_vector_type(4)));
+typedef unsigned long ulong1 __attribute__((ext_vector_type(1)));
+typedef unsigned long ulong2 __attribute__((ext_vector_type(2)));
+typedef unsigned long ulong3 

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

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

rebased


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
===
--- lib/Frontend/CompilerInvocation.cpp
+++ 

Re: [PATCH] D17963: [OPENMP] Codegen for teams directive for NVPTX

2016-03-10 Thread Carlo Bertolli via cfe-commits
carlo.bertolli added a comment.

I can actually add a regression test that checks that the compiler does not 
break when using a global in a teams region, even without declare target, if 
that is what is required here.


Repository:
  rL LLVM

http://reviews.llvm.org/D17963



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


Re: [PATCH] D11797: [LIbClang] Report the named type for ElaboratedType

2016-03-10 Thread Kevin Funk via cfe-commits
kfunk added inline comments.


Comment at: tools/libclang/CXType.cpp:990
@@ -987,1 +989,3 @@
 
+CXType clang_getNamedTypeUnderlyingElaboratedType(CXType CT){
+  QualType T = GetQualType(CT);

I'm not happy with this name either. If you look through the libclang API, 
functions are named like `clang_get${CPPCLASSNAME}${CPPMETHOD}`. E.g. 
`clang_getEnumConstantDeclValue`, `clang_getFieldDeclBitWidth`, 
`clang_getFunctionTypeCallingConv`.

Sergey's initial version was closer to that. Maybe 
`clang_getElaboratedTypeNamedType` will just do...?


http://reviews.llvm.org/D11797



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


Re: Change Request

2016-03-10 Thread Aaron Ballman via cfe-commits
On Thu, Mar 10, 2016 at 11:38 AM, Wes Witt via cfe-commits
 wrote:
> I would like to submit the attached changes for your approval.

Thank you for the patch!

This:

+  let Subjects = SubjectList<[Function, Var, CXXRecord,
ObjCInterface], WarnDiag,
+ "ExpectedVariableOrFunction">;

should be using ExpectedFunctionVariableOrClass. It's not completely
correct since you're adding Objective-C interfaces, but it's a bit
better than dropping the class part.

Also, patch submissions should include test cases exercising the
differences in the patch, so you should add some tests.

Welcome!

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


Re: Change Request

2016-03-10 Thread Jonathan Roelofs via cfe-commits



On 3/10/16 9:38 AM, Wes Witt via cfe-commits wrote:

I would like to submit the attached changes for your approval.


Gentle etiquette suggestion: please title your emails with something 
more descriptive. In this case, something like: "[PATCH] Windows support 
for ObjC codegen". And then in the body of the email, write a little 
blurb saying how the changes achieve that goal, and why they're necessary.




My name is Wes Witt and I’m a software engineer at Microsoft. The diff
represent some small changes that we’ve made in order to use Clang to
compile Objective C on Windows.

The compiler is used for the open source WinObjC project
(https://github.com/Microsoft/WinObjC).


While you're here changing the signature anyway, please change Name to 
be a `StringRef` instead of a `const std::string&`:


   virtual llvm::Value *GetClassNamed(CodeGenFunction ,
-  const std::string , bool isWeak);
+  const std::string , bool isWeak, bool isDLLImport);


This:

+bool isDLLImport = false;
+if (OID->hasAttr()) {
+isDLLImport = true;
+}
+return GetClassNamed(CGF, OID->getNameAsString(), 
OID->isWeakImported(), isDLLImport);


should be written as:

return GetClassNamed(CGF, OID->getNameAsString(), OID->isWeakImported(), 
OID->hasAttr());



This:

+  if (isDLLImport) 
ClassSymbol->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);


should be broken into two lines.

-  return GetClassNamed(CGF, "NSAutoreleasePool", false);
+  return GetClassNamed(CGF, "NSAutoreleasePool", false, true);

I think the last parameter there should be an "is this a windows target" 
check, rather than an unconditional 'true'.



You'll also need to write testcases to verify the changed behavior. Have 
a look in clang/test/CodeGenObjC for examples of how to do it.




Thank you for your consideration.


Welcome to the community, and happy hacking!


Jon



-Wes Witt

w...@microsoft.com 



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



--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15729: Load compiler plugins in ASTUnit, too

2016-03-10 Thread Kevin Funk via cfe-commits
kfunk added a comment.

@bkramer: Thoughts about my patch? I wonder if this makes your "work-around" in 
http://reviews.llvm.org/D17808 redundant.


http://reviews.llvm.org/D15729



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


Change Request

2016-03-10 Thread Wes Witt via cfe-commits
I would like to submit the attached changes for your approval.

My name is Wes Witt and I'm a software engineer at Microsoft. The diff 
represent some small changes that we've made in order to use Clang to compile 
Objective C on Windows.

The compiler is used for the open source WinObjC project 
(https://github.com/Microsoft/WinObjC).

Thank you for your consideration.

-Wes Witt
w...@microsoft.com



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


Re: [PATCH] D18024: Remove compile time PreserveName switch based on NDEBUG

2016-03-10 Thread Mehdi AMINI via cfe-commits
joker.eph updated this revision to Diff 50282.
joker.eph added a comment.

Add a FIXME to change the compile time switch to a runtime command line flag


http://reviews.llvm.org/D18024

Files:
  lib/CodeGen/CGBuilder.h
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CodeGenAction.cpp
  lib/CodeGen/CodeGenFunction.cpp

Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -747,9 +747,7 @@
   // later.  Don't create this with the builder, because we don't want it
   // folded.
   llvm::Value *Undef = llvm::UndefValue::get(Int32Ty);
-  AllocaInsertPt = new llvm::BitCastInst(Undef, Int32Ty, "", EntryBB);
-  if (Builder.isNamePreserving())
-AllocaInsertPt->setName("allocapt");
+  AllocaInsertPt = new llvm::BitCastInst(Undef, Int32Ty, "allocapt", EntryBB);
 
   ReturnBlock = getJumpDestInCurrentScope("return");
 
@@ -1862,26 +1860,14 @@
 CGM.getSanitizerMetadata()->disableSanitizerForInstruction(I);
 }
 
-template 
-void CGBuilderInserter::InsertHelper(
+void CGBuilderInserter::InsertHelper(
 llvm::Instruction *I, const llvm::Twine , llvm::BasicBlock *BB,
 llvm::BasicBlock::iterator InsertPt) const {
-  llvm::IRBuilderDefaultInserter::InsertHelper(I, Name, BB,
-  InsertPt);
+  llvm::IRBuilderDefaultInserter::InsertHelper(I, Name, BB, InsertPt);
   if (CGF)
 CGF->InsertHelper(I, Name, BB, InsertPt);
 }
 
-#ifdef NDEBUG
-#define PreserveNames false
-#else
-#define PreserveNames true
-#endif
-template void CGBuilderInserter::InsertHelper(
-llvm::Instruction *I, const llvm::Twine , llvm::BasicBlock *BB,
-llvm::BasicBlock::iterator InsertPt) const;
-#undef PreserveNames
-
 static bool hasRequiredFeatures(const SmallVectorImpl ,
 CodeGenModule , const FunctionDecl *FD,
 std::string ) {
Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -656,7 +656,13 @@
 
 CodeGenAction::CodeGenAction(unsigned _Act, LLVMContext *_VMContext)
 : Act(_Act), VMContext(_VMContext ? _VMContext : new LLVMContext),
-  OwnsVMContext(!_VMContext) {}
+  OwnsVMContext(!_VMContext) {
+#ifdef NDEBUG
+  // FIXME: change this to be controlled by a cc1 flag that the driver passes,
+  // on the model of --disable-free
+  _VMContext.setDiscardValueNames(true);
+#endif
+}
 
 CodeGenAction::~CodeGenAction() {
   TheModule.reset();
Index: lib/CodeGen/CGExpr.cpp
===
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -66,8 +66,6 @@
 /// block.
 llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty,
 const Twine ) {
-  if (!Builder.isNamePreserving())
-return new llvm::AllocaInst(Ty, nullptr, "", AllocaInsertPt);
   return new llvm::AllocaInst(Ty, nullptr, Name, AllocaInsertPt);
 }
 
Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -3605,7 +3605,7 @@
   }
 
   llvm::Instruction *CI = CS.getInstruction();
-  if (Builder.isNamePreserving() && !CI->getType()->isVoidTy())
+  if (!CI->getType()->isVoidTy())
 CI->setName("call");
 
   // Emit any writebacks immediately.  Arguably this should happen
Index: lib/CodeGen/CGBuilder.h
===
--- lib/CodeGen/CGBuilder.h
+++ lib/CodeGen/CGBuilder.h
@@ -22,9 +22,7 @@
 /// \brief This is an IRBuilder insertion helper that forwards to
 /// CodeGenFunction::InsertHelper, which adds necessary metadata to
 /// instructions.
-template 
-class CGBuilderInserter
-: protected llvm::IRBuilderDefaultInserter {
+class CGBuilderInserter : protected llvm::IRBuilderDefaultInserter {
 public:
   CGBuilderInserter() = default;
   explicit CGBuilderInserter(CodeGenFunction *CGF) : CGF(CGF) {}
@@ -38,17 +36,10 @@
   CodeGenFunction *CGF = nullptr;
 };
 
-// Don't preserve names on values in an optimized build.
-#ifdef NDEBUG
-#define PreserveNames false
-#else
-#define PreserveNames true
-#endif
-
-typedef CGBuilderInserter CGBuilderInserterTy;
+typedef CGBuilderInserter CGBuilderInserterTy;
 
-typedef llvm::IRBuilder CGBuilderBaseTy;
+typedef llvm::IRBuilder
+CGBuilderBaseTy;
 
 class CGBuilderTy : public CGBuilderBaseTy {
   /// Storing a reference to the type cache here makes it a lot easier
@@ -298,8 +289,6 @@
   }
 };
 
-#undef PreserveNames
-
 }  // end namespace CodeGen
 }  // end namespace clang
 
___
cfe-commits mailing list

Re: r262851 - Module Debugging: Fix a crash when emitting debug info for nested tag types

2016-03-10 Thread Adrian Prantl via cfe-commits

> On Mar 9, 2016, at 5:22 PM, David Blaikie  wrote:
> 
> Is this bug only reachable with modules debug info?

Yes, it’s in ObjectFilePCHContainerOperations.cpp, which is only used while 
building a PCH or module with -gmodules.

> Could you describe the nature of the fix (not quite clear to me just by 
> looking at it)

In the ASTConsumer callback for a finished TagDecl, we check whether the 
DeclContext is complete and only try to emit debug info for the Decl if the 
DeclContext is available.

-- adrian

> 
> On Mon, Mar 7, 2016 at 12:58 PM, Adrian Prantl via cfe-commits 
>  wrote:
> Author: adrian
> Date: Mon Mar  7 14:58:52 2016
> New Revision: 262851
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=262851=rev
> Log:
> Module Debugging: Fix a crash when emitting debug info for nested tag types
> whose DeclContext is not yet complete by deferring their emission.
> 
> rdar://problem/24918680
> 
> Modified:
> cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
> cfe/trunk/test/Modules/Inputs/DebugCXX.h
> cfe/trunk/test/Modules/ModuleDebugInfo.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=262851=262850=262851=diff
> ==
> --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
> +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Mar  7 
> 14:58:52 2016
> @@ -201,6 +201,15 @@ public:
>  if (D->getName().empty())
>return;
> 
> +// Defer tag decls until their declcontext is complete.
> +auto *DeclCtx = D->getDeclContext();
> +while (DeclCtx) {
> +  if (auto *D = dyn_cast(DeclCtx))
> +if (!D->isCompleteDefinition())
> +  return;
> +  DeclCtx = DeclCtx->getParent();
> +}
> +
>  DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx);
>  DTV.TraverseDecl(D);
>  Builder->UpdateCompletedType(D);
> 
> Modified: cfe/trunk/test/Modules/Inputs/DebugCXX.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugCXX.h?rev=262851=262850=262851=diff
> ==
> --- cfe/trunk/test/Modules/Inputs/DebugCXX.h (original)
> +++ cfe/trunk/test/Modules/Inputs/DebugCXX.h Mon Mar  7 14:58:52 2016
> @@ -72,3 +72,14 @@ namespace {
>  struct InAnonymousNamespace { int i; };
>}
>  }
> +
> +class Base;
> +class A {
> +  virtual Base *getParent() const;
> +};
> +class Base {};
> +class Derived : Base {
> +  class B : A {
> +Derived *getParent() const override;
> +  };
> +};
> 
> Modified: cfe/trunk/test/Modules/ModuleDebugInfo.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=262851=262850=262851=diff
> ==
> --- cfe/trunk/test/Modules/ModuleDebugInfo.cpp (original)
> +++ cfe/trunk/test/Modules/ModuleDebugInfo.cpp Mon Mar  7 14:58:52 2016
> @@ -71,6 +71,13 @@
>  // CHECK-NOT:  name:
>  // CHECK-SAME: identifier: "_ZTS13TypedefStruct")
> 
> +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "Derived",
> +// CHECK-SAME: identifier: "_ZTS7Derived")
> +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "B", scope: 
> !"_ZTS7Derived",
> +// CHECK-SAME: elements: ![[B_MBRS:.*]], vtableHolder: !"_ZTS1A"
> +// CHECK: ![[B_MBRS]] = !{{{.*}}, ![[GET_PARENT:.*]]}
> +// CHECK: ![[GET_PARENT]] = !DISubprogram(name: "getParent"
> +
>  // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstatiation"
>  // no mangled name here yet.
> 
> 
> 
> ___
> 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] D18024: Remove compile time PreserveName switch based on NDEBUG

2016-03-10 Thread Chandler Carruth via cfe-commits
chandlerc added inline comments.


Comment at: lib/CodeGen/CodeGenAction.cpp:660-663
@@ -660,1 +659,6 @@
+  OwnsVMContext(!_VMContext) {
+#ifdef NDEBUG
+  _VMContext.setDiscardValueNames(true);
+#endif
+}
 

joker.eph wrote:
> chandlerc wrote:
> > I'm surprised this isn't a driver-side NDEBUG default flip? Can this still 
> > be overridden with a flag?
> It's gonna be next patch: plumbing a cc1 flag somehow. Right now this is 
> minimum patch to maintain existing behavior in clang while adapting to the 
> IRBuilder API in LLVM.
Ah, just add a FIXME comment to make it clear that this is a transitional thing 
and not planned to be the end state?


http://reviews.llvm.org/D18024



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


Re: [PATCH] D18024: Remove compile time PreserveName switch based on NDEBUG

2016-03-10 Thread Mehdi AMINI via cfe-commits
joker.eph added inline comments.


Comment at: lib/CodeGen/CodeGenAction.cpp:660-663
@@ -660,1 +659,6 @@
+  OwnsVMContext(!_VMContext) {
+#ifdef NDEBUG
+  _VMContext.setDiscardValueNames(true);
+#endif
+}
 

chandlerc wrote:
> I'm surprised this isn't a driver-side NDEBUG default flip? Can this still be 
> overridden with a flag?
It's gonna be next patch: plumbing a cc1 flag somehow. Right now this is 
minimum patch to maintain existing behavior in clang while adapting to the 
IRBuilder API in LLVM.


http://reviews.llvm.org/D18024



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


Re: [PATCH] D17821: [OpenCL] Complete image types support

2016-03-10 Thread Alexey Bader via cfe-commits
bader added a comment.

If there are no objections to adopt this approach I can start working on 
rebasing that patch to the ToT.



Comment at: include/clang/AST/OpenCLImageTypes.def:39
@@ +38,3 @@
+
+IMAGE_READ_TYPE(image1d, OCLImage1d)
+IMAGE_READ_TYPE(image1d_array, OCLImage1dArray)

Minor comment: any image access qualifier can be applied to any image type, so 
I think it's better to list all image types once to avoid duplication.



http://reviews.llvm.org/D17821



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


Re: [libcxx] r263036 - Implement LWG#2583: There is no way to supply an allocator for basic_string(str, pos)

2016-03-10 Thread Nico Weber via cfe-commits
I think this is ABI-breaking. On OS X, new libc++ headers must work with
old system libc++.dylibs. When I build in this setup with this change, I get

Undefined symbols for architecture x86_64:
  "std::__1::basic_string::basic_string(std::__1::basic_string const&, unsigned
long, std::__1::allocator const&)", referenced from:

The new function probably needs that always_inline treatment that many
other functions have?


On Wed, Mar 9, 2016 at 12:51 PM, Marshall Clow via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: marshall
> Date: Wed Mar  9 11:51:43 2016
> New Revision: 263036
>
> URL: http://llvm.org/viewvc/llvm-project?rev=263036=rev
> Log:
> Implement LWG#2583: There is no way to supply an allocator for
> basic_string(str, pos)
>
> Modified:
> libcxx/trunk/include/string
> libcxx/trunk/test/std/strings/basic.string/string.cons/substr.pass.cpp
> libcxx/trunk/www/cxx1z_status.html
>
> Modified: libcxx/trunk/include/string
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=263036=263035=263036=diff
>
> ==
> --- libcxx/trunk/include/string (original)
> +++ libcxx/trunk/include/string Wed Mar  9 11:51:43 2016
> @@ -98,8 +98,10 @@ public:
>  basic_string(const basic_string& str);
>  basic_string(basic_string&& str)
>  noexcept(is_nothrow_move_constructible::value);
> -basic_string(const basic_string& str, size_type pos, size_type n =
> npos,
> +basic_string(const basic_string& str, size_type pos,
>  // LWG#2583
>   const allocator_type& a = allocator_type());
> +basic_string(const basic_string& str, size_type pos, size_type n,
> // LWG#2583
> + const Allocator& a = Allocator());
>  basic_string(const value_type* s, const allocator_type& a =
> allocator_type());
>  basic_string(const value_type* s, size_type n, const allocator_type&
> a = allocator_type());
>  basic_string(size_type n, value_type c, const allocator_type& a =
> allocator_type());
> @@ -1397,7 +1399,9 @@ public:
>  basic_string(size_type __n, value_type __c);
>  _LIBCPP_INLINE_VISIBILITY
>  basic_string(size_type __n, value_type __c, const allocator_type&
> __a);
> -basic_string(const basic_string& __str, size_type __pos, size_type
> __n = npos,
> +basic_string(const basic_string& __str, size_type __pos, size_type
> __n,
> + const allocator_type& __a = allocator_type());
> +basic_string(const basic_string& __str, size_type __pos,
>   const allocator_type& __a = allocator_type());
>  template
>  _LIBCPP_INLINE_VISIBILITY
> @@ -2220,6 +2224,20 @@ basic_string<_CharT, _Traits, _Allocator
>  #if _LIBCPP_DEBUG_LEVEL >= 2
>  __get_db()->__insert_c(this);
>  #endif
> +}
> +
> +template 
> +basic_string<_CharT, _Traits, _Allocator>::basic_string(const
> basic_string& __str, size_type __pos,
> +const
> allocator_type& __a)
> +: __r_(__a)
> +{
> +size_type __str_sz = __str.size();
> +if (__pos > __str_sz)
> +this->__throw_out_of_range();
> +__init(__str.data() + __pos, __str_sz - __pos);
> +#if _LIBCPP_DEBUG_LEVEL >= 2
> +__get_db()->__insert_c(this);
> +#endif
>  }
>
>  template 
>
> Modified:
> libcxx/trunk/test/std/strings/basic.string/string.cons/substr.pass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/substr.pass.cpp?rev=263036=263035=263036=diff
>
> ==
> --- libcxx/trunk/test/std/strings/basic.string/string.cons/substr.pass.cpp
> (original)
> +++ libcxx/trunk/test/std/strings/basic.string/string.cons/substr.pass.cpp
> Wed Mar  9 11:51:43 2016
> @@ -11,14 +11,21 @@
>  // 
>
>  // basic_string(const basic_string& str,
> -//  size_type pos, size_type n = npos,
> +//  size_type pos, size_type n,
> +//  const Allocator& a = Allocator());
> +//
> +// basic_string(const basic_string& str,
> +//  size_type pos,
>  //  const Allocator& a = Allocator());
>
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>  #include 
>
> +#include "test_macros.h"
>  #include "test_allocator.h"
>  #include "min_allocator.h"
>
> @@ -91,6 +98,20 @@ test(S str, unsigned pos, unsigned n, co
>  }
>  }
>
> +#if TEST_STD_VER >= 11
> +void test2583()
> +{   // LWG #2583
> +typedef std::basic_string test_allocator > StringA;
> +std::vector std::scoped_allocator_adaptor> vs;
> +StringA s{"1234"};
> +vs.emplace_back(s, 2);
> +
> +try { vs.emplace_back(s, 5); }
> +catch (const std::out_of_range&) { 

r263117 - Updated SSE3 builtin tests to more closely match the llvm fast-isel equivalent tests

2016-03-10 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Thu Mar 10 08:46:49 2016
New Revision: 263117

URL: http://llvm.org/viewvc/llvm-project?rev=263117=rev
Log:
Updated SSE3 builtin tests to more closely match the llvm fast-isel equivalent 
tests

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

Modified: cfe/trunk/test/CodeGen/sse3-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sse3-builtins.c?rev=263117=263116=263117=diff
==
--- cfe/trunk/test/CodeGen/sse3-builtins.c (original)
+++ cfe/trunk/test/CodeGen/sse3-builtins.c Thu Mar 10 08:46:49 2016
@@ -5,45 +5,47 @@
 
 #include 
 
+// NOTE: This should match the tests in 
llvm/test/CodeGen/X86/sse3-intrinsics-fast-isel.ll
+
 __m128d test_mm_addsub_pd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_addsub_pd
-  // CHECK: call <2 x double> @llvm.x86.sse3.addsub.pd
+  // CHECK: call <2 x double> @llvm.x86.sse3.addsub.pd(<2 x double> %{{.*}}, 
<2 x double> %{{.*}})
   return _mm_addsub_pd(A, B);
 }
 
 __m128 test_mm_addsub_ps(__m128 A, __m128 B) {
   // CHECK-LABEL: test_mm_addsub_ps
-  // CHECK: call <4 x float> @llvm.x86.sse3.addsub.ps
+  // CHECK: call <4 x float> @llvm.x86.sse3.addsub.ps(<4 x float> %{{.*}}, <4 
x float> %{{.*}})
   return _mm_addsub_ps(A, B);
 }
 
 __m128d test_mm_hadd_pd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_hadd_pd
-  // CHECK: call <2 x double> @llvm.x86.sse3.hadd.pd
+  // CHECK: call <2 x double> @llvm.x86.sse3.hadd.pd(<2 x double> %{{.*}}, <2 
x double> %{{.*}})
   return _mm_hadd_pd(A, B);
 }
 
 __m128 test_mm_hadd_ps(__m128 A, __m128 B) {
   // CHECK-LABEL: test_mm_hadd_ps
-  // CHECK: call <4 x float> @llvm.x86.sse3.hadd.ps
+  // CHECK: call <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float> %{{.*}}, <4 x 
float> %{{.*}})
   return _mm_hadd_ps(A, B);
 }
 
 __m128d test_mm_hsub_pd(__m128d A, __m128d B) {
   // CHECK-LABEL: test_mm_hsub_pd
-  // CHECK: call <2 x double> @llvm.x86.sse3.hsub.pd
+  // CHECK: call <2 x double> @llvm.x86.sse3.hsub.pd(<2 x double> %{{.*}}, <2 
x double> %{{.*}})
   return _mm_hsub_pd(A, B);
 }
 
 __m128 test_mm_hsub_ps(__m128 A, __m128 B) {
   // CHECK-LABEL: test_mm_hsub_ps
-  // CHECK: call <4 x float> @llvm.x86.sse3.hsub.ps
+  // CHECK: call <4 x float> @llvm.x86.sse3.hsub.ps(<4 x float> %{{.*}}, <4 x 
float> %{{.*}})
   return _mm_hsub_ps(A, B);
 }
 
 __m128i test_mm_lddqu_si128(__m128i const* P) {
   // CHECK-LABEL: test_mm_lddqu_si128
-  // CHECK: call <16 x i8> @llvm.x86.sse3.ldu.dq
+  // CHECK: call <16 x i8> @llvm.x86.sse3.ldu.dq(i8* %{{.*}})
   return _mm_lddqu_si128(P);
 }
 


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


r263116 - Added note to SSE4a builtins about keeping in sync with llvm tests

2016-03-10 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Thu Mar 10 08:44:32 2016
New Revision: 263116

URL: http://llvm.org/viewvc/llvm-project?rev=263116=rev
Log:
Added note to SSE4a builtins about keeping in sync with llvm tests

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

Modified: cfe/trunk/test/CodeGen/sse4a-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sse4a-builtins.c?rev=263116=263115=263116=diff
==
--- cfe/trunk/test/CodeGen/sse4a-builtins.c (original)
+++ cfe/trunk/test/CodeGen/sse4a-builtins.c Thu Mar 10 08:44:32 2016
@@ -5,6 +5,8 @@
 
 #include 
 
+// NOTE: This should match the tests in 
llvm/test/CodeGen/X86/sse4a-intrinsics-fast-isel.ll
+
 __m128i test_mm_extracti_si64(__m128i x) {
   // CHECK-LABEL: test_mm_extracti_si64
   // CHECK: call <2 x i64> @llvm.x86.sse4a.extrqi(<2 x i64> %{{[^,]+}}, i8 3, 
i8 2)


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


r263115 - Updated SSSE3 builtin tests to more closely match the llvm fast-isel equivalent tests

2016-03-10 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Thu Mar 10 08:42:17 2016
New Revision: 263115

URL: http://llvm.org/viewvc/llvm-project?rev=263115=rev
Log:
Updated SSSE3 builtin tests to more closely match the llvm fast-isel equivalent 
tests

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

Modified: cfe/trunk/test/CodeGen/ssse3-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ssse3-builtins.c?rev=263115=263114=263115=diff
==
--- cfe/trunk/test/CodeGen/ssse3-builtins.c (original)
+++ cfe/trunk/test/CodeGen/ssse3-builtins.c Thu Mar 10 08:42:17 2016
@@ -5,21 +5,23 @@
 
 #include 
 
+// NOTE: This should match the tests in 
llvm/test/CodeGen/X86/ssse3-intrinsics-fast-isel.ll
+
 __m128i test_mm_abs_epi8(__m128i a) {
   // CHECK-LABEL: test_mm_abs_epi8
-  // CHECK: call <16 x i8> @llvm.x86.ssse3.pabs.b.128
+  // CHECK: call <16 x i8> @llvm.x86.ssse3.pabs.b.128(<16 x i8> %{{.*}})
   return _mm_abs_epi8(a);
 }
 
 __m128i test_mm_abs_epi16(__m128i a) {
   // CHECK-LABEL: test_mm_abs_epi16
-  // CHECK: call <8 x i16> @llvm.x86.ssse3.pabs.w.128
+  // CHECK: call <8 x i16> @llvm.x86.ssse3.pabs.w.128(<8 x i16> %{{.*}})
   return _mm_abs_epi16(a);
 }
 
 __m128i test_mm_abs_epi32(__m128i a) {
   // CHECK-LABEL: test_mm_abs_epi32
-  // CHECK: call <4 x i32> @llvm.x86.ssse3.pabs.d.128
+  // CHECK: call <4 x i32> @llvm.x86.ssse3.pabs.d.128(<4 x i32> %{{.*}})
   return _mm_abs_epi32(a);
 }
 
@@ -37,72 +39,72 @@ __m128i test2_mm_alignr_epi8(__m128i a,
 
 __m128i test_mm_hadd_epi16(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_hadd_epi16
-  // CHECK: call <8 x i16> @llvm.x86.ssse3.phadd.w.128
+  // CHECK: call <8 x i16> @llvm.x86.ssse3.phadd.w.128(<8 x i16> %{{.*}}, <8 x 
i16> %{{.*}})
   return _mm_hadd_epi16(a, b);
 }
 
 __m128i test_mm_hadd_epi32(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_hadd_epi32
-  // CHECK: call <4 x i32> @llvm.x86.ssse3.phadd.d.128
+  // CHECK: call <4 x i32> @llvm.x86.ssse3.phadd.d.128(<4 x i32> %{{.*}}, <4 x 
i32> %{{.*}})
   return _mm_hadd_epi32(a, b);
 }
 
 __m128i test_mm_hadds_epi16(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_hadds_epi16
-  // CHECK: call <8 x i16> @llvm.x86.ssse3.phadd.sw.128
+  // CHECK: call <8 x i16> @llvm.x86.ssse3.phadd.sw.128(<8 x i16> %{{.*}}, <8 
x i16> %{{.*}})
   return _mm_hadds_epi16(a, b);
 }
 
 __m128i test_mm_hsub_epi16(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_hsub_epi16
-  // CHECK: call <8 x i16> @llvm.x86.ssse3.phsub.w.128
+  // CHECK: call <8 x i16> @llvm.x86.ssse3.phsub.w.128(<8 x i16> %{{.*}}, <8 x 
i16> %{{.*}})
   return _mm_hsub_epi16(a, b);
 }
 
 __m128i test_mm_hsub_epi32(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_hsub_epi32
-  // CHECK: call <4 x i32> @llvm.x86.ssse3.phsub.d.128
+  // CHECK: call <4 x i32> @llvm.x86.ssse3.phsub.d.128(<4 x i32> %{{.*}}, <4 x 
i32> %{{.*}})
   return _mm_hsub_epi32(a, b);
 }
 
 __m128i test_mm_hsubs_epi16(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_hsubs_epi16
-  // CHECK: call <8 x i16> @llvm.x86.ssse3.phsub.sw.128
+  // CHECK: call <8 x i16> @llvm.x86.ssse3.phsub.sw.128(<8 x i16> %{{.*}}, <8 
x i16> %{{.*}})
   return _mm_hsubs_epi16(a, b);
 }
 
 __m128i test_mm_maddubs_epi16(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_maddubs_epi16
-  // CHECK: call <8 x i16> @llvm.x86.ssse3.pmadd.ub.sw.128
+  // CHECK: call <8 x i16> @llvm.x86.ssse3.pmadd.ub.sw.128(<16 x i8> %{{.*}}, 
<16 x i8> %{{.*}})
   return _mm_maddubs_epi16(a, b);
 }
 
 __m128i test_mm_mulhrs_epi16(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_mulhrs_epi16
-  // CHECK: call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128
+  // CHECK: call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> %{{.*}}, 
<8 x i16> %{{.*}})
   return _mm_mulhrs_epi16(a, b);
 }
 
 __m128i test_mm_shuffle_epi8(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_shuffle_epi8
-  // CHECK: call <16 x i8> @llvm.x86.ssse3.pshuf.b.128
+  // CHECK: call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8> %{{.*}}, <16 
x i8> %{{.*}})
   return _mm_shuffle_epi8(a, b);
 }
 
 __m128i test_mm_sign_epi8(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_sign_epi8
-  // CHECK: call <16 x i8> @llvm.x86.ssse3.psign.b.128
+  // CHECK: call <16 x i8> @llvm.x86.ssse3.psign.b.128(<16 x i8> %{{.*}}, <16 
x i8> %{{.*}})
   return _mm_sign_epi8(a, b);
 }
 
 __m128i test_mm_sign_epi16(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_sign_epi16
-  // CHECK: call <8 x i16> @llvm.x86.ssse3.psign.w.128
+  // CHECK: call <8 x i16> @llvm.x86.ssse3.psign.w.128(<8 x i16> %{{.*}}, <8 x 
i16> %{{.*}})
   return _mm_sign_epi16(a, b);
 }
 
 __m128i test_mm_sign_epi32(__m128i a, __m128i b) {
   // CHECK-LABEL: test_mm_sign_epi32
-  // CHECK: call <4 x i32> @llvm.x86.ssse3.psign.d.128
+  // CHECK: call <4 x i32> @llvm.x86.ssse3.psign.d.128(<4 x i32> %{{.*}}, <4 x 
i32> %{{.*}})
   return _mm_sign_epi32(a, b);
 }


___
cfe-commits mailing list

Re: r263109 - Correcting an attribute documentation generation error by giving the abi_tag attribute a documentation category.

2016-03-10 Thread Dmitry Polukhin via cfe-commits
Aaron, thank you for fixing this!

On Thu, Mar 10, 2016 at 4:08 PM, Aaron Ballman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: aaronballman
> Date: Thu Mar 10 07:08:22 2016
> New Revision: 263109
>
> URL: http://llvm.org/viewvc/llvm-project?rev=263109=rev
> Log:
> Correcting an attribute documentation generation error by giving the
> abi_tag attribute a documentation category.
>
> Modified:
> cfe/trunk/include/clang/Basic/AttrDocs.td
>
> Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=263109=263108=263109=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
> +++ cfe/trunk/include/clang/Basic/AttrDocs.td Thu Mar 10 07:08:22 2016
> @@ -2160,6 +2160,7 @@ optimizations like C++'s named return va
>  }
>
>  def AbiTagsDocs : Documentation {
> +  let Category = DocCatFunction;
>let Content = [{
>  The ``abi_tag`` attribute can be applied to a function, variable, class or
>  inline namespace declaration to modify the mangled name of the entity. It
> gives
>
>
> ___
> 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] Canonicalize UnaryTransformType types when they don't have a known underlying type

2016-03-10 Thread Vassil Vassilev via cfe-commits
Would this one more reasonable to commit. As you suggested if the base 
type is dependent, create a unique canonical UnaryTransformType with the 
canonical form of the base type as its base type and with DependentTy as 
its underlying type, then use that canonical dependent type as the 
underlying type for your sugared UnaryTransformType.

The attached patch follows the getDecltypeType approach.
--Vassil
On 24/02/16 23:09, Richard Smith wrote:

A UnaryTransformType should itself be a canonical type if its BaseType
is dependent -- that is, its CanonicalType should be QualType(this,
0). It should definitely not be treated as being canonically
equivalent to its BaseType.

On Wed, Feb 24, 2016 at 2:03 PM, Vassil Vassilev  wrote:

ping...

On 07/01/16 08:09, Vassil Vassilev via cfe-commits wrote:

Hi all,
   I am attaching a fix for https://llvm.org/bugs/show_bug.cgi?id=26014
   To which type should I tie the canonical type of the unknown underlying
type? Currently it is tied to its BaseType.

   Please review.
--Vassil


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




From 5ccd8851142e6a40b47d892cced9ec53b294ce3d Mon Sep 17 00:00:00 2001
From: Vassil Vassilev 
Date: Mon, 4 Jan 2016 20:48:36 +0200
Subject: [PATCH] Canonicalize UnaryTransformType types when they don't have a
 known underlying type.

Fixes https://llvm.org/bugs/show_bug.cgi?id=26014
---
 include/clang/AST/ASTContext.h   |  4 ++-
 include/clang/AST/Type.h | 22 
 lib/AST/ASTContext.cpp   | 38 +---
 lib/AST/Type.cpp | 29 +
 test/Modules/Inputs/PR26014/A.h  | 13 ++
 test/Modules/Inputs/PR26014/B.h  | 10 
 test/Modules/Inputs/PR26014/module.modulemap |  9 +++
 test/Modules/pr26014.cpp |  7 +
 test/SemaCXX/underlying_type.cpp |  5 
 9 files changed, 116 insertions(+), 21 deletions(-)
 create mode 100644 test/Modules/Inputs/PR26014/A.h
 create mode 100644 test/Modules/Inputs/PR26014/B.h
 create mode 100644 test/Modules/Inputs/PR26014/module.modulemap
 create mode 100644 test/Modules/pr26014.cpp

diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h
index 438e676..f455bb9 100644
--- a/include/clang/AST/ASTContext.h
+++ b/include/clang/AST/ASTContext.h
@@ -128,6 +128,8 @@ class ASTContext : public RefCountedBase {
   llvm::FoldingSet PackExpansionTypes;
   mutable llvm::FoldingSet ObjCObjectTypes;
   mutable llvm::FoldingSet ObjCObjectPointerTypes;
+  mutable llvm::FoldingSet
+DependentUnaryTransformTypes;
   mutable llvm::FoldingSet AutoTypes;
   mutable llvm::FoldingSet AtomicTypes;
   llvm::FoldingSet AttributedTypes;
@@ -1301,7 +1303,7 @@ public:
   QualType getDecltypeType(Expr *e, QualType UnderlyingType) const;
 
   /// \brief Unary type transforms
-  QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType,
+  QualType getUnaryTransformType(QualType BaseTy, QualType UnderlyingTy,
  UnaryTransformType::UTTKind UKind) const;
 
   /// \brief C++11 deduced auto type.
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index d63b2c4..328ef05 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -3518,6 +3518,28 @@ public:
   }
 };
 
+/// \brief Internal representation of canonical, dependent
+/// __underlying_type(type) types.
+///
+/// This class is used internally by the ASTContext to manage
+/// canonical, dependent types, only. Clients will only see instances
+/// of this class via UnaryTransformType nodes.
+class DependentUnaryTransformType : public UnaryTransformType,
+public llvm::FoldingSetNode {
+public:
+  DependentUnaryTransformType(const ASTContext , QualType BaseTy,
+  UTTKind UKind);
+  void Profile(llvm::FoldingSetNodeID ) {
+Profile(ID, getBaseType(), getUTTKind());
+  }
+
+  static void Profile(llvm::FoldingSetNodeID , QualType BaseTy,
+  UTTKind UKind) {
+ID.AddPointer(BaseTy.getAsOpaquePtr());
+ID.AddInteger((unsigned)UKind);
+  }
+};
+
 class TagType : public Type {
   /// Stores the TagDecl associated with this type. The decl may point to any
   /// TagDecl that declares the entity.
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index eba3578..9e01976 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -4009,17 +4009,37 @@ QualType ASTContext::getDecltypeType(Expr *e, QualType 
UnderlyingType) const {
 
 /// getUnaryTransformationType - We don't unique these, since the memory
 /// savings are minimal and these are rare.
-QualType ASTContext::getUnaryTransformType(QualType BaseType,
- 

r263113 - Minor Wdocumentation fix. NFCI.

2016-03-10 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Thu Mar 10 08:16:36 2016
New Revision: 263113

URL: http://llvm.org/viewvc/llvm-project?rev=263113=rev
Log:
Minor Wdocumentation fix. NFCI.

Modified:
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=263113=263112=263113=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Thu Mar 10 08:16:36 2016
@@ -291,7 +291,6 @@ const internal::VariadicDynCastAllOfMatc
 /// \endcode
 /// labelDecl()
 ///   matches 'FOO:'
-/// \endcode
 const internal::VariadicDynCastAllOfMatcher labelDecl;
 
 /// \brief Matches a declaration of a namespace.


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


r263109 - Correcting an attribute documentation generation error by giving the abi_tag attribute a documentation category.

2016-03-10 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Thu Mar 10 07:08:22 2016
New Revision: 263109

URL: http://llvm.org/viewvc/llvm-project?rev=263109=rev
Log:
Correcting an attribute documentation generation error by giving the abi_tag 
attribute a documentation category.

Modified:
cfe/trunk/include/clang/Basic/AttrDocs.td

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=263109=263108=263109=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Thu Mar 10 07:08:22 2016
@@ -2160,6 +2160,7 @@ optimizations like C++'s named return va
 }
 
 def AbiTagsDocs : Documentation {
+  let Category = DocCatFunction;
   let Content = [{
 The ``abi_tag`` attribute can be applied to a function, variable, class or
 inline namespace declaration to modify the mangled name of the entity. It gives


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


Re: [PATCH] D17286: Make FreeBSD and NetBSD use CLANG_DEFAULT_CXX_STDLIB

2016-03-10 Thread Jonas Hahnfeld via cfe-commits
Hahnfeld added a comment.

More comments on this?

Thanks, Jonas


http://reviews.llvm.org/D17286



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


[PATCH] D18035: [GCC] PR23529 Mangler part of attrbute abi_tag support

2016-03-10 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin created this revision.
DmitryPolukhin added a reviewer: majnemer.
DmitryPolukhin added subscribers: cfe-commits, aaron.ballman, stbuehler.

 Original patch by Stefan Bühler http://reviews.llvm.org/D12834

Difference between original and this one:
- fixed all failing tests
- fixed mangling for global variable outside namespace
- emit ABI tags for guards and local names (i.e. GCC ABI 10+)
- clang-format + other stylistic changes

Sema part is here: http://reviews.llvm.org/D17567

http://reviews.llvm.org/D18035

Files:
  include/clang/Basic/AttrDocs.td
  lib/AST/ItaniumMangle.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGenCXX/mangle-abi-tag.cpp
  test/SemaCXX/attr-abi-tag-syntax.cpp
  test/SemaCXX/attr-abi-tag.cpp

Index: test/SemaCXX/attr-abi-tag.cpp
===
--- /dev/null
+++ test/SemaCXX/attr-abi-tag.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -x c++ -std=c++11 -triple x86_64-unknown-linux -emit-llvm < %s | FileCheck %s
+
+// CHECK: @_Z5Func1B6Names1v()
+inline namespace Names1 __attribute__((__abi_tag__)) {
+class C1 {};
+}
+C1 Func1() { return C1(); }
+
+// CHECK: @_Z5Func2B4Tag1B4Tag2v()
+inline namespace Names2 __attribute__((__abi_tag__("Tag1", "Tag2"))) {
+class C2 {};
+}
+C2 Func2() { return C2(); }
Index: test/SemaCXX/attr-abi-tag-syntax.cpp
===
--- test/SemaCXX/attr-abi-tag-syntax.cpp
+++ test/SemaCXX/attr-abi-tag-syntax.cpp
@@ -16,28 +16,18 @@
 // expected-warning@-1 {{'abi_tag' attribute on anonymous namespace ignored}}
 
 inline namespace N __attribute__((__abi_tag__)) {}
-// FIXME: remove this warning as soon as attribute fully supported.
-// expected-warning@-2 {{'__abi_tag__' attribute ignored}}
 
 } // namespcace N2
 
 __attribute__((abi_tag("B", "A"))) extern int a1;
-// FIXME: remove this warning as soon as attribute fully supported.
-// expected-warning@-2 {{'abi_tag' attribute ignored}}
 
 __attribute__((abi_tag("A", "B"))) extern int a1;
 // expected-note@-1 {{previous declaration is here}}
-// FIXME: remove this warning as soon as attribute fully supported.
-// expected-warning@-3 {{'abi_tag' attribute ignored}}
 
 __attribute__((abi_tag("A", "C"))) extern int a1;
 // expected-error@-1 {{'abi_tag' C missing in original declaration}}
-// FIXME: remove this warning as soon as attribute fully supported.
-// expected-warning@-3 {{'abi_tag' attribute ignored}}
 
 extern int a2;
 // expected-note@-1 {{previous declaration is here}}
 __attribute__((abi_tag("A")))extern int a2;
 // expected-error@-1 {{cannot add 'abi_tag' attribute in a redeclaration}}
-// FIXME: remove this warning as soon as attribute fully supported.
-// expected-warning@-3 {{'abi_tag' attribute ignored}}
Index: test/CodeGenCXX/mangle-abi-tag.cpp
===
--- /dev/null
+++ test/CodeGenCXX/mangle-abi-tag.cpp
@@ -0,0 +1,124 @@
+// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - | FileCheck %s
+
+struct __attribute__((abi_tag("A", "B"))) A { };
+
+struct B: A { };
+
+template
+
+struct C {
+};
+
+struct D { A* p; };
+
+template
+struct __attribute__((abi_tag("C", "D"))) E {
+};
+
+struct __attribute__((abi_tag("A", "B"))) F { };
+
+A a1;
+// CHECK: @_Z2a1B1AB1B =
+
+__attribute__((abi_tag("C", "D")))
+A a2;
+// CHECK: @_Z2a2B1AB1BB1CB1D =
+
+B a3;
+// CHECK: @a3 =
+
+C a4;
+// CHECK: @_Z2a4B1AB1B =
+
+D a5;
+// CHECK: @a5 =
+
+E a6;
+// CHECK: @_Z2a6B1CB1D =
+
+E a7;
+// CHECK: @_Z2a7B1AB1BB1CB1D =
+
+template<>
+struct E {
+  static float a8;
+};
+float E::a8;
+// CHECK: @_ZN1EB1CB1DIfE2a8E =
+
+template<>
+struct E {
+  static bool a9;
+};
+bool E::a9;
+// CHECK: @_ZN1EB1CB1DI1FB1AB1BE2a9E =
+
+struct __attribute__((abi_tag("A", "B"))) A10 {
+  virtual ~A10() {}
+} a10;
+// vtable
+// CHECK: @_ZTV3A10B1AB1B =
+// typeinfo
+// CHECK: @_ZTI3A10B1AB1B =
+
+// Local variables from f9.
+// f9()::L::foo[abi:C][abi:D]()::a[abi:A][abi:B]
+// CHECK-DAG: @_ZZZ2f9vEN1L3fooB1CB1DEvE1aB1AB1B =
+// guard variable for f9()::L::foo[abi:C][abi:D]()::a[abi:A][abi:B]
+// CHECK-DAG: @_ZGVZZ2f9vEN1L3fooB1CB1DEvE1aB1AB1B =
+
+__attribute__ ((abi_tag("C", "D")))
+void* f1() {
+  return 0;
+}
+// CHECK: define {{.*}} @_Z2f1B1CB1Dv(
+
+__attribute__ ((abi_tag("C", "D")))
+A* f2() {
+  return 0;
+}
+// CHECK: define {{.*}} @_Z2f2B1AB1BB1CB1Dv(
+
+B* f3() {
+  return 0;
+}
+// CHECK: define {{.*}} @_Z2f3v(
+
+C* f4() {
+  return 0;
+}
+// CHECK: define {{.*}} @_Z2f4B1AB1Bv(
+
+D* f5() {
+  return 0;
+}
+// CHECK: define {{.*}} @_Z2f5v(
+
+E* f6() {
+  return 0;
+}
+// CHECK: define {{.*}} @_Z2f6B1CB1Dv(
+
+E* f7() {
+  return 0;
+}
+// CHECK: define {{.*}} @_Z2f7B1AB1BB1CB1Dv(
+
+void f8(E*) {
+}
+// CHECK: define {{.*}} @_Z2f8P1EB1CB1DI1AB1AB1BE(
+
+inline void f9() {
+  struct L {
+static E* foo() {
+  static A10 a;
+  return 0;
+}
+  };
+  L::foo();
+}
+void f9_test() {
+  f9();
+}
+// f9()::L::foo[abi:C][abi:D]()
+// 

Re: [PATCH] D17453: [Driver] Enable --rtlib option for MSVC target

2016-03-10 Thread Roman Shirokiy via cfe-commits
roman.shirokiy updated this revision to Diff 50260.
roman.shirokiy added a comment.

Updated diff with the test for "nostdlib" + "rtlib" case.


http://reviews.llvm.org/D17453

Files:
  lib/Driver/Tools.cpp
  test/Driver/msvc-compiler-rt.c
  test/Driver/nostdlib.c

Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -8945,10 +8945,20 @@
   break;
 }
 break;
-  case ToolChain::RLT_Libgcc:
-AddLibgcc(TC.getTriple(), D, CmdArgs, Args);
-break;
-  }
+case ToolChain::RLT_Libgcc:
+  // Make sure libgcc is not used under MSVC environment by default
+  if (TC.getTriple().isKnownWindowsMSVCEnvironment()) {
+ // Issue error diagnostic if libgcc is explicitly specified 
+ // through command line as --rtlib option argument.
+ if (Args.hasArg(options::OPT_rtlib_EQ)) {
+   TC.getDriver().Diag(diag::err_drv_unsupported_rtlib_for_platform)
+   << Args.getLastArg(options::OPT_rtlib_EQ)->getValue() << "MSVC";
+ }
+  }
+  else   
+AddLibgcc(TC.getTriple(), D, CmdArgs, Args);
+  break;
+}
 }
 
 static const char *getLDMOption(const llvm::Triple , const ArgList ) {
@@ -9752,6 +9762,12 @@
 }
   }
 
+  // Add compiler-rt lib in case if it was explicitly
+  // specified as an argument for --rtlib option.
+  if (!Args.hasArg(options::OPT_nostdlib)) {
+AddRunTimeLibs(TC, TC.getDriver(), CmdArgs, Args);
+  }
+
   // Add filenames, libraries, and other linker inputs.
   for (const auto  : Inputs) {
 if (Input.isFilename()) {
Index: test/Driver/nostdlib.c
===
--- test/Driver/nostdlib.c
+++ test/Driver/nostdlib.c
@@ -22,6 +22,10 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir -lclang_rt.builtins-i686 \
 // RUN:   | FileCheck --check-prefix=CHECK-LINUX-NOSTDLIB %s
 //
+// RUN: %clang -target x86_64-pc-windows-msvc -nostdlib --rtlib=compiler-rt 
-### %s 2>&1 | FileCheck %s -check-prefix CHECK-MSVC-NOSTDLIB
+// RUN: %clang -target x86_64-pc-windows-msvc --rtlib=compiler-rt -nostdlib 
-### %s 2>&1 | FileCheck %s -check-prefix CHECK-MSVC-NOSTDLIB
+//
 // CHECK-LINUX-NOSTDLIB: warning: argument unused during compilation: 
'--rtlib=compiler-rt'
 // CHECK-LINUX-NOSTDLIB: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
 // CHECK-LINUX-NOSTDLIB-NOT: 
"{{.*}}/Inputs/resource_dir{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-i686.a"
+// CHECK-MSVC-NOSTDLIB: warning: argument unused during compilation: 
'--rtlib=compiler-rt'
Index: test/Driver/msvc-compiler-rt.c
===
--- test/Driver/msvc-compiler-rt.c
+++ test/Driver/msvc-compiler-rt.c
@@ -0,0 +1,5 @@
+// RUN: %clang -target x86_64-pc-windows-msvc --rtlib=compiler-rt -### %s 2>&1 
| FileCheck %s -check-prefix MSVC-COMPILER-RT
+// RUN: not %clang %s -target x86_64-pc-windows-msvc --rtlib=libgcc 2>&1 | 
FileCheck %s -check-prefix CHECK-ERROR
+
+// MSVC-COMPILER-RT: "{{.*}}clang_rt.builtins{{.*}}"
+// CHECK-ERROR: unsupported runtime library 'libgcc' for platform 'MSVC'


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -8945,10 +8945,20 @@
   break;
 }
 break;
-  case ToolChain::RLT_Libgcc:
-AddLibgcc(TC.getTriple(), D, CmdArgs, Args);
-break;
-  }
+case ToolChain::RLT_Libgcc:
+  // Make sure libgcc is not used under MSVC environment by default
+  if (TC.getTriple().isKnownWindowsMSVCEnvironment()) {
+ // Issue error diagnostic if libgcc is explicitly specified 
+ // through command line as --rtlib option argument.
+ if (Args.hasArg(options::OPT_rtlib_EQ)) {
+   TC.getDriver().Diag(diag::err_drv_unsupported_rtlib_for_platform)
+   << Args.getLastArg(options::OPT_rtlib_EQ)->getValue() << "MSVC";
+ }
+  }
+  else   
+AddLibgcc(TC.getTriple(), D, CmdArgs, Args);
+  break;
+}
 }
 
 static const char *getLDMOption(const llvm::Triple , const ArgList ) {
@@ -9752,6 +9762,12 @@
 }
   }
 
+  // Add compiler-rt lib in case if it was explicitly
+  // specified as an argument for --rtlib option.
+  if (!Args.hasArg(options::OPT_nostdlib)) {
+AddRunTimeLibs(TC, TC.getDriver(), CmdArgs, Args);
+  }
+
   // Add filenames, libraries, and other linker inputs.
   for (const auto  : Inputs) {
 if (Input.isFilename()) {
Index: test/Driver/nostdlib.c
===
--- test/Driver/nostdlib.c
+++ test/Driver/nostdlib.c
@@ -22,6 +22,10 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir -lclang_rt.builtins-i686 \
 // RUN:   | FileCheck --check-prefix=CHECK-LINUX-NOSTDLIB %s
 //
+// RUN: %clang -target x86_64-pc-windows-msvc -nostdlib --rtlib=compiler-rt -### %s 2>&1 | FileCheck %s -check-prefix 

Re: [PATCH] D17453: [Driver] Enable --rtlib option for MSVC target

2016-03-10 Thread Roman Shirokiy via cfe-commits
roman.shirokiy added a comment.

Hello!

Thanks for the feedback!

MSVC got its own runtime lib, so the function "AddRunTimeLibs" is not used 
anywhere in "visualstudio::Linker::Constructjob" i.e. "--rtlib" option is 
currently unused in MSVC environment (there is always a warning: argument 
unused during compilation').

  if (!Args.hasArg(options::OPT_nostdlib)) {
AddRunTimeLibs(TC, TC.getDriver(), CmdArgs, Args);
  }

This change is necessary to actually handle "--rtlib" on MSVC, but I totally 
agree that test for "-nostdlib --rtlib=compiler-rt" case is missed.


http://reviews.llvm.org/D17453



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


Re: [PATCH] D16873: Refactor MemRegionManager::getVarRegion to call two new functions, improving readability

2016-03-10 Thread Aleksei Sidorin via cfe-commits
a.sidorin added a comment.

Alexander, could you update status of this review?


http://reviews.llvm.org/D16873



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


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

2016-03-10 Thread Aleksei Sidorin via cfe-commits
a.sidorin added a comment.

Serge: BTW, tests for CXXBoolLiteralExpr are presented in this patch. There is 
no test //exactly// for it but at least one test uses bool literal and matches 
it successfully with cxxBoolLiteral() matcher.


http://reviews.llvm.org/D14286



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


Re: [PATCH] D18024: Remove compile time PreserveName switch based on NDEBUG

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

FYI, I'd lik eto hold off on submitting here until we're on the same page with 
Philip on the original LLVM review (http://reviews.llvm.org/D17946), but some 
comments on how this is working are below...



Comment at: lib/CodeGen/CodeGenAction.cpp:660-663
@@ -660,1 +659,6 @@
+  OwnsVMContext(!_VMContext) {
+#ifdef NDEBUG
+  _VMContext.setDiscardValueNames(true);
+#endif
+}
 

I'm surprised this isn't a driver-side NDEBUG default flip? Can this still be 
overridden with a flag?


http://reviews.llvm.org/D18024



___
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-10 Thread Haojian Wu via cfe-commits
hokein added a comment.

friendly ping @rsmith.


http://reviews.llvm.org/D17762



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