r253161 - Make the mingw toolchain accept 'ld' and 'lld' only as values to -fuse-ld.

2015-11-15 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Sun Nov 15 02:06:27 2015
New Revision: 253161

URL: http://llvm.org/viewvc/llvm-project?rev=253161&view=rev
Log:
Make the mingw toolchain accept 'ld' and 'lld' only as values to -fuse-ld.
Post-commit suggestion by Filipe Cabecinhas.


Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/mingw-useld.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253161&r1=253160&r2=253161&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sun Nov 15 02:06:27 2015
@@ -9468,6 +9468,8 @@ void MinGW::Linker::ConstructJob(Compila
   if (LinkerName.equals_lower("lld")) {
 CmdArgs.push_back("-flavor");
 CmdArgs.push_back("gnu");
+  } else if (!LinkerName.equals_lower("ld")) {
+D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
   }
 
   if (!D.SysRoot.empty())

Modified: cfe/trunk/test/Driver/mingw-useld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=253161&r1=253160&r2=253161&view=diff
==
--- cfe/trunk/test/Driver/mingw-useld.c (original)
+++ cfe/trunk/test/Driver/mingw-useld.c Sun Nov 15 02:06:27 2015
@@ -7,10 +7,6 @@
 // CHECK_LLD_32: lld" "-flavor" "gnu"
 // CHECK_LLD_32: "i386pe"
 
-// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=link.exe 2>&1 | 
FileCheck -check-prefix=CHECK_LINK_32 %s
-// CHECK_LINK_32: link.exe"
-// CHECK_LINK_32: "i386pe"
-
 // RUN: %clang -### -target x86_64-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_64 %s
 // CHECK_LLD_64: lld" "-flavor" "gnu"
 // CHECK_LLD_64: "i386pep"


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


Re: r242121 - Add support for -fuse-ld= in the mingw toolchain driver.

2015-11-15 Thread Yaron Keren via cfe-commits
r253161

2015-11-14 22:45 GMT+02:00 Martell Malone :

> The reason why I didn't use -fuse-ld=lld2 was because on Windows we don't
> have symlinks.
> I figured passing flavor gets over this hurdle and the installation takes
> up less space.
> If you want to change it I have no objections we will just have to look at
> having lld's cmake to ensure it is created on Windows like we do for clang++
>
> The idea of forcing either lld or ld LGTM yaron.
> I don't think using MSVC link.exe makes any sense to mingw users.
>
> On Saturday, November 14, 2015, Yaron Keren  wrote:
>
>> Filipe: with mingw targetting Windows/COFF files I think only ld and lld
>> makes sense as gold creates ELF files. I included Microsoft link.exe in the
>> mingw-useld test but rethinking, no one really uses that configuration, see
>> attached patch. Is that what you mean?
>>
>> Rafael: running under Windows which has symbolic links but they aren't
>> really used as much (or at all) as under Linux. For example clang-cl.exe
>> and clang++.exe are copies (not links) of clang.exe.
>>
>> Martell, what do you think?
>>
>>
>>
>> 2015-11-14 19:52 GMT+02:00 Rafael Espíndola :
>>
>>> On 15 November 2015 at 02:39, Filipe Cabecinhas 
>>> wrote:
>>> > Handling of values other than lld looked weird.
>>> > Can you make it a hard error to use something other than, I guess, ld,
>>> gold,
>>> > lld?
>>> > Or are there other linkers available?
>>>
>>> What I find strange is that we use -flavor at all. We should ideally
>>> just be using different links to lld, like we do with "-fuse-ld=lld2".
>>>
>>>
>>> Cheers,
>>> Rafael
>>>
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2015-11-15 Thread Stefan Kempf via cfe-commits
sisnkemp updated this revision to Diff 40230.

http://reviews.llvm.org/D14215

Files:
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/x86_64-profiling-keep-fp.c

Index: test/CodeGen/x86_64-profiling-keep-fp.c
===
--- /dev/null
+++ test/CodeGen/x86_64-profiling-keep-fp.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -pg -S -o - %s | \
+// RUN:   FileCheck %s
+
+// Test that the frame pointer is kept when compiling with
+// profiling.
+
+//CHECK: pushq %rbp
+int main(void)
+{
+  return 0;
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -453,7 +453,8 @@
   Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
   Opts.CodeModel = getCodeModel(Args, Diags);
   Opts.DebugPass = Args.getLastArgValue(OPT_mdebug_pass);
-  Opts.DisableFPElim = Args.hasArg(OPT_mdisable_fp_elim);
+  Opts.DisableFPElim =
+  (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg));
   Opts.DisableFree = Args.hasArg(OPT_disable_free);
   Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
   Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2755,6 +2755,8 @@
   if (Arg *A = Args.getLastArg(options::OPT_fno_omit_frame_pointer,
options::OPT_fomit_frame_pointer))
 return A->getOption().matches(options::OPT_fno_omit_frame_pointer);
+  if (Args.hasArg(options::OPT_pg))
+return true;
 
   return shouldUseFramePointerForTarget(Args, Triple);
 }
@@ -2764,6 +2766,8 @@
   if (Arg *A = Args.getLastArg(options::OPT_mno_omit_leaf_frame_pointer,
options::OPT_momit_leaf_frame_pointer))
 return A->getOption().matches(options::OPT_mno_omit_leaf_frame_pointer);
+  if (Args.hasArg(options::OPT_pg))
+return true;
 
   if (Triple.isPS4CPU())
 return false;


Index: test/CodeGen/x86_64-profiling-keep-fp.c
===
--- /dev/null
+++ test/CodeGen/x86_64-profiling-keep-fp.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -pg -S -o - %s | \
+// RUN:   FileCheck %s
+
+// Test that the frame pointer is kept when compiling with
+// profiling.
+
+//CHECK: pushq %rbp
+int main(void)
+{
+  return 0;
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -453,7 +453,8 @@
   Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
   Opts.CodeModel = getCodeModel(Args, Diags);
   Opts.DebugPass = Args.getLastArgValue(OPT_mdebug_pass);
-  Opts.DisableFPElim = Args.hasArg(OPT_mdisable_fp_elim);
+  Opts.DisableFPElim =
+  (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg));
   Opts.DisableFree = Args.hasArg(OPT_disable_free);
   Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
   Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2755,6 +2755,8 @@
   if (Arg *A = Args.getLastArg(options::OPT_fno_omit_frame_pointer,
options::OPT_fomit_frame_pointer))
 return A->getOption().matches(options::OPT_fno_omit_frame_pointer);
+  if (Args.hasArg(options::OPT_pg))
+return true;
 
   return shouldUseFramePointerForTarget(Args, Triple);
 }
@@ -2764,6 +2766,8 @@
   if (Arg *A = Args.getLastArg(options::OPT_mno_omit_leaf_frame_pointer,
options::OPT_momit_leaf_frame_pointer))
 return A->getOption().matches(options::OPT_mno_omit_leaf_frame_pointer);
+  if (Args.hasArg(options::OPT_pg))
+return true;
 
   if (Triple.isPS4CPU())
 return false;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253164 - Remove some trailing whitespace

2015-11-15 Thread Sergey Kalinichev via cfe-commits
Author: skalinichev
Date: Sun Nov 15 06:37:01 2015
New Revision: 253164

URL: http://llvm.org/viewvc/llvm-project?rev=253164&view=rev
Log:
Remove some trailing whitespace


Modified:
cfe/trunk/tools/libclang/CXType.cpp

