r272247 - [Sema] Don't crash when a field w/ a mem-initializer clashes with a record name

2016-06-08 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Thu Jun  9 00:26:56 2016
New Revision: 272247

URL: http://llvm.org/viewvc/llvm-project?rev=272247=rev
Log:
[Sema] Don't crash when a field w/ a mem-initializer clashes with a record name

It is possible for a field and a class to have the same name.  In such
cases, performing lookup for the field might return a result set with
more than one entry.  An overzealous assertion fired, causing us to
crash instead of using the non-class lookup result.

This fixes PR28060.

Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/test/SemaCXX/member-init.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=272247=272246=272247=diff
==
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Thu Jun  9 00:26:56 2016
@@ -2637,8 +2637,7 @@ Sema::InstantiateClassMembers(SourceLoca
 Instantiation->getTemplateInstantiationPattern();
 DeclContext::lookup_result Lookup =
 ClassPattern->lookup(Field->getDeclName());
-assert(Lookup.size() == 1);
-FieldDecl *Pattern = cast(Lookup[0]);
+FieldDecl *Pattern = cast(Lookup.front());
 InstantiateInClassInitializer(PointOfInstantiation, Field, Pattern,
   TemplateArgs);
   }

Modified: cfe/trunk/test/SemaCXX/member-init.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/member-init.cpp?rev=272247=272246=272247=diff
==
--- cfe/trunk/test/SemaCXX/member-init.cpp (original)
+++ cfe/trunk/test/SemaCXX/member-init.cpp Thu Jun  9 00:26:56 2016
@@ -192,3 +192,13 @@ struct S {
   int x[3] = {[N] = 3};
 };
 }
+
+namespace PR28060 {
+template 
+void foo(T v) {
+  struct s {
+T *s = 0;
+  };
+}
+template void foo(int);
+}


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


r272246 - [X86] Handle AVX2 pslldqi and psrldqi intrinsics shufflevector creation directly in the header file instead of in CGBuiltin.cpp. Simplify the sse2 equivalents as well.

2016-06-08 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Thu Jun  9 00:15:12 2016
New Revision: 272246

URL: http://llvm.org/viewvc/llvm-project?rev=272246=rev
Log:
[X86] Handle AVX2 pslldqi and psrldqi intrinsics shufflevector creation 
directly in the header file instead of in CGBuiltin.cpp. Simplify the sse2 
equivalents as well.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/avx2intrin.h
cfe/trunk/lib/Headers/emmintrin.h
cfe/trunk/test/CodeGen/avx2-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=272246=272245=272246=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Thu Jun  9 00:15:12 2016
@@ -557,7 +557,6 @@ TARGET_BUILTIN(__builtin_ia32_pshufb256,
 TARGET_BUILTIN(__builtin_ia32_psignb256, "V32cV32cV32c", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_psignw256, "V16sV16sV16s", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_psignd256, "V8iV8iV8i", "", "avx2")
-TARGET_BUILTIN(__builtin_ia32_pslldqi256, "V4LLiV4LLiIi", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_psllwi256, "V16sV16si", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_psllw256, "V16sV16sV8s", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_pslldi256, "V8iV8ii", "", "avx2")
@@ -568,7 +567,6 @@ TARGET_BUILTIN(__builtin_ia32_psrawi256,
 TARGET_BUILTIN(__builtin_ia32_psraw256, "V16sV16sV8s", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_psradi256, "V8iV8ii", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_psrad256, "V8iV8iV4i", "", "avx2")
-TARGET_BUILTIN(__builtin_ia32_psrldqi256, "V4LLiV4LLiIi", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_psrlwi256, "V16sV16si", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_psrlw256, "V16sV16sV8s", "", "avx2")
 TARGET_BUILTIN(__builtin_ia32_psrldi256, "V8iV8ii", "", "avx2")

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=272246=272245=272246=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Jun  9 00:15:12 2016
@@ -6704,58 +6704,6 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 return EmitX86Select(*this, Ops[4], Align, Ops[3]);
   }
 
-  case X86::BI__builtin_ia32_pslldqi256: {
-// Shift value is in bits so divide by 8.
-unsigned shiftVal = cast(Ops[1])->getZExtValue() >> 3;
-
-// If pslldq is shifting the vector more than 15 bytes, emit zero.
-if (shiftVal >= 16)
-  return llvm::Constant::getNullValue(ConvertType(E->getType()));
-
-int Indices[32];
-// 256-bit pslldq operates on 128-bit lanes so we need to handle that
-for (unsigned l = 0; l != 32; l += 16) {
-  for (unsigned i = 0; i != 16; ++i) {
-unsigned Idx = 32 + i - shiftVal;
-if (Idx < 32) Idx -= 16; // end of lane, switch operand.
-Indices[l + i] = Idx + l;
-  }
-}
-
-llvm::Type *VecTy = llvm::VectorType::get(Int8Ty, 32);
-Ops[0] = Builder.CreateBitCast(Ops[0], VecTy, "cast");
-Value *Zero = llvm::Constant::getNullValue(VecTy);
-
-Value *SV = Builder.CreateShuffleVector(Zero, Ops[0], Indices, "pslldq");
-llvm::Type *ResultType = ConvertType(E->getType());
-return Builder.CreateBitCast(SV, ResultType, "cast");
-  }
-  case X86::BI__builtin_ia32_psrldqi256: {
-// Shift value is in bits so divide by 8.
-unsigned shiftVal = cast(Ops[1])->getZExtValue() >> 3;
-
-// If psrldq is shifting the vector more than 15 bytes, emit zero.
-if (shiftVal >= 16)
-  return llvm::Constant::getNullValue(ConvertType(E->getType()));
-
-int Indices[32];
-// 256-bit psrldq operates on 128-bit lanes so we need to handle that
-for (unsigned l = 0; l != 32; l += 16) {
-  for (unsigned i = 0; i != 16; ++i) {
-unsigned Idx = i + shiftVal;
-if (Idx >= 16) Idx += 16; // end of lane, switch operand.
-Indices[l + i] = Idx + l;
-  }
-}
-
-llvm::Type *VecTy = llvm::VectorType::get(Int8Ty, 32);
-Ops[0] = Builder.CreateBitCast(Ops[0], VecTy, "cast");
-Value *Zero = llvm::Constant::getNullValue(VecTy);
-
-Value *SV = Builder.CreateShuffleVector(Ops[0], Zero, Indices, "psrldq");
-llvm::Type *ResultType = ConvertType(E->getType());
-return Builder.CreateBitCast(SV, ResultType, "cast");
-  }
   case X86::BI__builtin_ia32_movntps:
   case X86::BI__builtin_ia32_movntps256:
   case X86::BI__builtin_ia32_movntpd:

Modified: cfe/trunk/lib/Headers/avx2intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx2intrin.h?rev=272246=272245=272246=diff
==
--- cfe/trunk/lib/Headers/avx2intrin.h (original)
+++ cfe/trunk/lib/Headers/avx2intrin.h 

r272245 - [X86] Reuse the EmitX86Select routine to handle the select for masked palignr too.

2016-06-08 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Thu Jun  9 00:15:00 2016
New Revision: 272245

URL: http://llvm.org/viewvc/llvm-project?rev=272245=rev
Log:
[X86] Reuse the EmitX86Select routine to handle the select for masked palignr 
too.

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

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=272245=272244=272245=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Jun  9 00:15:00 2016
@@ -6334,17 +6334,16 @@ static Value *EmitX86MaskedLoad(CodeGenF
 }
 
 static Value *EmitX86Select(CodeGenFunction ,
-SmallVectorImpl ) {
+Value *Mask, Value *Op0, Value *Op1) {
 
   // If the mask is all ones just return first argument.
-  if (const auto *C = dyn_cast(Ops[0]))
+  if (const auto *C = dyn_cast(Mask))
 if (C->isAllOnesValue())
-  return Ops[1];
+  return Op0;
 
-  Value *MaskVec = getMaskVecValue(CGF, Ops[0],
-   Ops[1]->getType()->getVectorNumElements());
+  Mask = getMaskVecValue(CGF, Mask, Op0->getType()->getVectorNumElements());
 
-  return CGF.Builder.CreateSelect(MaskVec, Ops[1], Ops[2]);
+  return CGF.Builder.CreateSelect(Mask, Op0, Op1);
 }
 
 Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
@@ -6702,15 +6701,7 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 if (Ops.size() == 3)
   return Align;
 
-// If the mask is all ones just emit the align operation.
-if (const auto *C = dyn_cast(Ops[4]))
-  if (C->isAllOnesValue())
-return Align;
-
-llvm::VectorType *MaskTy = llvm::VectorType::get(Builder.getInt1Ty(),
- NumElts);
-llvm::Value *Mask = Builder.CreateBitCast(Ops[4], MaskTy, "cast");
-return Builder.CreateSelect(Mask, Align, Ops[3]);
+return EmitX86Select(*this, Ops[4], Align, Ops[3]);
   }
 
   case X86::BI__builtin_ia32_pslldqi256: {
@@ -6812,7 +6803,7 @@ Value *CodeGenFunction::EmitX86BuiltinEx
   case X86::BI__builtin_ia32_selectpd_128:
   case X86::BI__builtin_ia32_selectpd_256:
   case X86::BI__builtin_ia32_selectpd_512:
-return EmitX86Select(*this, Ops);
+return EmitX86Select(*this, Ops[0], Ops[1], Ops[2]);
   // 3DNow!
   case X86::BI__builtin_ia32_pswapdsf:
   case X86::BI__builtin_ia32_pswapdsi: {


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


r272244 - [X86] Add void to the argument list of intrinsics that don't take arguments since empty argument list mean something else in C.

2016-06-08 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Thu Jun  9 00:14:28 2016
New Revision: 272244

URL: http://llvm.org/viewvc/llvm-project?rev=272244=rev
Log:
[X86] Add void to the argument list of intrinsics that don't take arguments 
since empty argument list mean something else in C.

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/lib/Headers/avxintrin.h
cfe/trunk/lib/Headers/emmintrin.h
cfe/trunk/lib/Headers/mm3dnow.h
cfe/trunk/lib/Headers/xmmintrin.h

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=272244=272243=272244=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Thu Jun  9 00:14:28 2016
@@ -173,25 +173,25 @@ _mm512_setzero_si512(void)
 #define _mm512_setzero_epi32 _mm512_setzero_si512
 
 static __inline__ __m512d __DEFAULT_FN_ATTRS
-_mm512_undefined_pd()
+_mm512_undefined_pd(void)
 {
   return (__m512d)__builtin_ia32_undef512();
 }
 
 static __inline__ __m512 __DEFAULT_FN_ATTRS
-_mm512_undefined()
+_mm512_undefined(void)
 {
   return (__m512)__builtin_ia32_undef512();
 }
 
 static __inline__ __m512 __DEFAULT_FN_ATTRS
-_mm512_undefined_ps()
+_mm512_undefined_ps(void)
 {
   return (__m512)__builtin_ia32_undef512();
 }
 
 static __inline__ __m512i __DEFAULT_FN_ATTRS
-_mm512_undefined_epi32()
+_mm512_undefined_epi32(void)
 {
   return (__m512i)__builtin_ia32_undef512();
 }

Modified: cfe/trunk/lib/Headers/avxintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avxintrin.h?rev=272244=272243=272244=diff
==
--- cfe/trunk/lib/Headers/avxintrin.h (original)
+++ cfe/trunk/lib/Headers/avxintrin.h Thu Jun  9 00:14:28 2016
@@ -2513,19 +2513,19 @@ _mm256_stream_ps(float *__p, __m256 __a)
 
 /* Create vectors */
 static __inline__ __m256d __DEFAULT_FN_ATTRS
-_mm256_undefined_pd()
+_mm256_undefined_pd(void)
 {
   return (__m256d)__builtin_ia32_undef256();
 }
 
 static __inline__ __m256 __DEFAULT_FN_ATTRS
-_mm256_undefined_ps()
+_mm256_undefined_ps(void)
 {
   return (__m256)__builtin_ia32_undef256();
 }
 
 static __inline__ __m256i __DEFAULT_FN_ATTRS
-_mm256_undefined_si256()
+_mm256_undefined_si256(void)
 {
   return (__m256i)__builtin_ia32_undef256();
 }

Modified: cfe/trunk/lib/Headers/emmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/emmintrin.h?rev=272244=272243=272244=diff
==
--- cfe/trunk/lib/Headers/emmintrin.h (original)
+++ cfe/trunk/lib/Headers/emmintrin.h Thu Jun  9 00:14:28 2016
@@ -536,7 +536,7 @@ _mm_loadl_pd(__m128d __a, double const *
 }
 
 static __inline__ __m128d __DEFAULT_FN_ATTRS
-_mm_undefined_pd()
+_mm_undefined_pd(void)
 {
   return (__m128d)__builtin_ia32_undef128();
 }
@@ -1883,7 +1883,7 @@ _mm_loadl_epi64(__m128i const *__p)
 ///
 /// \returns A 128-bit vector of [4 x i32] with unspecified content.
 static __inline__ __m128i __DEFAULT_FN_ATTRS
-_mm_undefined_si128()
+_mm_undefined_si128(void)
 {
   return (__m128i)__builtin_ia32_undef128();
 }

Modified: cfe/trunk/lib/Headers/mm3dnow.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/mm3dnow.h?rev=272244=272243=272244=diff
==
--- cfe/trunk/lib/Headers/mm3dnow.h (original)
+++ cfe/trunk/lib/Headers/mm3dnow.h Thu Jun  9 00:14:28 2016
@@ -33,7 +33,7 @@ typedef float __v2sf __attribute__((__ve
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("3dnow")))
 
 static __inline__ void __DEFAULT_FN_ATTRS
-_m_femms() {
+_m_femms(void) {
   __builtin_ia32_femms();
 }
 

Modified: cfe/trunk/lib/Headers/xmmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/xmmintrin.h?rev=272244=272243=272244=diff
==
--- cfe/trunk/lib/Headers/xmmintrin.h (original)
+++ cfe/trunk/lib/Headers/xmmintrin.h Thu Jun  9 00:14:28 2016
@@ -1727,7 +1727,7 @@ _mm_loadr_ps(const float *__p)
 /// \returns A 128-bit vector of [4 x float] containing undefined values.
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS
-_mm_undefined_ps()
+_mm_undefined_ps(void)
 {
   return (__m128)__builtin_ia32_undef128();
 }


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


Re: [PATCH] D20748: Handle recursion in LLVMIRGeneration Timer

2016-06-08 Thread Davide Italiano via cfe-commits
I agree with Rafael. I ran with -ftime-report for a couple of weeks on
a lot of tests and never hit this problem.
It actually seems weird we have to handle the timer recursively here
as well (I'd like to avoid it at all), but let's see what Richard has
to say when he gets to this review.

On Wed, Jun 8, 2016 at 10:27 PM, Rafael Espíndola
 wrote:
> Since we found only one user, I think my preference is to handle it there.
>
> Cheers,
> Rafael
>
>
> On 8 June 2016 at 13:49, Vedant Kumar  wrote:
>> vsk added a comment.
>>
>> Ping, any updates on this patch?
>>
>>
>> http://reviews.llvm.org/D20748
>>
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20748: Handle recursion in LLVMIRGeneration Timer

2016-06-08 Thread Rafael Espíndola via cfe-commits
Since we found only one user, I think my preference is to handle it there.

Cheers,
Rafael


On 8 June 2016 at 13:49, Vedant Kumar  wrote:
> vsk added a comment.
>
> Ping, any updates on this patch?
>
>
> http://reviews.llvm.org/D20748
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21163: Strip Android version when looking up toolchain paths.

2016-06-08 Thread Josh Gao via cfe-commits
jmgao created this revision.
jmgao added reviewers: srhines, danalbert.
jmgao added a subscriber: cfe-commits.
Herald added subscribers: srhines, danalbert, tberghammer, aemerson.

Android target triples can include a version number in the abi field
(e.g. 'aarch64-linux-android21'), used for checking for availability.
However, the driver was searching for toolchain binaries using the
passed in triple as a prefix.

http://reviews.llvm.org/D21163

Files:
  lib/Driver/Driver.cpp

Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2283,7 +2283,15 @@
 const char *Tool, const ToolChain ,
 SmallVectorImpl ) const {
   // FIXME: Needs a better variable than DefaultTargetTriple
-  Names.emplace_back(DefaultTargetTriple + "-" + Tool);
+  StringRef Triple = DefaultTargetTriple;
+
+  // On Android, the target triple can include a version number that needs to
+  // be stripped.
+  if (TC.getTriple().isAndroid()) {
+Triple = Triple.rtrim("0123456789");
+  }
+
+  Names.emplace_back((Triple + "-" + Tool).str());
   Names.emplace_back(Tool);
 
   // Allow the discovery of tools prefixed with LLVM's default target triple.


Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2283,7 +2283,15 @@
 const char *Tool, const ToolChain ,
 SmallVectorImpl ) const {
   // FIXME: Needs a better variable than DefaultTargetTriple
-  Names.emplace_back(DefaultTargetTriple + "-" + Tool);
+  StringRef Triple = DefaultTargetTriple;
+
+  // On Android, the target triple can include a version number that needs to
+  // be stripped.
+  if (TC.getTriple().isAndroid()) {
+Triple = Triple.rtrim("0123456789");
+  }
+
+  Names.emplace_back((Triple + "-" + Tool).str());
   Names.emplace_back(Tool);
 
   // Allow the discovery of tools prefixed with LLVM's default target triple.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r272235 - Update to match LLVM r272232.

2016-06-08 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Jun  8 19:54:42 2016
New Revision: 272235

URL: http://llvm.org/viewvc/llvm-project?rev=272235=rev
Log:
Update to match LLVM r272232.

Modified:
clang-tools-extra/trunk/clang-query/tool/ClangQuery.cpp
clang-tools-extra/trunk/tool-template/ToolTemplate.cpp

Modified: clang-tools-extra/trunk/clang-query/tool/ClangQuery.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/tool/ClangQuery.cpp?rev=272235=272234=272235=diff
==
--- clang-tools-extra/trunk/clang-query/tool/ClangQuery.cpp (original)
+++ clang-tools-extra/trunk/clang-query/tool/ClangQuery.cpp Wed Jun  8 19:54:42 
2016
@@ -59,7 +59,7 @@ static cl::list CommandFile
   cl::cat(ClangQueryCategory));
 
 int main(int argc, const char **argv) {
-  llvm::sys::PrintStackTraceOnErrorSignal();
+  llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
 
   CommonOptionsParser OptionsParser(argc, argv, ClangQueryCategory);
 

Modified: clang-tools-extra/trunk/tool-template/ToolTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/tool-template/ToolTemplate.cpp?rev=272235=272234=272235=diff
==
--- clang-tools-extra/trunk/tool-template/ToolTemplate.cpp (original)
+++ clang-tools-extra/trunk/tool-template/ToolTemplate.cpp Wed Jun  8 19:54:42 
2016
@@ -73,7 +73,7 @@ static cl::extrahelp CommonHelp(CommonOp
 static cl::OptionCategory ToolTemplateCategory("tool-template options");
 
 int main(int argc, const char **argv) {
-  llvm::sys::PrintStackTraceOnErrorSignal();
+  llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
   CommonOptionsParser OptionsParser(argc, argv, ToolTemplateCategory);
   RefactoringTool Tool(OptionsParser.getCompilations(),
OptionsParser.getSourcePathList());


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


r272233 - Update to match LLVM r272232.

2016-06-08 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Jun  8 19:53:41 2016
New Revision: 272233

URL: http://llvm.org/viewvc/llvm-project?rev=272233=rev
Log:
Update to match LLVM r272232.

Modified:
cfe/trunk/tools/arcmt-test/arcmt-test.cpp
cfe/trunk/tools/c-index-test/c-index-test.c
cfe/trunk/tools/c-index-test/core_main.cpp
cfe/trunk/tools/clang-check/ClangCheck.cpp
cfe/trunk/tools/clang-format/ClangFormat.cpp
cfe/trunk/tools/driver/cc1_main.cpp
cfe/trunk/tools/driver/cc1as_main.cpp
cfe/trunk/tools/driver/driver.cpp
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/utils/TableGen/TableGen.cpp

Modified: cfe/trunk/tools/arcmt-test/arcmt-test.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/arcmt-test/arcmt-test.cpp?rev=272233=272232=272233=diff
==
--- cfe/trunk/tools/arcmt-test/arcmt-test.cpp (original)
+++ cfe/trunk/tools/arcmt-test/arcmt-test.cpp Wed Jun  8 19:53:41 2016
@@ -341,7 +341,7 @@ static void printSourceRange(CharSourceR
 
 int main(int argc, const char **argv) {
   void *MainAddr = (void*) (intptr_t) GetExecutablePath;
-  llvm::sys::PrintStackTraceOnErrorSignal();
+  llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
 
   std::string
 resourcesPath = CompilerInvocation::GetResourcesPath(argv[0], MainAddr);

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=272233=272232=272233=diff
==
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Wed Jun  8 19:53:41 2016
@@ -4440,11 +4440,8 @@ int main(int argc, const char **argv) {
   client_data.argc = argc;
   client_data.argv = argv;
 
-  if (argc > 1 && strcmp(argv[1], "core") == 0) {
+  if (argc > 1 && strcmp(argv[1], "core") == 0)
 client_data.main_func = indextest_core_main;
---client_data.argc;
-++client_data.argv;
-  }
 
   if (getenv("CINDEXTEST_NOTHREADS"))
 return client_data.main_func(client_data.argc, client_data.argv);

Modified: cfe/trunk/tools/c-index-test/core_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/core_main.cpp?rev=272233=272232=272233=diff
==
--- cfe/trunk/tools/c-index-test/core_main.cpp (original)
+++ cfe/trunk/tools/c-index-test/core_main.cpp Wed Jun  8 19:53:41 2016
@@ -196,9 +196,13 @@ static void printSymbolNameAndUSR(const
 
//===--===//
 
 int indextest_core_main(int argc, const char **argv) {
-  sys::PrintStackTraceOnErrorSignal();
+  sys::PrintStackTraceOnErrorSignal(argv[0]);
   PrettyStackTraceProgram X(argc, argv);
 
+  assert(argv[1] == StringRef("core"));
+  ++argv;
+  --argc;
+
   std::vector CompArgs;
   const char **DoubleDash = std::find(argv, argv + argc, StringRef("--"));
   if (DoubleDash != argv + argc) {

Modified: cfe/trunk/tools/clang-check/ClangCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-check/ClangCheck.cpp?rev=272233=272232=272233=diff
==
--- cfe/trunk/tools/clang-check/ClangCheck.cpp (original)
+++ cfe/trunk/tools/clang-check/ClangCheck.cpp Wed Jun  8 19:53:41 2016
@@ -150,7 +150,7 @@ public:
 } // namespace
 
 int main(int argc, const char **argv) {
-  llvm::sys::PrintStackTraceOnErrorSignal();
+  llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
 
   // Initialize targets for clang module support.
   llvm::InitializeAllTargets();

Modified: cfe/trunk/tools/clang-format/ClangFormat.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/ClangFormat.cpp?rev=272233=272232=272233=diff
==
--- cfe/trunk/tools/clang-format/ClangFormat.cpp (original)
+++ cfe/trunk/tools/clang-format/ClangFormat.cpp Wed Jun  8 19:53:41 2016
@@ -315,7 +315,7 @@ static void PrintVersion() {
 }
 
 int main(int argc, const char **argv) {
-  llvm::sys::PrintStackTraceOnErrorSignal();
+  llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
 
   cl::HideUnrelatedOptions(ClangFormatCategory);
 

Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=272233=272232=272233=diff
==
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Wed Jun  8 19:53:41 2016
@@ -132,9 +132,5 @@ int cc1_main(ArrayRef Argv
 return !Success;
   }
 
-  // Managed static deconstruction. Useful for making things like
-  // -time-passes usable.
-  llvm::llvm_shutdown();
-
   return !Success;
 }

Modified: cfe/trunk/tools/driver/cc1as_main.cpp
URL: 

[PATCH] D21162: [CUDA] Implement __shfl* intrinsics in clang headers.

2016-06-08 Thread Justin Lebar via cfe-commits
jlebar created this revision.
jlebar added a reviewer: tra.
jlebar added subscribers: cfe-commits, jholewinski.

Clang changes to make use of the LLVM intrinsics added in D21160.

http://reviews.llvm.org/D21162

Files:
  include/clang/Basic/BuiltinsNVPTX.def
  lib/Headers/__clang_cuda_intrinsics.h
  lib/Headers/__clang_cuda_runtime_wrapper.h

Index: lib/Headers/__clang_cuda_runtime_wrapper.h
===
--- lib/Headers/__clang_cuda_runtime_wrapper.h
+++ lib/Headers/__clang_cuda_runtime_wrapper.h
@@ -198,13 +198,14 @@
 #include "sm_20_atomic_functions.hpp"
 #include "sm_20_intrinsics.hpp"
 #include "sm_32_atomic_functions.hpp"
-// sm_30_intrinsics.h has declarations that use default argument, so
-// we have to include it and it will in turn include .hpp
-#include "sm_30_intrinsics.h"
 
-// Don't include sm_32_intrinsics.h.  That header defines __ldg using inline
-// asm, but we want to define it using builtins, because we can't use the
-// [addr+imm] addressing mode if we use the inline asm in the header.
+// Don't include sm_30_intrinsics.h and sm_32_intrinsics.h.  These define the
+// __shfl and __ldg intrinsics using inline (volatile) asm, but we want to
+// define them using builtins so that the optimizer can reason about and across
+// these instructions.  In particular, using intrinsics for ldg gets us the
+// [addr+imm] addressing mode, which, although it doesn't actually exist in the
+// hardware, seems to generate faster machine code because ptxas can more easily
+// reason about our code.
 
 #undef __MATH_FUNCTIONS_HPP__
 
Index: lib/Headers/__clang_cuda_intrinsics.h
===
--- lib/Headers/__clang_cuda_intrinsics.h
+++ lib/Headers/__clang_cuda_intrinsics.h
@@ -26,6 +26,74 @@
 #error "This file is for CUDA compilation only."
 #endif
 
+// sm_30 intrinsics: __shfl_{up,down,xor}.
+
+#define __SM_30_INTRINSICS_H__
+#define __SM_30_INTRINSICS_HPP__
+
+#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 300
+
+#pragma push_macro("__MAKE_SHUFFLES")
+#define __MAKE_SHUFFLES(__FnName, __IntIntrinsic, __FloatIntrinsic, __Mask)\
+  inline __device__ int __FnName(int __in, int __offset,   \
+ int __width = warpSize) { \
+return __IntIntrinsic(__in, __offset,  \
+  ((warpSize - __width) << 8) | (__Mask)); \
+  }\
+  inline __device__ float __FnName(float __in, int __offset,   \
+   int __width = warpSize) {   \
+return __FloatIntrinsic(__in, __offset,\
+((warpSize - __width) << 8) | (__Mask));   \
+  }\
+  inline __device__ unsigned int __FnName(unsigned int __in, int __offset, \
+  int __width = warpSize) {\
+return static_cast(  \
+::__FnName(static_cast(__in), __offset, __width));\
+  }\
+  inline __device__ long long __FnName(long long __in, int __offset,   \
+   int __width = warpSize) {   \
+struct __Bits {\
+  int __a, __b;\
+}; \
+_Static_assert(sizeof(__in) == sizeof(__Bits));\
+_Static_assert(sizeof(__Bits) == 2 * sizeof(int)); \
+__Bits __tmp;  \
+memcpy(&__in, &__tmp, sizeof(__in));   \
+__tmp.__a = ::__FnName(__tmp.__a, __offset, __width);  \
+__tmp.__b = ::__FnName(__tmp.__b, __offset, __width);  \
+long long __out;   \
+memcpy(&__out, &__tmp, sizeof(__tmp)); \
+return __out;  \
+  }\
+  inline __device__ unsigned long long __FnName(   \
+  unsigned long long __in, int __offset, int __width = warpSize) { \
+return static_cast(\
+::__FnName(static_cast(__in), __offset, __width)); \
+  }\
+  

Re: [PATCH] D21113: Add support for case-insensitive header lookup

2016-06-08 Thread Hans Wennborg via cfe-commits
hans added a comment.

In http://reviews.llvm.org/D21113#452673, @thakis wrote:

> Not sure if we want a flag that adds 50% overhead, no matter how convenient 
> it might be :-/


I now have a version of the patch that caches directory contents that it lists:

  real2m31.461s
  user68m42.090s
  sys 1m51.707s

While the sys time is a little bit higher, real time is on par with putting the 
SDK on FAT, so I think this is still worth pursuing. I need to clean up the 
patch and figure out how to invalidate the cache after module things are 
written, though.


http://reviews.llvm.org/D21113



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


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-08 Thread Bruno Cardoso Lopes via cfe-commits
bruno added inline comments.


Comment at: lib/Lex/PPDirectives.cpp:179
@@ +178,3 @@
+"exception", "iterator", "random", "strstream", "vector",
+"forward_list", "limits", "ratio", "system_error",
+

Applying your patch reveled a bunch of ^M (carriage-return) characters in the 
C++ library headers section above. Also make sure to clean this up.


http://reviews.llvm.org/D19843



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


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-08 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Lex/PPDirectives.cpp:33
@@ -28,2 +32,2 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/SaveAndRestore.h"

eric_niebler wrote:
> You mean, instead of the `StringSet` below? Looks like `StringSwitch` just 
> turns into cascading `memcmp`'s. Bet I can tell you how that performs versus 
> a hash set. :-) Also, with the `StringSet`, I get to initialize it once and 
> reuse it many times. I expect that will be pretty darn quick at runtime, but 
> I'm looking forward to @bruno's results.
Right, I'm not suggesting `StringSwitch` will be faster; it's preferable for 
other reasons (it avoids the memory and shutdown costs of the static local 
set). We should stick with what you have if the performance advantage is 
measurable; otherwise my preference would be to use `StringSwitch`. But it's 
only a slight preference -- if you'd rather not, I won't complain.

[`StringSwitch` isn't /quite/ as bad as you're suggesting: it always first 
compares on length, and it typically compiles into a switch on string length 
followed by memcmps. Moreover, the code should be "obvious" enough that 
compilers can (at least in principle) optimize those memcmps very aggressively, 
right down into the equivalent of an unrolled DFA or a perfect hash function, 
but I'm not at all confident that LLVM will actually do that =)]


Comment at: lib/Lex/PPDirectives.cpp:220
@@ +219,3 @@
+// In the ASCII range?
+if (Ch < 0 || Ch > 0xff)
+  return false; // Can't be a standard header

Comment doesn't match code: the ASCII range ends at 0x7F.


Comment at: lib/Lex/PPDirectives.cpp:225-229
@@ +224,7 @@
+  Ch += 'a' - 'A';
+#ifdef LLVM_ON_WIN32
+// Normalize path separators for comparison purposes.
+else if (Ch == '\\')
+  Ch = '/';
+#endif
+  }

Rather than hardcoding this platform-specific test here, maybe use 
`llvm::sys::path::is_separator(Ch)`.


http://reviews.llvm.org/D19843



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


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-08 Thread Eric Niebler via cfe-commits
eric_niebler added inline comments.


Comment at: lib/Lex/PPDirectives.cpp:220
@@ +219,3 @@
+// In the ASCII range?
+if (Ch < 0 || Ch > 0xff)
+  return false; // Can't be a standard header

rsmith wrote:
> Comment doesn't match code: the ASCII range ends at 0x7F.
This should be `0x7F`. I'll fix it.


http://reviews.llvm.org/D19843



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


[libcxx] r272216 - Add notes for 2688

2016-06-08 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Jun  8 17:33:25 2016
New Revision: 272216

URL: http://llvm.org/viewvc/llvm-project?rev=272216=rev
Log:
Add notes for 2688

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=272216=272215=272216=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Wed Jun  8 17:33:25 2016
@@ -86,7 +86,7 @@
http://wg21.link/LWG2683;>2683filesystem::copy() says "no 
effects"Oulu
http://wg21.link/LWG2684;>2684priority_queue lacking 
comparator typedefOuluPatch Ready
http://wg21.link/LWG2685;>2685shared_ptr 
deleters must not not throw on move 
constructionOuluComplete
-   http://wg21.link/LWG2688;>2688clamp 
misses preconditions and has extraneous condition on 
resultOulu
+   http://wg21.link/LWG2688;>2688clamp 
misses preconditions and has extraneous condition on 
resultOuluPatch Ready
http://wg21.link/LWG2689;>2689Parallel 
versions of std::copy and std::move shouldn't be in 
orderOulu
http://wg21.link/LWG2698;>2698Effect of 
assign() on 
iterators/pointers/referencesOuluComplete
http://wg21.link/LWG2706;>2706Error 
reporting for recursive_directory_iterator::pop() is 
under-specifiedOulu
@@ -123,7 +123,7 @@
 2683 - 
 2684 - We already have one; just need to add a test for it.
 2685 - Wording clarification; no code change needed. We don't handle 
throwing move ctors here anyway.
-2688 - I believe that we already do this.
+2688 - I believe that we already do this. Add more tests
 2689 - We don't have a parallel implementation yet (though I'm working on 
it).
 2698 - Wording clarification; no code change needed.
 2706 - 


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


r272215 - [docs] Coverage: Clarify return value of __llvm_profile_write_file

2016-06-08 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Wed Jun  8 17:32:03 2016
New Revision: 272215

URL: http://llvm.org/viewvc/llvm-project?rev=272215=rev
Log:
[docs] Coverage: Clarify return value of __llvm_profile_write_file

Modified:
cfe/trunk/docs/SourceBasedCodeCoverage.rst

Modified: cfe/trunk/docs/SourceBasedCodeCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SourceBasedCodeCoverage.rst?rev=272215=272214=272215=diff
==
--- cfe/trunk/docs/SourceBasedCodeCoverage.rst (original)
+++ cfe/trunk/docs/SourceBasedCodeCoverage.rst Wed Jun  8 17:32:03 2016
@@ -206,8 +206,9 @@ without using static initializers, do th
   to ``__llvm_profile_write_file``.
 
 * Forward-declare ``int __llvm_profile_write_file(void)`` and call it to write
-  out a profile. Calling this function multiple times appends profile data to
-  an existing on-disk raw profile.
+  out a profile. This function returns 0 when it succeeds, and a non-zero value
+  otherwise. Calling this function multiple times appends profile data to an
+  existing on-disk raw profile.
 
 Drawbacks and limitations
 =


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


r272214 - [docs] Coverage: Flesh out instructions for avoiding static initializeres

2016-06-08 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Wed Jun  8 17:24:52 2016
New Revision: 272214

URL: http://llvm.org/viewvc/llvm-project?rev=272214=rev
Log:
[docs] Coverage: Flesh out instructions for avoiding static initializeres

Modified:
cfe/trunk/docs/SourceBasedCodeCoverage.rst

Modified: cfe/trunk/docs/SourceBasedCodeCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SourceBasedCodeCoverage.rst?rev=272214=272213=272214=diff
==
--- cfe/trunk/docs/SourceBasedCodeCoverage.rst (original)
+++ cfe/trunk/docs/SourceBasedCodeCoverage.rst Wed Jun  8 17:24:52 2016
@@ -192,14 +192,22 @@ By default the compiler runtime uses a s
 profile output path and to register a writer function. To collect profiles
 without using static initializers, do this manually:
 
-* Export a ``int __llvm_profile_runtime`` symbol. The linker won't pull in the
-  object file containing the profiling runtime's static initializer if this
-  symbol is defined.
+* Export a ``int __llvm_profile_runtime`` symbol from each instrumented shared
+  library and executable. When the linker finds a definition of this symbol, it
+  knows to skip loading the object which contains the profiling runtime's
+  static initializer.
 
-* Call ``__llvm_profile_initialize_file`` once. This parses
-  ``LLVM_PROFILE_FILE`` and sets the output path.
+* Forward-declare ``void __llvm_profile_initialize_file(void)`` and call it
+  once from each instrumented executable. This function parses
+  ``LLVM_PROFILE_FILE``, sets the output path, and truncates any existing files
+  at that path. To get the same behavior without truncating existing files,
+  pass a filename pattern string to ``void __llvm_profile_set_filename(char
+  *)``.  These calls can be placed anywhere so long as they precede all calls
+  to ``__llvm_profile_write_file``.
 
-* Call ``__llvm_profile_write_file`` to write out a profile.
+* Forward-declare ``int __llvm_profile_write_file(void)`` and call it to write
+  out a profile. Calling this function multiple times appends profile data to
+  an existing on-disk raw profile.
 
 Drawbacks and limitations
 =


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


r272213 - [CMake] Cleanup uses of USES_TERMINAL

2016-06-08 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Wed Jun  8 17:20:43 2016
New Revision: 272213

URL: http://llvm.org/viewvc/llvm-project?rev=272213=rev
Log:
[CMake] Cleanup uses of USES_TERMINAL

Now that we are on CMake 3.4.3 we no longer need a version check around this.

This is the clang side of r272211.

Modified:
cfe/trunk/runtime/CMakeLists.txt

Modified: cfe/trunk/runtime/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/runtime/CMakeLists.txt?rev=272213=272212=272213=diff
==
--- cfe/trunk/runtime/CMakeLists.txt (original)
+++ cfe/trunk/runtime/CMakeLists.txt Wed Jun  8 17:20:43 2016
@@ -83,7 +83,6 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND E
-DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX}
-   -Dcmake_3_2_USES_TERMINAL=${cmake_3_2_USES_TERMINAL}
${COMPILER_RT_PASSTHROUGH_VARIABLES}
 INSTALL_COMMAND ""
 STEP_TARGETS configure build
@@ -136,7 +135,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND E
 DEPENDS compiler-rt-build ${COMPILER_RT_TEST_DEPENDENCIES}
 WORKING_DIRECTORY ${BINARY_DIR}
 VERBATIM
-${cmake_3_2_USES_TERMINAL}
+USES_TERMINAL
 )
 endforeach()
 


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


[libcxx] r272212 - [CMake] Cleanup uses of USES_TERMINAL

2016-06-08 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Wed Jun  8 17:20:28 2016
New Revision: 272212

URL: http://llvm.org/viewvc/llvm-project?rev=272212=rev
Log:
[CMake] Cleanup uses of USES_TERMINAL

Now that we are on CMake 3.4.3 we no longer need a version check around this.

This is the libcxx side of r272211.

Modified:
libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake

Modified: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=272212=272211=272212=diff
==
--- libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original)
+++ libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Wed Jun  8 17:20:28 
2016
@@ -93,14 +93,6 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   endif()
   set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for 
lit")
 
-  # Make sure we can use the console pool for recent cmake and ninja > 1.5
-  # Needed for add_lit_testsuite
-  if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
-set(cmake_3_2_USES_TERMINAL)
-  else()
-set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
-  endif()
-
   # Required doc configuration
   if (LLVM_ENABLE_SPHINX)
 message(STATUS "Sphinx enabled.")


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


Re: r272198 - [DebugInfo] Add calling conventions to DISubroutineType

2016-06-08 Thread David Blaikie via cfe-commits
At least in theory it'd be nice to have test cases for the other call sites
this change adds CC to.

On Wed, Jun 8, 2016 at 1:41 PM, Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rnk
> Date: Wed Jun  8 15:41:54 2016
> New Revision: 272198
>
> URL: http://llvm.org/viewvc/llvm-project?rev=272198=rev
> Log:
> [DebugInfo] Add calling conventions to DISubroutineType
>
> Summary:
> This should have been a very simple change, but it was greatly
> complicated by the construction of new Decls during IR generation.
>
> In particular, we reconstruct the AST function type in order to get the
> implicit 'this' parameter into C++ method types.
>
> We also have to worry about FunctionDecls whose types are not
> FunctionTypes because CGBlocks.cpp constructs some dummy FunctionDecls
> with 'void' type.
>
> Depends on D21114
>
> Reviewers: aprantl, dblaikie
>
> Subscribers: cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D21141
>
> Added:
> cfe/trunk/test/CodeGenCXX/debug-info-calling-conventions.cpp
> Modified:
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=272198=272197=272198=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jun  8 15:41:54 2016
> @@ -831,6 +831,39 @@ llvm::DIType *CGDebugInfo::CreateType(co
>getDeclContextDescriptor(Ty->getDecl()));
>  }
>
> +static unsigned getDwarfCC(CallingConv CC) {
> +  switch (CC) {
> +  case CC_C:
> +// Avoid emitting DW_AT_calling_convention if the C convention was
> used.
> +return 0;
> +
> +  case CC_X86StdCall:
> +return llvm::dwarf::DW_CC_BORLAND_stdcall;
> +  case CC_X86FastCall:
> +return llvm::dwarf::DW_CC_BORLAND_msfastcall;
> +  case CC_X86ThisCall:
> +return llvm::dwarf::DW_CC_BORLAND_thiscall;
> +  case CC_X86VectorCall:
> +return llvm::dwarf::DW_CC_LLVM_vectorcall;
> +  case CC_X86Pascal:
> +return llvm::dwarf::DW_CC_BORLAND_pascal;
> +
> +  // FIXME: Create new DW_CC_ codes for these calling conventions.
> +  case CC_X86_64Win64:
> +  case CC_X86_64SysV:
> +  case CC_AAPCS:
> +  case CC_AAPCS_VFP:
> +  case CC_IntelOclBicc:
> +  case CC_SpirFunction:
> +  case CC_SpirKernel:
> +  case CC_Swift:
> +  case CC_PreserveMost:
> +  case CC_PreserveAll:
> +return 0;
> +  }
> +  return 0;
> +}
> +
>  llvm::DIType *CGDebugInfo::CreateType(const FunctionType *Ty,
>llvm::DIFile *Unit) {
>SmallVector EltTys;
> @@ -850,7 +883,8 @@ llvm::DIType *CGDebugInfo::CreateType(co
>}
>
>llvm::DITypeRefArray EltTypeArray =
> DBuilder.getOrCreateTypeArray(EltTys);
> -  return DBuilder.createSubroutineType(EltTypeArray);
> +  return DBuilder.createSubroutineType(EltTypeArray, 0,
> +   getDwarfCC(Ty->getCallConv()));
>  }
>
>  /// Convert an AccessSpecifier into the corresponding DINode flag.
> @@ -1103,7 +1137,8 @@ llvm::DISubroutineType *CGDebugInfo::get
>if (Func->getExtProtoInfo().RefQualifier == RQ_RValue)
>  Flags |= llvm::DINode::FlagRValueReference;
>
> -  return DBuilder.createSubroutineType(EltTypeArray, Flags);
> +  return DBuilder.createSubroutineType(EltTypeArray, Flags,
> +   getDwarfCC(Func->getCallConv()));
>  }
>
>  /// isFunctionLocalClass - Return true if CXXRecordDecl is defined
> @@ -2562,9 +2597,9 @@ CGDebugInfo::getFunctionForwardDeclarati
>SmallVector ArgTypes;
>for (const ParmVarDecl *Parm: FD->parameters())
>  ArgTypes.push_back(Parm->getType());
> -  QualType FnType =
> -CGM.getContext().getFunctionType(FD->getReturnType(), ArgTypes,
> - FunctionProtoType::ExtProtoInfo());
> +  CallingConv CC = FD->getType()->castAs()->getCallConv();
> +  QualType FnType = CGM.getContext().getFunctionType(
> +  FD->getReturnType(), ArgTypes, FunctionProtoType::ExtProtoInfo(CC));
>llvm::DISubprogram *SP = DBuilder.createTempFunctionFwdDecl(
>DContext, Name, LinkageName, Unit, Line,
>getOrCreateFunctionType(FD, FnType, Unit),
> !FD->isExternallyVisible(),
> @@ -2668,6 +2703,10 @@ llvm::DISubroutineType *CGDebugInfo::get
>
>if (const CXXMethodDecl *Method = dyn_cast(D))
>  return getOrCreateMethodType(Method, F);
> +
> +  const auto *FTy = FnType->getAs();
> +  CallingConv CC = FTy ? FTy->getCallConv() : CallingConv::CC_C;
> +
>if (const ObjCMethodDecl *OMethod = dyn_cast(D)) {
>  // Add "self" and "_cmd"
>  SmallVector Elts;
> @@ -2701,7 +2740,7 @@ llvm::DISubroutineType *CGDebugInfo::get
>Elts.push_back(DBuilder.createUnspecifiedParameter());
>
>  llvm::DITypeRefArray EltTypeArray =
> DBuilder.getOrCreateTypeArray(Elts);
> -  

Re: [PATCH] D20933: Preallocate ExplodedNode hash table

2016-06-08 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

A 6% speed improvement could be a big win! Do we have a sense of what the 
expected increased memory cost (as a % of average use over the lifetime of the 
process) is? My guess is it would be relatively low. I suspect most analyzer 
users run relatively few concurrent 'clang' processes -- so this might be well 
worth it.

I do think we should make sure the user can't shoot themselves in the foot by 
pre-reserving space for an absurdly high maximum step count. We might want to 
to clamp this reservation to something that is not outrageous even when the 
maximum step count is huge.


http://reviews.llvm.org/D20933



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


Re: [PATCH] D20681: Add target-specific pre-linking passes to Clang

2016-06-08 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 60105.
yaxunl marked an inline comment as done.
yaxunl added a comment.

Refactor to eliminate lambda function argument.


http://reviews.llvm.org/D20681

Files:
  include/clang/CodeGen/BackendUtil.h
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CodeGenAction.cpp

Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -165,6 +165,10 @@
   void *OldDiagnosticContext = Ctx.getDiagnosticContext();
   Ctx.setDiagnosticHandler(DiagnosticHandler, this);
 
+  PerformPrelinkPasses(Diags, CodeGenOpts, TargetOpts, LangOpts,
+   C.getTargetInfo().getDataLayout(),
+   getModule(), Action);
+
   // Link LinkModule into this module if present, preserving its validity.
   for (auto  : LinkModules) {
 unsigned LinkFlags = I.first;
@@ -177,7 +181,8 @@
 
   EmitBackendOutput(Diags, CodeGenOpts, TargetOpts, LangOpts,
 C.getTargetInfo().getDataLayout(),
-getModule(), Action, AsmOutStream);
+getModule(), Action, AsmOutStream,
+false /* SetLLVMOpts */);
 
   Ctx.setInlineAsmDiagnosticHandler(OldHandler, OldContext);
 
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -59,8 +59,10 @@
   const LangOptions 
   Module *TheModule;
 
+  Timer PreLinkTime;
   Timer CodeGenerationTime;
 
+  mutable legacy::PassManager *PreLinkPasses;
   mutable legacy::PassManager *CodeGenPasses;
   mutable legacy::PassManager *PerModulePasses;
   mutable legacy::FunctionPassManager *PerFunctionPasses;
@@ -100,8 +102,14 @@
 return PerFunctionPasses;
   }
 
-  /// Set LLVM command line options passed through -backend-option.
-  void setCommandLineOpts();
+  legacy::PassManager *getPreLinkPasses() const {
+if (!PreLinkPasses) {
+  PreLinkPasses = new legacy::PassManager();
+  PreLinkPasses->add(
+  createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
+}
+return PreLinkPasses;
+  }
 
   void CreatePasses(ModuleSummaryIndex *ModuleSummary);
 
@@ -120,16 +128,21 @@
   /// \return True on success.
   bool AddEmitPasses(BackendAction Action, raw_pwrite_stream );
 
+  /// Add target specific pre-linking passes.
+  void AddPreLinkPasses();
+
 public:
   EmitAssemblyHelper(DiagnosticsEngine &_Diags, const CodeGenOptions ,
  const clang::TargetOptions ,
  const LangOptions , Module *M)
   : Diags(_Diags), CodeGenOpts(CGOpts), TargetOpts(TOpts), LangOpts(LOpts),
-TheModule(M), CodeGenerationTime("Code Generation Time"),
+TheModule(M), PreLinkTime("Pre-Linking Passes Time"),
+CodeGenerationTime("Code Generation Time"), PreLinkPasses(nullptr),
 CodeGenPasses(nullptr), PerModulePasses(nullptr),
 PerFunctionPasses(nullptr) {}
 
   ~EmitAssemblyHelper() {
+delete PreLinkPasses;
 delete CodeGenPasses;
 delete PerModulePasses;
 delete PerFunctionPasses;
@@ -140,6 +153,14 @@
   std::unique_ptr TM;
 
   void EmitAssembly(BackendAction Action, raw_pwrite_stream *OS);
+  void DoPreLinkPasses();
+
+  /// Set LLVM command line options passed through -backend-option.
+  void setCommandLineOpts();
+
+  /// Set up target for target specific pre-linking passes and LLVM code
+  /// generation.
+  void setTarget(BackendAction Action);
 };
 
 // We need this wrapper to access LangOpts and CGOpts from extension functions
@@ -515,6 +536,14 @@
 BackendArgs.data());
 }
 
+void EmitAssemblyHelper::setTarget(BackendAction Action) {
+  bool UsesCodeGen = (Action != Backend_EmitNothing &&
+  Action != Backend_EmitBC &&
+  Action != Backend_EmitLL);
+  if (!TM)
+TM.reset(CreateTargetMachine(UsesCodeGen));
+}
+
 TargetMachine *EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) {
   // Create the TargetMachine for generating code.
   std::string Error;
@@ -674,17 +703,18 @@
   return true;
 }
 
+void EmitAssemblyHelper::AddPreLinkPasses() {
+  legacy::PassManager *PM = getPreLinkPasses();
+  TM->addPreLinkPasses(*PM);
+}
+
 void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
   raw_pwrite_stream *OS) {
   TimeRegion Region(llvm::TimePassesIsEnabled ?  : nullptr);
 
-  setCommandLineOpts();
-
   bool UsesCodeGen = (Action != Backend_EmitNothing &&
   Action != Backend_EmitBC &&
   Action != Backend_EmitLL);
-  if (!TM)
-TM.reset(CreateTargetMachine(UsesCodeGen));
 
   if (UsesCodeGen && !TM)
 return;
@@ -760,14 +790,35 @@
   }
 }
 
+void EmitAssemblyHelper::DoPreLinkPasses() {
+  TimeRegion Region(llvm::TimePassesIsEnabled ?  : 

Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-08 Thread Eric Niebler via cfe-commits
eric_niebler added inline comments.


Comment at: lib/Lex/PPDirectives.cpp:33
@@ -28,2 +32,2 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/SaveAndRestore.h"

You mean, instead of the `StringSet` below? Looks like `StringSwitch` just 
turns into cascading `memcmp`'s. Bet I can tell you how that performs versus a 
hash set. :-) Also, with the `StringSet`, I get to initialize it once and reuse 
it many times. I expect that will be pretty darn quick at runtime, but I'm 
looking forward to @bruno's results.


http://reviews.llvm.org/D19843



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


[libcxx] r272202 - Mark 2441 as ready

2016-06-08 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Jun  8 16:25:38 2016
New Revision: 272202

URL: http://llvm.org/viewvc/llvm-project?rev=272202=rev
Log:
Mark 2441 as ready

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=272202=272201=272202=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Wed Jun  8 16:25:38 2016
@@ -66,7 +66,7 @@
http://wg21.link/LWG2393;>2393std::function's Callable 
definition is brokenOulu
http://wg21.link/LWG2426;>2426Issue about 
compare_exchangeOulu
http://wg21.link/LWG2436;>2436Comparators 
for associative containers should always be 
CopyConstructibleOuluPatch Ready
-   http://wg21.link/LWG2441;>2441Exact-width 
atomic typedefs should be providedOulu
+   http://wg21.link/LWG2441;>2441Exact-width 
atomic typedefs should be providedOuluPatch Ready
http://wg21.link/LWG2451;>2451[fund.ts.v2] optional 
should 'forward' T's implicit conversionsOulu
http://wg21.link/LWG2509;>2509[fund.ts.v2] any_cast doesn't 
work with rvalue reference targets and cannot move with a value 
targetOulu
http://wg21.link/LWG2516;>2516[fund.ts.v2] Public 
"exposition only" members in observer_ptrOulu


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


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-08 Thread Richard Smith via cfe-commits
rsmith added a comment.

Looks OK to me, pending Bruno's confirmation that performance is acceptable.



Comment at: lib/Lex/PPDirectives.cpp:102


Can you use `llvm::StringSwitch` for this? I'd be interested to see how the 
performance compares.


http://reviews.llvm.org/D19843



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


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-08 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

Before this goes in again, I want to double check that this doesn't affect 
compile time on darwin + frameworks. Will get back to you asap.



Comment at: lib/Lex/PPDirectives.cpp:218
@@ +217,3 @@
+  SmallString<32> LowerInclude{Include};
+  for (char& Ch : LowerInclude) {
+// In the ASCII range?

-> "char "


Comment at: lib/Lex/PPDirectives.cpp:1666
@@ +1665,3 @@
+// not 100% correct in the presence of symlinks.
+for(auto  : llvm::reverse(Components)) {
+  if ("." == Component) {

-> "for (auto..."


http://reviews.llvm.org/D19843



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


Re: [PATCH] D21141: [DebugInfo] Add calling conventions to DISubroutineType

2016-06-08 Thread Reid Kleckner via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272198: [DebugInfo] Add calling conventions to 
DISubroutineType (authored by rnk).

Changed prior to commit:
  http://reviews.llvm.org/D21141?vs=60055=60101#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21141

Files:
  cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
  cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
  cfe/trunk/test/CodeGenCXX/debug-info-calling-conventions.cpp

Index: cfe/trunk/test/CodeGenCXX/debug-info-calling-conventions.cpp
===
--- cfe/trunk/test/CodeGenCXX/debug-info-calling-conventions.cpp
+++ cfe/trunk/test/CodeGenCXX/debug-info-calling-conventions.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -emit-llvm -o - | FileCheck %s
+
+struct A {
+  void thiscallcc();
+};
+void A::thiscallcc() {}
+
+// CHECK: !DISubprogram(name: "thiscallcc", {{.*}} type: ![[thiscallty:[^,]*]], {{.*}})
+// CHECK: ![[thiscallty]] = !DISubroutineType(cc: DW_CC_BORLAND_thiscall, types: ![[thisargs:[^,)]*]])
+// CHECK: ![[thisargs]] = !{null, ![[thisptrty:[^,}]*]]}
+// CHECK: ![[thisptrty]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !{{.*}}, size: 32, align: 32, flags: DIFlagArtificial | DIFlagObjectPointer)
+
+void cdeclcc() {}
+void __fastcall fastcallcc() {}
+void __stdcall stdcallcc() {}
+void __vectorcall vectorcallcc() {}
+
+// CHECK: !DISubprogram(name: "cdeclcc", {{.*}} type: ![[cdeclty:[^,]*]], {{.*}})
+// CHECK: ![[cdeclty]] = !DISubroutineType(types: ![[noargs:[^,)]*]])
+// CHECK: ![[noargs]] = !{null}
+// CHECK: !DISubprogram(name: "fastcallcc", {{.*}} type: ![[fastcallty:[^,]*]], {{.*}})
+// CHECK: ![[fastcallty]] = !DISubroutineType(cc: DW_CC_BORLAND_msfastcall, types: ![[noargs]])
+// CHECK: !DISubprogram(name: "stdcallcc", {{.*}} type: ![[stdcallty:[^,]*]], {{.*}})
+// CHECK: ![[stdcallty]] = !DISubroutineType(cc: DW_CC_BORLAND_stdcall, types: ![[noargs]])
+// CHECK: !DISubprogram(name: "vectorcallcc", {{.*}} type: ![[vectorcallty:[^,]*]], {{.*}})
+// CHECK: ![[vectorcallty]] = !DISubroutineType(cc: DW_CC_LLVM_vectorcall, types: ![[noargs]])
Index: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
===
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
@@ -831,6 +831,39 @@
   getDeclContextDescriptor(Ty->getDecl()));
 }
 
+static unsigned getDwarfCC(CallingConv CC) {
+  switch (CC) {
+  case CC_C:
+// Avoid emitting DW_AT_calling_convention if the C convention was used.
+return 0;
+
+  case CC_X86StdCall:
+return llvm::dwarf::DW_CC_BORLAND_stdcall;
+  case CC_X86FastCall:
+return llvm::dwarf::DW_CC_BORLAND_msfastcall;
+  case CC_X86ThisCall:
+return llvm::dwarf::DW_CC_BORLAND_thiscall;
+  case CC_X86VectorCall:
+return llvm::dwarf::DW_CC_LLVM_vectorcall;
+  case CC_X86Pascal:
+return llvm::dwarf::DW_CC_BORLAND_pascal;
+
+  // FIXME: Create new DW_CC_ codes for these calling conventions.
+  case CC_X86_64Win64:
+  case CC_X86_64SysV:
+  case CC_AAPCS:
+  case CC_AAPCS_VFP:
+  case CC_IntelOclBicc:
+  case CC_SpirFunction:
+  case CC_SpirKernel:
+  case CC_Swift:
+  case CC_PreserveMost:
+  case CC_PreserveAll:
+return 0;
+  }
+  return 0;
+}
+
 llvm::DIType *CGDebugInfo::CreateType(const FunctionType *Ty,
   llvm::DIFile *Unit) {
   SmallVector EltTys;
@@ -850,7 +883,8 @@
   }
 
   llvm::DITypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(EltTys);
-  return DBuilder.createSubroutineType(EltTypeArray);
+  return DBuilder.createSubroutineType(EltTypeArray, 0,
+   getDwarfCC(Ty->getCallConv()));
 }
 
 /// Convert an AccessSpecifier into the corresponding DINode flag.
@@ -1103,7 +1137,8 @@
   if (Func->getExtProtoInfo().RefQualifier == RQ_RValue)
 Flags |= llvm::DINode::FlagRValueReference;
 
-  return DBuilder.createSubroutineType(EltTypeArray, Flags);
+  return DBuilder.createSubroutineType(EltTypeArray, Flags,
+   getDwarfCC(Func->getCallConv()));
 }
 
 /// isFunctionLocalClass - Return true if CXXRecordDecl is defined
@@ -2562,9 +2597,9 @@
   SmallVector ArgTypes;
   for (const ParmVarDecl *Parm: FD->parameters())
 ArgTypes.push_back(Parm->getType());
-  QualType FnType =
-CGM.getContext().getFunctionType(FD->getReturnType(), ArgTypes,
- FunctionProtoType::ExtProtoInfo());
+  CallingConv CC = FD->getType()->castAs()->getCallConv();
+  QualType FnType = CGM.getContext().getFunctionType(
+  FD->getReturnType(), ArgTypes, FunctionProtoType::ExtProtoInfo(CC));
   llvm::DISubprogram *SP = DBuilder.createTempFunctionFwdDecl(
   DContext, Name, LinkageName, Unit, Line,
   getOrCreateFunctionType(FD, FnType, Unit), !FD->isExternallyVisible(),
@@ -2668,6 +2703,10 @@
 
   if (const CXXMethodDecl 

r272198 - [DebugInfo] Add calling conventions to DISubroutineType

2016-06-08 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Wed Jun  8 15:41:54 2016
New Revision: 272198

URL: http://llvm.org/viewvc/llvm-project?rev=272198=rev
Log:
[DebugInfo] Add calling conventions to DISubroutineType

Summary:
This should have been a very simple change, but it was greatly
complicated by the construction of new Decls during IR generation.

In particular, we reconstruct the AST function type in order to get the
implicit 'this' parameter into C++ method types.

We also have to worry about FunctionDecls whose types are not
FunctionTypes because CGBlocks.cpp constructs some dummy FunctionDecls
with 'void' type.

Depends on D21114

Reviewers: aprantl, dblaikie

Subscribers: cfe-commits

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

Added:
cfe/trunk/test/CodeGenCXX/debug-info-calling-conventions.cpp
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=272198=272197=272198=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jun  8 15:41:54 2016
@@ -831,6 +831,39 @@ llvm::DIType *CGDebugInfo::CreateType(co
   getDeclContextDescriptor(Ty->getDecl()));
 }
 
+static unsigned getDwarfCC(CallingConv CC) {
+  switch (CC) {
+  case CC_C:
+// Avoid emitting DW_AT_calling_convention if the C convention was used.
+return 0;
+
+  case CC_X86StdCall:
+return llvm::dwarf::DW_CC_BORLAND_stdcall;
+  case CC_X86FastCall:
+return llvm::dwarf::DW_CC_BORLAND_msfastcall;
+  case CC_X86ThisCall:
+return llvm::dwarf::DW_CC_BORLAND_thiscall;
+  case CC_X86VectorCall:
+return llvm::dwarf::DW_CC_LLVM_vectorcall;
+  case CC_X86Pascal:
+return llvm::dwarf::DW_CC_BORLAND_pascal;
+
+  // FIXME: Create new DW_CC_ codes for these calling conventions.
+  case CC_X86_64Win64:
+  case CC_X86_64SysV:
+  case CC_AAPCS:
+  case CC_AAPCS_VFP:
+  case CC_IntelOclBicc:
+  case CC_SpirFunction:
+  case CC_SpirKernel:
+  case CC_Swift:
+  case CC_PreserveMost:
+  case CC_PreserveAll:
+return 0;
+  }
+  return 0;
+}
+
 llvm::DIType *CGDebugInfo::CreateType(const FunctionType *Ty,
   llvm::DIFile *Unit) {
   SmallVector EltTys;
@@ -850,7 +883,8 @@ llvm::DIType *CGDebugInfo::CreateType(co
   }
 
   llvm::DITypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(EltTys);
-  return DBuilder.createSubroutineType(EltTypeArray);
+  return DBuilder.createSubroutineType(EltTypeArray, 0,
+   getDwarfCC(Ty->getCallConv()));
 }
 
 /// Convert an AccessSpecifier into the corresponding DINode flag.
@@ -1103,7 +1137,8 @@ llvm::DISubroutineType *CGDebugInfo::get
   if (Func->getExtProtoInfo().RefQualifier == RQ_RValue)
 Flags |= llvm::DINode::FlagRValueReference;
 
-  return DBuilder.createSubroutineType(EltTypeArray, Flags);
+  return DBuilder.createSubroutineType(EltTypeArray, Flags,
+   getDwarfCC(Func->getCallConv()));
 }
 
 /// isFunctionLocalClass - Return true if CXXRecordDecl is defined
@@ -2562,9 +2597,9 @@ CGDebugInfo::getFunctionForwardDeclarati
   SmallVector ArgTypes;
   for (const ParmVarDecl *Parm: FD->parameters())
 ArgTypes.push_back(Parm->getType());
-  QualType FnType =
-CGM.getContext().getFunctionType(FD->getReturnType(), ArgTypes,
- FunctionProtoType::ExtProtoInfo());
+  CallingConv CC = FD->getType()->castAs()->getCallConv();
+  QualType FnType = CGM.getContext().getFunctionType(
+  FD->getReturnType(), ArgTypes, FunctionProtoType::ExtProtoInfo(CC));
   llvm::DISubprogram *SP = DBuilder.createTempFunctionFwdDecl(
   DContext, Name, LinkageName, Unit, Line,
   getOrCreateFunctionType(FD, FnType, Unit), !FD->isExternallyVisible(),
@@ -2668,6 +2703,10 @@ llvm::DISubroutineType *CGDebugInfo::get
 
   if (const CXXMethodDecl *Method = dyn_cast(D))
 return getOrCreateMethodType(Method, F);
+
+  const auto *FTy = FnType->getAs();
+  CallingConv CC = FTy ? FTy->getCallConv() : CallingConv::CC_C;
+
   if (const ObjCMethodDecl *OMethod = dyn_cast(D)) {
 // Add "self" and "_cmd"
 SmallVector Elts;
@@ -2701,7 +2740,7 @@ llvm::DISubroutineType *CGDebugInfo::get
   Elts.push_back(DBuilder.createUnspecifiedParameter());
 
 llvm::DITypeRefArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts);
-return DBuilder.createSubroutineType(EltTypeArray);
+return DBuilder.createSubroutineType(EltTypeArray, 0, getDwarfCC(CC));
   }
 
   // Handle variadic function types; they need an additional
@@ -2715,7 +2754,7 @@ llvm::DISubroutineType *CGDebugInfo::get
   EltTys.push_back(getOrCreateType(FPT->getParamType(i), F));
   EltTys.push_back(DBuilder.createUnspecifiedParameter());
   llvm::DITypeRefArray EltTypeArray = 

Re: [PATCH] D20428: Tracking exception specification source locations

2016-06-08 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
This revision is now accepted and ready to land.


Comment at: lib/AST/Decl.cpp:2938-2948
@@ -2937,1 +2937,13 @@
 
+SourceRange FunctionDecl::getExceptionSpecSourceRange() const {
+  const TypeSourceInfo *TSI = getTypeSourceInfo();
+  if (!TSI)
+return SourceRange();
+  FunctionTypeLoc FTL =
+TSI->getTypeLoc().IgnoreParens().getAs();
+  if (!FTL)
+return SourceRange();
+
+  return FTL.getExceptionSpecRange();
+}
+

Can you factor out a function to get the `FunctionTypeLoc` from a 
`FunctionDecl`, when there is one (preferably as a separate change)? This is 
duplicated in a few places now (you can find some more by searching for 
`getAs` in Sema), and looks slightly wrong here (we 
should skip calling convention attributes as well as parens).


http://reviews.llvm.org/D20428



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


Re: [PATCH] D21120: clang-rename: implement renaming of classes inside dynamic_cast

2016-06-08 Thread Miklos Vajna via cfe-commits
vmiklos added a comment.

Hmm, 
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/14332/steps/test/logs/stdio
 fails with "error: cannot use dynamic_cast with -fno-rtti"; is there some way 
to detect if "-fno-rtti" is the default, and in that case don't execute the 
test? Thanks.


Repository:
  rL LLVM

http://reviews.llvm.org/D21120



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


Re: [PATCH] D20428: Tracking exception specification source locations

2016-06-08 Thread don hinton via cfe-commits
hintonda added a comment.

The comment says to rebuild TypeSourceInfo, but isn't that what this does?

  if (TSInfo->getType() != FD->getType())
Updated = getFunctionTypeWithExceptionSpec(*this, TSInfo->getType(), ESI);
  TSInfo->overrideType(Updated);

If so, could you fix this by either removing the assert or moving it below

  TSInfo->overrideType(Updated);


http://reviews.llvm.org/D20428



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


[PATCH] D21150: [OpenMP] Cast captures by copy when passed to fork call so that they are compatible to what the runtime library expects.

2016-06-08 Thread Samuel Antao via cfe-commits
sfantao created this revision.
sfantao added reviewers: ABataev, hfinkel, arpith-jacob, carlo.bertolli, kkwli0.
sfantao added subscribers: caomhin, cfe-commits.

This patch fixes an issue detected when firstprivate variables are passed to an 
OpenMP outlined function vararg list. Currently they are not compatible with 
what the runtime library expects causing malfunction in some targets.

This patch fixes the issue by moving the casting logic already in place for 
offloading to the common code that creates the outline function and arguments 
and updates the regression tests accordingly.

http://reviews.llvm.org/D21150

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/CodeGen/CodeGenFunction.h
  test/OpenMP/for_firstprivate_codegen.cpp
  test/OpenMP/parallel_firstprivate_codegen.cpp
  test/OpenMP/sections_firstprivate_codegen.cpp
  test/OpenMP/single_codegen.cpp
  test/OpenMP/single_firstprivate_codegen.cpp
  test/OpenMP/teams_firstprivate_codegen.cpp

Index: test/OpenMP/teams_firstprivate_codegen.cpp
===
--- test/OpenMP/teams_firstprivate_codegen.cpp
+++ test/OpenMP/teams_firstprivate_codegen.cpp
@@ -76,20 +76,23 @@
   #pragma omp target
   #pragma omp teams firstprivate(g, sivar)
   {
-// LAMBDA: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* noalias %{{.+}}, i32* noalias %{{.+}}, i32* dereferenceable(4) [[G_IN:%.+]], i32 {{.*}}[[SIVAR_IN:%.+]])
+// LAMBDA: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* noalias %{{.+}}, i32* noalias %{{.+}}, i32* dereferenceable(4) [[G_IN:%.+]], i{{64|32}} {{.*}}[[SIVAR_IN:%.+]])
 // LAMBDA: store i{{[0-9]+}}* [[G_IN]], i{{[0-9]+}}** [[G_ADDR:%.+]],
 // LAMBDA: store i{{[0-9]+}} [[SIVAR_IN]], i{{[0-9]+}}* [[SIVAR_ADDR:%.+]],
 // LAMBDA: [[G_ADDR_VAL:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_ADDR]],
+// LAMBDA-64: [[SIVAR_CONV:%.+]] = bitcast i64*  [[SIVAR_ADDR]] to i32*
 // LAMBDA: [[G_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[G_ADDR_VAL]],
 // LAMBDA: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_LOCAL:%.+]],
 g = 1;
 sivar = 2;
 // LAMBDA: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_LOCAL]],
-// LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[SIVAR_ADDR]],
+// LAMBDA-64: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[SIVAR_CONV]],
+// LAMBDA-32: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[SIVAR_ADDR]],
 // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
 // LAMBDA: store i{{[0-9]+}}* [[G_LOCAL]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]]
 // LAMBDA: [[SIVAR_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
-// LAMBDA: store i{{[0-9]+}}* [[SIVAR_ADDR]], i{{[0-9]+}}** [[SIVAR_PRIVATE_ADDR_REF]]
+// LAMBDA-64: store i{{[0-9]+}}* [[SIVAR_CONV]], i{{[0-9]+}}** [[SIVAR_PRIVATE_ADDR_REF]]
+// LAMBDA-32: store i{{[0-9]+}}* [[SIVAR_ADDR]], i{{[0-9]+}}** [[SIVAR_PRIVATE_ADDR_REF]]
 // LAMBDA: call{{.*}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]])
 [&]() {
   // LAMBDA: define {{.+}} void [[INNER_LAMBDA]](%{{.+}}* [[ARG_PTR:%.+]])
@@ -127,20 +130,22 @@
 }
 
 // CHECK: define internal {{.*}}void [[OMP_OFFLOADING:@.+]](
-// CHECK: call {{.*}}void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_teams(%{{.+}}* @{{.+}}, i{{[0-9]+}} 5, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [2 x i32]*, i32, [2 x [[S_FLOAT_TY]]]*, [[S_FLOAT_TY]]*, i{{[0-9]+}})* [[OMP_OUTLINED:@.+]] to void
+// CHECK: call {{.*}}void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_teams(%{{.+}}* @{{.+}}, i{{[0-9]+}} 5, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [2 x i32]*, i{{32|64}}, [2 x [[S_FLOAT_TY]]]*, [[S_FLOAT_TY]]*, i{{[0-9]+}})* [[OMP_OUTLINED:@.+]] to void
 // CHECK: ret
 //
-// CHECK: define internal {{.*}}void [[OMP_OUTLINED]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, [2 x i32]* dereferenceable(8) %{{.+}}, i32 {{.*}}%{{.+}}, [2 x [[S_FLOAT_TY]]]* dereferenceable(8) %{{.+}}, [[S_FLOAT_TY]]* dereferenceable(4) %{{.+}}, i32 {{.*}}[[SIVAR:%.+]])
+// CHECK: define internal {{.*}}void [[OMP_OUTLINED]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, [2 x i32]* dereferenceable(8) %{{.+}}, i{{32|64}} {{.*}}%{{.+}}, [2 x [[S_FLOAT_TY]]]* dereferenceable(8) %{{.+}}, [[S_FLOAT_TY]]* dereferenceable(4) %{{.+}}, i{{32|64}} {{.*}}[[SIVAR:%.+]])
 // CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}},
 // CHECK: [[SIVAR7_PRIV:%.+]] = alloca i{{[0-9]+}},
 // CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}],
 // CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_FLOAT_TY]]],
 // CHECK: [[VAR_PRIV:%.+]] = alloca [[S_FLOAT_TY]],
 // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]],
 
 // CHECK: [[VEC_REF:%.+]] = load 

Re: [PATCH] D21113: Add support for case-insensitive header lookup

2016-06-08 Thread Nico Weber via cfe-commits
thakis added a comment.

Not sure if we want a flag that adds 50% overhead, no matter how convenient it 
might be :-/


http://reviews.llvm.org/D21113



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


Re: [PATCH] D21113: Add support for case-insensitive header lookup

2016-06-08 Thread Hans Wennborg via cfe-commits
hans added a comment.

In http://reviews.llvm.org/D21113#452558, @thakis wrote:

> Can you try building a few more files? Say, v8_base?


Well, that was depressing:

  Putting the sdk on a vfat fs:
  real2m26.077s
  user68m31.476s
  sys 1m25.702s
  
  Using the flag:
  real9m5.179s
  user69m3.417s
  sys 212m47.136s  <--- !
  
  Using the flag with bloom filters:
  real3m1.046s
  user69m5.328s
  sys 19m4.368s

It seems the filesystem wasn't so happy about 32 processes doing a lot of 
readdir() at the same time.


http://reviews.llvm.org/D21113



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


Re: [PATCH] D20681: Add target-specific pre-linking passes to Clang

2016-06-08 Thread Yaxun Liu via cfe-commits
yaxunl marked 2 inline comments as done.
yaxunl added a comment.

> > We have prelinking passes in amdgpu backend but it requires the llvm change 
> > to be committed first. We can add a test for this after that.

> 

> 

> Sure. Could you subscribe me to the relevant backend reviews if possible 
> please? Thanks!


Sure, will do when we review such a pass.



Comment at: lib/CodeGen/CodeGenAction.cpp:169
@@ +168,3 @@
+  std::function
+LinkCallBack = [=](llvm::Module *M)->bool {
+// Link LinkModule into this module if present, preserving its 
validity.

Anastasia wrote:
> yaxunl wrote:
> > Anastasia wrote:
> > > Is there any reason for having this as a callback now?
> > > 
> > > Could we just add a call to prelink passes here above instead without 
> > > modifying much the original flow?
> > EmitBackendOutput does not set its own diagnostic handler. When linking 
> > error happens, the diagnostic handler of BackendConsumer is used, which 
> > requires the member variable CurLinkModule of BackendConsumer to be set to 
> > current module to be linked to emit correct error msg. Therefore the 
> > linking step of EmitBackendOutput needs to update a member of 
> > BackendConsumer, a lambda function can achieve that with minimal change to 
> > other parts of the code.
> > 
> > An alternative implementation can do without the lambda function, but needs 
> > to 
> > 
> >   # define a diagnostic handler for EmitBackendOutput 
> >   # at the begining of EmitBackendOutput, save the old diagnostic handler 
> > and set the new one
> >   # at the end of EmitBackendOutput, recover the old diagnostic handler
> >   # define a helper class for diagnostic handler for EmitBackendOutput to 
> > retain the states needed for emitting diagnostic msgs 
> >   # move or copy the diagnostic handling required by EmitBackendOutput from 
> > the diagnostic handler of BackendConsumer to the helper class of diagnostic 
> > handler for EmitBackendOutput
> > 
> > Do we want to take this approach?
> > 
> I see, seems complicated indeed. Would returning the module into 
> CurLinkModule  be possible instead?
We can replace the lambda function argument with two arguments: the modules to 
be linked with, and a pointer to CurLinkModule. Then CurLinkModule can be 
updated during linking.

There may be a more elegant way. I will see if I can add a new function for 
performing pre-linking passes and call it from HandleTranslationUnit. Then we 
can keep the linking stage in HandleTranslationUnit unchanged.


http://reviews.llvm.org/D20681



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


Re: [PATCH] D20979: [OpenCL] Use function attribute/metadata to represent kernel attributes

2016-06-08 Thread Yaxun Liu via cfe-commits
yaxunl added a comment.

In http://reviews.llvm.org/D20979#452463, @Anastasia wrote:

> Looking good generally, I am just not sure about mixing two different 
> representations.


If we choose only one form of representation, would you suggest to use function 
metadata or function attribute?


http://reviews.llvm.org/D20979



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


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-06-08 Thread Yaxun Liu via cfe-commits
yaxunl marked 5 inline comments as done.


Comment at: test/Headers/opencl-c-header.cl:50
@@ +49,3 @@
+
+// ===
+// Compile for OpenCL 1.0 for the second time. The module should not be 
re-created.

I changed the module to read only. If Clang tries to create a new module, it 
will fail. Also add a check to make sure module is read.


Comment at: test/Headers/opencl-c-header.cl:70
@@ +69,3 @@
+// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s | FileCheck %s
+// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - -cl-std=CL2.0 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s
+// RUN: %clang_cc1 -triple amdgcn--amdhsa -emit-llvm -o - -cl-std=CL2.0  
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s

I added check to the second compilation to make sure module is read, also 
changed the modules to be read only so that they won't be created again.


http://reviews.llvm.org/D20444



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


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-06-08 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 60078.
yaxunl marked 2 inline comments as done.
yaxunl added a comment.

Modified the test for module as Anastasia suggested.


http://reviews.llvm.org/D20444

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/LangOptions.def
  include/clang/Driver/CC1Options.td
  include/clang/Frontend/CompilerInvocation.h
  lib/Frontend/CompilerInvocation.cpp
  lib/Headers/module.modulemap
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaType.cpp
  test/Frontend/opencl-blocks.cl
  test/Headers/opencl-c-header.cl

Index: test/Headers/opencl-c-header.cl
===
--- test/Headers/opencl-c-header.cl
+++ test/Headers/opencl-c-header.cl
@@ -1,33 +1,88 @@
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| FileCheck %s
 // RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| FileCheck %s
-// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck %s
+// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s -cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s 

Re: [PATCH] D21141: [DebugInfo] Add calling conventions to DISubroutineType

2016-06-08 Thread Adrian Prantl via cfe-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Function pointers make sense to me, thanks!
LGTM



Comment at: lib/CodeGen/CGDebugInfo.cpp:834
@@ -833,1 +833,3 @@
 
+static unsigned getDwarfCC(CallingConv CC) {
+  switch (CC) {

I just wanted to say that it would be nice to have this function in DIBuilder, 
but then realized that CallingConv is defined in clang.


http://reviews.llvm.org/D21141



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


Re: r271708 - Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-08 Thread Eric Niebler via cfe-commits
On 6/8/16, 11:12 AM, "tha...@google.com on behalf of Nico Weber" 
 wrote:
>On Wed, Jun 8, 2016 at 1:56 PM, Eric Niebler  wrote:
>>
>>(adding back cfe-commits, answers inline)
>>
>>On 6/8/16, 10:11 AM, "tha...@google.com on behalf of Nico Weber" 
>> wrote:
>>>Sounds like "commit to the current file case and fix all the world's 
>>>includes" then :-) (MinGW's windows headers have different case than MSVC's, 
>>>making this extra annoying.)
>>>
>>>Maybe this warning could be keyed off -fmsc-version in clang-cl then and 
>>>only be enabled there once a future MSVC with headers where this is fixed 
>>>has been deployed and is picked via -fmsc-version?
>>
>>I just changed the patch so that #includes to headers found in system include 
>>paths do not trigger this warning by default (unless the header is a known 
>>“portable” header – i.e., standard C/C++/Posix or Boost headers). This 
>>shouldn’t be an issue anymore.
>
>Well, it'd be nice if the warning would fire everywhere and everyone got their 
>cases right – then a project that builds on a case-insensitive file system 
>should compile fine if it's moved to a case-sensitive one.

Sure, that’d be nice. And folks who really care can get that with my patch by 
flipping –Wnonportable-system-include-path; it’s just not the default. You 
could think of this patch as a staged rollout of the feature.

\e
 


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


Re: [PATCH] D21120: clang-rename: implement renaming of classes inside dynamic_cast

2016-06-08 Thread Miklos Vajna via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272188: clang-rename: implement renaming of classes inside 
dynamic_cast (authored by vmiklos).

Changed prior to commit:
  http://reviews.llvm.org/D21120?vs=60001=60073#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21120

Files:
  clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
  clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp

Index: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
===
--- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
+++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
@@ -124,20 +124,11 @@
   }
 
   bool VisitCXXStaticCastExpr(clang::CXXStaticCastExpr *Expr) {
-clang::QualType Type = Expr->getType();
-// See if this a cast of a pointer.
-const RecordDecl* Decl = Type->getPointeeCXXRecordDecl();
-if (!Decl) {
-  // See if this is a cast of a reference.
-  Decl = Type->getAsCXXRecordDecl();
-}
-
-if (Decl && getUSRForDecl(Decl) == USR) {
-  SourceLocation Location = 
Expr->getTypeInfoAsWritten()->getTypeLoc().getBeginLoc();
-  LocationsFound.push_back(Location);
-}
+return handleCXXNamedCastExpr(Expr);
+  }
 
-return true;
+  bool VisitCXXDynamicCastExpr(clang::CXXDynamicCastExpr *Expr) {
+return handleCXXNamedCastExpr(Expr);
   }
 
   // Non-visitors:
@@ -159,6 +150,23 @@
 }
   }
 
+  bool handleCXXNamedCastExpr(clang::CXXNamedCastExpr *Expr) {
+clang::QualType Type = Expr->getType();
+// See if this a cast of a pointer.
+const RecordDecl* Decl = Type->getPointeeCXXRecordDecl();
+if (!Decl) {
+  // See if this is a cast of a reference.
+  Decl = Type->getAsCXXRecordDecl();
+}
+
+if (Decl && getUSRForDecl(Decl) == USR) {
+  SourceLocation Location = 
Expr->getTypeInfoAsWritten()->getTypeLoc().getBeginLoc();
+  LocationsFound.push_back(Location);
+}
+
+return true;
+  }
+
   // All the locations of the USR were found.
   const std::string USR;
   // Old name that is renamed.
Index: clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
+++ clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
@@ -0,0 +1,25 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=186 -new-name=X %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class Base {
+  virtual int getValue() const = 0;
+};
+
+class Derived : public Base {
+public:
+  int getValue() const {
+return 0;
+  }
+};
+
+int main() {
+  Derived D;
+  const Base  = D;
+  const Base *Pointer = 
+
+  dynamic_cast(Reference).getValue(); // CHECK: 
dynamic_cast
+  dynamic_cast(Pointer)->getValue();  // CHECK: 
dynamic_cast
+}
+
+// Use grep -FUbo 'Derived'  to get the correct offset of foo when 
changing
+// this file.


Index: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
===
--- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
+++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
@@ -124,20 +124,11 @@
   }
 
   bool VisitCXXStaticCastExpr(clang::CXXStaticCastExpr *Expr) {
-clang::QualType Type = Expr->getType();
-// See if this a cast of a pointer.
-const RecordDecl* Decl = Type->getPointeeCXXRecordDecl();
-if (!Decl) {
-  // See if this is a cast of a reference.
-  Decl = Type->getAsCXXRecordDecl();
-}
-
-if (Decl && getUSRForDecl(Decl) == USR) {
-  SourceLocation Location = Expr->getTypeInfoAsWritten()->getTypeLoc().getBeginLoc();
-  LocationsFound.push_back(Location);
-}
+return handleCXXNamedCastExpr(Expr);
+  }
 
-return true;
+  bool VisitCXXDynamicCastExpr(clang::CXXDynamicCastExpr *Expr) {
+return handleCXXNamedCastExpr(Expr);
   }
 
   // Non-visitors:
@@ -159,6 +150,23 @@
 }
   }
 