Modified: cfe/trunk/tools/libclang/CXType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXType.cpp?rev=253164&r1=253163&r2=253164&view=diff
==
--- cfe/trunk/tools/libclang/CXType.cpp (original)
+++ cfe/trunk/tools/libclang/CXType.cpp Sun Nov 15 06:37:01 2015
@@ -144,7 +144,7 @@ extern "C" {
 
 CXType clang_getCursorType(CXCursor C) {
   using namespace cxcursor;
-  
+
   CXTranslationUnit TU = cxcursor::getCursorTU(C);
   if (!TU)
 return MakeCXType(QualType(), TU);
@@ -174,7 +174,7 @@ CXType clang_getCursorType(CXCursor C) {
   return MakeCXType(FTD->getTemplatedDecl()->getType(), TU);
 return MakeCXType(QualType(), TU);
   }
-  
+
   if (clang_isReference(C.kind)) {
 switch (C.kind) {
 case CXCursor_ObjCSuperClassRef: {
@@ -182,18 +182,18 @@ CXType clang_getCursorType(CXCursor C) {
 = Context.getObjCInterfaceType(getCursorObjCSuperClassRef(C).first);
   return MakeCXType(T, TU);
 }
-
+
 case CXCursor_ObjCClassRef: {
   QualType T = 
Context.getObjCInterfaceType(getCursorObjCClassRef(C).first);
   return MakeCXType(T, TU);
 }
-
+
 case CXCursor_TypeRef: {
   QualType T = Context.getTypeDeclType(getCursorTypeRef(C).first);
   return MakeCXType(T, TU);
 
 }
-  
+
 case CXCursor_CXXBaseSpecifier:
   return cxtype::MakeCXType(getCursorCXXBaseSpecifier(C)->getType(), TU);
 
@@ -210,7 +210,7 @@ CXType clang_getCursorType(CXCursor C) {
 default:
   break;
 }
-
+
 return MakeCXType(QualType(), TU);
   }
 
@@ -348,10 +348,10 @@ unsigned clang_isRestrictQualifiedType(C
 CXType clang_getPointeeType(CXType CT) {
   QualType T = GetQualType(CT);
   const Type *TP = T.getTypePtrOrNull();
-  
+
   if (!TP)
 return MakeCXType(QualType(), GetTU(CT));
-  
+
   switch (TP->getTypeClass()) {
 case Type::Pointer:
   T = cast(TP)->getPointeeType();
@@ -410,7 +410,7 @@ try_again:
   D = cast(TP)->getTemplateName()
  .getAsTemplateDecl();
 break;
-  
+
   case Type::InjectedClassName:
 D = cast(TP)->getDecl();
 break;
@@ -420,7 +420,7 @@ try_again:
   case Type::Elaborated:
 TP = cast(TP)->getNamedType().getTypePtrOrNull();
 goto try_again;
-
+
   default:
 break;
   }


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


Re: [PATCH] D13000: [libclang] Expose AutoType

2015-11-15 Thread Sergey Kalinichev via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253165: [libclang] Expose AutoType (authored by skalinichev).

Changed prior to commit:
  http://reviews.llvm.org/D13000?vs=35193&id=40232#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13000

Files:
  cfe/trunk/bindings/python/clang/cindex.py
  cfe/trunk/include/clang-c/Index.h
  cfe/trunk/test/Index/print-type.cpp
  cfe/trunk/tools/libclang/CXType.cpp

Index: cfe/trunk/bindings/python/clang/cindex.py
===
--- cfe/trunk/bindings/python/clang/cindex.py
+++ cfe/trunk/bindings/python/clang/cindex.py
@@ -1699,6 +1699,7 @@
 TypeKind.VARIABLEARRAY = TypeKind(115)
 TypeKind.DEPENDENTSIZEDARRAY = TypeKind(116)
 TypeKind.MEMBERPOINTER = TypeKind(117)
+TypeKind.AUTO = TypeKind(118)
 
 class RefQualifierKind(BaseEnumeration):
 """Describes a specific ref-qualifier of a type."""
Index: cfe/trunk/include/clang-c/Index.h
===
--- cfe/trunk/include/clang-c/Index.h
+++ cfe/trunk/include/clang-c/Index.h
@@ -2860,7 +2860,8 @@
   CXType_IncompleteArray = 114,
   CXType_VariableArray = 115,
   CXType_DependentSizedArray = 116,
-  CXType_MemberPointer = 117
+  CXType_MemberPointer = 117,
+  CXType_Auto = 118
 };
 
 /**
Index: cfe/trunk/test/Index/print-type.cpp
===
--- cfe/trunk/test/Index/print-type.cpp
+++ cfe/trunk/test/Index/print-type.cpp
@@ -127,20 +127,20 @@
 // CHECK: StructDecl=Blob:45:8 (Definition) [type=Blob] [typekind=Record] 
[isPOD=1] [nbFields=2]
 // CHECK: FieldDecl=i:46:7 (Definition) [type=int] [typekind=Int] [isPOD=1]
 // CHECK: VarDecl=member_pointer:49:12 (Definition) [type=int Blob::*] 
[typekind=MemberPointer] [isPOD=1]
-// CHECK: VarDecl=autoI:53:6 (Definition) [type=int] [typekind=Unexposed] 
[canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]
+// CHECK: VarDecl=autoI:53:6 (Definition) [type=int] [typekind=Auto] 
[canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]
 // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1]
-// CHECK: VarDecl=autoTbar:54:6 (Definition) [type=int] [typekind=Unexposed] 
[canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]
+// CHECK: VarDecl=autoTbar:54:6 (Definition) [type=int] [typekind=Auto] 
[canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]
 // CHECK: CallExpr=tbar:35:3 [type=int] [typekind=Unexposed] 
[canonicaltype=int] [canonicaltypekind=Int] [args= [int] [Int]] [isPOD=1]
 // CHECK: UnexposedExpr=tbar:35:3 [type=int (*)(int)] [typekind=Pointer] 
[canonicaltype=int (*)(int)] [canonicaltypekind=Pointer] [isPOD=1] 
[pointeetype=int (int)] [pointeekind=FunctionProto]
 // CHECK: DeclRefExpr=tbar:35:3 RefName=[54:17 - 54:21] RefName=[54:21 - 
54:26] [type=int (int)] [typekind=FunctionProto] [canonicaltype=int (int)] 
[canonicaltypekind=FunctionProto] [isPOD=0]
 // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1]
-// CHECK: VarDecl=autoBlob:55:6 (Definition) [type=Blob *] 
[typekind=Unexposed] [canonicaltype=Blob *] [canonicaltypekind=Pointer] 
[isPOD=1]
+// CHECK: VarDecl=autoBlob:55:6 (Definition) [type=Blob *] [typekind=Auto] 
[canonicaltype=Blob *] [canonicaltypekind=Pointer] [isPOD=1]
 // CHECK: CXXNewExpr= [type=Blob *] [typekind=Pointer] [isPOD=1] 
[pointeetype=Blob] [pointeekind=Record]
 // CHECK: TypeRef=struct Blob:45:8 [type=Blob] [typekind=Record] [isPOD=1] 
[nbFields=2]
 // CHECK: CallExpr=Blob:45:8 [type=Blob] [typekind=Record] [isPOD=1] 
[nbFields=2]
-// CHECK: FunctionDecl=autoFunction:56:6 (Definition) [type=int ()] 
[typekind=FunctionProto] [canonicaltype=int ()] 
[canonicaltypekind=FunctionProto] [resulttype=int] [resulttypekind=Unexposed] 
[isPOD=0]
+// CHECK: FunctionDecl=autoFunction:56:6 (Definition) [type=int ()] 
[typekind=FunctionProto] [canonicaltype=int ()] 
[canonicaltypekind=FunctionProto] [resulttype=int] [resulttypekind=Auto] 
[isPOD=0]
 // CHECK: CompoundStmt= [type=] [typekind=Invalid] [isPOD=0]
 // CHECK: ReturnStmt= [type=] [typekind=Invalid] [isPOD=0]
 // CHECK: UnexposedExpr= [type=int] [typekind=Int] [isPOD=1]
-// CHECK: VarDecl=autoInt:57:16 (Definition) [type=int] [typekind=Unexposed] 
[canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]
+// CHECK: VarDecl=autoInt:57:16 (Definition) [type=int] [typekind=Auto] 
[canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]
 // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1]
Index: cfe/trunk/tools/libclang/CXType.cpp
===
--- cfe/trunk/tools/libclang/CXType.cpp
+++ cfe/trunk/tools/libclang/CXType.cpp
@@ -90,6 +90,7 @@
 TKCASE(DependentSizedArray);
 TKCASE(Vector);
 TKCASE(MemberPointer);
+TKCASE(Auto);
 default:
   return CXType_Unexposed;
   }
@@ -483,6 +484,7 @@
 TKIND(DependentSizedArray);
 TKIND(Vector);
 TKIND(MemberPointer);
+TKIND(Auto);
   }
 #undef TKIND
   ret

r253165 - [libclang] Expose AutoType

2015-11-15 Thread Sergey Kalinichev via cfe-commits
Author: skalinichev
Date: Sun Nov 15 07:10:10 2015
New Revision: 253165

URL: http://llvm.org/viewvc/llvm-project?rev=253165&view=rev
Log:
[libclang] Expose AutoType

Expose the AutoType via LibClang and python bindings

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

Modified:
cfe/trunk/bindings/python/clang/cindex.py
cfe/trunk/include/clang-c/Index.h
cfe/trunk/test/Index/print-type.cpp
cfe/trunk/tools/libclang/CXType.cpp

Modified: cfe/trunk/bindings/python/clang/cindex.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=253165&r1=253164&r2=253165&view=diff
==
--- cfe/trunk/bindings/python/clang/cindex.py (original)
+++ cfe/trunk/bindings/python/clang/cindex.py Sun Nov 15 07:10:10 2015
@@ -1699,6 +1699,7 @@ TypeKind.INCOMPLETEARRAY = TypeKind(114)
 TypeKind.VARIABLEARRAY = TypeKind(115)
 TypeKind.DEPENDENTSIZEDARRAY = TypeKind(116)
 TypeKind.MEMBERPOINTER = TypeKind(117)
+TypeKind.AUTO = TypeKind(118)
 
 class RefQualifierKind(BaseEnumeration):
 """Describes a specific ref-qualifier of a type."""

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=253165&r1=253164&r2=253165&view=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Sun Nov 15 07:10:10 2015
@@ -2860,7 +2860,8 @@ enum CXTypeKind {
   CXType_IncompleteArray = 114,
   CXType_VariableArray = 115,
   CXType_DependentSizedArray = 116,
-  CXType_MemberPointer = 117
+  CXType_MemberPointer = 117,
+  CXType_Auto = 118
 };
 
 /**

Modified: cfe/trunk/test/Index/print-type.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/print-type.cpp?rev=253165&r1=253164&r2=253165&view=diff
==
--- cfe/trunk/test/Index/print-type.cpp (original)
+++ cfe/trunk/test/Index/print-type.cpp Sun Nov 15 07:10:10 2015
@@ -127,20 +127,20 @@ decltype(auto) autoInt = 5;
 // CHECK: StructDecl=Blob:45:8 (Definition) [type=Blob] [typekind=Record] 
[isPOD=1] [nbFields=2]
 // CHECK: FieldDecl=i:46:7 (Definition) [type=int] [typekind=Int] [isPOD=1]
 // CHECK: VarDecl=member_pointer:49:12 (Definition) [type=int Blob::*] 
[typekind=MemberPointer] [isPOD=1]
-// CHECK: VarDecl=autoI:53:6 (Definition) [type=int] [typekind=Unexposed] 
[canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]
+// CHECK: VarDecl=autoI:53:6 (Definition) [type=int] [typekind=Auto] 
[canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]
 // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1]
-// CHECK: VarDecl=autoTbar:54:6 (Definition) [type=int] [typekind=Unexposed] 
[canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]
+// CHECK: VarDecl=autoTbar:54:6 (Definition) [type=int] [typekind=Auto] 
[canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]
 // CHECK: CallExpr=tbar:35:3 [type=int] [typekind=Unexposed] 
[canonicaltype=int] [canonicaltypekind=Int] [args= [int] [Int]] [isPOD=1]
 // CHECK: UnexposedExpr=tbar:35:3 [type=int (*)(int)] [typekind=Pointer] 
[canonicaltype=int (*)(int)] [canonicaltypekind=Pointer] [isPOD=1] 
[pointeetype=int (int)] [pointeekind=FunctionProto]
 // CHECK: DeclRefExpr=tbar:35:3 RefName=[54:17 - 54:21] RefName=[54:21 - 
54:26] [type=int (int)] [typekind=FunctionProto] [canonicaltype=int (int)] 
[canonicaltypekind=FunctionProto] [isPOD=0]
 // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1]
-// CHECK: VarDecl=autoBlob:55:6 (Definition) [type=Blob *] 
[typekind=Unexposed] [canonicaltype=Blob *] [canonicaltypekind=Pointer] 
[isPOD=1]
+// CHECK: VarDecl=autoBlob:55:6 (Definition) [type=Blob *] [typekind=Auto] 
[canonicaltype=Blob *] [canonicaltypekind=Pointer] [isPOD=1]
 // CHECK: CXXNewExpr= [type=Blob *] [typekind=Pointer] [isPOD=1] 
[pointeetype=Blob] [pointeekind=Record]
 // CHECK: TypeRef=struct Blob:45:8 [type=Blob] [typekind=Record] [isPOD=1] 
[nbFields=2]
 // CHECK: CallExpr=Blob:45:8 [type=Blob] [typekind=Record] [isPOD=1] 
[nbFields=2]
-// CHECK: FunctionDecl=autoFunction:56:6 (Definition) [type=int ()] 
[typekind=FunctionProto] [canonicaltype=int ()] 
[canonicaltypekind=FunctionProto] [resulttype=int] [resulttypekind=Unexposed] 
[isPOD=0]
+// CHECK: FunctionDecl=autoFunction:56:6 (Definition) [type=int ()] 
[typekind=FunctionProto] [canonicaltype=int ()] 
[canonicaltypekind=FunctionProto] [resulttype=int] [resulttypekind=Auto] 
[isPOD=0]
 // CHECK: CompoundStmt= [type=] [typekind=Invalid] [isPOD=0]
 // CHECK: ReturnStmt= [type=] [typekind=Invalid] [isPOD=0]
 // CHECK: UnexposedExpr= [type=int] [typekind=Int] [isPOD=1]
-// CHECK: VarDecl=autoInt:57:16 (Definition) [type=int] [typekind=Unexposed] 
[canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]
+// CHECK: VarDecl=autoInt:57:16 (Definition) [type=int] [typekind=Auto] 
[canonicaltype=int] [canoni

r253166 - [libclang] Visit TypeAliasTemplateDecl

2015-11-15 Thread Sergey Kalinichev via cfe-commits
Author: skalinichev
Date: Sun Nov 15 07:48:32 2015
New Revision: 253166

URL: http://llvm.org/viewvc/llvm-project?rev=253166&view=rev
Log:
[libclang] Visit TypeAliasTemplateDecl

This makes TypeAliasTemplateDecl accessible via LibClang and python bindings

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

Modified:
cfe/trunk/bindings/python/clang/cindex.py
cfe/trunk/bindings/python/tests/cindex/test_cursor_kind.py
cfe/trunk/include/clang-c/Index.h
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp
cfe/trunk/test/Index/index-templates.cpp
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/CursorVisitor.h

Modified: cfe/trunk/bindings/python/clang/cindex.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=253166&r1=253165&r2=253166&view=diff
==
--- cfe/trunk/bindings/python/clang/cindex.py (original)
+++ cfe/trunk/bindings/python/clang/cindex.py Sun Nov 15 07:48:32 2015
@@ -1114,7 +1114,8 @@ CursorKind.INCLUSION_DIRECTIVE = CursorK
 
 # A module import declaration.
 CursorKind.MODULE_IMPORT_DECL = CursorKind(600)
-
+# A type alias template declaration
+CursorKind.TYPE_ALIAS_TEMPLATE_DECL = CursorKind(601)
 
 ### Template Argument Kinds ###
 class TemplateArgumentKind(BaseEnumeration):

Modified: cfe/trunk/bindings/python/tests/cindex/test_cursor_kind.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_cursor_kind.py?rev=253166&r1=253165&r2=253166&view=diff
==
--- cfe/trunk/bindings/python/tests/cindex/test_cursor_kind.py (original)
+++ cfe/trunk/bindings/python/tests/cindex/test_cursor_kind.py Sun Nov 15 
07:48:32 2015
@@ -13,6 +13,7 @@ def test_get_all_kinds():
 assert CursorKind.OBJ_SELF_EXPR in kinds
 assert CursorKind.MS_ASM_STMT in kinds
 assert CursorKind.MODULE_IMPORT_DECL in kinds
+assert CursorKind.TYPE_ALIAS_TEMPLATE_DECL in kinds
 
 def test_kind_groups():
 """Check that every kind classifies to exactly one group."""

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=253166&r1=253165&r2=253166&view=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Sun Nov 15 07:48:32 2015
@@ -2296,8 +2296,9 @@ enum CXCursorKind {
* \brief A module import declaration.
*/
   CXCursor_ModuleImportDecl  = 600,
+  CXCursor_TypeAliasTemplateDecl = 601,
   CXCursor_FirstExtraDecl= CXCursor_ModuleImportDecl,
-  CXCursor_LastExtraDecl = CXCursor_ModuleImportDecl,
+  CXCursor_LastExtraDecl = CXCursor_TypeAliasTemplateDecl,
 
   /**
* \brief A code completion overload candidate.

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=253166&r1=253165&r2=253166&view=diff
==
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Sun Nov 15 07:48:32 2015
@@ -3036,6 +3036,7 @@ CXCursorKind clang::getCursorKindForDecl
 case Decl::ParmVar:return CXCursor_ParmDecl;
 case Decl::Typedef:return CXCursor_TypedefDecl;
 case Decl::TypeAlias:  return CXCursor_TypeAliasDecl;
+case Decl::TypeAliasTemplate:  return CXCursor_TypeAliasTemplateDecl;
 case Decl::Var:return CXCursor_VarDecl;
 case Decl::Namespace:  return CXCursor_Namespace;
 case Decl::NamespaceAlias: return CXCursor_NamespaceAlias;

Modified: cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp?rev=253166&r1=253165&r2=253166&view=diff
==
--- cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp (original)
+++ cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp Sun Nov 15 07:48:32 
2015
@@ -800,7 +800,7 @@ class comment_to_xml_conversion_01 {
   template
   using comment_to_xml_conversion_09 = comment_to_xml_conversion_08;
 
-// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:3: 
UnexposedDecl=comment_to_xml_conversion_09:{{.*}} FullCommentAsXML=[comment_to_xml_conversion_09c:@S@comment_to_xml_conversion_01@comment_to_xml_conversion_09template
 \nusing comment_to_xml_conversion_09 = 
comment_to_xml_conversion_08 
Aaa.]
+// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:3: 
TypeAliasTemplateDecl=comment_to_xml_conversion_09:{{.*}} 
FullCommentAsXML=[comment_to_xml_conversion_09c:@S

Re: [PATCH] D13844: [libclang] Visit TypeAliasTemplateDecl

2015-11-15 Thread Sergey Kalinichev via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253166: [libclang] Visit TypeAliasTemplateDecl (authored by 
skalinichev).

Changed prior to commit:
  http://reviews.llvm.org/D13844?vs=37672&id=40234#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13844

Files:
  cfe/trunk/bindings/python/clang/cindex.py
  cfe/trunk/bindings/python/tests/cindex/test_cursor_kind.py
  cfe/trunk/include/clang-c/Index.h
  cfe/trunk/lib/Sema/SemaCodeComplete.cpp
  cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp
  cfe/trunk/test/Index/index-templates.cpp
  cfe/trunk/tools/libclang/CIndex.cpp
  cfe/trunk/tools/libclang/CursorVisitor.h

Index: cfe/trunk/include/clang-c/Index.h
===
--- cfe/trunk/include/clang-c/Index.h
+++ cfe/trunk/include/clang-c/Index.h
@@ -2296,8 +2296,9 @@
* \brief A module import declaration.
*/
   CXCursor_ModuleImportDecl  = 600,
+  CXCursor_TypeAliasTemplateDecl = 601,
   CXCursor_FirstExtraDecl= CXCursor_ModuleImportDecl,
-  CXCursor_LastExtraDecl = CXCursor_ModuleImportDecl,
+  CXCursor_LastExtraDecl = CXCursor_TypeAliasTemplateDecl,
 
   /**
* \brief A code completion overload candidate.
Index: cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp
===
--- cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp
+++ cfe/trunk/test/Index/comment-to-html-xml-conversion.cpp
@@ -800,7 +800,7 @@
   template
   using comment_to_xml_conversion_09 = comment_to_xml_conversion_08;
 
-// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:3: UnexposedDecl=comment_to_xml_conversion_09:{{.*}} FullCommentAsXML=[comment_to_xml_conversion_09c:@S@comment_to_xml_conversion_01@comment_to_xml_conversion_09template \nusing comment_to_xml_conversion_09 = comment_to_xml_conversion_08 Aaa.]
+// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:3: TypeAliasTemplateDecl=comment_to_xml_conversion_09:{{.*}} FullCommentAsXML=[comment_to_xml_conversion_09c:@S@comment_to_xml_conversion_01@comment_to_xml_conversion_09template \nusing comment_to_xml_conversion_09 = comment_to_xml_conversion_08 Aaa.]
 };
 
 /// Aaa.
Index: cfe/trunk/test/Index/index-templates.cpp
===
--- cfe/trunk/test/Index/index-templates.cpp
+++ cfe/trunk/test/Index/index-templates.cpp
@@ -110,6 +110,9 @@
 template <>
 void foo(float Value);
 
+template 
+using alias = T;
+
 // RUN: c-index-test -test-load-source all -fno-delayed-template-parsing %s | FileCheck -check-prefix=CHECK-LOAD %s
 // CHECK-LOAD: index-templates.cpp:4:6: FunctionTemplate=f:4:6 Extent=[3:1 - 4:22]
 // CHECK-LOAD: index-templates.cpp:3:19: TemplateTypeParameter=T:3:19 (Definition) Extent=[3:10 - 3:20]
@@ -189,6 +192,10 @@
 // CHECK-LOAD: index-templates.cpp:101:20: C++ base class specifier=Pair:98:16 [access=public isVirtual=false] Extent=[101:20 - 101:34]
 // CHECK-LOAD: index-templates.cpp:101:36: C++ base class specifier=Pair:76:8 [access=public isVirtual=false] Extent=[101:36 - 101:46]
 // CHECK-LOAD: index-templates.cpp:111:6: FunctionDecl=foo:111:6 [Specialization of foo:107:6] [Template arg 0: kind: 1, type: float] [Template arg 1: kind: 4, intval: 9] [Template arg 2: kind: 4, intval: 1] [Template arg 3: kind: 4, intval: 14] Extent=[110:1 - 111:64]
+// CHECK-LOAD: index-templates.cpp:114:1: TypeAliasTemplateDecl=alias:114:1 (Definition) Extent=[113:1 - 114:16]
+// CHECK-LOAD: index-templates.cpp:113:17: TemplateTypeParameter=T:113:17 (Definition) Extent=[113:11 - 113:18] [access=public]
+// CHECK-LOAD: index-templates.cpp:114:7: TypeAliasDecl=alias:114:7 (Definition) Extent=[114:1 - 114:16]
+// CHECK-LOAD: index-templates.cpp:114:15: TypeRef=T:113:17 Extent=[114:15 - 114:16]
 
 // RUN: c-index-test -test-load-source-usrs all -fno-delayed-template-parsing %s | FileCheck -check-prefix=CHECK-USRS %s
 // CHECK-USRS: index-templates.cpp c:@FT@>3#T#Nt0.0#t>2#T#Nt1.0f#>t0.22S0_#v# Extent=[3:1 - 4:22]
Index: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
===
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp
@@ -3036,6 +3036,7 @@
 case Decl::ParmVar:return CXCursor_ParmDecl;
 case Decl::Typedef:return CXCursor_TypedefDecl;
 case Decl::TypeAlias:  return CXCursor_TypeAliasDecl;
+case Decl::TypeAliasTemplate:  return CXCursor_TypeAliasTemplateDecl;
 case Decl::Var:return CXCursor_VarDecl;
 case Decl::Namespace:  return CXCursor_Namespace;
 case Decl::NamespaceAlias: return CXCursor_NamespaceAlias;
Index: cfe/trunk/tools/libclang/CIndex.cpp
===
--- cfe/trunk/tools/libclang/CIndex.cpp
+++ 

r253169 - [X86][MMX] Added MMX IR + assembly codegen builtin tests for some missing cvt intrinsics

2015-11-15 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Sun Nov 15 08:40:31 2015
New Revision: 253169

URL: http://llvm.org/viewvc/llvm-project?rev=253169&view=rev
Log:
[X86][MMX] Added MMX IR + assembly codegen builtin tests for some missing cvt 
intrinsics

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

Modified: cfe/trunk/test/CodeGen/mmx-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mmx-builtins.c?rev=253169&r1=253168&r2=253169&view=diff
==
--- cfe/trunk/test/CodeGen/mmx-builtins.c (original)
+++ cfe/trunk/test/CodeGen/mmx-builtins.c Sun Nov 15 08:40:31 2015
@@ -163,6 +163,20 @@ __m64 test_mm_cmpgt_pi32(__m64 a, __m64
   return _mm_cmpgt_pi32(a, b);
 }
 
+__m128 test_mm_cvt_pi2ps(__m128 a, __m64 b) {
+  // CHECK-LABEL: test_mm_cvt_pi2ps
+  // CHECK: <4 x float> @llvm.x86.sse.cvtpi2ps
+  // CHECK-ASM: cvtpi2ps %mm{{.*}}, %xmm{{.*}}
+  return _mm_cvt_pi2ps(a, b);
+}
+
+__m64 test_mm_cvt_ps2pi(__m128 a) {
+  // CHECK-LABEL: test_mm_cvt_ps2pi
+  // CHECK: call x86_mmx @llvm.x86.sse.cvtps2pi
+  // CHECK-ASM: cvtps2pi %xmm{{.*}}, %mm{{.*}}
+  return _mm_cvt_ps2pi(a);
+}
+
 __m64 test_mm_cvtpd_pi32(__m128d a) {
   // CHECK-LABEL: test_mm_cvtpd_pi32
   // CHECK: call x86_mmx @llvm.x86.sse.cvtpd2pi
@@ -184,6 +198,52 @@ __m128d test_mm_cvtpi32_pd(__m64 a) {
   return _mm_cvtpi32_pd(a);
 }
 
+__m128 test_mm_cvtpi32_ps(__m128 a, __m64 b) {
+  // CHECK-LABEL: test_mm_cvtpi32_ps
+  // CHECK: call <4 x float> @llvm.x86.sse.cvtpi2ps
+  // CHECK-ASM: cvtpi2ps %mm{{.*}}, %xmm{{.*}}
+  return _mm_cvtpi32_ps(a, b);
+}
+
+__m128 test_mm_cvtpi32x2_ps(__m64 a, __m64 b) {
+  // CHECK-LABEL: test_mm_cvtpi32x2_ps
+  // CHECK: call <4 x float> @llvm.x86.sse.cvtpi2ps
+  // CHECK: call <4 x float> @llvm.x86.sse.cvtpi2ps
+  // CHECK-ASM: cvtpi2ps %mm{{.*}}, %xmm{{.*}}
+  // CHECK-ASM: cvtpi2ps %mm{{.*}}, %xmm{{.*}}
+  return _mm_cvtpi32x2_ps(a, b);
+}
+
+__m64 test_mm_cvtps_pi16(__m128 a) {
+  // CHECK-LABEL: test_mm_cvtps_pi16
+  // CHECK: call x86_mmx @llvm.x86.sse.cvtps2pi
+  // CHECK-ASM: cvtps2pi %xmm{{.*}}, %mm{{.*}}
+  // CHECK-ASM: cvtps2pi %xmm{{.*}}, %mm{{.*}}
+  // CHECK-ASM: packssdw %mm{{.*}}, %mm{{.*}}
+  return _mm_cvtps_pi16(a);
+}
+
+__m64 test_mm_cvtps_pi32(__m128 a) {
+  // CHECK-LABEL: test_mm_cvtps_pi32
+  // CHECK: call x86_mmx @llvm.x86.sse.cvtps2pi
+  // CHECK-ASM: cvtps2pi %xmm{{.*}}, %mm{{.*}}
+  return _mm_cvtps_pi32(a);
+}
+
+__m64 test_mm_cvtsi32_si64(int a) {
+  // CHECK-LABEL: test_mm_cvtsi32_si64
+  // CHECK: insertelement <2 x i32>
+  // CHECK-ASM: movd
+  return _mm_cvtsi32_si64(a);
+}
+
+int test_mm_cvtsi64_si32(__m64 a) {
+  // CHECK-LABEL: test_mm_cvtsi64_si32
+  // CHECK: extractelement <2 x i32>
+  // CHECK-ASM: movd
+  return _mm_cvtsi64_si32(a);
+}
+
 __m64 test_mm_cvttpd_pi32(__m128d a) {
   // CHECK-LABEL: test_mm_cvttpd_pi32
   // CHECK: call x86_mmx @llvm.x86.sse.cvttpd2pi
@@ -191,6 +251,13 @@ __m64 test_mm_cvttpd_pi32(__m128d a) {
   return _mm_cvttpd_pi32(a);
 }
 
+__m64 test_mm_cvttps_pi32(__m128 a) {
+  // CHECK-LABEL: test_mm_cvttps_pi32
+  // CHECK: call x86_mmx @llvm.x86.sse.cvttps2pi
+  // CHECK-ASM: cvttps2pi %xmm{{.*}}, %mm{{.*}}
+  return _mm_cvttps_pi32(a);
+}
+
 __m64 test_m_from_int(int a) {
   // CHECK-LABEL: test_m_from_int
   // CHECK: insertelement <2 x i32>
@@ -366,6 +433,20 @@ __m64 test_mm_sad_pu8(__m64 a, __m64 b)
   return _mm_sad_pu8(a, b);
 }
 
+__m64 test_mm_shuffle_pi8(__m64 a, __m64 b) {
+  // CHECK-LABEL: test_mm_shuffle_pi8
+  // CHECK: call x86_mmx @llvm.x86.ssse3.pshuf.b
+  // CHECK-ASM: pshufb %mm{{.*}}, %mm{{.*}}
+  return _mm_shuffle_pi8(a, b);
+}
+
+__m64 test_mm_shuffle_pi16(__m64 a) {
+  // CHECK-LABEL: test_mm_shuffle_pi16
+  // CHECK: call x86_mmx @llvm.x86.sse.pshuf.w
+  // CHECK-ASM: pshufw $3, %mm{{.*}}, %mm{{.*}}
+  return _mm_shuffle_pi16(a, 3);
+}
+
 __m64 test_mm_sign_pi8(__m64 a, __m64 b) {
   // CHECK-LABEL: test_mm_sign_pi8
   // CHECK: call x86_mmx @llvm.x86.ssse3.psign.b
@@ -387,20 +468,6 @@ __m64 test_mm_sign_pi32(__m64 a, __m64 b
   return _mm_sign_pi32(a, b);
 }
 
-__m64 test_mm_shuffle_pi8(__m64 a, __m64 b) {
-  // CHECK-LABEL: test_mm_shuffle_pi8
-  // CHECK: call x86_mmx @llvm.x86.ssse3.pshuf.b
-  // CHECK-ASM: pshufb %mm{{.*}}, %mm{{.*}}
-  return _mm_shuffle_pi8(a, b);
-}
-
-__m64 test_mm_shuffle_pi16(__m64 a) {
-  // CHECK-LABEL: test_mm_shuffle_pi16
-  // CHECK: call x86_mmx @llvm.x86.sse.pshuf.w
-  // CHECK-ASM: pshufw $3, %mm{{.*}}, %mm{{.*}}
-  return _mm_shuffle_pi16(a, 3);
-}
-
 __m64 test_mm_sll_pi16(__m64 a, __m64 b) {
   // CHECK-LABEL: test_mm_sll_pi16
   // CHECK: call x86_mmx @llvm.x86.mmx.psll.w


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


r253173 - [Sema] Remove unnecessary includes and forward declarations. NFC

2015-11-15 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sun Nov 15 11:27:52 2015
New Revision: 253173

URL: http://llvm.org/viewvc/llvm-project?rev=253173&view=rev
Log:
[Sema] Remove unnecessary includes and forward declarations. NFC

Modified:
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/lib/Sema/DeclSpec.cpp

Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=253173&r1=253172&r2=253173&view=diff
==
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Sun Nov 15 11:27:52 2015
@@ -31,7 +31,6 @@
 #include "clang/Lex/Token.h"
 #include "clang/Sema/AttributeList.h"
 #include "clang/Sema/Ownership.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -44,8 +43,6 @@ namespace clang {
   class IdentifierInfo;
   class NamespaceAliasDecl;
   class NamespaceDecl;
-  class NestedNameSpecifier;
-  class NestedNameSpecifierLoc;
   class ObjCDeclSpec;
   class Sema;
   class Declarator;

Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=253173&r1=253172&r2=253173&view=diff
==
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Sun Nov 15 11:27:52 2015
@@ -15,7 +15,6 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/Expr.h"
-#include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/TargetInfo.h"
@@ -25,7 +24,6 @@
 #include "clang/Sema/SemaDiagnostic.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
-#include "llvm/Support/ErrorHandling.h"
 #include 
 using namespace clang;
 


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


r253174 - [Sema] Fix filename in header. NFC

2015-11-15 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sun Nov 15 11:27:55 2015
New Revision: 253174

URL: http://llvm.org/viewvc/llvm-project?rev=253174&view=rev
Log:
[Sema] Fix filename in header. NFC

Modified:
cfe/trunk/lib/Sema/DeclSpec.cpp

Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=253174&r1=253173&r2=253174&view=diff
==
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Sun Nov 15 11:27:55 2015
@@ -1,4 +1,4 @@
-//===--- SemaDeclSpec.cpp - Declaration Specifier Semantic Analysis 
---===//
+//===--- DeclSpec.cpp - Declaration Specifier Semantic Analysis 
---===//
 //
 // The LLVM Compiler Infrastructure
 //


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


r253175 - [Sema] Use getLangOpts in Sema instead of Preprocessor. Call getTargetInfo on the AST context instead of Preprocessor. NFC

2015-11-15 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sun Nov 15 11:27:57 2015
New Revision: 253175

URL: http://llvm.org/viewvc/llvm-project?rev=253175&view=rev
Log:
[Sema] Use getLangOpts in Sema instead of Preprocessor. Call getTargetInfo on 
the AST context instead of Preprocessor. NFC

Modified:
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaCodeComplete.cpp

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=253175&r1=253174&r2=253175&view=diff
==
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Sun Nov 15 11:27:57 2015
@@ -120,8 +120,7 @@ Sema::Sema(Preprocessor &pp, ASTContext
 FieldCollector.reset(new CXXFieldCollector());
 
   // Tell diagnostics how to render things from the AST library.
-  PP.getDiagnostics().SetArgToStringFn(&FormatASTNodeDiagnosticArgument,
-   &Context);
+  Diags.SetArgToStringFn(&FormatASTNodeDiagnosticArgument, &Context);
 
   ExprEvalContexts.emplace_back(PotentiallyEvaluated, 0, false, nullptr, 
false);
 
@@ -168,7 +167,7 @@ void Sema::Initialize() {
 
 
   // Initialize predefined Objective-C types:
-  if (PP.getLangOpts().ObjC1) {
+  if (getLangOpts().ObjC1) {
 // If 'SEL' does not yet refer to any declarations, make it refer to the
 // predefined 'SEL'.
 DeclarationName SEL = &Context.Idents.get("SEL");
@@ -193,8 +192,8 @@ void Sema::Initialize() {
   }
 
   // Initialize Microsoft "predefined C++ types".
-  if (PP.getLangOpts().MSVCCompat) {
-if (PP.getLangOpts().CPlusPlus &&
+  if (getLangOpts().MSVCCompat) {
+if (getLangOpts().CPlusPlus &&
 IdResolver.begin(&Context.Idents.get("type_info")) == IdResolver.end())
   PushOnScopeChains(Context.buildImplicitRecord("type_info", TTK_Class),
 TUScope);
@@ -203,7 +202,7 @@ void Sema::Initialize() {
   }
 
   // Initialize predefined OpenCL types.
-  if (PP.getLangOpts().OpenCL) {
+  if (getLangOpts().OpenCL) {
 addImplicitTypedef("image1d_t", Context.OCLImage1dTy);
 addImplicitTypedef("image1d_array_t", Context.OCLImage1dArrayTy);
 addImplicitTypedef("image1d_buffer_t", Context.OCLImage1dBufferTy);
@@ -249,7 +248,7 @@ void Sema::Initialize() {
 }
   }
 
-  if (PP.getTargetInfo().hasBuiltinMSVaList()) {
+  if (Context.getTargetInfo().hasBuiltinMSVaList()) {
 DeclarationName MSVaList = &Context.Idents.get("__builtin_ms_va_list");
 if (IdResolver.begin(MSVaList) == IdResolver.end())
   PushOnScopeChains(Context.getBuiltinMSVaListDecl(), TUScope);

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=253175&r1=253174&r2=253175&view=diff
==
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Sun Nov 15 11:27:57 2015
@@ -3377,7 +3377,7 @@ void Sema::CodeCompleteOrdinaryName(Scop
   case PCC_Statement:
   case PCC_RecoveryInFunction:
 if (S->getFnParent())
-  AddPrettyFunctionResults(PP.getLangOpts(), Results);
+  AddPrettyFunctionResults(getLangOpts(), Results);
 break;
 
   case PCC_Namespace:
@@ -3521,7 +3521,7 @@ void Sema::CodeCompleteExpression(Scope
   if (S->getFnParent() && 
   !Data.ObjCCollection && 
   !Data.IntegralConstantExpression)
-AddPrettyFunctionResults(PP.getLangOpts(), Results);
+AddPrettyFunctionResults(getLangOpts(), Results);
 
   if (CodeCompleter->includeMacros())
 AddMacroResults(PP, Results, false, PreferredTypeIsPointer);
@@ -4206,7 +4206,7 @@ void Sema::CodeCompleteAfterIf(Scope *S)
   Results.ExitScope();
   
   if (S->getFnParent())
-AddPrettyFunctionResults(PP.getLangOpts(), Results);
+AddPrettyFunctionResults(getLangOpts(), Results);
   
   if (CodeCompleter->includeMacros())
 AddMacroResults(PP, Results, false);


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


r253176 - [analyzer] Handle calling ObjC super method from inside C++ lambda.

2015-11-15 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Sun Nov 15 11:48:22 2015
New Revision: 253176

URL: http://llvm.org/viewvc/llvm-project?rev=253176&view=rev
Log:
[analyzer] Handle calling ObjC super method from inside C++ lambda.

When calling a ObjC method on super from inside a C++ lambda, look at the
captures to find "self". This mirrors how the analyzer handles calling super in
an ObjC block and fixes an assertion failure.

rdar://problem/23550077

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

Modified: cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp?rev=253176&r1=253175&r2=253176&view=diff
==
--- cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp (original)
+++ cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp Sun Nov 15 11:48:22 2015
@@ -148,6 +148,23 @@ const ImplicitParamDecl *AnalysisDeclCon
 }
   }
 
+  auto *CXXMethod = dyn_cast(D);
+  if (!CXXMethod)
+return nullptr;
+
+  const CXXRecordDecl *parent = CXXMethod->getParent();
+  if (!parent->isLambda())
+return nullptr;
+
+  for (const LambdaCapture &LC : parent->captures()) {
+if (!LC.capturesVariable())
+  continue;
+
+VarDecl *VD = LC.getCapturedVar();
+if (VD->getName() == "self")
+  return dyn_cast(VD);
+  }
+
   return nullptr;
 }
 

Added: cfe/trunk/test/Analysis/lambdas.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/lambdas.mm?rev=253176&view=auto
==
--- cfe/trunk/test/Analysis/lambdas.mm (added)
+++ cfe/trunk/test/Analysis/lambdas.mm Sun Nov 15 11:48:22 2015
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wno-objc-root-class -analyze 
-analyzer-checker=core,debug.ExprInspection -analyzer-config 
inline-lambdas=true -verify %s
+
+int clang_analyzer_eval(int);
+
+@interface Super
+- (void)superMethod;
+@end
+
+@interface Sub : Super {
+  int _ivar1;
+  int _ivar2;
+}
+@end
+
+
+@implementation Sub
+- (void)callMethodOnSuperInCXXLambda; {
+  // Explicit capture.
+  [self]() {
+[super superMethod];
+  }();
+
+  // Implicit capture.
+  [=]() {
+[super superMethod];
+  }();
+}
+
+- (void)swapIvars {
+  int tmp = _ivar1;
+  _ivar1 = _ivar2;
+  _ivar2 = tmp;
+}
+
+- (void)callMethodOnSelfInCXXLambda; {
+  _ivar1 = 7;
+  _ivar2 = 8;
+  [self]() {
+[self swapIvars];
+  }();
+
+  clang_analyzer_eval(_ivar1 == 8); // expected-warning{{TRUE}}
+  clang_analyzer_eval(_ivar2 == 7); // expected-warning{{TRUE}}
+}
+
+@end


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


Re: [PATCH] D14521: [Driver] Use platform-appropriate profiling libraries for WatchOS, TVOS

2015-11-15 Thread Vedant Kumar via cfe-commits
vsk closed this revision.
vsk added a comment.

Committed as r252558.


http://reviews.llvm.org/D14521



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


r253177 - [Basic] Use a bitfield in SLocEntry for clarity. NFC.

2015-11-15 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Sun Nov 15 18:11:58 2015
New Revision: 253177

URL: http://llvm.org/viewvc/llvm-project?rev=253177&view=rev
Log:
[Basic] Use a bitfield in SLocEntry for clarity. NFC.

Modified:
cfe/trunk/include/clang/Basic/SourceManager.h

Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=253177&r1=253176&r2=253177&view=diff
==
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Sun Nov 15 18:11:58 2015
@@ -388,15 +388,16 @@ namespace SrcMgr {
   /// SourceManager keeps an array of these objects, and they are uniquely
   /// identified by the FileID datatype.
   class SLocEntry {
-unsigned Offset;   // low bit is set for expansion info.
+unsigned Offset : 31;
+unsigned IsExpansion : 1;
 union {
   FileInfo File;
   ExpansionInfo Expansion;
 };
   public:
-unsigned getOffset() const { return Offset >> 1; }
+unsigned getOffset() const { return Offset; }
 
-bool isExpansion() const { return Offset & 1; }
+bool isExpansion() const { return IsExpansion; }
 bool isFile() const { return !isExpansion(); }
 
 const FileInfo &getFile() const {
@@ -410,15 +411,19 @@ namespace SrcMgr {
 }
 
 static SLocEntry get(unsigned Offset, const FileInfo &FI) {
+  assert(!(Offset & (1 << 31)) && "Offset is too large");
   SLocEntry E;
-  E.Offset = Offset << 1;
+  E.Offset = Offset;
+  E.IsExpansion = false;
   E.File = FI;
   return E;
 }
 
 static SLocEntry get(unsigned Offset, const ExpansionInfo &Expansion) {
+  assert(!(Offset & (1 << 31)) && "Offset is too large");
   SLocEntry E;
-  E.Offset = (Offset << 1) | 1;
+  E.Offset = Offset;
+  E.IsExpansion = true;
   E.Expansion = Expansion;
   return E;
 }


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


r253178 - [Frontend] Rangify for loop. NFC.

2015-11-15 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Sun Nov 15 18:59:34 2015
New Revision: 253178

URL: http://llvm.org/viewvc/llvm-project?rev=253178&view=rev
Log:
[Frontend] Rangify for loop. NFC.

Modified:
cfe/trunk/lib/Frontend/CompilerInstance.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=253178&r1=253177&r2=253178&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Sun Nov 15 18:59:34 2015
@@ -831,13 +831,13 @@ bool CompilerInstance::ExecuteAction(Fro
   if (getFrontendOpts().ShowStats)
 llvm::EnableStatistics();
 
-  for (unsigned i = 0, e = getFrontendOpts().Inputs.size(); i != e; ++i) {
+  for (const FrontendInputFile &FIF : getFrontendOpts().Inputs) {
 // Reset the ID tables if we are reusing the SourceManager and parsing
 // regular files.
 if (hasSourceManager() && !Act.isModelParsingAction())
   getSourceManager().clearIDTables();
 
-if (Act.BeginSourceFile(*this, getFrontendOpts().Inputs[i])) {
+if (Act.BeginSourceFile(*this, FIF)) {
   Act.Execute();
   Act.EndSourceFile();
 }


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


[PATCH] D14691: clang side of http://reviews.llvm.org/D14690

2015-11-15 Thread Rafael Ávila de Espíndola via cfe-commits
rafael created this revision.
rafael added a reviewer: chandlerc.
rafael added a subscriber: cfe-commits.
Herald added a reviewer: tstellarAMD.

http://reviews.llvm.org/D14691

Files:
  include/clang/Lex/HeaderSearchOptions.h
  include/clang/Sema/Sema.h
  lib/AST/VTableBuilder.cpp
  lib/CodeGen/CGObjCMac.cpp
  lib/CodeGen/CoverageMappingGen.cpp
  lib/Driver/Tools.cpp
  test/Driver/amdgpu-toolchain.c
  test/Driver/mingw-useld.c
  test/Driver/mips-mti-linux.c
  utils/TableGen/NeonEmitter.cpp

Index: utils/TableGen/NeonEmitter.cpp
===
--- utils/TableGen/NeonEmitter.cpp
+++ utils/TableGen/NeonEmitter.cpp
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 using namespace llvm;
 
 namespace {
Index: test/Driver/mips-mti-linux.c
===
--- test/Driver/mips-mti-linux.c
+++ test/Driver/mips-mti-linux.c
@@ -14,7 +14,7 @@
 // CHECK-BE-HF-32R2: "{{[^"]*}}clang{{[^"]*}}" {{.*}} "-triple" "mips-mti-linux"
 // CHECK-BE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2"
 // CHECK-BE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
-// CHECK-BE-HF-32R2: "{{[^"]*}}lld{{[^"]*}}" "-flavor" "gnu" "-target" "mips-mti-linux"
+// CHECK-BE-HF-32R2: "{{[^"]*}}lld{{[^"]*}}" "-flavor" "old-gnu" "-target" "mips-mti-linux"
 // CHECK-BE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} "-dynamic-linker" "/lib/ld-musl-mips.so.1"
 // CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crt1.o"
 // CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crti.o"
@@ -32,7 +32,7 @@
 // CHECK-LE-HF-32R2: "{{[^"]*}}clang{{[^"]*}}" {{.*}} "-triple" "mipsel-mti-linux"
 // CHECK-LE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2"
 // CHECK-LE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
-// CHECK-LE-HF-32R2: "{{[^"]*}}lld{{[^"]*}}" "-flavor" "gnu" "-target" "mipsel-mti-linux"
+// CHECK-LE-HF-32R2: "{{[^"]*}}lld{{[^"]*}}" "-flavor" "old-gnu" "-target" "mipsel-mti-linux"
 // CHECK-LE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} "-dynamic-linker" "/lib/ld-musl-mipsel.so.1"
 // CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crt1.o"
 // CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crti.o"
Index: test/Driver/mingw-useld.c
===
--- test/Driver/mingw-useld.c
+++ test/Driver/mingw-useld.c
@@ -1,20 +1,20 @@
 // RUN: %clang -### -target i686-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_LD_32 %s
 // CHECK_LD_32: {{ld|ld.exe}}"
 // CHECK_LD_32: "i386pe"
-// CHECK_LD_32_NOT: "-flavor" "gnu"
+// CHECK_LD_32_NOT: "-flavor" "old-gnu"
 
 // RUN: %clang -### -target i686-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck -check-prefix=CHECK_LLD_32 %s
-// CHECK_LLD_32: lld" "-flavor" "gnu"
+// CHECK_LLD_32: lld" "-flavor" "old-gnu"
 // CHECK_LLD_32: "i386pe"
 
 // RUN: %clang -### -target i686-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=link.exe 2>&1 | FileCheck -check-prefix=CHECK_LINK_32 %s
 // CHECK_LINK_32: link.exe"
 // CHECK_LINK_32: "i386pe"
 
 // RUN: %clang -### -target x86_64-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck -check-prefix=CHECK_LLD_64 %s
-// CHECK_LLD_64: lld" "-flavor" "gnu"
+// CHECK_LLD_64: lld" "-flavor" "old-gnu"
 // CHECK_LLD_64: "i386pep"
 
 // RUN: %clang -### -target arm-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck -check-prefix=CHECK_LLD_ARM %s
-// CHECK_LLD_ARM: lld" "-flavor" "gnu"
+// CHECK_LLD_ARM: lld" "-flavor" "old-gnu"
 // CHECK_LLD_ARM: "thumb2pe"
Index: test/Driver/amdgpu-toolchain.c
===
--- test/Driver/amdgpu-toolchain.c
+++ test/Driver/amdgpu-toolchain.c
@@ -1,3 +1,3 @@
 // RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=AS_LINK %s
 // AS_LINK: clang{{.*}} "-cc1as"
-// AS_LINK: lld{{.*}} "-flavor" "gnu" "-target" "amdgcn--amdhsa"
+// AS_LINK: lld{{.*}} "-flavor" "old-gnu" "-target" "amdgcn--amdhsa"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -6224,7 +6224,7 @@
   std::string Linker = getToolChain().GetProgramPath(getShortName());
   ArgStringList CmdArgs;
   CmdArgs.push_back("-flavor");
-  CmdArgs.push_back("gnu");
+  CmdArgs.push_back("old-gnu");
   CmdArgs.push_back("-target");
   CmdArgs.push_back(Args.MakeArgString(getToolChain().getTripleString()));
   AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
@@ -8477,7 +8477,7 @@
 
   if (llvm::sys::path::filename(ToolChain.Linker) == "lld") {
 CmdArgs.push_back("-flavor");
-CmdArgs.push_back("gnu");
+  

r253181 - [Basic] Replace vector with BitVector in SourceManager. NFC.

2015-11-15 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Sun Nov 15 22:39:22 2015
New Revision: 253181

URL: http://llvm.org/viewvc/llvm-project?rev=253181&view=rev
Log:
[Basic] Replace vector with BitVector in SourceManager. NFC.

Modified:
cfe/trunk/include/clang/Basic/SourceManager.h

Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=253181&r1=253180&r2=253181&view=diff
==
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Sun Nov 15 22:39:22 2015
@@ -39,6 +39,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/BitVector.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -620,7 +621,7 @@ class SourceManager : public RefCountedB
   /// have already been loaded from the external source.
   ///
   /// Same indexing as LoadedSLocEntryTable.
-  std::vector SLocEntryLoaded;
+  llvm::BitVector SLocEntryLoaded;
 
   /// \brief An external source for source location entries.
   ExternalSLocEntrySource *ExternalSLocEntries;


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


r253184 - [Sema] Implement several unary type traits more accurately

2015-11-15 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Mon Nov 16 00:58:51 2015
New Revision: 253184

URL: http://llvm.org/viewvc/llvm-project?rev=253184&view=rev
Log:
[Sema] Implement several unary type traits more accurately

is_empty, is_polymorphic, and is_abstract didn't handle incomplete types
correctly.  Only non-union class types must be complete for these
traits.

is_final and is_sealed don't care about the particular spelling of the
FinalAttr.

is_interface_class should always return false regardless of its input.
The type trait can only be satisfied in a mode we do not support (/CLR).

Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/abstract.cpp
cfe/trunk/test/SemaCXX/ms-interface.cpp
cfe/trunk/test/SemaCXX/type-traits.cpp

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=253184&r1=253183&r2=253184&view=diff
==
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Mon Nov 16 00:58:51 2015
@@ -3550,27 +3550,43 @@ static bool CheckUnaryTypeTraitTypeCompl
   case UTT_IsVolatile:
   case UTT_IsSigned:
   case UTT_IsUnsigned:
+
+  // This type trait always returns false, checking the type is moot.
+  case UTT_IsInterfaceClass:
+return true;
+
+  // C++14 [meta.unary.prop]:
+  //   If T is a non-union class type, T shall be a complete type.
+  case UTT_IsEmpty:
+  case UTT_IsPolymorphic:
+  case UTT_IsAbstract:
+if (const auto *RD = ArgTy->getAsCXXRecordDecl())
+  if (!RD->isUnion())
+return !S.RequireCompleteType(
+Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
+return true;
+
+  // C++14 [meta.unary.prop]:
+  //   If T is a class type, T shall be a complete type.
+  case UTT_IsFinal:
+  case UTT_IsSealed:
+if (ArgTy->getAsCXXRecordDecl())
+  return !S.RequireCompleteType(
+  Loc, ArgTy, diag::err_incomplete_type_used_in_type_trait_expr);
 return true;
 
-// C++0x [meta.unary.prop] Table 49 requires the following traits to be
-// applied to a complete type.
+  // C++0x [meta.unary.prop] Table 49 requires the following traits to be
+  // applied to a complete type.
   case UTT_IsTrivial:
   case UTT_IsTriviallyCopyable:
   case UTT_IsStandardLayout:
   case UTT_IsPOD:
   case UTT_IsLiteral:
-  case UTT_IsEmpty:
-  case UTT_IsPolymorphic:
-  case UTT_IsAbstract:
-  case UTT_IsInterfaceClass:
+
   case UTT_IsDestructible:
   case UTT_IsNothrowDestructible:
 // Fall-through
 
-  // These traits require a complete type.
-  case UTT_IsFinal:
-  case UTT_IsSealed:
-
 // These trait expressions are designed to help implement predicates in
 // [meta.unary.prop] despite not being named the same. They are specified
 // by both GCC and the Embarcadero C++ compiler, and require the complete
@@ -3729,24 +3745,21 @@ static bool EvaluateUnaryTypeTrait(Sema
 return false;
   case UTT_IsPolymorphic:
 if (const CXXRecordDecl *RD = T->getAsCXXRecordDecl())
-  return RD->isPolymorphic();
+  return !RD->isUnion() && RD->isPolymorphic();
 return false;
   case UTT_IsAbstract:
 if (const CXXRecordDecl *RD = T->getAsCXXRecordDecl())
-  return RD->isAbstract();
+  return !RD->isUnion() && RD->isAbstract();
 return false;
+  // __is_interface_class only returns true when CL is invoked in /CLR mode and
+  // even then only when it is used with the 'interface struct ...' syntax
+  // Clang doesn't support /CLR which makes this type trait moot.
   case UTT_IsInterfaceClass:
-if (const CXXRecordDecl *RD = T->getAsCXXRecordDecl())
-  return RD->isInterface();
 return false;
   case UTT_IsFinal:
-if (const CXXRecordDecl *RD = T->getAsCXXRecordDecl())
-  return RD->hasAttr();
-return false;
   case UTT_IsSealed:
 if (const CXXRecordDecl *RD = T->getAsCXXRecordDecl())
-  if (FinalAttr *FA = RD->getAttr())
-return FA->isSpelledAsSealed();
+  return RD->hasAttr();
 return false;
   case UTT_IsSigned:
 return T->isSignedIntegerType();

Modified: cfe/trunk/test/SemaCXX/abstract.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/abstract.cpp?rev=253184&r1=253183&r2=253184&view=diff
==
--- cfe/trunk/test/SemaCXX/abstract.cpp (original)
+++ cfe/trunk/test/SemaCXX/abstract.cpp Mon Nov 16 00:58:51 2015
@@ -8,6 +8,10 @@
   typedef int __CONCAT(__sa, __LINE__)[__b ? 1 : -1]
 #endif
 
+union IncompleteUnion;
+
+static_assert(!__is_abstract(IncompleteUnion), "unions are never abstract");
+
 class C {
   virtual void f() = 0; // expected-note {{unimplemented pure virtual method 
'f'}}
 };

Modified: cfe/trunk/test/SemaCXX/ms-interface.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ms-interface.cpp?rev=253184&r1=253183&r2=253184&view=diff
===