+  bool handleCXXNamedCastExpr(clang::CXXNamedCastExpr *Expr) {
+clang::QualType Type = Expr->getType();
+// See if this a cast of a pointer.
+const RecordDecl* Decl = Type->getPointeeCXXRecordDecl();
+if (!Decl) {
+  // See if this is a cast of a reference.
+  Decl = Type->getAsCXXRecordDecl();
+}
+
+if (Decl && getUSRForDecl(Decl) == USR) {
+  SourceLocation Location = Expr->getTypeInfoAsWritten()->getTypeLoc().getBeginLoc();
+  LocationsFound.push_back(Location);
+}
+
+return true;
+  }
+
   // All the locations of the USR were found.
   const std::string USR;
   // Old name that is renamed.
Index: clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
===
--- clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
+++ clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
@@ -0,0 +1,25 @@
+// RUN: cat %s > %t.cpp
+// 

Re: r271708 - Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-08 Thread Eric Niebler via cfe-commits
(adding back cfe-commits, answers inline)

On 6/8/16, 10:11 AM, "tha...@google.com on behalf of Nico Weber" 
 wrote:
>Sounds like "commit to the current file case and fix all the world's includes" 
>then :-) (MinGW's windows headers have different case than MSVC's, making this 
>extra annoying.) 
>
>Maybe this warning could be keyed off -fmsc-version in clang-cl then and only 
>be enabled there once a future MSVC with headers where this is fixed has been 
>deployed and is picked via -fmsc-version?

I just changed the patch so that #includes to headers found in system include 
paths do not trigger this warning by default (unless the header is a known 
“portable” header – i.e., standard C/C++/Posix or Boost headers). This 
shouldn’t be an issue anymore.

>Eric, do you think you could send Stephan a list of #includes in Windows 
>headers that would need changing?

Since warnings are not emitted from within system headers, and since 
badly-cased #includes of WinSDK headers will no longer warn by default, is this 
still an issue? I don’t have an easy way to generate this list.

>(any reason cfe-commits got dropped from the cc list? This would be good to 
>discuss on-thread.)
>
>On Tue, Jun 7, 2016 at 6:42 PM, Stephan T. Lavavej 
> wrote:
>>Knowing Windows, there is probably no way that they would change the case on 
>>disk on the headers, as that would be observable to directory enumeration.
>> 
>>STL
>> 
>>From: tha...@google.com [mailto:tha...@google.com] On Behalf Of Nico Weber
>>Sent: Tuesday, June 7, 2016 3:40 PM
>>To: Stephan T. Lavavej 
>>Cc: Eric Niebler ; Taewook Oh 
>>Subject: Re: r271708 - Use the name of the file on disk to issue a new 
>>diagnostic about non-portable #include and #import paths.
>> 
>>>STL: "Make sure all filenames have lower-case names and all #includes refer 
>>>to them by lower-case name, and tell all users to include files by lower 
>>>case" is probably the only SDK change that's simple enough that it has a 
>>>chance to be understood and to actually happen. (The other alternative is 
>>"commit to keep the case of each SDK header as-is forever, and ask every 
>>>client to use the on-disk casing, which unless they use a compiler with a 
>>>warning like this they'll have to look up themselves" -- and at the moment I 
>>>think the on-disk case of windows.h is Windows.h while every program I 
>>know of includes it as , so this would require changing 
>>>decades of existing code.)
>>> 
>>>On Tue, Jun 7, 2016 at 12:57 PM, Stephan T. Lavavej 
>>> wrote:
Sure, but it's time consuming to figure out a build, and I have a limited 
amount of time to donate.

On the other hand, if this gets into trunk and eventually Clang/C2, at that 
point auditing the headers would be pretty easy over here.

STL 

-Original Message-
From: Eric Niebler [mailto:enieb...@fb.com]
Sent: Tuesday, June 7, 2016 9:00 AM
To: Stephan T. Lavavej ; Nico Weber 

Cc: Taewook Oh 
Subject: Re: r271708 - Use the name of the file on disk to issue a new 
diagnostic about non-portable #include and #import paths.

>Someone who builds and distributes their own mingw distribution can figure 
>out how to build clang. ☺ The directions are here: 
>http://clang.llvm.org/get_started.html. I’m happy to answer any questions.
>
>\e
>
>On 6/6/16, 5:54 PM, "Stephan T. Lavavej"  
>wrote:
>>Unfortunately, I haven't figured out how to build Clang/LLVM (all of my 
>>Clang work is with Clang/C2 which they build for me).
>>
>>STL
>>
>>-Original Message-
>>From: Eric Niebler [mailto:enieb...@fb.com]
>>Sent: Monday, June 6, 2016 3:19 PM
>>To: Stephan T. Lavavej ; Nico Weber 
>>
>>Cc: Taewook Oh 
>>Subject: Re: r271708 - Use the name of the file on disk to issue a new 
>>diagnostic about non-portable #include and #import paths.
>>
>>On 6/3/16, 5:17 PM, "Stephan T. Lavavej"  
>>wrote:
>>> [Eric Niebler]
 Once I sort out the -imsvc thing, how bad would it be to leave it 
 alone?
 Probably pretty bad for folks in the Windows world, huh?
>>>
>>> If you can send me an explicit list of WinSDK headers that are 
>>> including things with the wrong case, I can send it to Windows - they 
>>> are committed to cleaning up the WinSDK in order to make it friendlier 
>>> to other tools.
>>>
>>> Note that we can't go back in time and fix the shipped SDKs, though.
>>
>>It would actually be easier for you to generate this list than for me 
>>since I’m not set up to 

[clang-tools-extra] r272188 - clang-rename: implement renaming of classes inside dynamic_cast

2016-06-08 Thread Miklos Vajna via cfe-commits
Author: vmiklos
Date: Wed Jun  8 13:38:23 2016
New Revision: 272188

URL: http://llvm.org/viewvc/llvm-project?rev=272188=rev
Log:
clang-rename: implement renaming of classes inside dynamic_cast

Refactor to do the same as what is done already for static_cast.

Reviewers: klimek

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

Added:
clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
Modified:
clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp

Modified: clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp?rev=272188=272187=272188=diff
==
--- clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp (original)
+++ clang-tools-extra/trunk/clang-rename/USRLocFinder.cpp Wed Jun  8 13:38:23 
2016
@@ -124,20 +124,11 @@ public:
   }
 
   bool VisitCXXStaticCastExpr(clang::CXXStaticCastExpr *Expr) {
-clang::QualType Type = Expr->getType();
-// See if this a cast of a pointer.
-const RecordDecl* Decl = Type->getPointeeCXXRecordDecl();
-if (!Decl) {
-  // See if this is a cast of a reference.
-  Decl = Type->getAsCXXRecordDecl();
-}
-
-if (Decl && getUSRForDecl(Decl) == USR) {
-  SourceLocation Location = 
Expr->getTypeInfoAsWritten()->getTypeLoc().getBeginLoc();
-  LocationsFound.push_back(Location);
-}
+return handleCXXNamedCastExpr(Expr);
+  }
 
-return true;
+  bool VisitCXXDynamicCastExpr(clang::CXXDynamicCastExpr *Expr) {
+return handleCXXNamedCastExpr(Expr);
   }
 
   // Non-visitors:
@@ -159,6 +150,23 @@ private:
 }
   }
 
+  bool handleCXXNamedCastExpr(clang::CXXNamedCastExpr *Expr) {
+clang::QualType Type = Expr->getType();
+// See if this a cast of a pointer.
+const RecordDecl* Decl = Type->getPointeeCXXRecordDecl();
+if (!Decl) {
+  // See if this is a cast of a reference.
+  Decl = Type->getAsCXXRecordDecl();
+}
+
+if (Decl && getUSRForDecl(Decl) == USR) {
+  SourceLocation Location = 
Expr->getTypeInfoAsWritten()->getTypeLoc().getBeginLoc();
+  LocationsFound.push_back(Location);
+}
+
+return true;
+  }
+
   // All the locations of the USR were found.
   const std::string USR;
   // Old name that is renamed.

Added: clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp?rev=272188=auto
==
--- clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp (added)
+++ clang-tools-extra/trunk/test/clang-rename/DynamicCastExpr.cpp Wed Jun  8 
13:38:23 2016
@@ -0,0 +1,25 @@
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=186 -new-name=X %t.cpp -i --
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class Base {
+  virtual int getValue() const = 0;
+};
+
+class Derived : public Base {
+public:
+  int getValue() const {
+return 0;
+  }
+};
+
+int main() {
+  Derived D;
+  const Base  = D;
+  const Base *Pointer = 
+
+  dynamic_cast(Reference).getValue(); // CHECK: 
dynamic_cast
+  dynamic_cast(Pointer)->getValue();  // CHECK: 
dynamic_cast
+}
+
+// Use grep -FUbo 'Derived'  to get the correct offset of foo when 
changing
+// this file.


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


Re: [PATCH] D20933: Preallocate ExplodedNode hash table

2016-06-08 Thread Ben Craig via cfe-commits
bcraig added a comment.

In http://reviews.llvm.org/D20933#452352, @zaks.anna wrote:

> > For the pile of LLVM projects that I am currently building (llvm, clang, 
> > libcxx, libcxxabi), 18.9% of all analyzed
>
> >  functions hit the maximum step count. For the previously discussed large 
> > .C file, 37% of the analyzed functions hit the maximum step count.
>
>
> These look high to me. I've looked up some statistics that I've collected 
> years ago and I see a similar number for sqlite, but much lower numbers for 
> other test cases. I tested with the Preview app (~150 files) and a bunch of 
> preprocessed files we had on hand at that moment in both cases the number of 
> reaching timeout was about 1%. sqlite is special because all source code is 
> in that one file, so we can do much more inlining. Which C test case have you 
> used?
>
> (I do not have any numbers for C++.)
>
> Another wrinkle here is that we support "Analyzer shallow mode" 
> (-analyzer-config mode=shallow) , which dials down inlining quite a bit. We 
> have users who analyze during build (believe it or not) and they use the 
> shallow mode by default.


I've run another analysis, this time on a code base that is mostly C (maybe 5% 
C++).  6% of the functions there hit the max.  The average number of steps was 
13439, and the median is 2867.

Analyzer shallow mode does adjust inlining.  It also lowers the maximum number 
of steps from 15 to 75000.  That reduction in number of steps drops the 
exploded graph reservation down to half a meg instead of the full megabyte.


http://reviews.llvm.org/D20933



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


Re: [PATCH] D21113: Add support for case-insensitive header lookup

2016-06-08 Thread Nico Weber via cfe-commits
thakis added a comment.

Can you try building a few more files? Say, v8_base?


http://reviews.llvm.org/D21113



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


Re: [PATCH] D21141: [DebugInfo] Add calling conventions to DISubroutineType

2016-06-08 Thread Reid Kleckner via cfe-commits
rnk added a comment.

In http://reviews.llvm.org/D21141#452517, @aprantl wrote:

> Assuming that we could usually get the calling convention from the Function — 
> what's the motivation for emitting the calling convention of a subprogram 
> that has been optimized away?


I don't have any motivation to emit DISubprograms for optimized away code, but 
Functions aren't always available. Function pointers can also have calling 
conventions, and they will only have a DISubroutineType.


http://reviews.llvm.org/D21141



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


Re: [PATCH] D21113: Add support for case-insensitive header lookup

2016-06-08 Thread Hans Wennborg via cfe-commits
hans added a comment.

In http://reviews.llvm.org/D21113#452431, @thakis wrote:

> For performance: Can you check how build times for some large target in 
> Chromium on Linux targeting Windows compares with this vs having the sdk in a 
> fat mount? That would give us some data.


I measured compile times (perf stat -r5) of the same V8 file as above on Linux, 
but now targeting Windows:

  SDK in vfat-mounted file:   5.84s +- 1.91%
  SDK on normal fs with -fcase-insensitive-paths: 7.18s +- 3.06%
  As above, with directory bloom filters: 6.08s +- 0.76%

This makes my patch look slower, but it's a lot more convenient than setting up 
that file system.

> The discussion in the include case warning thread sounds like MS might update 
> its headers to have #include lines matching actual file case, so hopefully 
> this won't be needed at all eventually.


That would be pretty cool!



Comment at: lib/Basic/VirtualFileSystem.cpp:410
@@ +409,3 @@
+  std::error_code EC;
+  directory_iterator I = Base->dir_begin(Dir, EC), E;
+

compnerd wrote:
> Thats slightly difficult to read (the `E` directory_iterator.
You're right. Moving the declaration of E to its own line further down.


http://reviews.llvm.org/D21113



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


Re: [PATCH] D21117: Specify target in lifetime-asan test.

2016-06-08 Thread Vitaly Buka via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272185: Specify target in lifetime-asan test. (authored by 
vitalybuka).

Changed prior to commit:
  http://reviews.llvm.org/D21117?vs=59987=60071#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21117

Files:
  cfe/trunk/test/CodeGen/lifetime-asan.c

Index: cfe/trunk/test/CodeGen/lifetime-asan.c
===
--- cfe/trunk/test/CodeGen/lifetime-asan.c
+++ cfe/trunk/test/CodeGen/lifetime-asan.c
@@ -1,8 +1,7 @@
-// RUN: %clang -S -emit-llvm -o - -O0 %s | FileCheck %s -check-prefix=CHECK-O0
-// RUN: %clang -S -emit-llvm -o - -O0 \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - -O0 %s | FileCheck 
%s -check-prefix=CHECK-O0
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - -O0 \
 // RUN: -fsanitize=address -fsanitize-address-use-after-scope %s | \
 // RUN: FileCheck %s -check-prefix=CHECK-ASAN-USE-AFTER-SCOPE
-// UNSUPPORTED: mingw32
 
 extern int bar(char *A, int n);
 


Index: cfe/trunk/test/CodeGen/lifetime-asan.c
===
--- cfe/trunk/test/CodeGen/lifetime-asan.c
+++ cfe/trunk/test/CodeGen/lifetime-asan.c
@@ -1,8 +1,7 @@
-// RUN: %clang -S -emit-llvm -o - -O0 %s | FileCheck %s -check-prefix=CHECK-O0
-// RUN: %clang -S -emit-llvm -o - -O0 \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - -O0 %s | FileCheck %s -check-prefix=CHECK-O0
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - -O0 \
 // RUN: -fsanitize=address -fsanitize-address-use-after-scope %s | \
 // RUN: FileCheck %s -check-prefix=CHECK-ASAN-USE-AFTER-SCOPE
-// UNSUPPORTED: mingw32
 
 extern int bar(char *A, int n);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r272185 - Specify target in lifetime-asan test.

2016-06-08 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Wed Jun  8 13:18:08 2016
New Revision: 272185

URL: http://llvm.org/viewvc/llvm-project?rev=272185=rev
Log:
Specify target in lifetime-asan test.

Summary: Some target platforms -fsanitize=address.

Reviewers: pcc, eugenis

Subscribers: cfe-commits, christof, chapuni, kubabrecka

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

Modified:
cfe/trunk/test/CodeGen/lifetime-asan.c

Modified: cfe/trunk/test/CodeGen/lifetime-asan.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/lifetime-asan.c?rev=272185=272184=272185=diff
==
--- cfe/trunk/test/CodeGen/lifetime-asan.c (original)
+++ cfe/trunk/test/CodeGen/lifetime-asan.c Wed Jun  8 13:18:08 2016
@@ -1,8 +1,7 @@
-// RUN: %clang -S -emit-llvm -o - -O0 %s | FileCheck %s -check-prefix=CHECK-O0
-// RUN: %clang -S -emit-llvm -o - -O0 \
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - -O0 %s | FileCheck 
%s -check-prefix=CHECK-O0
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - -O0 \
 // RUN: -fsanitize=address -fsanitize-address-use-after-scope %s | \
 // RUN: FileCheck %s -check-prefix=CHECK-ASAN-USE-AFTER-SCOPE
-// UNSUPPORTED: mingw32
 
 extern int bar(char *A, int n);
 


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


Re: r271708 - Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-08 Thread Nico Weber via cfe-commits
On Wed, Jun 8, 2016 at 1:56 PM, Eric Niebler  wrote:

> (adding back cfe-commits, answers inline)
>
> On 6/8/16, 10:11 AM, "tha...@google.com on behalf of Nico Weber" <
> tha...@google.com on behalf of tha...@chromium.org> wrote:
> >Sounds like "commit to the current file case and fix all the world's
> includes" then :-) (MinGW's windows headers have different case than
> MSVC's, making this extra annoying.)
> >
> >Maybe this warning could be keyed off -fmsc-version in clang-cl then and
> only be enabled there once a future MSVC with headers where this is fixed
> has been deployed and is picked via -fmsc-version?
>
> I just changed the patch so that #includes to headers found in system
> include paths do not trigger this warning by default (unless the header is
> a known “portable” header – i.e., standard C/C++/Posix or Boost headers).
> This shouldn’t be an issue anymore.
>

Well, it'd be nice if the warning would fire everywhere and everyone got
their cases right – then a project that builds on a case-insensitive file
system should compile fine if it's moved to a case-sensitive one.


> >Eric, do you think you could send Stephan a list of #includes in Windows
> headers that would need changing?
>
> Since warnings are not emitted from within system headers, and since
> badly-cased #includes of WinSDK headers will no longer warn by default, is
> this still an issue? I don’t have an easy way to generate this list.
>
> >(any reason cfe-commits got dropped from the cc list? This would be good
> to discuss on-thread.)
> >
> >On Tue, Jun 7, 2016 at 6:42 PM, Stephan T. Lavavej <
> s...@exchange.microsoft.com> wrote:
> >>Knowing Windows, there is probably no way that they would change the
> case on disk on the headers, as that would be observable to directory
> enumeration.
> >>
> >>STL
> >>
> >>From: tha...@google.com [mailto:tha...@google.com] On Behalf Of Nico
> Weber
> >>Sent: Tuesday, June 7, 2016 3:40 PM
> >>To: Stephan T. Lavavej 
> >>Cc: Eric Niebler ; Taewook Oh 
> >>Subject: Re: r271708 - Use the name of the file on disk to issue a new
> diagnostic about non-portable #include and #import paths.
> >>
> >>>STL: "Make sure all filenames have lower-case names and all #includes
> refer to them by lower-case name, and tell all users to include files by
> lower case" is probably the only SDK change that's simple enough that it
> has a chance to be understood and to actually happen. (The other
> alternative is >>>"commit to keep the case of each SDK header as-is
> forever, and ask every client to use the on-disk casing, which unless they
> use a compiler with a warning like this they'll have to look up themselves"
> -- and at the moment I think the on-disk case of windows.h is Windows.h
> while every program I >>>know of includes it as , so this would
> require changing decades of existing code.)
> >>>
> >>>On Tue, Jun 7, 2016 at 12:57 PM, Stephan T. Lavavej <
> s...@exchange.microsoft.com> wrote:
> Sure, but it's time consuming to figure out a build, and I have a
> limited amount of time to donate.
> 
> On the other hand, if this gets into trunk and eventually Clang/C2, at
> that point auditing the headers would be pretty easy over here.
> 
> STL
> 
> -Original Message-
> From: Eric Niebler [mailto:enieb...@fb.com]
> Sent: Tuesday, June 7, 2016 9:00 AM
> To: Stephan T. Lavavej ; Nico Weber <
> tha...@chromium.org>
> Cc: Taewook Oh 
> Subject: Re: r271708 - Use the name of the file on disk to issue a new
> diagnostic about non-portable #include and #import paths.
> 
> >Someone who builds and distributes their own mingw distribution can
> figure out how to build clang. ☺ The directions are here:
> http://clang.llvm.org/get_started.html. I’m happy to answer any questions.
> >
> >\e
> >
> >On 6/6/16, 5:54 PM, "Stephan T. Lavavej" 
> wrote:
> >>Unfortunately, I haven't figured out how to build Clang/LLVM (all of
> my Clang work is with Clang/C2 which they build for me).
> >>
> >>STL
> >>
> >>-Original Message-
> >>From: Eric Niebler [mailto:enieb...@fb.com]
> >>Sent: Monday, June 6, 2016 3:19 PM
> >>To: Stephan T. Lavavej ; Nico Weber <
> tha...@chromium.org>
> >>Cc: Taewook Oh 
> >>Subject: Re: r271708 - Use the name of the file on disk to issue a
> new diagnostic about non-portable #include and #import paths.
> >>
> >>On 6/3/16, 5:17 PM, "Stephan T. Lavavej" 
> wrote:
> >>> [Eric Niebler]
>  Once I sort out the -imsvc thing, how bad would it be to leave it
> alone?
>  Probably pretty bad for folks in the Windows world, huh?
> >>>
> >>> If you can send me an explicit list of WinSDK headers that are
> including things with the wrong case, 

Re: [PATCH] D20681: Add target-specific pre-linking passes to Clang

2016-06-08 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

In http://reviews.llvm.org/D20681#450073, @yaxunl wrote:

> In http://reviews.llvm.org/D20681#448443, @Anastasia wrote:
>
> > Do you think we could add any test for this change?
>
>
> We have prelinking passes in amdgpu backend but it requires the llvm change 
> to be committed first. We can add a test for this after that.


Sure. Could you subscribe me to the relevant backend reviews if possible 
please? Thanks!



Comment at: lib/CodeGen/CodeGenAction.cpp:169
@@ +168,3 @@
+  std::function
+LinkCallBack = [=](llvm::Module *M)->bool {
+// Link LinkModule into this module if present, preserving its 
validity.

yaxunl wrote:
> Anastasia wrote:
> > Is there any reason for having this as a callback now?
> > 
> > Could we just add a call to prelink passes here above instead without 
> > modifying much the original flow?
> EmitBackendOutput does not set its own diagnostic handler. When linking error 
> happens, the diagnostic handler of BackendConsumer is used, which requires 
> the member variable CurLinkModule of BackendConsumer to be set to current 
> module to be linked to emit correct error msg. Therefore the linking step of 
> EmitBackendOutput needs to update a member of BackendConsumer, a lambda 
> function can achieve that with minimal change to other parts of the code.
> 
> An alternative implementation can do without the lambda function, but needs 
> to 
> 
>   # define a diagnostic handler for EmitBackendOutput 
>   # at the begining of EmitBackendOutput, save the old diagnostic handler and 
> set the new one
>   # at the end of EmitBackendOutput, recover the old diagnostic handler
>   # define a helper class for diagnostic handler for EmitBackendOutput to 
> retain the states needed for emitting diagnostic msgs 
>   # move or copy the diagnostic handling required by EmitBackendOutput from 
> the diagnostic handler of BackendConsumer to the helper class of diagnostic 
> handler for EmitBackendOutput
> 
> Do we want to take this approach?
> 
I see, seems complicated indeed. Would returning the module into CurLinkModule  
be possible instead?


http://reviews.llvm.org/D20681



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


[PATCH] D21145: [Sema] Fix crash on valid where instantiation of lambda cannot access type of 'this'

2016-06-08 Thread Erik Pilkington via cfe-commits
erik.pilkington created this revision.
erik.pilkington added reviewers: faisalv, rsmith, ahatanak.
erik.pilkington added a subscriber: cfe-commits.

Clang crashes during the instantiation of a lambda call operator where a 
`VarDecl` is initialized with an expression that requires the `this` type of 
the enclosing class, because when instantiating the initializing expression we 
introduce a new context which nulls out the `Sema::CXXThisTypeOverride`. This 
patch fixes the crash by retaining the 'this' type when the current lexical 
context is the body of the lambda.

This is a regression from 3.8 introduced in r267956. Fixes PR27994.

Thanks!

http://reviews.llvm.org/D21145

Files:
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  test/SemaCXX/lambda-expressions.cpp

Index: test/SemaCXX/lambda-expressions.cpp
===
--- test/SemaCXX/lambda-expressions.cpp
+++ test/SemaCXX/lambda-expressions.cpp
@@ -499,3 +499,15 @@
   };
 }
 }
+
+namespace PR27994 {
+struct A { template  A(T); };
+
+template 
+struct B {
+  int x;
+  A a = [&] { int y = x; };
+};
+
+B b;
+}
Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -12,6 +12,7 @@
 #include "clang/Sema/SemaInternal.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ASTLambda.h"
 #include "clang/AST/ASTMutationListener.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/DeclVisitor.h"
@@ -3916,7 +3917,9 @@
 ExprResult Init;
 
 {
-  ContextRAII SwitchContext(*this, Var->getDeclContext());
+  ContextRAII SwitchContext(
+  *this, Var->getDeclContext(),
+  /*NewThisContext=*/!isLambdaCallOperator(getCurLexicalContext()));
   Init = SubstInitializer(OldVar->getInit(), TemplateArgs,
   OldVar->getInitStyle() == VarDecl::CallInit);
 }


Index: test/SemaCXX/lambda-expressions.cpp
===
--- test/SemaCXX/lambda-expressions.cpp
+++ test/SemaCXX/lambda-expressions.cpp
@@ -499,3 +499,15 @@
   };
 }
 }
+
+namespace PR27994 {
+struct A { template  A(T); };
+
+template 
+struct B {
+  int x;
+  A a = [&] { int y = x; };
+};
+
+B b;
+}
Index: lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -12,6 +12,7 @@
 #include "clang/Sema/SemaInternal.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ASTLambda.h"
 #include "clang/AST/ASTMutationListener.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/DeclVisitor.h"
@@ -3916,7 +3917,9 @@
 ExprResult Init;
 
 {
-  ContextRAII SwitchContext(*this, Var->getDeclContext());
+  ContextRAII SwitchContext(
+  *this, Var->getDeclContext(),
+  /*NewThisContext=*/!isLambdaCallOperator(getCurLexicalContext()));
   Init = SubstInitializer(OldVar->getInit(), TemplateArgs,
   OldVar->getInitStyle() == VarDecl::CallInit);
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20880: [Coverage] Push a region and propagate counts through try blocks

2016-06-08 Thread Vedant Kumar via cfe-commits
vsk added a comment.

Ping.


http://reviews.llvm.org/D20880



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


Re: [PATCH] D20748: Handle recursion in LLVMIRGeneration Timer

2016-06-08 Thread Vedant Kumar via cfe-commits
vsk added a comment.

Ping, any updates on this patch?


http://reviews.llvm.org/D20748



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


RE: r269670 - [OpenCL] Add supported OpenCL extensions to target info.

2016-06-08 Thread Anastasia Stulova via cfe-commits
> I still think it would be good if the extensions that only affect the 
> host-side are removed, in particular cl_khr_icd and cl_khr_terminate_context. 
> We have a runtime that indirectly includes both Clang’s OpenCLExtensions.def 
> and the Khronos extension header, and we run into problems when we include 
> the extension header before OpenCLExtensions.def, because the extension 
> header defines macros named cl_khr_icd and cl_khr_terminate_context. I admit 
> this is a somewhat special use-case though.

We currently don't use all the extensions in Clang yet. But these particularly 
don't seem to have any use in the compiler indeed.

-Original Message-
From: Jeroen Ketema [mailto:j.ket...@imperial.ac.uk] 
Sent: 06 June 2016 22:16
To: Liu, Yaxun (Sam)
Cc: Anastasia Stulova; Clang Commits; nd
Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target info.

Hi Sam,

Thanks baring with me, and thanks a lot for your explanation! I indeed now 
believe that this is correct; I got somewhat confused by all the macro magic 
that is going on, and had missed that the enabled extensions are actually 
stored in a class instance separate from the one with available options.

I still think it would be good if the extensions that only affect the host-side 
are removed, in particular cl_khr_icd and cl_khr_terminate_context. We have a 
runtime that indirectly includes both Clang’s OpenCLExtensions.def and the 
Khronos extension header, and we run into problems when we include the 
extension header before OpenCLExtensions.def, because the extension header 
defines macros named cl_khr_icd and cl_khr_terminate_context. I admit this is a 
somewhat special use-case though.

Thanks again,

 Jeroen

> On 02 Jun 2016, at 21:53, Liu, Yaxun (Sam)  wrote:
> 
> Sorry for the delay.
> 
> In ParsePragma.cpp:
> 
> void Parser::HandlePragmaOpenCLExtension() {  
> assert(Tok.is(tok::annot_pragma_opencl_extension));
>  OpenCLExtData data =
>  OpenCLExtData::getFromOpaqueValue(Tok.getAnnotationValue());
>  unsigned state = data.getInt();
>  IdentifierInfo *ename = data.getPointer();  SourceLocation NameLoc = 
> Tok.getLocation();  ConsumeToken(); // The annotation token.
> 
>  OpenCLOptions  = Actions.getOpenCLOptions();  auto CLVer = 
> getLangOpts().OpenCLVersion;  auto  = 
> getTargetInfo().getSupportedOpenCLOpts();
>  // OpenCL 1.1 9.1: "The all variant sets the behavior for all 
> extensions,  // overriding all previously issued extension directives, 
> but only if the  // behavior is set to disable."
>  if (state == 0 && ename->isStr("all")) { #define OPENCLEXT(nm) \
>if (Supp.is_##nm##_supported_extension(CLVer)) \
>  f.nm = 0;
> #include "clang/Basic/OpenCLExtensions.def"
>  }
> #define OPENCLEXT(nm) else if (ename->isStr(#nm)) \
>   if (Supp.is_##nm##_supported_extension(CLVer)) \
> f.nm = state; \
>   else if (Supp.is_##nm##_supported_core(CLVer)) \
> PP.Diag(NameLoc, diag::warn_pragma_extension_is_core) << ename; \
>   else \
> PP.Diag(NameLoc, diag::warn_pragma_unsupported_extension) << 
> ename; #include "clang/Basic/OpenCLExtensions.def"
>  else {
>PP.Diag(NameLoc, diag::warn_pragma_unknown_extension) << ename;
>return;
>  }
> }
> 
> Whether an extension is supported is represented by 
> getTargetInfo().getSupportedOpenCLOpts(), which does not change with pragma.
> 
> Whether an extension is enabled is reprented by Actions.getOpenCLOptions(), 
> which changes with pragma.
> 
> test/SemaOpenCL/extensions.cl contains examples of unsupported extensions.
> 
> Sam
> 
> -Original Message-
> From: Jeroen Ketema [mailto:j.ket...@imperial.ac.uk]
> Sent: Tuesday, May 31, 2016 6:07 PM
> To: Liu, Yaxun (Sam) 
> Cc: Anastasia Stulova ; Clang Commits 
> ; nd 
> Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target 
> info.
> 
> Hi Sam,
> 
>> This commit does not change the initial state of the extensions. An 
>> extension is supported is not the same as enabled. At the beginning all 
>> extensions are disabled.
> 
> I do not see this reflected in the code at all. Could you please:
> 
> a. Point me to the location where this distinction is made.
> 
> b. Convince me that I cannot enable an extension for a target if that target 
> does not support the extension?
> 
> Jeroen
> 

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


Re: Virtual patch: `svn mv lib/Headers/Intrin.h lib/Headers/intrin.h`

2016-06-08 Thread Nico Weber via cfe-commits
On Wed, Jun 8, 2016 at 1:27 PM, Hans Wennborg  wrote:

> On Wed, Jun 8, 2016 at 10:20 AM, Nico Weber  wrote:
> > It looks like we're starting to be more careful about header case. MSVC's
> > intrin.h is called intrin.h with a lower-case 'i'; ours starts with an
> > upper-case 'I' for no good reason.
> >
> > It looks like file-only renames work fine as of svn 1.7 without any
> > workarounds
> > (
> http://subversion.apache.org/docs/release-notes/1.7.html#windows-case-change
> ),
> > so let's `svn mv` the file to its correct case.
> >
> > SGTM?
>
> Hmm, from http://subversion.apache.org/faq.html#case-change it seems
> users with pre-1.7 svn might run into problems when updating past the
> name change? Do users with such ancient versions still exist? Turns
> out I seem to be on svn 1.6.6 myself :-/
>

1.7 was released 6 years ago. I think it's ok if people who use an old svn
need to do some manual work when they update. I can mention what people
need to do in the CL description (also explained at
http://subversion.apache.org/faq.html#case-change).

I'm guessing most people get clang via the git mirror, and I think with git
this will hopefully just work (?)

Anyone else out there still on svn 1.6? Hans uses Chromium's depot_tools
svn (and Chromium's clang/win/tot bots do too, so they'll need some care),
but I'd expect that most people who don't happen to work on Chromium
probably have a newer svn by now?
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21020: [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-08 Thread James Reynolds via cfe-commits
JamesReynolds marked an inline comment as done.
JamesReynolds added a comment.

http://reviews.llvm.org/D21020



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


Re: [PATCH] D21020: [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-08 Thread James Reynolds via cfe-commits
JamesReynolds updated this revision to Diff 60058.
JamesReynolds marked an inline comment as not done.
JamesReynolds added a comment.

Missed one modification in last update.


http://reviews.llvm.org/D21020

Files:
  clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tidy/readability/IdentifierNamingCheck.h
  docs/ReleaseNotes.rst
  test/clang-tidy/readability-identifier-naming.cpp

Index: test/clang-tidy/readability-identifier-naming.cpp
===
--- test/clang-tidy/readability-identifier-naming.cpp
+++ test/clang-tidy/readability-identifier-naming.cpp
@@ -61,6 +61,7 @@
 // RUN: {key: readability-identifier-naming.VariableCase, value: lower_case}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodCase, value: UPPER_CASE}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodPrefix, value: 'v_'}, \
+// RUN: {key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE}, \
 // RUN: {key: readability-identifier-naming.TypeAliasCase, value: lower_case}, \
 // RUN: {key: readability-identifier-naming.TypeAliasSuffix, value: '_t'}, \
 // RUN: {key: readability-identifier-naming.IgnoreFailedSplit, value: 0} \
@@ -307,6 +308,12 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for typedef 'struct_type'
 // CHECK-FIXES: {{^}}typedef this_structure struct_type_t;{{$}}
 
+struct_type GlobalTypedefTestFunction(struct_type a_argument1) {
+// CHECK-FIXES: {{^}}struct_type_t GlobalTypedefTestFunction(struct_type_t a_argument1) {
+struct_type typedef_test_1;
+// CHECK-FIXES: {{^}}struct_type_t typedef_test_1;
+}
+
 using my_struct_type = THIS___Structure;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 'my_struct_type'
 // CHECK-FIXES: {{^}}using my_struct_type_t = this_structure;{{$}}
@@ -329,5 +336,11 @@
 // CHECK-FIXES: {{^}}  using ::foo_ns::inline_namespace::ce_function;{{$}}
 }
 
+#define MY_TEST_Macro(X) X()
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for macro definition 'MY_TEST_Macro'
+// CHECK-FIXES: {{^}}#define MY_TEST_MACRO(X) X()
+
+void MY_TEST_Macro(function) {}
+// CHECK-FIXES: {{^}}void MY_TEST_MACRO(function) {}
 }
 }
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -249,6 +249,11 @@
   Warns about defaulted constructors and assignment operators that are actually
   deleted.
 
+- Updated `readability-identifier-naming-check
+  `_
+
+  Added support for enforcing the case of macro statements.
+
 - New `readability-redundant-control-flow
   `_ check
 
Index: clang-tidy/readability/IdentifierNamingCheck.h
===
--- clang-tidy/readability/IdentifierNamingCheck.h
+++ clang-tidy/readability/IdentifierNamingCheck.h
@@ -13,6 +13,9 @@
 #include "../ClangTidy.h"
 
 namespace clang {
+
+class MacroInfo;
+
 namespace tidy {
 namespace readability {
 
@@ -36,6 +39,7 @@
   void storeOptions(ClangTidyOptions::OptionMap ) override;
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult ) override;
+  void registerPPCallbacks(CompilerInstance ) override;
   void onEndOfTranslationUnit() override;
 
   enum CaseType {
@@ -64,7 +68,7 @@
 
   /// \brief Holds an identifier name check failure, tracking the kind of the
   /// identifer, its possible fixup and the starting locations of all the
-  /// idenfiier usages.
+  /// identifier usages.
   struct NamingCheckFailure {
 std::string KindName;
 std::string Fixup;
@@ -81,9 +85,19 @@
 
 NamingCheckFailure() : ShouldFix(true) {}
   };
-  typedef llvm::DenseMap
+
+  typedef std::pair NamingCheckId;
+
+  typedef llvm::DenseMap
   NamingCheckFailureMap;
 
+  /// Check Macros for style violations
+  void checkMacro(SourceManager , const Token ,
+  const MacroInfo *MI);
+
+  /// Add a usage of a macro if it already has a violation
+  void expandMacro(const Token , const MacroInfo *MI);
+
 private:
   std::vector NamingStyles;
   bool IgnoreFailedSplit;
Index: clang-tidy/readability/IdentifierNamingCheck.cpp
===
--- clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -12,11 +12,53 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Lex/PPCallbacks.h"
+#include "clang/Lex/Preprocessor.h"
+#include "llvm/ADT/DenseMapInfo.h"
 
 #define DEBUG_TYPE 

Re: [PATCH] D21020: [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-08 Thread James Reynolds via cfe-commits
JamesReynolds marked an inline comment as done.
JamesReynolds added a comment.

http://reviews.llvm.org/D21020



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


Re: [PATCH] D21020: [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-08 Thread James Reynolds via cfe-commits
JamesReynolds added inline comments.


Comment at: clang-tidy/readability/IdentifierNamingCheck.h:89
@@ +88,3 @@
+
+  typedef std::pair NamingCheckId;
+

I think I thought that this wouldn't get picked up by the specialization 
machinery - but you're right, a typedef works out fine! Maybe I was thinking of 
overloads...


http://reviews.llvm.org/D21020



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


Re: [PATCH] D21020: [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-08 Thread James Reynolds via cfe-commits
JamesReynolds updated this revision to Diff 60056.
JamesReynolds marked 5 inline comments as done.
JamesReynolds added a comment.

Applied suggested code changes.


http://reviews.llvm.org/D21020

Files:
  clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tidy/readability/IdentifierNamingCheck.h
  docs/ReleaseNotes.rst
  test/clang-tidy/readability-identifier-naming.cpp

Index: test/clang-tidy/readability-identifier-naming.cpp
===
--- test/clang-tidy/readability-identifier-naming.cpp
+++ test/clang-tidy/readability-identifier-naming.cpp
@@ -61,6 +61,7 @@
 // RUN: {key: readability-identifier-naming.VariableCase, value: lower_case}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodCase, value: UPPER_CASE}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodPrefix, value: 'v_'}, \
+// RUN: {key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE}, \
 // RUN: {key: readability-identifier-naming.TypeAliasCase, value: lower_case}, \
 // RUN: {key: readability-identifier-naming.TypeAliasSuffix, value: '_t'}, \
 // RUN: {key: readability-identifier-naming.IgnoreFailedSplit, value: 0} \
@@ -307,6 +308,12 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for typedef 'struct_type'
 // CHECK-FIXES: {{^}}typedef this_structure struct_type_t;{{$}}
 
+struct_type GlobalTypedefTestFunction(struct_type a_argument1) {
+// CHECK-FIXES: {{^}}struct_type_t GlobalTypedefTestFunction(struct_type_t a_argument1) {
+struct_type typedef_test_1;
+// CHECK-FIXES: {{^}}struct_type_t typedef_test_1;
+}
+
 using my_struct_type = THIS___Structure;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 'my_struct_type'
 // CHECK-FIXES: {{^}}using my_struct_type_t = this_structure;{{$}}
@@ -329,5 +336,11 @@
 // CHECK-FIXES: {{^}}  using ::foo_ns::inline_namespace::ce_function;{{$}}
 }
 
+#define MY_TEST_Macro(X) X()
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for macro definition 'MY_TEST_Macro'
+// CHECK-FIXES: {{^}}#define MY_TEST_MACRO(X) X()
+
+void MY_TEST_Macro(function) {}
+// CHECK-FIXES: {{^}}void MY_TEST_MACRO(function) {}
 }
 }
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -249,6 +249,11 @@
   Warns about defaulted constructors and assignment operators that are actually
   deleted.
 
+- Updated `readability-identifier-naming-check
+  `_
+
+  Added support for enforcing the case of macro statements.
+
 - New `readability-redundant-control-flow
   `_ check
 
Index: clang-tidy/readability/IdentifierNamingCheck.h
===
--- clang-tidy/readability/IdentifierNamingCheck.h
+++ clang-tidy/readability/IdentifierNamingCheck.h
@@ -13,6 +13,9 @@
 #include "../ClangTidy.h"
 
 namespace clang {
+
+class MacroInfo;
+
 namespace tidy {
 namespace readability {
 
@@ -36,6 +39,7 @@
   void storeOptions(ClangTidyOptions::OptionMap ) override;
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult ) override;
+  void registerPPCallbacks(CompilerInstance ) override;
   void onEndOfTranslationUnit() override;
 
   enum CaseType {
@@ -64,7 +68,7 @@
 
   /// \brief Holds an identifier name check failure, tracking the kind of the
   /// identifer, its possible fixup and the starting locations of all the
-  /// idenfiier usages.
+  /// identifier usages.
   struct NamingCheckFailure {
 std::string KindName;
 std::string Fixup;
@@ -81,9 +85,19 @@
 
 NamingCheckFailure() : ShouldFix(true) {}
   };
-  typedef llvm::DenseMap
+
+  typedef std::pair NamingCheckId;
+
+  typedef llvm::DenseMap
   NamingCheckFailureMap;
 
+  /// Check Macros for style violations
+  void checkMacro(SourceManager , const Token ,
+  const MacroInfo *MI);
+
+  /// Add a usage of a macro if it already has a violation
+  void expandMacro(const Token , const MacroInfo *MI);
+
 private:
   std::vector NamingStyles;
   bool IgnoreFailedSplit;
Index: clang-tidy/readability/IdentifierNamingCheck.cpp
===
--- clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -12,11 +12,53 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Lex/PPCallbacks.h"
+#include "clang/Lex/Preprocessor.h"
+#include "llvm/ADT/DenseMapInfo.h"
 
 #define DEBUG_TYPE "clang-tidy"
 
 

Re: Virtual patch: `svn mv lib/Headers/Intrin.h lib/Headers/intrin.h`

2016-06-08 Thread Hans Wennborg via cfe-commits
On Wed, Jun 8, 2016 at 10:20 AM, Nico Weber  wrote:
> It looks like we're starting to be more careful about header case. MSVC's
> intrin.h is called intrin.h with a lower-case 'i'; ours starts with an
> upper-case 'I' for no good reason.
>
> It looks like file-only renames work fine as of svn 1.7 without any
> workarounds
> (http://subversion.apache.org/docs/release-notes/1.7.html#windows-case-change),
> so let's `svn mv` the file to its correct case.
>
> SGTM?

Hmm, from http://subversion.apache.org/faq.html#case-change it seems
users with pre-1.7 svn might run into problems when updating past the
name change? Do users with such ancient versions still exist? Turns
out I seem to be on svn 1.6.6 myself :-/
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20979: [OpenCL] Use function attribute/metadata to represent kernel attributes

2016-06-08 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

Looking good generally, I am just not sure about mixing two different 
representations.


http://reviews.llvm.org/D20979



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


Virtual patch: `svn mv lib/Headers/Intrin.h lib/Headers/intrin.h`

2016-06-08 Thread Nico Weber via cfe-commits
It looks like we're starting to be more careful about header case. MSVC's
intrin.h is called intrin.h with a lower-case 'i'; ours starts with an
upper-case 'I' for no good reason.

It looks like file-only renames work fine as of svn 1.7 without any
workarounds (
http://subversion.apache.org/docs/release-notes/1.7.html#windows-case-change),
so let's `svn mv` the file to its correct case.

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


Re: [PATCH] D21113: Add support for case-insensitive header lookup

2016-06-08 Thread Nico Weber via cfe-commits
thakis added a comment.

For performance: Can you check how build times for some large target in 
Chromium on Linux targeting Windows compares with this vs having the sdk in a 
fat mount? That would give us some data.

The discussion in the include case warning thread sounds like MS might update 
its headers to have #include lines matching actual file case, so hopefully this 
won't be needed at all eventually.


http://reviews.llvm.org/D21113



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


Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-08 Thread Eric Niebler via cfe-commits
eric_niebler reopened this revision.
eric_niebler added a subscriber: bogner.
eric_niebler added a comment.
This revision is now accepted and ready to land.

Reopening. I would like some eyes on the updated patch before we merge. @rsmith 
Would you prefer this (and http://reviews.llvm.org/D19842) in new diffs?

@bruno, @bogner: This should fix the use-after-free that ASAN was complaining 
about. ASAN rules.


http://reviews.llvm.org/D19843



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


Re: [PATCH] D20948: [OpenCL] Fix access qualifiers handling for typedefs

2016-06-08 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: lib/Sema/SemaType.cpp:6494
@@ +6493,3 @@
+default:
+  assert(0 && "unable to find corresponding image type");
+}

Please start the assert message from the upper case and finish with .


Comment at: test/SemaOpenCL/images-typedef.cl:10
@@ +9,3 @@
+#if __OPENCL_C_VERSION__ >= 200
+  typedef read_write image1d_t img1d_rw;
+#endif

I think for OpenCL < 2.0 we should give an error that read_write can not be 
used in earlier than OpenCL version 2.0.


Comment at: test/SemaOpenCL/images-typedef.cl:21
@@ +20,3 @@
+#if __OPENCL_C_VERSION__ >= 200
+  void myReadWrite(read_write image1d_t);
+#endif

don't indent inside macro directives #if


Comment at: test/SemaOpenCL/images-typedef.cl:41
@@ +40,3 @@
+  }
+#endif
+

Yes, looks good!


Comment at: test/SemaOpenCL/images-typedef.cl:44
@@ +43,3 @@
+kernel void k5(img1d_ro_default img) {
+  myWrite(img); // expected-error {{passing 'img1d_ro_default' (aka 
'__read_only image1d_t') to parameter of incompatible type '__write_only 
image1d_t'}}
+}

Sure, makes sense!


http://reviews.llvm.org/D20948



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


Re: [PATCH] D21113: Add support for case-insensitive header lookup

2016-06-08 Thread Hans Wennborg via cfe-commits
hans updated this revision to Diff 60054.
hans marked 2 inline comments as done.
hans added a comment.

Addressing Saleem's comments, and renaming the flag to 
-fcase-insensitive-paths, since this doesn't apply just to includes, but 
anything that goes through vfs, including the main source filename.


http://reviews.llvm.org/D21113

Files:
  include/clang/Basic/VirtualFileSystem.h
  include/clang/Driver/Options.td
  include/clang/Lex/HeaderSearchOptions.h
  lib/Basic/VirtualFileSystem.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Driver/cl-options.c
  test/Frontend/Inputs/case-insensitive-paths.h
  test/Frontend/case-insensitive-paths.c
  unittests/Basic/VirtualFileSystemTest.cpp

Index: unittests/Basic/VirtualFileSystemTest.cpp
===
--- unittests/Basic/VirtualFileSystemTest.cpp
+++ unittests/Basic/VirtualFileSystemTest.cpp
@@ -107,8 +107,15 @@
 
   vfs::directory_iterator dir_begin(const Twine ,
 std::error_code ) override {
-return vfs::directory_iterator(
+auto I = vfs::directory_iterator(
 std::make_shared(FilesAndDirs, Dir));
+
+// Even if there is no entry for /foo, /foo/bar may exist, so only set the
+// error code if /foo returns an empty iterator.
+if (I == vfs::directory_iterator())
+  EC = status(Dir).getError();
+
+return I;
   }
 
   void addEntry(StringRef Path, const vfs::Status ) {
@@ -1164,3 +1171,52 @@
   }
   EXPECT_EQ(I, E);
 }
+
+class CaseInsensitiveFileSystemTest : public ::testing::Test {
+private:
+  IntrusiveRefCntPtr Base;
+
+protected:
+  IntrusiveRefCntPtr FS;
+
+  CaseInsensitiveFileSystemTest()
+  : Base(new DummyFileSystem()),
+FS(new clang::vfs::CaseInsensitiveFileSystem(Base)) {
+Base->addRegularFile("/foo");
+Base->addDirectory("/bar");
+Base->addRegularFile("/bar/baz");
+  }
+};
+
+TEST_F(CaseInsensitiveFileSystemTest, Basic) {
+  // Not just accepting anything.
+  auto Status = FS->status("/F00");
+  ASSERT_EQ(llvm::errc::no_such_file_or_directory, Status.getError());
+
+  // Case-insensitive file is found.
+  Status = FS->status("/FoO");
+  ASSERT_FALSE(Status.getError());
+
+  // Case-insensitive dir works too.
+  Status = FS->status("/bAr/baZ");
+  ASSERT_FALSE(Status.getError());
+
+  // Test openFileForRead.
+  auto File = FS->openFileForRead("/F00");
+  ASSERT_EQ(llvm::errc::no_such_file_or_directory, File.getError());
+  File = FS->openFileForRead("/Foo");
+  ASSERT_FALSE(File.getError());
+  File = FS->openFileForRead("/Bar/Baz");
+  ASSERT_FALSE(File.getError());
+
+  // Test directory listing.
+  std::error_code EC;
+  auto Dir = FS->dir_begin("/b4r", EC);
+  ASSERT_EQ(llvm::errc::no_such_file_or_directory, EC);
+  Dir = FS->dir_begin("/bAr", EC);
+  ASSERT_FALSE(EC);
+  ASSERT_EQ("/bar/baz", Dir->getName());
+  Dir.increment(EC);
+  ASSERT_FALSE(EC);
+  ASSERT_EQ(vfs::directory_iterator(), Dir);
+}
Index: test/Frontend/case-insensitive-paths.c
===
--- /dev/null
+++ test/Frontend/case-insensitive-paths.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -fcase-insensitive-paths -verify %s
+// RUN: %clang_cc1 -fsyntax-only --show-includes -fcase-insensitive-paths %s | FileCheck %s
+
+#include "InpUts/CasE-InsensitivE-Paths.h" // expected-no-diagnostics
+
+// Make sure the real filename is used when printing header dependencies.
+// CHECK: including file: {{.*}}case-insensitive-paths.h
Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -466,6 +466,7 @@
 // RUN: -mllvm -disable-llvm-optzns \
 // RUN: -Wunused-variable \
 // RUN: -fmacro-backtrace-limit=0 \
+// RUN: -fcase-insensitive-paths \
 // RUN: -Werror /Zs -- %s 2>&1
 
 
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1447,6 +1447,8 @@
 
   for (const Arg *A : Args.filtered(OPT_ivfsoverlay))
 Opts.AddVFSOverlayFile(A->getValue());
+
+  Opts.CaseInsensitive = Args.hasArg(OPT_fcase_insensitive_paths);
 }
 
 void CompilerInvocation::setLangDefaults(LangOptions , InputKind IK,
@@ -2538,12 +2540,8 @@
   GraveYard[Idx] = Ptr;
 }
 
-IntrusiveRefCntPtr
-createVFSFromCompilerInvocation(const CompilerInvocation ,
-DiagnosticsEngine ) {
-  if (CI.getHeaderSearchOpts().VFSOverlayFiles.empty())
-return vfs::getRealFileSystem();
-
+static IntrusiveRefCntPtr
+getOverlayFS(const CompilerInvocation , DiagnosticsEngine ) {
   IntrusiveRefCntPtr
 Overlay(new vfs::OverlayFileSystem(vfs::getRealFileSystem()));
   // earlier vfs files are on the bottom
@@ -2565,4 +2563,20 @@
   }
   return Overlay;
 }
+
+IntrusiveRefCntPtr
+createVFSFromCompilerInvocation(const 

[PATCH] D21141: [DebugInfo] Add calling conventions to DISubroutineType

2016-06-08 Thread Reid Kleckner via cfe-commits
rnk created this revision.
rnk added reviewers: aprantl, dblaikie.
rnk added a subscriber: cfe-commits.
rnk added a dependency: D21114: [DebugInfo] Add calling convention support for 
DWARF and CodeView.

This should have been a very simple change, but it was greatly
complicated by the construction of new Decls during IR generation.

In particular, we reconstruct the AST function type in order to get the
implicit 'this' parameter into C++ method types.

We also have to worry about FunctionDecls whose types are not
FunctionTypes because CGBlocks.cpp constructs some dummy FunctionDecls
with 'void' type.

Depends on D21114

http://reviews.llvm.org/D21141

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CodeGenFunction.cpp
  test/CodeGenCXX/debug-info-calling-conventions.cpp

Index: test/CodeGenCXX/debug-info-calling-conventions.cpp
===
--- /dev/null
+++ test/CodeGenCXX/debug-info-calling-conventions.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -emit-llvm -o - | FileCheck %s
+
+struct A {
+  void thiscallcc();
+};
+void A::thiscallcc() {}
+
+// CHECK: !DISubprogram(name: "thiscallcc", {{.*}} type: ![[thiscallty:[^,]*]], {{.*}})
+// CHECK: ![[thiscallty]] = !DISubroutineType(cc: DW_CC_BORLAND_thiscall, types: ![[thisargs:[^,)]*]])
+// CHECK: ![[thisargs]] = !{null, ![[thisptrty:[^,}]*]]}
+// CHECK: ![[thisptrty]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !{{.*}}, size: 32, align: 32, flags: DIFlagArtificial | DIFlagObjectPointer)
+
+void cdeclcc() {}
+void __fastcall fastcallcc() {}
+void __stdcall stdcallcc() {}
+void __vectorcall vectorcallcc() {}
+
+// CHECK: !DISubprogram(name: "cdeclcc", {{.*}} type: ![[cdeclty:[^,]*]], {{.*}})
+// CHECK: ![[cdeclty]] = !DISubroutineType(types: ![[noargs:[^,)]*]])
+// CHECK: ![[noargs]] = !{null}
+// CHECK: !DISubprogram(name: "fastcallcc", {{.*}} type: ![[fastcallty:[^,]*]], {{.*}})
+// CHECK: ![[fastcallty]] = !DISubroutineType(cc: DW_CC_BORLAND_msfastcall, types: ![[noargs]])
+// CHECK: !DISubprogram(name: "stdcallcc", {{.*}} type: ![[stdcallty:[^,]*]], {{.*}})
+// CHECK: ![[stdcallty]] = !DISubroutineType(cc: DW_CC_BORLAND_stdcall, types: ![[noargs]])
+// CHECK: !DISubprogram(name: "vectorcallcc", {{.*}} type: ![[vectorcallty:[^,]*]], {{.*}})
+// CHECK: ![[vectorcallty]] = !DISubroutineType(cc: DW_CC_LLVM_vectorcall, types: ![[noargs]])
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -762,15 +762,18 @@
 
   // Emit subprogram debug descriptor.
   if (CGDebugInfo *DI = getDebugInfo()) {
+// Reconstruct the type from the argument list so that implicit parameters,
+// such as 'this' and 'vtt', show up in the debug info. Preserve the calling
+// convention.
+CallingConv CC = CallingConv::CC_C;
+if (auto *FD = dyn_cast_or_null(D))
+  if (const auto *SrcFnTy = FD->getType()->getAs())
+CC = SrcFnTy->getCallConv();
 SmallVector ArgTypes;
-for (FunctionArgList::const_iterator i = Args.begin(), e = Args.end();
-	 i != e; ++i) {
-  ArgTypes.push_back((*i)->getType());
-}
-
-QualType FnType =
-  getContext().getFunctionType(RetTy, ArgTypes,
-   FunctionProtoType::ExtProtoInfo());
+for (const VarDecl *VD : Args)
+  ArgTypes.push_back(VD->getType());
+QualType FnType = getContext().getFunctionType(
+RetTy, ArgTypes, FunctionProtoType::ExtProtoInfo(CC));
 DI->EmitFunctionStart(GD, Loc, StartLoc, FnType, CurFn, Builder);
   }
 
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -831,6 +831,39 @@
   getDeclContextDescriptor(Ty->getDecl()));
 }
 
+static unsigned getDwarfCC(CallingConv CC) {
+  switch (CC) {
+  case CC_C:
+// Avoid emitting DW_AT_calling_convention if the C convention was used.
+return 0;
+
+  case CC_X86StdCall:
+return llvm::dwarf::DW_CC_BORLAND_stdcall;
+  case CC_X86FastCall:
+return llvm::dwarf::DW_CC_BORLAND_msfastcall;
+  case CC_X86ThisCall:
+return llvm::dwarf::DW_CC_BORLAND_thiscall;
+  case CC_X86VectorCall:
+return llvm::dwarf::DW_CC_LLVM_vectorcall;
+  case CC_X86Pascal:
+return llvm::dwarf::DW_CC_BORLAND_pascal;
+
+  // FIXME: Create new DW_CC_ codes for these calling conventions.
+  case CC_X86_64Win64:
+  case CC_X86_64SysV:
+  case CC_AAPCS:
+  case CC_AAPCS_VFP:
+  case CC_IntelOclBicc:
+  case CC_SpirFunction:
+  case CC_SpirKernel:
+  case CC_Swift:
+  case CC_PreserveMost:
+  case CC_PreserveAll:
+return 0;
+  }
+  return 0;
+}
+
 llvm::DIType *CGDebugInfo::CreateType(const FunctionType *Ty,
   llvm::DIFile *Unit) {
   SmallVector EltTys;
@@ -850,7 +883,8 @@
   }
 
   

Re: [PATCH] D20732: Don't use static variables in LambdaCapture

2016-06-08 Thread John Brawn via cfe-commits
john.brawn added a comment.

In http://reviews.llvm.org/D20732#452055, @faisalv wrote:

> I'm assuming you've given some thought to any existing pathological code that 
> might break if the actual compile-time alignment of Decl itself is changed 
> (since currently it seems to be that the alignment requirements are 
> established at run-time and only through allocation via new (not that anyone 
> would be creating Decls on the stack)) - and whether there are any 
> consequences of relevance there...


I can't think of anything that could go wrong because of it. Reducing the 
alignment could cause problems, if there were things that check that the 
alignment is at least some value, but here I'm increasing it. Decl and all of 
its subclasses only have protected or private constructors and the only way to 
create them is through the various XYZDecl::Create methods which go through new 
so there should be no problem there either.


Repository:
  rL LLVM

http://reviews.llvm.org/D20732



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


Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a clang module

2016-06-08 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/Headers/opencl-c-header.cl:50
@@ +49,3 @@
+// RUN: %clang_cc1 -cc1 -triple spir-unknown-unknown -emit-llvm -o - 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -fdisable-module-hash %s | FileCheck %s
+// RUN: diff %t/1_0.pcm %t/opencl_c.pcm
+// RUN: rm %t/opencl_c.pcm

yaxunl wrote:
> Anastasia wrote:
> > I see, but is diffing accurate here? Because if the file is regenerated but 
> > with exactly the same content it won't be caught...
> It cannot detect if the file was re-written with the same content.
> 
> There is one way we can do that:
> get the modified time of the file
> sleep 1 second
> get the modified time of the file again and compare
> 
> but it will slow down the test by 1 second. do we really want to do that?
Not desirable to increase the testing time. I was wondering if we could amend 
the attribute of the file let's say run chmod on it? I guess if it's 
regenerated it would get default attributes again?

Otherwise, I would rather skip testing uniqueness, if we can't do it properly. 
We rely on the existing modules functionality anyways which is already being 
tested elsewhere.


Comment at: test/Headers/opencl-c-header.cl:70
@@ +69,3 @@
+// RUN: %clang_cc1 -cc1 -triple amdgcn--amdhsa -emit-llvm -o - -cl-std=CL2.0  
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s
+// RUN: %clang_cc1 -cc1 -triple spir-unknown-unknown -emit-llvm -o - 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s | FileCheck %s
+// RUN: %clang_cc1 -cc1 -triple spir-unknown-unknown -emit-llvm -o - 
-cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s | FileCheck --check-prefix=CHECK20 %s

yaxunl wrote:
> Anastasia wrote:
> > So in this line it will be regenerated because the line above used 
> > different triple?
> No. It should use the cached module.
Ok, but it doesn't seem like there is something different being tested to line 
67.


http://reviews.llvm.org/D20444



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


Re: [PATCH] D21134: clang-tidy: new check readability-misplaced-array-index

2016-06-08 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a subscriber: Eugene.Zelenko.
Eugene.Zelenko added a comment.

Please mention this check in docs/ReleaseNotes.rst (in alphabetical order).


Repository:
  rL LLVM

http://reviews.llvm.org/D21134



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


Re: [PATCH] D20933: Preallocate ExplodedNode hash table

2016-06-08 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

> For the pile of LLVM projects that I am currently building (llvm, clang, 
> libcxx, libcxxabi), 18.9% of all analyzed

>  functions hit the maximum step count. For the previously discussed large .C 
> file, 37% of the analyzed functions hit the maximum step count.


These look high to me. I've looked up some statistics that I've collected years 
ago and I see a similar number for sqlite, but much lower numbers for other 
test cases. I tested with the Preview app (~150 files) and a bunch of 
preprocessed files we had on hand at that moment in both cases the number of 
reaching timeout was about 1%. sqlite is special because all source code is in 
that one file, so we can do much more inlining. Which C test case have you used?

(I do not have any numbers for C++.)

Another wrinkle here is that we support "Analyzer shallow mode" 
(-analyzer-config mode=shallow) , which dials down inlining quite a bit. We 
have users who analyze during build (believe it or not) and they use the 
shallow mode by default.


http://reviews.llvm.org/D20933



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


r272159 - [Sema] Don't permit catching variably modified types

2016-06-08 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Wed Jun  8 11:05:07 2016
New Revision: 272159

URL: http://llvm.org/viewvc/llvm-project?rev=272159=rev
Log:
[Sema] Don't permit catching variably modified types

Variably modified types shouldn't be permitted in catch clauses.

This fixes PR28047.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/exceptions.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=272159=272158=272159=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jun  8 11:05:07 
2016
@@ -5904,6 +5904,8 @@ def err_catch_incomplete_ref : Error<
   "cannot catch reference to incomplete type %0">;
 def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
 def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue 
reference">;
+def err_catch_variably_modified : Error<
+  "cannot catch variably modified type %0">;
 def err_qualified_catch_declarator : Error<
   "exception declarator cannot be qualified">;
 def err_early_catch_all : Error<"catch-all handler must come last">;

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=272159=272158=272159=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Jun  8 11:05:07 2016
@@ -12207,6 +12207,11 @@ VarDecl *Sema::BuildExceptionDeclaration
 Invalid = true;
   }
 
+  if (ExDeclType->isVariablyModifiedType()) {
+Diag(Loc, diag::err_catch_variably_modified) << ExDeclType;
+Invalid = true;
+  }
+
   QualType BaseType = ExDeclType;
   int Mode = 0; // 0 for direct type, 1 for pointer, 2 for reference
   unsigned DK = diag::err_catch_incomplete;

Modified: cfe/trunk/test/SemaCXX/exceptions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/exceptions.cpp?rev=272159=272158=272159=diff
==
--- cfe/trunk/test/SemaCXX/exceptions.cpp (original)
+++ cfe/trunk/test/SemaCXX/exceptions.cpp Wed Jun  8 11:05:07 2016
@@ -268,3 +268,17 @@ void g() {
   }
 }
 }
+
+namespace PR28047 {
+void test1(int i) {
+  try {
+  } catch (int(*)[i]) { // expected-error{{cannot catch variably modified 
type}}
+  }
+}
+void test2() {
+  int i;
+  try {
+  } catch (int(*)[i]) { // expected-error{{cannot catch variably modified 
type}}
+  }
+}
+}


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


r272156 - Prune away some unused using decls. NFC.

2016-06-08 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Wed Jun  8 10:34:36 2016
New Revision: 272156

URL: http://llvm.org/viewvc/llvm-project?rev=272156=rev
Log:
Prune away some unused using decls. NFC.

Found by clang's misc-unused-using-decls.

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
cfe/trunk/unittests/AST/ASTContextParentMapTest.cpp
cfe/trunk/unittests/AST/ASTImporterTest.cpp
cfe/trunk/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp

Modified: 
cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp?rev=272156=272155=272156=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp 
(original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp Wed 
Jun  8 10:34:36 2016
@@ -29,7 +29,6 @@
 
 using namespace clang;
 using namespace ento;
-using llvm::APInt;
 using llvm::APSInt;
 
 namespace {

Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=272156=272155=272156=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Wed Jun  8 
10:34:36 2016
@@ -51,7 +51,6 @@
 
 using namespace clang;
 using namespace ento;
-using llvm::SmallPtrSet;
 
 #define DEBUG_TYPE "AnalysisConsumer"
 

Modified: cfe/trunk/unittests/AST/ASTContextParentMapTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTContextParentMapTest.cpp?rev=272156=272155=272156=diff
==
--- cfe/trunk/unittests/AST/ASTContextParentMapTest.cpp (original)
+++ cfe/trunk/unittests/AST/ASTContextParentMapTest.cpp Wed Jun  8 10:34:36 2016
@@ -21,10 +21,6 @@
 namespace clang {
 namespace ast_matchers {
 
-using clang::tooling::newFrontendActionFactory;
-using clang::tooling::runToolOnCodeWithArgs;
-using clang::tooling::FrontendActionFactory;
-
 TEST(GetParents, ReturnsParentForDecl) {
   MatchVerifier Verifier;
   EXPECT_TRUE(

Modified: cfe/trunk/unittests/AST/ASTImporterTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTImporterTest.cpp?rev=272156=272155=272156=diff
==
--- cfe/trunk/unittests/AST/ASTImporterTest.cpp (original)
+++ cfe/trunk/unittests/AST/ASTImporterTest.cpp Wed Jun  8 10:34:36 2016
@@ -22,10 +22,6 @@
 namespace clang {
 namespace ast_matchers {
 
-using clang::tooling::newFrontendActionFactory;
-using clang::tooling::runToolOnCodeWithArgs;
-using clang::tooling::FrontendActionFactory;
-
 typedef std::vector StringVector;
 
 void getLangArgs(Language Lang, StringVector ) {

Modified: cfe/trunk/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp?rev=272156=272155=272156=diff
==
--- cfe/trunk/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp Wed Jun  8 
10:34:36 2016
@@ -16,9 +16,6 @@ namespace ast_matchers {
 namespace dynamic {
 namespace {
 
-using ast_matchers::internal::DynTypedMatcher;
-using ast_matchers::internal::Matcher;
-
 TEST(VariantValueTest, Unsigned) {
   const unsigned kUnsigned = 17;
   VariantValue Value = kUnsigned;


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


Re: [clang-tools-extra] r272152 - [include-fixer] Keep dot dot in SymbolInfo file paths.

2016-06-08 Thread Benjamin Kramer via cfe-commits
Turns out that this is causing weirdness when path minimization is
disabled, we will insert includes with .. in that case. I don't know
how to solve that, maybe still clean up the path in the fixer if
minimization is off?

On Wed, Jun 8, 2016 at 5:10 PM, Haojian Wu via cfe-commits
 wrote:
> Author: hokein
> Date: Wed Jun  8 10:10:18 2016
> New Revision: 272152
>
> URL: http://llvm.org/viewvc/llvm-project?rev=272152=rev
> Log:
> [include-fixer] Keep dot dot in SymbolInfo file paths.
>
> Summary:
> Currently, removing dot dot in header's path doesn't make include-fixer
> minimize path correctly in some cases, for example, specify a relative search
> path based on the build directory("-I../include/").
>
> Besides, removing dot dot can break symbolic link directories. So don't
> removing it for now.
>
> Reviewers: ioeric, bkramer
>
> Subscribers: cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D21132
>
> Modified:
> clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp
> 
> clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
> clang-tools-extra/trunk/test/include-fixer/include_path.cpp
> 
> clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
>
> Modified: 
> clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp?rev=272152=272151=272152=diff
> ==
> --- clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp 
> (original)
> +++ clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp Wed 
> Jun  8 10:10:18 2016
> @@ -33,7 +33,7 @@ std::string getIncludePath(const SourceM
>if (Collector)
>  FilePath = Collector->getMappedHeader(FilePath);
>SmallString<256> CleanedFilePath = FilePath;
> -  llvm::sys::path::remove_dots(CleanedFilePath, /*remove_dot_dot=*/true);
> +  llvm::sys::path::remove_dots(CleanedFilePath, /*remove_dot_dot=*/false);
>
>return CleanedFilePath.str();
>  }
>
> Modified: 
> clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp?rev=272152=272151=272152=diff
> ==
> --- 
> clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
>  (original)
> +++ 
> clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
>  Wed Jun  8 10:10:18 2016
> @@ -158,6 +158,5 @@ int main(int argc, const char **argv) {
>auto Factory =
>
> llvm::make_unique(
>, clang::find_all_symbols::getSTLPostfixHeaderMap());
> -  Tool.run(Factory.get());
> -  return 0;
> +  return Tool.run(Factory.get());
>  }
>
> Modified: clang-tools-extra/trunk/test/include-fixer/include_path.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/include-fixer/include_path.cpp?rev=272152=272151=272152=diff
> ==
> --- clang-tools-extra/trunk/test/include-fixer/include_path.cpp (original)
> +++ clang-tools-extra/trunk/test/include-fixer/include_path.cpp Wed Jun  8 
> 10:10:18 2016
> @@ -1,14 +1,20 @@
>  // REQUIRES: shell
>  // RUN: mkdir -p %T/include-fixer/include
> +// RUN: mkdir -p %T/include-fixer/symbols
>  // RUN: mkdir -p %T/include-fixer/build
>  // RUN: mkdir -p %T/include-fixer/src
>  // RUN: sed 's|test_dir|%T/include-fixer|g' %S/Inputs/database_template.json 
> > %T/include-fixer/build/compile_commands.json
> -// RUN: cp %S/Inputs/fake_yaml_db.yaml 
> %T/include-fixer/build/fake_yaml_db.yaml
> -// RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
> -// RUN: touch %T/include-fixer/include/bar.h
> +// RUN: echo -e '#include "bar.h"\nb::a::bar f;' > 
> %T/include-fixer/src/bar.cpp
> +// RUN: echo 'namespace b { namespace a { class bar {}; } }' > 
> %T/include-fixer/include/bar.h
>  // RUN: cd %T/include-fixer/build
> -// RUN: clang-include-fixer -db=yaml -input=fake_yaml_db.yaml 
> -minimize-paths=true -p=. %T/include-fixer/src/bar.cpp
> +// RUN: find-all-symbols -output-dir=%T/include-fixer/symbols -p=. 
> %T/include-fixer/src/bar.cpp
> +// RUN: find-all-symbols -merge-dir=%T/include-fixer/symbols 
> %T/include-fixer/build/find_all_symbols.yaml
> +// RUN: FileCheck -input-file=%T/include-fixer/build/find_all_symbols.yaml 
> -check-prefix=CHECK-YAML %s
> +//
> +// RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
> +// RUN: clang-include-fixer -db=yaml 
> -input=%T/include-fixer/build/find_all_symbols.yaml -minimize-paths=true -p=. 
> %T/include-fixer/src/bar.cpp
>  // RUN: FileCheck -input-file=%T/include-fixer/src/bar.cpp %s
>
> +// 

[clang-tools-extra] r272155 - [clang-tidy] misc-argument-comment: don't bail out when an argument is a macro expansion (e.g. NULL).

2016-06-08 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Jun  8 10:27:46 2016
New Revision: 272155

URL: http://llvm.org/viewvc/llvm-project?rev=272155=rev
Log:
[clang-tidy] misc-argument-comment: don't bail out when an argument is a macro 
expansion (e.g. NULL).

Add CHECK-FIX tests.

Modified:
clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h
clang-tools-extra/trunk/test/clang-tidy/misc-argument-comment.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp?rev=272155=272154=272155=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.cpp Wed Jun  8 
10:27:46 2016
@@ -37,8 +37,8 @@ void ArgumentCommentCheck::registerMatch
   Finder->addMatcher(cxxConstructExpr().bind("expr"), this);
 }
 
-std::vector>
-ArgumentCommentCheck::getCommentsInRange(ASTContext *Ctx, SourceRange Range) {
+static std::vector>
+getCommentsInRange(ASTContext *Ctx, CharSourceRange Range) {
   std::vector> Comments;
   auto  = Ctx->getSourceManager();
   std::pair BeginLoc = SM.getDecomposedLoc(Range.getBegin()),
@@ -132,16 +132,13 @@ void ArgumentCommentCheck::checkCallArgs
   }
 }
 
-SourceLocation BeginSLoc, EndSLoc = Args[i]->getLocStart();
-if (i == 0)
-  BeginSLoc = ArgBeginLoc;
-else
-  BeginSLoc = Args[i - 1]->getLocEnd();
-if (BeginSLoc.isMacroID() || EndSLoc.isMacroID())
-  continue;
+CharSourceRange BeforeArgument = CharSourceRange::getCharRange(
+i == 0 ? ArgBeginLoc : Args[i - 1]->getLocEnd(),
+Args[i]->getLocStart());
+BeforeArgument = Lexer::makeFileCharRange(
+BeforeArgument, Ctx->getSourceManager(), Ctx->getLangOpts());
 
-for (auto Comment :
- getCommentsInRange(Ctx, SourceRange(BeginSLoc, EndSLoc))) {
+for (auto Comment : getCommentsInRange(Ctx, BeforeArgument)) {
   llvm::SmallVector Matches;
   if (IdentRE.match(Comment.second, )) {
 if (Matches[2] != II->getName()) {

Modified: clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h?rev=272155=272154=272155=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h Wed Jun  8 
10:27:46 2016
@@ -43,8 +43,6 @@ private:
 
   bool isLikelyTypo(llvm::ArrayRef Params, StringRef ArgName,
 unsigned ArgIndex);
-  std::vector>
-  getCommentsInRange(ASTContext *Ctx, SourceRange Range);
   void checkCallArgs(ASTContext *Ctx, const FunctionDecl *Callee,
  SourceLocation ArgBeginLoc,
  llvm::ArrayRef Args);

Modified: clang-tools-extra/trunk/test/clang-tidy/misc-argument-comment.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-argument-comment.cpp?rev=272155=272154=272155=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/misc-argument-comment.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-argument-comment.cpp Wed Jun  
8 10:27:46 2016
@@ -12,6 +12,7 @@ void g() {
   // CHECK-MESSAGES: [[@LINE+2]]:14: warning: argument name 'z' in comment 
does not match parameter name 'y'
   // CHECK-MESSAGES: :[[@LINE-5]]:19: note: 'y' declared here
   f(/*y=*/0, /*z=*/0);
+  // CHECK-FIXES: {{^}}  f(/*y=*/0, /*z=*/0);
 }
 
 struct Closure {};
@@ -37,4 +38,11 @@ void templates() {
   variadic(/*xxx=*/0, /*yyy=*/1);
   variadic2(/*zzZ=*/0, /*xxx=*/1, /*yyy=*/2);
   // CHECK-MESSAGES: [[@LINE-1]]:13: warning: argument name 'zzZ' in comment 
does not match parameter name 'zzz'
+  // CHECK-FIXES: variadic2(/*zzz=*/0, /*xxx=*/1, /*yyy=*/2);
 }
+
+#define FALSE 0
+void qqq(bool aaa);
+void f() { qqq(/*bbb=*/FALSE); }
+// CHECK-MESSAGES: [[@LINE-1]]:16: warning: argument name 'bbb' in comment 
does not match parameter name 'aaa'
+// CHECK-FIXES: void f() { qqq(/*bbb=*/FALSE); }


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


Re: [PATCH] D21020: [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-08 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:142
@@ +141,3 @@
+SourceManager (PP->getSourceManager());
+if (!SM.isInMainFile(MacroNameTok.getLocation()))
+  return;

I'm not sure the check currently refuses to fix stuff defined in headers. It 
probably relies on -header-filter to limit its scope. It's intrinsically 
dangerous (since we should see all translation units using the entity to 
correctly rename it), but we should let users do this, in case they know what 
to do.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:152
@@ +151,3 @@
+SourceRange Range, const MacroArgs *Args) override {
+(void)Range;
+(void)Args;

No need to mute -Wunused _this_ way. Just comment out parameter names in the 
declaration.


Comment at: clang-tidy/readability/IdentifierNamingCheck.cpp:814
@@ +813,3 @@
+  SourceRange Range =
+  SourceRange(MacroNameTok.getLocation(), MacroNameTok.getEndLoc());
+  addUsage(NamingCheckFailures, ID, Range);

Remove ` = SourceRange`. Just `SourceRange Range(...);` is enough.


Comment at: clang-tidy/readability/IdentifierNamingCheck.h:86
@@ +85,3 @@
+
+  struct NamingCheckId : std::pair {
+typedef std::pair Parent;

Maybe just typedef?


Comment at: clang-tidy/readability/IdentifierNamingCheck.h:88
@@ +87,3 @@
+typedef std::pair Parent;
+using Parent::Parent;
+  };

Delegating constructors don't work in VS2013, which LLVM should still support.


http://reviews.llvm.org/D21020



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


Re: [PATCH] D20133: [OpenCL] Fix __builtin_astype for vec3 types.

2016-06-08 Thread Yaxun Liu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272153: [OpenCL] Fix __builtin_astype for vec3 types. 
(authored by yaxunl).

Changed prior to commit:
  http://reviews.llvm.org/D20133?vs=59630=60043#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20133

Files:
  cfe/trunk/lib/CodeGen/CGExprScalar.cpp
  cfe/trunk/test/CodeGenOpenCL/as_type.cl
  cfe/trunk/test/SemaOpenCL/as_type.cl

Index: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
===
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp
@@ -3382,50 +3382,48 @@
   return CGF.EmitBlockLiteral(block);
 }
 
+// Convert a vec3 to vec4, or vice versa.
+static Value *ConvertVec3AndVec4(CGBuilderTy , CodeGenFunction ,
+ Value *Src, unsigned NumElementsDst) {
+  llvm::Value *UnV = llvm::UndefValue::get(Src->getType());
+  SmallVector Args;
+  Args.push_back(Builder.getInt32(0));
+  Args.push_back(Builder.getInt32(1));
+  Args.push_back(Builder.getInt32(2));
+  if (NumElementsDst == 4)
+Args.push_back(llvm::UndefValue::get(CGF.Int32Ty));
+  llvm::Constant *Mask = llvm::ConstantVector::get(Args);
+  return Builder.CreateShuffleVector(Src, UnV, Mask);
+}
+
 Value *ScalarExprEmitter::VisitAsTypeExpr(AsTypeExpr *E) {
   Value *Src  = CGF.EmitScalarExpr(E->getSrcExpr());
   llvm::Type *DstTy = ConvertType(E->getType());
 
-  // Going from vec4->vec3 or vec3->vec4 is a special case and requires
-  // a shuffle vector instead of a bitcast.
   llvm::Type *SrcTy = Src->getType();
-  if (isa(DstTy) && isa(SrcTy)) {
-unsigned numElementsDst = cast(DstTy)->getNumElements();
-unsigned numElementsSrc = cast(SrcTy)->getNumElements();
-if ((numElementsDst == 3 && numElementsSrc == 4)
-|| (numElementsDst == 4 && numElementsSrc == 3)) {
-
-
-  // In the case of going from int4->float3, a bitcast is needed before
-  // doing a shuffle.
-  llvm::Type *srcElemTy =
-  cast(SrcTy)->getElementType();
-  llvm::Type *dstElemTy =
-  cast(DstTy)->getElementType();
-
-  if ((srcElemTy->isIntegerTy() && dstElemTy->isFloatTy())
-  || (srcElemTy->isFloatTy() && dstElemTy->isIntegerTy())) {
-// Create a float type of the same size as the source or destination.
-llvm::VectorType *newSrcTy = llvm::VectorType::get(dstElemTy,
- numElementsSrc);
-
-Src = Builder.CreateBitCast(Src, newSrcTy, "astypeCast");
-  }
-
-  llvm::Value *UnV = llvm::UndefValue::get(Src->getType());
-
-  SmallVector Args;
-  Args.push_back(Builder.getInt32(0));
-  Args.push_back(Builder.getInt32(1));
-  Args.push_back(Builder.getInt32(2));
-
-  if (numElementsDst == 4)
-Args.push_back(llvm::UndefValue::get(CGF.Int32Ty));
-
-  llvm::Constant *Mask = llvm::ConstantVector::get(Args);
+  unsigned NumElementsSrc = isa(SrcTy) ?
+cast(SrcTy)->getNumElements() : 0;
+  unsigned NumElementsDst = isa(DstTy) ?
+cast(DstTy)->getNumElements() : 0;
+
+  // Going from vec3 to non-vec3 is a special case and requires a shuffle
+  // vector to get a vec4, then a bitcast if the target type is different.
+  if (NumElementsSrc == 3 && NumElementsDst != 3) {
+Src = ConvertVec3AndVec4(Builder, CGF, Src, 4);
+Src = Builder.CreateBitCast(Src, DstTy);
+Src->setName("astype");
+return Src;
+  }
 
-  return Builder.CreateShuffleVector(Src, UnV, Mask, "astype");
-}
+  // Going from non-vec3 to vec3 is a special case and requires a bitcast
+  // to vec4 if the original type is not vec4, then a shuffle vector to
+  // get a vec3.
+  if (NumElementsSrc != 3 && NumElementsDst == 3) {
+auto Vec4Ty = llvm::VectorType::get(DstTy->getVectorElementType(), 4);
+Src = Builder.CreateBitCast(Src, Vec4Ty);
+Src = ConvertVec3AndVec4(Builder, CGF, Src, 3);
+Src->setName("astype");
+return Src;
   }
 
   return Builder.CreateBitCast(Src, DstTy, "astype");
Index: cfe/trunk/test/SemaOpenCL/as_type.cl
===
--- cfe/trunk/test/SemaOpenCL/as_type.cl
+++ cfe/trunk/test/SemaOpenCL/as_type.cl
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -emit-llvm -triple spir-unknown-unknown -o - -verify -fsyntax-only
+
+typedef __attribute__(( ext_vector_type(3) )) char char3;
+typedef __attribute__(( ext_vector_type(16) )) char char16;
+
+char3 f1(char16 x) {
+  return  __builtin_astype(x, char3); // expected-error{{invalid reinterpretation: sizes of 'char3' (vector of 3 'char' values) and 'char16' (vector of 16 'char' values) must match}}
+}
+
+char16 f3(int x) {
+  return __builtin_astype(x, char16); // expected-error{{invalid reinterpretation: sizes of 'char16' (vector of 16 'char' values) and 'int' must match}}
+}
+
Index: cfe/trunk/test/CodeGenOpenCL/as_type.cl

r272149 - [Sparc] Complex return value ABI compliance.

2016-06-08 Thread Chris Dewhurst via cfe-commits
Author: lerochris
Date: Wed Jun  8 09:47:25 2016
New Revision: 272149

URL: http://llvm.org/viewvc/llvm-project?rev=272149=rev
Log:
[Sparc] Complex return value ABI compliance.

According to the Sparc V8 ABI, complex numbers should be passed and returned as 
pairs of registers:

https://docs.oracle.com/cd/E26502_01/html/E28387/gentextid-2734.html

This fix ensures this is the case. Without this, complex numbers are returned 
as a struct of two floats, which breaks the ABI rules.

Differential Review: http://reviews.llvm.org/D20955

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

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=272149=272148=272149=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Jun  8 09:47:25 2016
@@ -6843,6 +6843,49 @@ void AMDGPUTargetCodeGenInfo::setTargetA
 
 
 
//===--===//
+// SPARC v8 ABI Implementation.
+// Based on the SPARC Compliance Definition version 2.4.1.
+//
+// Ensures that complex values are passed in registers.
+//
+namespace {
+class SparcV8ABIInfo : public DefaultABIInfo {
+public:
+  SparcV8ABIInfo(CodeGenTypes ) : DefaultABIInfo(CGT) {}
+
+private:
+  ABIArgInfo classifyReturnType(QualType RetTy) const;
+  void computeInfo(CGFunctionInfo ) const override;
+};
+} // end anonymous namespace
+
+
+ABIArgInfo
+SparcV8ABIInfo::classifyReturnType(QualType Ty) const {
+  if (Ty->isAnyComplexType()) {
+return ABIArgInfo::getDirect();
+  }
+  else {
+return DefaultABIInfo::classifyReturnType(Ty);
+  }
+}
+
+void SparcV8ABIInfo::computeInfo(CGFunctionInfo ) const {
+
+  FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
+  for (auto  : FI.arguments())
+Arg.info = classifyArgumentType(Arg.type);
+}
+
+namespace {
+class SparcV8TargetCodeGenInfo : public TargetCodeGenInfo {
+public:
+  SparcV8TargetCodeGenInfo(CodeGenTypes )
+: TargetCodeGenInfo(new SparcV8ABIInfo(CGT)) {}
+};
+} // end anonymous namespace
+
+//===--===//
 // SPARC v9 ABI Implementation.
 // Based on the SPARC Compliance Definition version 2.4.1.
 //
@@ -7965,6 +8008,8 @@ const TargetCodeGenInfo ::
 return SetCGInfo(new AMDGPUTargetCodeGenInfo(Types));
   case llvm::Triple::amdgcn:
 return SetCGInfo(new AMDGPUTargetCodeGenInfo(Types));
+  case llvm::Triple::sparc:
+return SetCGInfo(new SparcV8TargetCodeGenInfo(Types));
   case llvm::Triple::sparcv9:
 return SetCGInfo(new SparcV9TargetCodeGenInfo(Types));
   case llvm::Triple::xcore:


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


Re: [PATCH] D21132: [include-fixer] Keep dot dot in SymbolInfo file paths.

2016-06-08 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 60041.
hokein added a comment.

Rebase.


http://reviews.llvm.org/D21132

Files:
  include-fixer/find-all-symbols/PathConfig.cpp
  include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
  test/include-fixer/include_path.cpp
  unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Index: unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
===
--- unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
+++ unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
@@ -105,7 +105,7 @@
   "#include \"internal/internal.h\"";
 #if !defined(_MSC_VER) && !defined(__MINGW32__)
 // Test path cleaning for both decls and macros.
-const std::string DirtyHeader = "./internal/../internal/./a/b.h";
+const std::string DirtyHeader = "./internal/./a/b.h";
 Content += "\n#include \"" + DirtyHeader + "\"";
 const std::string CleanHeader = "internal/a/b.h";
 const std::string DirtyHeaderContent =
Index: test/include-fixer/include_path.cpp
===
--- test/include-fixer/include_path.cpp
+++ test/include-fixer/include_path.cpp
@@ -1,14 +1,20 @@
 // REQUIRES: shell
 // RUN: mkdir -p %T/include-fixer/include
+// RUN: mkdir -p %T/include-fixer/symbols
 // RUN: mkdir -p %T/include-fixer/build
 // RUN: mkdir -p %T/include-fixer/src
 // RUN: sed 's|test_dir|%T/include-fixer|g' %S/Inputs/database_template.json > 
%T/include-fixer/build/compile_commands.json
-// RUN: cp %S/Inputs/fake_yaml_db.yaml %T/include-fixer/build/fake_yaml_db.yaml
-// RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
-// RUN: touch %T/include-fixer/include/bar.h
+// RUN: echo -e '#include "bar.h"\nb::a::bar f;' > %T/include-fixer/src/bar.cpp
+// RUN: echo 'namespace b { namespace a { class bar {}; } }' > 
%T/include-fixer/include/bar.h
 // RUN: cd %T/include-fixer/build
-// RUN: clang-include-fixer -db=yaml -input=fake_yaml_db.yaml 
-minimize-paths=true -p=. %T/include-fixer/src/bar.cpp
+// RUN: find-all-symbols -output-dir=%T/include-fixer/symbols -p=. 
%T/include-fixer/src/bar.cpp
+// RUN: find-all-symbols -merge-dir=%T/include-fixer/symbols 
%T/include-fixer/build/find_all_symbols.yaml
+// RUN: FileCheck -input-file=%T/include-fixer/build/find_all_symbols.yaml 
-check-prefix=CHECK-YAML %s
+//
+// RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
+// RUN: clang-include-fixer -db=yaml 
-input=%T/include-fixer/build/find_all_symbols.yaml -minimize-paths=true -p=. 
%T/include-fixer/src/bar.cpp
 // RUN: FileCheck -input-file=%T/include-fixer/src/bar.cpp %s
 
+// CHECK-YAML: ../include/bar.h
 // CHECK: #include "bar.h"
 // CHECK: b::a::bar f;
Index: include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
===
--- include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
+++ include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
@@ -158,6 +158,5 @@
   auto Factory =
   llvm::make_unique(
   , clang::find_all_symbols::getSTLPostfixHeaderMap());
-  Tool.run(Factory.get());
-  return 0;
+  return Tool.run(Factory.get());
 }
Index: include-fixer/find-all-symbols/PathConfig.cpp
===
--- include-fixer/find-all-symbols/PathConfig.cpp
+++ include-fixer/find-all-symbols/PathConfig.cpp
@@ -33,7 +33,7 @@
   if (Collector)
 FilePath = Collector->getMappedHeader(FilePath);
   SmallString<256> CleanedFilePath = FilePath;
-  llvm::sys::path::remove_dots(CleanedFilePath, /*remove_dot_dot=*/true);
+  llvm::sys::path::remove_dots(CleanedFilePath, /*remove_dot_dot=*/false);
 
   return CleanedFilePath.str();
 }


Index: unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
===
--- unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
+++ unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
@@ -105,7 +105,7 @@
   "#include \"internal/internal.h\"";
 #if !defined(_MSC_VER) && !defined(__MINGW32__)
 // Test path cleaning for both decls and macros.
-const std::string DirtyHeader = "./internal/../internal/./a/b.h";
+const std::string DirtyHeader = "./internal/./a/b.h";
 Content += "\n#include \"" + DirtyHeader + "\"";
 const std::string CleanHeader = "internal/a/b.h";
 const std::string DirtyHeaderContent =
Index: test/include-fixer/include_path.cpp
===
--- test/include-fixer/include_path.cpp
+++ test/include-fixer/include_path.cpp
@@ -1,14 +1,20 @@
 // REQUIRES: shell
 // RUN: mkdir -p %T/include-fixer/include
+// RUN: mkdir -p %T/include-fixer/symbols
 // RUN: mkdir -p %T/include-fixer/build
 // RUN: mkdir -p %T/include-fixer/src
 // RUN: sed 's|test_dir|%T/include-fixer|g' 

r272148 - [Sparc] Complex return value ABI compliance.

2016-06-08 Thread Chris Dewhurst via cfe-commits
Author: lerochris
Date: Wed Jun  8 09:46:05 2016
New Revision: 272148

URL: http://llvm.org/viewvc/llvm-project?rev=272148=rev
Log:
[Sparc] Complex return value ABI compliance.

According to the Sparc V8 ABI, complex numbers should be passed and returned as 
pairs of registers:

https://docs.oracle.com/cd/E26502_01/html/E28387/gentextid-2734.html

This fix ensures this is the case. Without this, complex numbers are returned 
as a struct of two floats, which breaks the ABI rules.

Differential Review: http://reviews.llvm.org/D20955

Added:
cfe/trunk/test/CodeGen/sparcv8-abi.c   (with props)

Added: cfe/trunk/test/CodeGen/sparcv8-abi.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sparcv8-abi.c?rev=272148=auto
==
--- cfe/trunk/test/CodeGen/sparcv8-abi.c (added)
+++ cfe/trunk/test/CodeGen/sparcv8-abi.c Wed Jun  8 09:46:05 2016
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple sparc-unknown-unknown -emit-llvm %s -o - | 
FileCheck %s
+
+// CHECK-LABEL: define { float, float } @p({ float, float }* byval align 4 %a, 
{ float, float }* byval align 4 %b) #0 {
+float __complex__
+p (float __complex__  a, float __complex__  b)
+{
+}
+
+// CHECK-LABEL: define { double, double } @q({ double, double }* byval align 8 
%a, { double, double }* byval align 8 %b) #0 {
+double __complex__
+q (double __complex__  a, double __complex__  b)
+{
+}
+
+// CHECK-LABEL: define { i64, i64 } @r({ i64, i64 }* byval align 8 %a, { i64, 
i64 }* byval align 8 %b) #0 {
+long long __complex__
+r (long long __complex__  a, long long __complex__  b)
+{
+}

Propchange: cfe/trunk/test/CodeGen/sparcv8-abi.c
--
svn:eol-style = native


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


Re: [PATCH] D21132: [include-fixer] Keep dot dot in SymbolInfo file paths.

2016-06-08 Thread Haojian Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272152: [include-fixer] Keep dot dot in SymbolInfo file 
paths. (authored by hokein).

Changed prior to commit:
  http://reviews.llvm.org/D21132?vs=60041=60042#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21132

Files:
  clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp
  
clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
  clang-tools-extra/trunk/test/include-fixer/include_path.cpp
  
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Index: clang-tools-extra/trunk/test/include-fixer/include_path.cpp
===
--- clang-tools-extra/trunk/test/include-fixer/include_path.cpp
+++ clang-tools-extra/trunk/test/include-fixer/include_path.cpp
@@ -1,14 +1,20 @@
 // REQUIRES: shell
 // RUN: mkdir -p %T/include-fixer/include
+// RUN: mkdir -p %T/include-fixer/symbols
 // RUN: mkdir -p %T/include-fixer/build
 // RUN: mkdir -p %T/include-fixer/src
 // RUN: sed 's|test_dir|%T/include-fixer|g' %S/Inputs/database_template.json > 
%T/include-fixer/build/compile_commands.json
-// RUN: cp %S/Inputs/fake_yaml_db.yaml %T/include-fixer/build/fake_yaml_db.yaml
-// RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
-// RUN: touch %T/include-fixer/include/bar.h
+// RUN: echo -e '#include "bar.h"\nb::a::bar f;' > %T/include-fixer/src/bar.cpp
+// RUN: echo 'namespace b { namespace a { class bar {}; } }' > 
%T/include-fixer/include/bar.h
 // RUN: cd %T/include-fixer/build
-// RUN: clang-include-fixer -db=yaml -input=fake_yaml_db.yaml 
-minimize-paths=true -p=. %T/include-fixer/src/bar.cpp
+// RUN: find-all-symbols -output-dir=%T/include-fixer/symbols -p=. 
%T/include-fixer/src/bar.cpp
+// RUN: find-all-symbols -merge-dir=%T/include-fixer/symbols 
%T/include-fixer/build/find_all_symbols.yaml
+// RUN: FileCheck -input-file=%T/include-fixer/build/find_all_symbols.yaml 
-check-prefix=CHECK-YAML %s
+//
+// RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
+// RUN: clang-include-fixer -db=yaml 
-input=%T/include-fixer/build/find_all_symbols.yaml -minimize-paths=true -p=. 
%T/include-fixer/src/bar.cpp
 // RUN: FileCheck -input-file=%T/include-fixer/src/bar.cpp %s
 
+// CHECK-YAML: ../include/bar.h
 // CHECK: #include "bar.h"
 // CHECK: b::a::bar f;
Index: 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
===
--- 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
+++ 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
@@ -105,7 +105,7 @@
   "#include \"internal/internal.h\"";
 #if !defined(_MSC_VER) && !defined(__MINGW32__)
 // Test path cleaning for both decls and macros.
-const std::string DirtyHeader = "./internal/../internal/./a/b.h";
+const std::string DirtyHeader = "./internal/./a/b.h";
 Content += "\n#include \"" + DirtyHeader + "\"";
 const std::string CleanHeader = "internal/a/b.h";
 const std::string DirtyHeaderContent =
Index: 
clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
===
--- 
clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
+++ 
clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
@@ -158,6 +158,5 @@
   auto Factory =
   llvm::make_unique(
   , clang::find_all_symbols::getSTLPostfixHeaderMap());
-  Tool.run(Factory.get());
-  return 0;
+  return Tool.run(Factory.get());
 }
Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp
===
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp
@@ -33,7 +33,7 @@
   if (Collector)
 FilePath = Collector->getMappedHeader(FilePath);
   SmallString<256> CleanedFilePath = FilePath;
-  llvm::sys::path::remove_dots(CleanedFilePath, /*remove_dot_dot=*/true);
+  llvm::sys::path::remove_dots(CleanedFilePath, /*remove_dot_dot=*/false);
 
   return CleanedFilePath.str();
 }


Index: clang-tools-extra/trunk/test/include-fixer/include_path.cpp
===
--- clang-tools-extra/trunk/test/include-fixer/include_path.cpp
+++ clang-tools-extra/trunk/test/include-fixer/include_path.cpp
@@ -1,14 +1,20 @@
 // REQUIRES: shell
 // RUN: mkdir -p %T/include-fixer/include
+// RUN: mkdir -p %T/include-fixer/symbols
 // RUN: mkdir -p %T/include-fixer/build
 // RUN: mkdir -p %T/include-fixer/src
 // RUN: sed 's|test_dir|%T/include-fixer|g' %S/Inputs/database_template.json > %T/include-fixer/build/compile_commands.json
-// 

r272153 - [OpenCL] Fix __builtin_astype for vec3 types.

2016-06-08 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Wed Jun  8 10:11:21 2016
New Revision: 272153

URL: http://llvm.org/viewvc/llvm-project?rev=272153=rev
Log:
[OpenCL] Fix __builtin_astype for vec3 types.

__builtin_astype does not generate correct LLVM IR for vec3 types. This patch 
inserts bitcasts to/from vec4 when necessary in addition to generating vector 
shuffle. Sema and codegen tests are added.

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

Added:
cfe/trunk/test/CodeGenOpenCL/as_type.cl
cfe/trunk/test/SemaOpenCL/as_type.cl
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=272153=272152=272153=diff
==
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Jun  8 10:11:21 2016
@@ -3382,50 +3382,48 @@ Value *ScalarExprEmitter::VisitBlockExpr
   return CGF.EmitBlockLiteral(block);
 }
 
+// Convert a vec3 to vec4, or vice versa.
+static Value *ConvertVec3AndVec4(CGBuilderTy , CodeGenFunction ,
+ Value *Src, unsigned NumElementsDst) {
+  llvm::Value *UnV = llvm::UndefValue::get(Src->getType());
+  SmallVector Args;
+  Args.push_back(Builder.getInt32(0));
+  Args.push_back(Builder.getInt32(1));
+  Args.push_back(Builder.getInt32(2));
+  if (NumElementsDst == 4)
+Args.push_back(llvm::UndefValue::get(CGF.Int32Ty));
+  llvm::Constant *Mask = llvm::ConstantVector::get(Args);
+  return Builder.CreateShuffleVector(Src, UnV, Mask);
+}
+
 Value *ScalarExprEmitter::VisitAsTypeExpr(AsTypeExpr *E) {
   Value *Src  = CGF.EmitScalarExpr(E->getSrcExpr());
   llvm::Type *DstTy = ConvertType(E->getType());
 
-  // Going from vec4->vec3 or vec3->vec4 is a special case and requires
-  // a shuffle vector instead of a bitcast.
   llvm::Type *SrcTy = Src->getType();
-  if (isa(DstTy) && isa(SrcTy)) {
-unsigned numElementsDst = cast(DstTy)->getNumElements();
-unsigned numElementsSrc = cast(SrcTy)->getNumElements();
-if ((numElementsDst == 3 && numElementsSrc == 4)
-|| (numElementsDst == 4 && numElementsSrc == 3)) {
-
-
-  // In the case of going from int4->float3, a bitcast is needed before
-  // doing a shuffle.
-  llvm::Type *srcElemTy =
-  cast(SrcTy)->getElementType();
-  llvm::Type *dstElemTy =
-  cast(DstTy)->getElementType();
-
-  if ((srcElemTy->isIntegerTy() && dstElemTy->isFloatTy())
-  || (srcElemTy->isFloatTy() && dstElemTy->isIntegerTy())) {
-// Create a float type of the same size as the source or destination.
-llvm::VectorType *newSrcTy = llvm::VectorType::get(dstElemTy,
- 
numElementsSrc);
-
-Src = Builder.CreateBitCast(Src, newSrcTy, "astypeCast");
-  }
-
-  llvm::Value *UnV = llvm::UndefValue::get(Src->getType());
-
-  SmallVector Args;
-  Args.push_back(Builder.getInt32(0));
-  Args.push_back(Builder.getInt32(1));
-  Args.push_back(Builder.getInt32(2));
-
-  if (numElementsDst == 4)
-Args.push_back(llvm::UndefValue::get(CGF.Int32Ty));
-
-  llvm::Constant *Mask = llvm::ConstantVector::get(Args);
+  unsigned NumElementsSrc = isa(SrcTy) ?
+cast(SrcTy)->getNumElements() : 0;
+  unsigned NumElementsDst = isa(DstTy) ?
+cast(DstTy)->getNumElements() : 0;
+
+  // Going from vec3 to non-vec3 is a special case and requires a shuffle
+  // vector to get a vec4, then a bitcast if the target type is different.
+  if (NumElementsSrc == 3 && NumElementsDst != 3) {
+Src = ConvertVec3AndVec4(Builder, CGF, Src, 4);
+Src = Builder.CreateBitCast(Src, DstTy);
+Src->setName("astype");
+return Src;
+  }
 
-  return Builder.CreateShuffleVector(Src, UnV, Mask, "astype");
-}
+  // Going from non-vec3 to vec3 is a special case and requires a bitcast
+  // to vec4 if the original type is not vec4, then a shuffle vector to
+  // get a vec3.
+  if (NumElementsSrc != 3 && NumElementsDst == 3) {
+auto Vec4Ty = llvm::VectorType::get(DstTy->getVectorElementType(), 4);
+Src = Builder.CreateBitCast(Src, Vec4Ty);
+Src = ConvertVec3AndVec4(Builder, CGF, Src, 3);
+Src->setName("astype");
+return Src;
   }
 
   return Builder.CreateBitCast(Src, DstTy, "astype");

Added: cfe/trunk/test/CodeGenOpenCL/as_type.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/as_type.cl?rev=272153=auto
==
--- cfe/trunk/test/CodeGenOpenCL/as_type.cl (added)
+++ cfe/trunk/test/CodeGenOpenCL/as_type.cl Wed Jun  8 10:11:21 2016
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 %s -emit-llvm -triple spir-unknown-unknown -o - | FileCheck 
%s
+
+typedef __attribute__(( ext_vector_type(3) )) char char3;
+typedef __attribute__(( 

[clang-tools-extra] r272152 - [include-fixer] Keep dot dot in SymbolInfo file paths.

2016-06-08 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Wed Jun  8 10:10:18 2016
New Revision: 272152

URL: http://llvm.org/viewvc/llvm-project?rev=272152=rev
Log:
[include-fixer] Keep dot dot in SymbolInfo file paths.

Summary:
Currently, removing dot dot in header's path doesn't make include-fixer
minimize path correctly in some cases, for example, specify a relative search
path based on the build directory("-I../include/").

Besides, removing dot dot can break symbolic link directories. So don't
removing it for now.

Reviewers: ioeric, bkramer

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp

clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
clang-tools-extra/trunk/test/include-fixer/include_path.cpp

clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp?rev=272152=272151=272152=diff
==
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp 
(original)
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/PathConfig.cpp Wed 
Jun  8 10:10:18 2016
@@ -33,7 +33,7 @@ std::string getIncludePath(const SourceM
   if (Collector)
 FilePath = Collector->getMappedHeader(FilePath);
   SmallString<256> CleanedFilePath = FilePath;
-  llvm::sys::path::remove_dots(CleanedFilePath, /*remove_dot_dot=*/true);
+  llvm::sys::path::remove_dots(CleanedFilePath, /*remove_dot_dot=*/false);
 
   return CleanedFilePath.str();
 }

Modified: 
clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp?rev=272152=272151=272152=diff
==
--- 
clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
 (original)
+++ 
clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
 Wed Jun  8 10:10:18 2016
@@ -158,6 +158,5 @@ int main(int argc, const char **argv) {
   auto Factory =
   llvm::make_unique(
   , clang::find_all_symbols::getSTLPostfixHeaderMap());
-  Tool.run(Factory.get());
-  return 0;
+  return Tool.run(Factory.get());
 }

Modified: clang-tools-extra/trunk/test/include-fixer/include_path.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/include-fixer/include_path.cpp?rev=272152=272151=272152=diff
==
--- clang-tools-extra/trunk/test/include-fixer/include_path.cpp (original)
+++ clang-tools-extra/trunk/test/include-fixer/include_path.cpp Wed Jun  8 
10:10:18 2016
@@ -1,14 +1,20 @@
 // REQUIRES: shell
 // RUN: mkdir -p %T/include-fixer/include
+// RUN: mkdir -p %T/include-fixer/symbols
 // RUN: mkdir -p %T/include-fixer/build
 // RUN: mkdir -p %T/include-fixer/src
 // RUN: sed 's|test_dir|%T/include-fixer|g' %S/Inputs/database_template.json > 
%T/include-fixer/build/compile_commands.json
-// RUN: cp %S/Inputs/fake_yaml_db.yaml %T/include-fixer/build/fake_yaml_db.yaml
-// RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
-// RUN: touch %T/include-fixer/include/bar.h
+// RUN: echo -e '#include "bar.h"\nb::a::bar f;' > %T/include-fixer/src/bar.cpp
+// RUN: echo 'namespace b { namespace a { class bar {}; } }' > 
%T/include-fixer/include/bar.h
 // RUN: cd %T/include-fixer/build
-// RUN: clang-include-fixer -db=yaml -input=fake_yaml_db.yaml 
-minimize-paths=true -p=. %T/include-fixer/src/bar.cpp
+// RUN: find-all-symbols -output-dir=%T/include-fixer/symbols -p=. 
%T/include-fixer/src/bar.cpp
+// RUN: find-all-symbols -merge-dir=%T/include-fixer/symbols 
%T/include-fixer/build/find_all_symbols.yaml
+// RUN: FileCheck -input-file=%T/include-fixer/build/find_all_symbols.yaml 
-check-prefix=CHECK-YAML %s
+//
+// RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
+// RUN: clang-include-fixer -db=yaml 
-input=%T/include-fixer/build/find_all_symbols.yaml -minimize-paths=true -p=. 
%T/include-fixer/src/bar.cpp
 // RUN: FileCheck -input-file=%T/include-fixer/src/bar.cpp %s
 
+// CHECK-YAML: ../include/bar.h
 // CHECK: #include "bar.h"
 // CHECK: b::a::bar f;

Modified: 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp?rev=272152=272151=272152=diff
==
--- 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
 (original)
+++ 

[clang-tools-extra] r272151 - [include-fixer] explicitly set minimize-paths in test.

2016-06-08 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Wed Jun  8 09:57:43 2016
New Revision: 272151

URL: http://llvm.org/viewvc/llvm-project?rev=272151=rev
Log:
[include-fixer] explicitly set minimize-paths in test.

Modified:
clang-tools-extra/trunk/test/include-fixer/include_path.cpp

Modified: clang-tools-extra/trunk/test/include-fixer/include_path.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/include-fixer/include_path.cpp?rev=272151=272150=272151=diff
==
--- clang-tools-extra/trunk/test/include-fixer/include_path.cpp (original)
+++ clang-tools-extra/trunk/test/include-fixer/include_path.cpp Wed Jun  8 
09:57:43 2016
@@ -7,7 +7,7 @@
 // RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
 // RUN: touch %T/include-fixer/include/bar.h
 // RUN: cd %T/include-fixer/build
-// RUN: clang-include-fixer -db=yaml -input=fake_yaml_db.yaml -p=. 
%T/include-fixer/src/bar.cpp
+// RUN: clang-include-fixer -db=yaml -input=fake_yaml_db.yaml 
-minimize-paths=true -p=. %T/include-fixer/src/bar.cpp
 // RUN: FileCheck -input-file=%T/include-fixer/src/bar.cpp %s
 
 // CHECK: #include "bar.h"


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


[libcxx] r272150 - Patch ready for #2436

2016-06-08 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Jun  8 09:54:35 2016
New Revision: 272150

URL: http://llvm.org/viewvc/llvm-project?rev=272150=rev
Log:
Patch ready for #2436

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=272150=272149=272150=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Wed Jun  8 09:54:35 2016
@@ -65,7 +65,7 @@
http://wg21.link/LWG2328;>2328Rvalue 
stream extraction should use perfect forwardingOulu
http://wg21.link/LWG2393;>2393std::function's Callable 
definition is brokenOulu
http://wg21.link/LWG2426;>2426Issue about 
compare_exchangeOulu
-   http://wg21.link/LWG2436;>2436Comparators 
for associative containers should always be 
CopyConstructibleOulu
+   http://wg21.link/LWG2436;>2436Comparators 
for associative containers should always be 
CopyConstructibleOuluPatch Ready
http://wg21.link/LWG2441;>2441Exact-width 
atomic typedefs should be providedOulu
http://wg21.link/LWG2451;>2451[fund.ts.v2] optional 
should 'forward' T's implicit conversionsOulu
http://wg21.link/LWG2509;>2509[fund.ts.v2] any_cast doesn't 
work with rvalue reference targets and cannot move with a value 
targetOulu


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


Re: [PATCH] D21132: [include-fixer] Keep dot dot in SymbolInfo file paths.

2016-06-08 Thread Benjamin Kramer via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

Ok, let's try this. Maybe it will solve our path problems once and for all. 
ONCE AND FOR ALL.


http://reviews.llvm.org/D21132



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


Re: [PATCH] D21050: [clang-tidy] correct clang-tidy-diff.py help message

2016-06-08 Thread Alexander Kornienko via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272144: [clang-tidy] correct clang-tidy-diff.py help message 
(authored by alexfh).

Changed prior to commit:
  http://reviews.llvm.org/D21050?vs=59813=60035#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21050

Files:
  clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py

Index: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
===
--- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
+++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
@@ -33,20 +33,20 @@
 
 def main():
   parser = argparse.ArgumentParser(description=
-   'Reformat changed lines in diff. Without -i 
'
-   'option just output the diff that would be '
-   'introduced.')
+   'Run clang-tidy against changed files, and '
+   'output diagnostics only for modified '
+   'lines.')
   parser.add_argument('-clang-tidy-binary', metavar='PATH',
   default='clang-tidy',
   help='path to clang-tidy binary')
   parser.add_argument('-p', metavar='NUM', default=0,
   help='strip the smallest prefix containing P slashes')
   parser.add_argument('-regex', metavar='PATTERN', default=None,
-  help='custom pattern selecting file paths to reformat '
+  help='custom pattern selecting file paths to check '
   '(case sensitive, overrides -iregex)')
   parser.add_argument('-iregex', metavar='PATTERN', default=
   r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hpp|m|mm|inc)',
-  help='custom pattern selecting file paths to reformat '
+  help='custom pattern selecting file paths to check '
   '(case insensitive, overridden by -regex)')
 
   parser.add_argument('-fix', action='store_true', default=False,


Index: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
===
--- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
+++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
@@ -33,20 +33,20 @@
 
 def main():
   parser = argparse.ArgumentParser(description=
-   'Reformat changed lines in diff. Without -i '
-   'option just output the diff that would be '
-   'introduced.')
+   'Run clang-tidy against changed files, and '
+   'output diagnostics only for modified '
+   'lines.')
   parser.add_argument('-clang-tidy-binary', metavar='PATH',
   default='clang-tidy',
   help='path to clang-tidy binary')
   parser.add_argument('-p', metavar='NUM', default=0,
   help='strip the smallest prefix containing P slashes')
   parser.add_argument('-regex', metavar='PATTERN', default=None,
-  help='custom pattern selecting file paths to reformat '
+  help='custom pattern selecting file paths to check '
   '(case sensitive, overrides -iregex)')
   parser.add_argument('-iregex', metavar='PATTERN', default=
   r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hpp|m|mm|inc)',
-  help='custom pattern selecting file paths to reformat '
+  help='custom pattern selecting file paths to check '
   '(case insensitive, overridden by -regex)')
 
   parser.add_argument('-fix', action='store_true', default=False,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r272144 - [clang-tidy] correct clang-tidy-diff.py help message

2016-06-08 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Jun  8 09:27:43 2016
New Revision: 272144

URL: http://llvm.org/viewvc/llvm-project?rev=272144=rev
Log:
[clang-tidy] correct clang-tidy-diff.py help message

Summary:
Looks like the original code was copied from clang-format-diff.py.
Update help message to make it clang-tidy specific.

Reviewers: klimek, alexfh

Subscribers: Eugene.Zelenko, cfe-commits

Patch by Igor Sugak!

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

Modified:
clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py

Modified: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py?rev=272144=272143=272144=diff
==
--- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py Wed Jun  8 
09:27:43 2016
@@ -33,20 +33,20 @@ import sys
 
 def main():
   parser = argparse.ArgumentParser(description=
-   'Reformat changed lines in diff. Without -i 
'
-   'option just output the diff that would be '
-   'introduced.')
+   'Run clang-tidy against changed files, and '
+   'output diagnostics only for modified '
+   'lines.')
   parser.add_argument('-clang-tidy-binary', metavar='PATH',
   default='clang-tidy',
   help='path to clang-tidy binary')
   parser.add_argument('-p', metavar='NUM', default=0,
   help='strip the smallest prefix containing P slashes')
   parser.add_argument('-regex', metavar='PATTERN', default=None,
-  help='custom pattern selecting file paths to reformat '
+  help='custom pattern selecting file paths to check '
   '(case sensitive, overrides -iregex)')
   parser.add_argument('-iregex', metavar='PATTERN', default=
   r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hpp|m|mm|inc)',
-  help='custom pattern selecting file paths to reformat '
+  help='custom pattern selecting file paths to check '
   '(case insensitive, overridden by -regex)')
 
   parser.add_argument('-fix', action='store_true', default=False,


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


r272143 - clang-format: [JS] fix a FIXME.

2016-06-08 Thread Martin Probst via cfe-commits
Author: mprobst
Date: Wed Jun  8 09:05:26 2016
New Revision: 272143

URL: http://llvm.org/viewvc/llvm-project?rev=272143=rev
Log:
clang-format: [JS] fix a FIXME.

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

Modified: cfe/trunk/lib/Format/SortJavaScriptImports.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/SortJavaScriptImports.cpp?rev=272143=272142=272143=diff
==
--- cfe/trunk/lib/Format/SortJavaScriptImports.cpp (original)
+++ cfe/trunk/lib/Format/SortJavaScriptImports.cpp Wed Jun  8 09:05:26 2016
@@ -179,7 +179,7 @@ public:
 // after applying source sorting.
 // This loop just backfills trailing spaces after the imports, which are
 // harmless and will be stripped by the subsequent formatting pass.
-// TODO: A better long term fix is to re-calculate Ranges after sorting.
+// FIXME: A better long term fix is to re-calculate Ranges after sorting.
 unsigned PreviousSize = getSourceText(InsertionPoint).size();
 while (ReferencesText.size() < PreviousSize) {
   ReferencesText += " ";


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


r272142 - clang-format: [JS] fix an assertion failure caused by shrinking sources.

2016-06-08 Thread Martin Probst via cfe-commits
Author: mprobst
Date: Wed Jun  8 09:04:04 2016
New Revision: 272142

URL: http://llvm.org/viewvc/llvm-project?rev=272142=rev
Log:
clang-format: [JS] fix an assertion failure caused by shrinking sources.

Summary:
The JavaScript import sorter has a corner condition that can cause the overall
source text length to shrink. This change circumvents the issue by appending
trailing space in the line after the import blocks to match at least the
previous source code length.

This needs a better long term fix, but this fixes the immediate issue.

Reviewers: alexeagle, djasper

Subscribers: klimek

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

Modified:
cfe/trunk/lib/Format/SortJavaScriptImports.cpp
cfe/trunk/unittests/Format/SortImportsTestJS.cpp

Modified: cfe/trunk/lib/Format/SortJavaScriptImports.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/SortJavaScriptImports.cpp?rev=272142=272141=272142=diff
==
--- cfe/trunk/lib/Format/SortJavaScriptImports.cpp (original)
+++ cfe/trunk/lib/Format/SortJavaScriptImports.cpp Wed Jun  8 09:04:04 2016
@@ -170,12 +170,25 @@ public:
 if (ReferencesInOrder && SymbolsInOrder)
   return Result;
 
+SourceRange InsertionPoint = References[0].Range;
+InsertionPoint.setEnd(References[References.size() - 1].Range.getEnd());
+
+// The loop above might collapse previously existing line breaks between
+// import blocks, and thus shrink the file. SortIncludes must not shrink
+// overall source length as there is currently no re-calculation of ranges
+// after applying source sorting.
+// This loop just backfills trailing spaces after the imports, which are
+// harmless and will be stripped by the subsequent formatting pass.
+// TODO: A better long term fix is to re-calculate Ranges after sorting.
+unsigned PreviousSize = getSourceText(InsertionPoint).size();
+while (ReferencesText.size() < PreviousSize) {
+  ReferencesText += " ";
+}
+
 // Separate references from the main code body of the file.
 if (FirstNonImportLine && FirstNonImportLine->First->NewlinesBefore < 2)
   ReferencesText += "\n";
 
-SourceRange InsertionPoint = References[0].Range;
-InsertionPoint.setEnd(References[References.size() - 1].Range.getEnd());
 DEBUG(llvm::dbgs() << "Replacing imports:\n"
<< getSourceText(InsertionPoint) << "\nwith:\n"
<< ReferencesText << "\n");

Modified: cfe/trunk/unittests/Format/SortImportsTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/SortImportsTestJS.cpp?rev=272142=272141=272142=diff
==
--- cfe/trunk/unittests/Format/SortImportsTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/SortImportsTestJS.cpp Wed Jun  8 09:04:04 2016
@@ -223,6 +223,19 @@ TEST_F(SortImportsTestJS, AffectedRange)
  24, 30);
 }
 
+TEST_F(SortImportsTestJS, SortingCanShrink) {
+  // Sort excluding a suffix.
+  verifySort("import {B} from 'a';\n"
+ "import {A} from 'b';\n"
+ "\n"
+ "1;",
+ "import {A} from 'b';\n"
+ "\n"
+ "import {B} from 'a';\n"
+ "\n"
+ "1;");
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang


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


r272141 - [AVX512] Emit select instruction instead of using x86 specific instrinsics.

2016-06-08 Thread Igor Breger via cfe-commits
Author: ibreger
Date: Wed Jun  8 08:59:20 2016
New Revision: 272141

URL: http://llvm.org/viewvc/llvm-project?rev=272141=rev
Log:
[AVX512] Emit select instruction instead of using x86 specific instrinsics.

This will allow us to remove the x86 instrinics from the backend.

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

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/avx512bwintrin.h
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/lib/Headers/avx512vlbwintrin.h
cfe/trunk/lib/Headers/avx512vlintrin.h
cfe/trunk/test/CodeGen/avx512bw-builtins.c
cfe/trunk/test/CodeGen/avx512f-builtins.c
cfe/trunk/test/CodeGen/avx512vl-builtins.c
cfe/trunk/test/CodeGen/avx512vlbw-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=272141=272140=272141=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Wed Jun  8 08:59:20 2016
@@ -1002,10 +1002,6 @@ TARGET_BUILTIN(__builtin_ia32_pminud512_
 TARGET_BUILTIN(__builtin_ia32_pminuq512_mask, "V8LLiV8LLiV8LLiV8LLiUc", "", 
"avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmuldq512_mask, "V8LLiV16iV16iV8LLiUc", "", 
"avx512f")
 TARGET_BUILTIN(__builtin_ia32_pmuludq512_mask, "V8LLiV16iV16iV8LLiUc", "", 
"avx512f")
-TARGET_BUILTIN(__builtin_ia32_blendmd_512_mask, "V16iV16iV16iUs", "", 
"avx512f")
-TARGET_BUILTIN(__builtin_ia32_blendmq_512_mask, "V8LLiV8LLiV8LLiUc", "", 
"avx512f")
-TARGET_BUILTIN(__builtin_ia32_blendmps_512_mask, "V16fV16fV16fUs", "", 
"avx512f")
-TARGET_BUILTIN(__builtin_ia32_blendmpd_512_mask, "V8dV8dV8dUc", "", "avx512f")
 TARGET_BUILTIN(__builtin_ia32_ptestmd512, "UsV16iV16iUs", "", "avx512f")
 TARGET_BUILTIN(__builtin_ia32_ptestmq512, "UcV8LLiV8LLiUc", "", "avx512f")
 TARGET_BUILTIN(__builtin_ia32_pbroadcastd512, "V16iV4iV16iUs","","avx512f")
@@ -1190,8 +1186,6 @@ TARGET_BUILTIN(__builtin_ia32_orpd128_ma
 TARGET_BUILTIN(__builtin_ia32_orps256_mask, "V8fV8fV8fV8fUc", "", 
"avx512vl,avx512dq")
 TARGET_BUILTIN(__builtin_ia32_orps128_mask, "V4fV4fV4fV4fUc", "", 
"avx512vl,avx512dq")
 
-TARGET_BUILTIN(__builtin_ia32_blendmb_512_mask, "V64cV64cV64cULLi", "", 
"avx512bw")
-TARGET_BUILTIN(__builtin_ia32_blendmw_512_mask, "V32sV32sV32sUi", "", 
"avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pabsb512_mask, "V64cV64cV64cULLi", "", 
"avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pabsw512_mask, "V32sV32sV32sUi", "", "avx512bw")
 TARGET_BUILTIN(__builtin_ia32_packssdw512_mask, "V32sV16iV16iV32sUi", "", 
"avx512bw")
@@ -1231,10 +1225,6 @@ TARGET_BUILTIN(__builtin_ia32_vpconflict
 TARGET_BUILTIN(__builtin_ia32_vplzcntd_512_mask, "V16iV16iV16iUs", "", 
"avx512cd")
 TARGET_BUILTIN(__builtin_ia32_vplzcntq_512_mask, "V8LLiV8LLiV8LLiUc", "", 
"avx512cd")
 
-TARGET_BUILTIN(__builtin_ia32_blendmb_128_mask, "V16cV16cV16cUs", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_blendmb_256_mask, "V32cV32cV32cUi", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_blendmw_128_mask, "V8sV8sV8sUc", "", 
"avx512vl,avx512bw")
-TARGET_BUILTIN(__builtin_ia32_blendmw_256_mask, "V16sV16sV16sUs", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pabsb128_mask, "V16cV16cV16cUs", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pabsb256_mask, "V32cV32cV32cUi", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pabsw128_mask, "V8sV8sV8sUc", "", 
"avx512vl,avx512bw")
@@ -1326,14 +1316,6 @@ TARGET_BUILTIN(__builtin_ia32_addpd128_m
 TARGET_BUILTIN(__builtin_ia32_addpd256_mask, "V4dV4dV4dV4dUc", "", "avx512vl")
 TARGET_BUILTIN(__builtin_ia32_addps128_mask, "V4fV4fV4fV4fUc", "", "avx512vl")
 TARGET_BUILTIN(__builtin_ia32_addps256_mask, "V8fV8fV8fV8fUc", "", "avx512vl")
-TARGET_BUILTIN(__builtin_ia32_blendmd_128_mask, "V4iV4iV4iUc", "", "avx512vl")
-TARGET_BUILTIN(__builtin_ia32_blendmd_256_mask, "V8iV8iV8iUc", "", "avx512vl")
-TARGET_BUILTIN(__builtin_ia32_blendmpd_128_mask, "V2dV2dV2dUc", "", "avx512vl")
-TARGET_BUILTIN(__builtin_ia32_blendmpd_256_mask, "V4dV4dV4dUc", "", "avx512vl")
-TARGET_BUILTIN(__builtin_ia32_blendmps_128_mask, "V4fV4fV4fUc", "", "avx512vl")
-TARGET_BUILTIN(__builtin_ia32_blendmps_256_mask, "V8fV8fV8fUc", "", "avx512vl")
-TARGET_BUILTIN(__builtin_ia32_blendmq_128_mask, "V2LLiV2LLiV2LLiUc", "", 
"avx512vl")
-TARGET_BUILTIN(__builtin_ia32_blendmq_256_mask, "V4LLiV4LLiV4LLiUc", "", 
"avx512vl")
 TARGET_BUILTIN(__builtin_ia32_compressdf128_mask, "V2dV2dV2dUc", "", 
"avx512vl")
 TARGET_BUILTIN(__builtin_ia32_compressdf256_mask, "V4dV4dV4dUc", "", 
"avx512vl")
 TARGET_BUILTIN(__builtin_ia32_compressdi128_mask, "V2LLiV2LLiV2LLiUc", "", 
"avx512vl")
@@ -1700,30 +1682,18 @@ TARGET_BUILTIN(__builtin_ia32_psrlw128_m
 TARGET_BUILTIN(__builtin_ia32_psrlw256_mask, 
"V16sV16sV8sV16sUs","","avx512bw,avx512vl")
 

[PATCH] D21132: [include-fixer] Keep dot dot in SymbolInfo file paths.

2016-06-08 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added reviewers: bkramer, ioeric.
hokein added a subscriber: cfe-commits.

Currently, removing dot dot in header's path doesn't make include-fixer
minimize path correctly in some cases, for example, specify a relative search
path based on the build directory("-I../include/").

Besides, removing dot dot can break symbolic link directories. So don't
removing it for now.

http://reviews.llvm.org/D21132

Files:
  include-fixer/find-all-symbols/PathConfig.cpp
  include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
  test/include-fixer/include_path.cpp
  unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Index: unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
===
--- unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
+++ unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
@@ -105,7 +105,7 @@
   "#include \"internal/internal.h\"";
 #if !defined(_MSC_VER) && !defined(__MINGW32__)
 // Test path cleaning for both decls and macros.
-const std::string DirtyHeader = "./internal/../internal/./a/b.h";
+const std::string DirtyHeader = "./internal/./a/b.h";
 Content += "\n#include \"" + DirtyHeader + "\"";
 const std::string CleanHeader = "internal/a/b.h";
 const std::string DirtyHeaderContent =
Index: test/include-fixer/include_path.cpp
===
--- test/include-fixer/include_path.cpp
+++ test/include-fixer/include_path.cpp
@@ -1,14 +1,20 @@
 // REQUIRES: shell
 // RUN: mkdir -p %T/include-fixer/include
+// RUN: mkdir -p %T/include-fixer/symbols
 // RUN: mkdir -p %T/include-fixer/build
 // RUN: mkdir -p %T/include-fixer/src
 // RUN: sed 's|test_dir|%T/include-fixer|g' %S/Inputs/database_template.json > 
%T/include-fixer/build/compile_commands.json
-// RUN: cp %S/Inputs/fake_yaml_db.yaml %T/include-fixer/build/fake_yaml_db.yaml
-// RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
-// RUN: touch %T/include-fixer/include/bar.h
+// RUN: echo -e '#include "bar.h"\nb::a::bar f;' > %T/include-fixer/src/bar.cpp
+// RUN: echo 'namespace b { namespace a { class bar {}; } }' > 
%T/include-fixer/include/bar.h
 // RUN: cd %T/include-fixer/build
-// RUN: clang-include-fixer -db=yaml -input=fake_yaml_db.yaml -p=. 
%T/include-fixer/src/bar.cpp
+// RUN: find-all-symbols -output-dir=%T/include-fixer/symbols -p=. 
%T/include-fixer/src/bar.cpp
+// RUN: find-all-symbols -merge-dir=%T/include-fixer/symbols 
%T/include-fixer/build/find_all_symbols.yaml
+// RUN: FileCheck -input-file=%T/include-fixer/build/find_all_symbols.yaml 
-check-prefix=CHECK-YAML %s
+//
+// RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
+// RUN: clang-include-fixer -db=yaml 
-input=%T/include-fixer/build/find_all_symbols.yaml -p=. 
%T/include-fixer/src/bar.cpp
 // RUN: FileCheck -input-file=%T/include-fixer/src/bar.cpp %s
 
+// CHECK-YAML: ../include/bar.h
 // CHECK: #include "bar.h"
 // CHECK: b::a::bar f;
Index: include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
===
--- include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
+++ include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp
@@ -158,6 +158,5 @@
   auto Factory =
   llvm::make_unique(
   , clang::find_all_symbols::getSTLPostfixHeaderMap());
-  Tool.run(Factory.get());
-  return 0;
+  return Tool.run(Factory.get());
 }
Index: include-fixer/find-all-symbols/PathConfig.cpp
===
--- include-fixer/find-all-symbols/PathConfig.cpp
+++ include-fixer/find-all-symbols/PathConfig.cpp
@@ -33,7 +33,7 @@
   if (Collector)
 FilePath = Collector->getMappedHeader(FilePath);
   SmallString<256> CleanedFilePath = FilePath;
-  llvm::sys::path::remove_dots(CleanedFilePath, /*remove_dot_dot=*/true);
+  llvm::sys::path::remove_dots(CleanedFilePath, /*remove_dot_dot=*/false);
 
   return CleanedFilePath.str();
 }


Index: unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
===
--- unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
+++ unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
@@ -105,7 +105,7 @@
   "#include \"internal/internal.h\"";
 #if !defined(_MSC_VER) && !defined(__MINGW32__)
 // Test path cleaning for both decls and macros.
-const std::string DirtyHeader = "./internal/../internal/./a/b.h";
+const std::string DirtyHeader = "./internal/./a/b.h";
 Content += "\n#include \"" + DirtyHeader + "\"";
 const std::string CleanHeader = "internal/a/b.h";
 const std::string DirtyHeaderContent =
Index: test/include-fixer/include_path.cpp
===
--- test/include-fixer/include_path.cpp
+++ 

[PATCH] D21134: clang-tidy: new check readability-misplaced-array-index

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

this is a new check for clang-tidy that diagnoses when it see unusual array 
index syntax.

there is nothing wrong about such syntax so it's not a misc check. It's just a 
readability check.


Repository:
  rL LLVM

http://reviews.llvm.org/D21134

Files:
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/MisplacedArrayIndexCheck.cpp
  clang-tidy/readability/MisplacedArrayIndexCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-misplaced-array-index.rst
  test/clang-tidy/readability-misplaced-array-index.cpp

Index: test/clang-tidy/readability-misplaced-array-index.cpp
===
--- test/clang-tidy/readability-misplaced-array-index.cpp
+++ test/clang-tidy/readability-misplaced-array-index.cpp
@@ -0,0 +1,19 @@
+// RUN: %check_clang_tidy %s readability-misplaced-array-index %t
+
+#define ABC  "abc"
+
+int unusualSyntax(int *x)
+{
+  10[x] = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: unusual array index syntax, usually the index is inside the []
+  // CHECK-FIXES: x[10] = 0;
+
+  return 1[ABC];
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: unusual array index syntax, usually the index is inside the []
+  // No fixit, we don't want to replace with "abc"[1]
+}
+
+int normalSyntax(int *x)
+{
+  return x[10];
+}
Index: docs/clang-tidy/checks/readability-misplaced-array-index.rst
===
--- docs/clang-tidy/checks/readability-misplaced-array-index.rst
+++ docs/clang-tidy/checks/readability-misplaced-array-index.rst
@@ -0,0 +1,29 @@
+.. title:: clang-tidy - readability-misplaced-array-index
+
+readability-misplaced-array-index
+=
+
+This check warns for unusual array index syntax.
+
+The following code has unusual array index syntax:
+
+.. code:: c++
+
+  void f(int *x, int y)
+  {
+y[x] = 0;
+  }
+
+becomes
+
+.. code:: c++
+
+  void f(int *x, int y)
+  {
+x[y] = 0;
+  }
+
+The check warns about such unusual syntax for readability reasons:
+ * There are programmers that are not familiar with this unusual syntax.
+ * It is possible that variables are mixed up.
+
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -120,6 +120,7 @@
readability-identifier-naming
readability-implicit-bool-cast
readability-inconsistent-declaration-parameter-name
+   readability-misplaced-array-index
readability-named-parameter
readability-redundant-control-flow
readability-redundant-smartptr-get
Index: clang-tidy/readability/ReadabilityTidyModule.cpp
===
--- clang-tidy/readability/ReadabilityTidyModule.cpp
+++ clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -19,6 +19,7 @@
 #include "IdentifierNamingCheck.h"
 #include "ImplicitBoolCastCheck.h"
 #include "InconsistentDeclarationParameterNameCheck.h"
+#include "MisplacedArrayIndexCheck.h"
 #include "NamedParameterCheck.h"
 #include "RedundantControlFlowCheck.h"
 #include "RedundantSmartptrGetCheck.h"
@@ -53,6 +54,8 @@
 "readability-implicit-bool-cast");
 CheckFactories.registerCheck(
 "readability-inconsistent-declaration-parameter-name");
+CheckFactories.registerCheck(
+"readability-misplaced-array-index");
 CheckFactories.registerCheck(
 "readability-static-definition-in-anonymous-namespace");
 CheckFactories.registerCheck(
Index: clang-tidy/readability/MisplacedArrayIndexCheck.h
===
--- clang-tidy/readability/MisplacedArrayIndexCheck.h
+++ clang-tidy/readability/MisplacedArrayIndexCheck.h
@@ -0,0 +1,36 @@
+//===--- MisplacedArrayIndexCheck.h - clang-tidy-*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_MISPLACED_ARRAY_INDEX_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_MISPLACED_ARRAY_INDEX_H
+
+#include "../ClangTidy.h"
+
+namespace clang {
+namespace tidy {
+namespace readability {
+
+/// Warn about unusual array index syntax (index[array] instead of
+/// array[index]).
+///
+/// For the user-facing documentation see:
+/// http://clang.llvm.org/extra/clang-tidy/checks/readability-misplaced-array-index.html
+class MisplacedArrayIndexCheck : public ClangTidyCheck {
+public:
+  

Re: [PATCH] D20428: Tracking exception specification source locations

2016-06-08 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

One thing this patch does not do but needs to is fix 
`ASTContext::adjustExceptionSpec()` (Thanks to Don Hinton for pointing this out 
off-list!), however, I am at a bit of a loss for how best to rebuild the type 
location.

Would it be correct to call `CreateTypeSourceInfo(Updated)` to get a new 
TypeSourceInfo object of the proper size, then `initializeFullCopy()` the new 
type location object from the old one, and call `setExceptionSpecRange()` to 
update the source range information on the new type loc object? (The range 
would have to be passed to `adjustExceptionSpec()`.) Or is there a better way 
to perform this rebuilding?


http://reviews.llvm.org/D20428



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


Re: [PATCH] D15926: Do not print certain warnings when input is a header.

2016-06-08 Thread Erik Verbruggen via cfe-commits
erikjv updated this revision to Diff 60023.

http://reviews.llvm.org/D15926

Files:
  include/clang/Basic/LangOptions.h
  lib/Frontend/CompilerInvocation.cpp
  lib/Lex/PPDirectives.cpp
  lib/Lex/PPMacroExpansion.cpp
  lib/Lex/Pragma.cpp
  test/Preprocessor/header_is_main_file.c

Index: test/Preprocessor/header_is_main_file.c
===
--- /dev/null
+++ test/Preprocessor/header_is_main_file.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -x c-header -ffreestanding -Eonly -verify %s
+// expected-no-diagnostics
+
+#pragma once
+#include_next "stdint.h"
+#if !__has_include_next("stdint.h")
+#error "__has_include_next failed"
+#endif
Index: lib/Lex/Pragma.cpp
===
--- lib/Lex/Pragma.cpp
+++ lib/Lex/Pragma.cpp
@@ -354,7 +354,9 @@
 /// HandlePragmaOnce - Handle \#pragma once.  OnceTok is the 'once'.
 ///
 void Preprocessor::HandlePragmaOnce(Token ) {
-  if (isInPrimaryFile()) {
+  // If the main file is a header, then it's either for PCH/AST generation,
+  // or libclang opened it. Allow #pragma once either way.
+  if (isInPrimaryFile() && !getLangOpts().IsHeaderFile) {
 Diag(OnceTok, diag::pp_pragma_once_in_main_file);
 return;
   }
Index: lib/Lex/PPMacroExpansion.cpp
===
--- lib/Lex/PPMacroExpansion.cpp
+++ lib/Lex/PPMacroExpansion.cpp
@@ -1400,7 +1400,10 @@
   // Preprocessor::HandleIncludeNextDirective.
   const DirectoryLookup *Lookup = PP.GetCurDirLookup();
   const FileEntry *LookupFromFile = nullptr;
-  if (PP.isInPrimaryFile()) {
+  if (PP.isInPrimaryFile() && PP.getLangOpts().IsHeaderFile) {
+// If the main file is a header, then it's either for PCH/AST generation,
+// or libclang opened it. Either way, handle it as a normal include below.
+  } else if (PP.isInPrimaryFile()) {
 Lookup = nullptr;
 PP.Diag(Tok, diag::pp_include_next_in_primary);
   } else if (PP.getCurrentSubmodule()) {
Index: lib/Lex/PPDirectives.cpp
===
--- lib/Lex/PPDirectives.cpp
+++ lib/Lex/PPDirectives.cpp
@@ -1895,7 +1895,10 @@
   // diagnostic.
   const DirectoryLookup *Lookup = CurDirLookup;
   const FileEntry *LookupFromFile = nullptr;
-  if (isInPrimaryFile()) {
+  if (isInPrimaryFile() && LangOpts.IsHeaderFile) {
+// If the main file is a header, then it's either for PCH/AST generation,
+// or libclang opened it. Either way, handle it as a normal include below.
+  } else if (isInPrimaryFile()) {
 Lookup = nullptr;
 Diag(IncludeNextTok, diag::pp_include_next_in_primary);
   } else if (CurSubmodule) {
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1056,7 +1056,8 @@
 }
 
 static InputKind ParseFrontendArgs(FrontendOptions , ArgList ,
-   DiagnosticsEngine ) {
+   DiagnosticsEngine ,
+   bool ) {
   using namespace options;
   Opts.ProgramAction = frontend::ParseSyntaxOnly;
   if (const Arg *A = Args.getLastArg(OPT_Action_Group)) {
@@ -1296,6 +1297,14 @@
 if (DashX == IK_None)
   Diags.Report(diag::err_drv_invalid_value)
 << A->getAsString(Args) << A->getValue();
+
+IsHeaderFile = llvm::StringSwitch(A->getValue())
+.Case("c-header", true)
+.Case("cl-header", true)
+.Case("objective-c-header", true)
+.Case("c++-header", true)
+.Case("objective-c++-header", true)
+.Default(false);
   }
 
   // '-' is the default input if none is given.
@@ -2291,7 +2300,8 @@
   ParseCommentArgs(LangOpts.CommentOpts, Args);
   ParseFileSystemArgs(Res.getFileSystemOpts(), Args);
   // FIXME: We shouldn't have to pass the DashX option around here
-  InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), Args, Diags);
+  InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), Args, Diags,
+  LangOpts.IsHeaderFile);
   ParseTargetArgs(Res.getTargetOpts(), Args, Diags);
   Success &= ParseCodeGenArgs(Res.getCodeGenOpts(), Args, DashX, Diags,
   Res.getTargetOpts());
Index: include/clang/Basic/LangOptions.h
===
--- include/clang/Basic/LangOptions.h
+++ include/clang/Basic/LangOptions.h
@@ -126,6 +126,10 @@
   /// host code generation.
   std::string OMPHostIRFile;
 
+  /// \brief Indicates whether the front-end is explicitly told that the
+  /// input is a header file (i.e. -x c-header).
+  bool IsHeaderFile = false;
+
   LangOptions();
 
   // Define accessors/mutators for language options of enumeration type.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-08 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 added a comment.

Ping?

Thanks a lot.


http://reviews.llvm.org/D20561



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


r272136 - Correcting a typo in a comment; NFC.

2016-06-08 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Jun  8 07:33:18 2016
New Revision: 272136

URL: http://llvm.org/viewvc/llvm-project?rev=272136=rev
Log:
Correcting a typo in a comment; NFC.

Modified:
cfe/trunk/lib/Sema/TypeLocBuilder.h

Modified: cfe/trunk/lib/Sema/TypeLocBuilder.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TypeLocBuilder.h?rev=272136=272135=272136=diff
==
--- cfe/trunk/lib/Sema/TypeLocBuilder.h (original)
+++ cfe/trunk/lib/Sema/TypeLocBuilder.h Wed Jun  8 07:33:18 2016
@@ -7,7 +7,7 @@
 //
 
//===--===//
 //
-//  This files defines TypeLocBuilder, a class for building TypeLocs
+//  This file defines TypeLocBuilder, a class for building TypeLocs
 //  bottom-up.
 //
 
//===--===//


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


[clang-tools-extra] r272132 - [include-fixer] do not add enum forward declaration into symbol index table.

2016-06-08 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Wed Jun  8 07:13:14 2016
New Revision: 272132

URL: http://llvm.org/viewvc/llvm-project?rev=272132=rev
Log:
[include-fixer] do not add enum forward declaration into symbol index table.

Modified:
clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp

clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp

Modified: 
clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp?rev=272132=272131=272132=diff
==
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp 
(original)
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/FindAllSymbols.cpp 
Wed Jun  8 07:13:14 2016
@@ -183,10 +183,10 @@ void FindAllSymbols::registerMatchers(Ma
   this);
 
   // Matchers for enum declarations.
-  MatchFinder->addMatcher(
-  enumDecl(CommonFilter, anyOf(HasNSOrTUCtxMatcher, ExternCMatcher))
-  .bind("decl"),
-  this);
+  MatchFinder->addMatcher(enumDecl(CommonFilter, isDefinition(),
+   anyOf(HasNSOrTUCtxMatcher, ExternCMatcher))
+  .bind("decl"),
+  this);
 
   // Matchers for enum constant declarations.
   // We only match the enum constants in non-scoped enum declarations which are

Modified: 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp?rev=272132=272131=272132=diff
==
--- 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
 (original)
+++ 
clang-tools-extra/trunk/unittests/include-fixer/find-all-symbols/FindAllSymbolsTests.cpp
 Wed Jun  8 07:13:14 2016
@@ -334,6 +334,7 @@ TEST_F(FindAllSymbolsTest, EnumTest) {
   public:
 enum A_ENUM { X1, X2 };
   };
+  enum DECL : int;
   )";
   runFindAllSymbols(Code);
 
@@ -376,6 +377,10 @@ TEST_F(FindAllSymbolsTest, EnumTest) {
   {{SymbolInfo::ContextType::EnumDecl, "A_ENUM"},
{SymbolInfo::ContextType::Record, "A"}});
   EXPECT_FALSE(hasSymbol(Symbol));
+
+  Symbol =
+  SymbolInfo("DECL", SymbolInfo::SymbolKind::EnumDecl, HeaderName, 9, {});
+  EXPECT_FALSE(hasSymbol(Symbol));
 }
 
 TEST_F(FindAllSymbolsTest, IWYUPrivatePragmaTest) {


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


  1   2   >