[PATCH] D49240: [libc++] Introduce _LIBCPP_HIDE_FROM_ABI to replace _LIBCPP_INLINE_VISIBILITY
thakis added a comment. When we updated out clang bundle in chromium (which includes libc++ headers), our ios simulator bots regressed debug info size by ~50% due to this commit (https://bugs.chromium.org/p/chromium/issues/detail?id=872926#c13). Is that expected? Repository: rCXX libc++ https://reviews.llvm.org/D49240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46652: [clang-cl, PCH] Implement support for MS-style PCH through headers
thakis added a comment. In https://reviews.llvm.org/D46652#1174220, @mikerice wrote: > In https://reviews.llvm.org/D46652#1164010, @thakis wrote: > > > Also, were you planning on also adding support for the (filename-less > > version of) hdrstop pragma? After this change, that should probably be > > fairly straightforward. > > > Thanks for taking a look. I'll be going through our PCH tests at some point > soon and will likely add support for this and any other interesting issues > that remain. Cool :-) I gave hrdstop a try (wip at https://reviews.llvm.org/D49496) but kind of got stuck and haven't had time to become unstuck. If you get to it first, maybe the wip patch is useful (or not). It looks like your change did break using /P together with /Yu: https://bugs.llvm.org/show_bug.cgi?id=38508 Repository: rC Clang https://reviews.llvm.org/D46652 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50640: Fix for bug 38508 - Don't do PCH processing when only generating preprocessor output
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. The approach lgtm, thanks. How does the gcc driver codepath handle this? Does it just not have to worry about this because it doesn't have something like warn_pp_macro_def_mismatch_with_pch? Comment at: test/Driver/cl-pch.cpp:368 +// CHECK-YU-E-NOT: -emit-pch +// CHECK-YU-E-NOT: -include-pch Can we have an integration-test type test that creates a pch and uses it, and checks that there are no warnings? (Like in https://bugs.llvm.org/show_bug.cgi?id=38508#c1) Probably fairly easy to add to one of the test/PCH/pch-through* files. Repository: rC Clang https://reviews.llvm.org/D50640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50652: [libcxx] By default, do not use internal_linkage to hide symbols from the ABI
thakis added a comment. I haven't read all the messages in these threads, forgive me if someone asked this already. It's a bit weird to me that we have to override this behavior in Chromium while the default is different. Why isn't the executable size blowup we see in chromium a problem for everyone else too? Is the plan to fix ld64's string pooling at the same time as rolling this change out, and this is just a workaround for people who have head libc++ but not head ld64? Repository: rCXX libc++ https://reviews.llvm.org/D50652 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50652: [libcxx] By default, do not use internal_linkage to hide symbols from the ABI
thakis added a comment. (I defer to Hans) Repository: rCXX libc++ https://reviews.llvm.org/D50652 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50640: Fix for bug 38508 - Don't do PCH processing when only generating preprocessor output
thakis accepted this revision. thakis added a comment. Thanks! Do you need someone to land this? https://reviews.llvm.org/D50640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50907: Make __shiftleft128 / __shiftright128 real compiler built-ins.
thakis added a comment. Forgot to add cfe-commits :-( Doing that now. https://reviews.llvm.org/D50907 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50907: Make __shiftleft128 / __shiftright128 real compiler built-ins.
thakis added a comment. r340048, thanks! https://reviews.llvm.org/D50907 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50877: [MS] Mangle a hash of the main file path into anonymous namespaces
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. Can you explicitly mention that this intentionally doesn't use an absolute path in MicrosoftMangleContextImpl() or similar? https://reviews.llvm.org/D50877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50979: Eliminate instances of `EmitScalarExpr(E->getArg(n))` in EmitX86BuiltinExpr().
thakis created this revision. thakis added a reviewer: rnk. Herald added a reviewer: javed.absar. Herald added a subscriber: kristof.beyls. EmitX86BuiltinExpr() emits all args into Ops at the beginning, so don't do that work again. No intended behavior change. (TNorthover: EmitAArch64BuiltinExpr() also emits args into Ops before the big switch (with some more subtlety around the last arg that I don't understand), but then almost every switch case does `EmitScalarExpr(E->getArg(n))`. It's been like this since the commit that added the arm64 code. Was the Ops pushing code added later and all the EmitScalarExpr()s are now unneeded, or is some reason for this?) https://reviews.llvm.org/D50979 Files: clang/lib/CodeGen/CGBuiltin.cpp Index: clang/lib/CodeGen/CGBuiltin.cpp === --- clang/lib/CodeGen/CGBuiltin.cpp +++ clang/lib/CodeGen/CGBuiltin.cpp @@ -10480,14 +10480,11 @@ llvm::Type *Int128PtrTy = Int128Ty->getPointerTo(); Value *Destination = -Builder.CreateBitCast(EmitScalarExpr(E->getArg(0)), Int128PtrTy); -Value *ExchangeHigh128 = -Builder.CreateZExt(EmitScalarExpr(E->getArg(1)), Int128Ty); -Value *ExchangeLow128 = -Builder.CreateZExt(EmitScalarExpr(E->getArg(2)), Int128Ty); -Address ComparandResult( -Builder.CreateBitCast(EmitScalarExpr(E->getArg(3)), Int128PtrTy), -getContext().toCharUnitsFromBits(128)); +Builder.CreateBitCast(Ops[0], Int128PtrTy); +Value *ExchangeHigh128 = Builder.CreateZExt(Ops[1], Int128Ty); +Value *ExchangeLow128 = Builder.CreateZExt(Ops[2], Int128Ty); +Address ComparandResult(Builder.CreateBitCast(Ops[3], Int128PtrTy), +getContext().toCharUnitsFromBits(128)); Value *Exchange = Builder.CreateOr( Builder.CreateShl(ExchangeHigh128, 64, "", false, false), @@ -10538,8 +10535,8 @@ case X86::BI__readfsdword: case X86::BI__readfsqword: { llvm::Type *IntTy = ConvertType(E->getType()); -Value *Ptr = Builder.CreateIntToPtr(EmitScalarExpr(E->getArg(0)), -llvm::PointerType::get(IntTy, 257)); +Value *Ptr = +Builder.CreateIntToPtr(Ops[0], llvm::PointerType::get(IntTy, 257)); LoadInst *Load = Builder.CreateAlignedLoad( IntTy, Ptr, getContext().getTypeAlignInChars(E->getType())); Load->setVolatile(true); @@ -10550,8 +10547,8 @@ case X86::BI__readgsdword: case X86::BI__readgsqword: { llvm::Type *IntTy = ConvertType(E->getType()); -Value *Ptr = Builder.CreateIntToPtr(EmitScalarExpr(E->getArg(0)), -llvm::PointerType::get(IntTy, 256)); +Value *Ptr = +Builder.CreateIntToPtr(Ops[0], llvm::PointerType::get(IntTy, 256)); LoadInst *Load = Builder.CreateAlignedLoad( IntTy, Ptr, getContext().getTypeAlignInChars(E->getType())); Load->setVolatile(true); Index: clang/lib/CodeGen/CGBuiltin.cpp === --- clang/lib/CodeGen/CGBuiltin.cpp +++ clang/lib/CodeGen/CGBuiltin.cpp @@ -10480,14 +10480,11 @@ llvm::Type *Int128PtrTy = Int128Ty->getPointerTo(); Value *Destination = -Builder.CreateBitCast(EmitScalarExpr(E->getArg(0)), Int128PtrTy); -Value *ExchangeHigh128 = -Builder.CreateZExt(EmitScalarExpr(E->getArg(1)), Int128Ty); -Value *ExchangeLow128 = -Builder.CreateZExt(EmitScalarExpr(E->getArg(2)), Int128Ty); -Address ComparandResult( -Builder.CreateBitCast(EmitScalarExpr(E->getArg(3)), Int128PtrTy), -getContext().toCharUnitsFromBits(128)); +Builder.CreateBitCast(Ops[0], Int128PtrTy); +Value *ExchangeHigh128 = Builder.CreateZExt(Ops[1], Int128Ty); +Value *ExchangeLow128 = Builder.CreateZExt(Ops[2], Int128Ty); +Address ComparandResult(Builder.CreateBitCast(Ops[3], Int128PtrTy), +getContext().toCharUnitsFromBits(128)); Value *Exchange = Builder.CreateOr( Builder.CreateShl(ExchangeHigh128, 64, "", false, false), @@ -10538,8 +10535,8 @@ case X86::BI__readfsdword: case X86::BI__readfsqword: { llvm::Type *IntTy = ConvertType(E->getType()); -Value *Ptr = Builder.CreateIntToPtr(EmitScalarExpr(E->getArg(0)), -llvm::PointerType::get(IntTy, 257)); +Value *Ptr = +Builder.CreateIntToPtr(Ops[0], llvm::PointerType::get(IntTy, 257)); LoadInst *Load = Builder.CreateAlignedLoad( IntTy, Ptr, getContext().getTypeAlignInChars(E->getType())); Load->setVolatile(true); @@ -10550,8 +10547,8 @@ case X86::BI__readgsdword: case X86::BI__readgsqword: { llvm::Type *IntTy = ConvertType(E->getType()); -Value *Ptr = Builder.CreateIntToPtr(EmitScalarExpr(E->getArg(0)), -llvm::PointerType::get(IntTy, 256)); +Value *Ptr = +Builder.CreateIntToPtr(Ops
[PATCH] D50979: Eliminate instances of `EmitScalarExpr(E->getArg(n))` in EmitX86BuiltinExpr().
thakis added a comment. In https://reviews.llvm.org/D50979#1206211, @rsmith wrote: > I don't think this is NFC. Testcase: > > long long int a, b, c, d; > unsigned char f() { return _InterlockedCompareExchange128(&(++a), ++b, ++c, > &(++d)); } > > > Today, Clang increments `a`, `b`, `c`, and `d` twice each in `f()`. Thanks for pointing this out, good to hear that this even happens to find a bug :-) I'll add some tests to document the progression. https://reviews.llvm.org/D50979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50979: Eliminate instances of `EmitScalarExpr(E->getArg(n))` in EmitX86BuiltinExpr().
thakis added a comment. In https://reviews.llvm.org/D50979#1206282, @thakis wrote: > In https://reviews.llvm.org/D50979#1206211, @rsmith wrote: > > > I don't think this is NFC. Testcase: > > > > long long int a, b, c, d; > > unsigned char f() { return _InterlockedCompareExchange128(&(++a), ++b, > > ++c, &(++d)); } > > > > > > Today, Clang increments `a`, `b`, `c`, and `d` twice each in `f()`. > > > Thanks for pointing this out, good to hear that this even happens to find a > bug :-) I'll add some tests to document the progression. *happens to _fix_ a bug https://reviews.llvm.org/D50979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50979: Eliminate instances of `EmitScalarExpr(E->getArg(n))` in EmitX86BuiltinExpr().
thakis updated this revision to Diff 161824. thakis edited the summary of this revision. thakis added a comment. Add tests. https://reviews.llvm.org/D50979 Files: clang/lib/CodeGen/CGBuiltin.cpp clang/test/CodeGen/ms-intrinsics.c clang/test/CodeGen/ms-x86-intrinsics.c Index: clang/test/CodeGen/ms-x86-intrinsics.c === --- clang/test/CodeGen/ms-x86-intrinsics.c +++ clang/test/CodeGen/ms-x86-intrinsics.c @@ -7,34 +7,38 @@ #if defined(__i386__) char test__readfsbyte(unsigned long Offset) { - return __readfsbyte(Offset); + return __readfsbyte(++Offset); } // CHECK-I386-LABEL: define dso_local signext i8 @test__readfsbyte(i32 %Offset) -// CHECK-I386: [[PTR:%[0-9]+]] = inttoptr i32 %Offset to i8 addrspace(257)* +// CHECK-I386: %inc = add i32 %Offset, 1 +// CHECK-I386: [[PTR:%[0-9]+]] = inttoptr i32 %inc to i8 addrspace(257)* // CHECK-I386: [[VALUE:%[0-9]+]] = load volatile i8, i8 addrspace(257)* [[PTR]], align 1 // CHECK-I386: ret i8 [[VALUE:%[0-9]+]] short test__readfsword(unsigned long Offset) { - return __readfsword(Offset); + return __readfsword(++Offset); } // CHECK-I386-LABEL: define dso_local signext i16 @test__readfsword(i32 %Offset) -// CHECK-I386: [[PTR:%[0-9]+]] = inttoptr i32 %Offset to i16 addrspace(257)* +// CHECK-I386: %inc = add i32 %Offset, 1 +// CHECK-I386: [[PTR:%[0-9]+]] = inttoptr i32 %inc to i16 addrspace(257)* // CHECK-I386: [[VALUE:%[0-9]+]] = load volatile i16, i16 addrspace(257)* [[PTR]], align 2 // CHECK-I386: ret i16 [[VALUE:%[0-9]+]] long test__readfsdword(unsigned long Offset) { - return __readfsdword(Offset); + return __readfsdword(++Offset); } // CHECK-I386-LABEL: define dso_local i32 @test__readfsdword(i32 %Offset) -// CHECK-I386: [[PTR:%[0-9]+]] = inttoptr i32 %Offset to i32 addrspace(257)* +// CHECK-I386: %inc = add i32 %Offset, 1 +// CHECK-I386: [[PTR:%[0-9]+]] = inttoptr i32 %inc to i32 addrspace(257)* // CHECK-I386: [[VALUE:%[0-9]+]] = load volatile i32, i32 addrspace(257)* [[PTR]], align 4 // CHECK-I386: ret i32 [[VALUE:%[0-9]+]] long long test__readfsqword(unsigned long Offset) { - return __readfsqword(Offset); + return __readfsqword(++Offset); } // CHECK-I386-LABEL: define dso_local i64 @test__readfsqword(i32 %Offset) -// CHECK-I386: [[PTR:%[0-9]+]] = inttoptr i32 %Offset to i64 addrspace(257)* +// CHECK-I386: %inc = add i32 %Offset, 1 +// CHECK-I386: [[PTR:%[0-9]+]] = inttoptr i32 %inc to i64 addrspace(257)* // CHECK-I386: [[VALUE:%[0-9]+]] = load volatile i64, i64 addrspace(257)* [[PTR]], align 8 // CHECK-I386: ret i64 [[VALUE:%[0-9]+]] #endif @@ -60,37 +64,41 @@ #if defined(__x86_64__) char test__readgsbyte(unsigned long Offset) { - return __readgsbyte(Offset); + return __readgsbyte(++Offset); } // CHECK-X64-LABEL: define dso_local i8 @test__readgsbyte(i32 %Offset) -// CHECK-X64: [[ZEXT:%[0-9]+]] = zext i32 %Offset to i64 +// CHECK-X64: %inc = add i32 %Offset, 1 +// CHECK-X64: [[ZEXT:%[0-9]+]] = zext i32 %inc to i64 // CHECK-X64: [[PTR:%[0-9]+]] = inttoptr i64 [[ZEXT]] to i8 addrspace(256)* // CHECK-X64: [[VALUE:%[0-9]+]] = load volatile i8, i8 addrspace(256)* [[PTR]], align 1 // CHECK-X64: ret i8 [[VALUE:%[0-9]+]] short test__readgsword(unsigned long Offset) { - return __readgsword(Offset); + return __readgsword(++Offset); } // CHECK-X64-LABEL: define dso_local i16 @test__readgsword(i32 %Offset) -// CHECK-X64: [[ZEXT:%[0-9]+]] = zext i32 %Offset to i64 +// CHECK-X64: %inc = add i32 %Offset, 1 +// CHECK-X64: [[ZEXT:%[0-9]+]] = zext i32 %inc to i64 // CHECK-X64: [[PTR:%[0-9]+]] = inttoptr i64 [[ZEXT]] to i16 addrspace(256)* // CHECK-X64: [[VALUE:%[0-9]+]] = load volatile i16, i16 addrspace(256)* [[PTR]], align 2 // CHECK-X64: ret i16 [[VALUE:%[0-9]+]] long test__readgsdword(unsigned long Offset) { - return __readgsdword(Offset); + return __readgsdword(++Offset); } // CHECK-X64-LABEL: define dso_local i32 @test__readgsdword(i32 %Offset) -// CHECK-X64: [[ZEXT:%[0-9]+]] = zext i32 %Offset to i64 +// CHECK-X64: %inc = add i32 %Offset, 1 +// CHECK-X64: [[ZEXT:%[0-9]+]] = zext i32 %inc to i64 // CHECK-X64: [[PTR:%[0-9]+]] = inttoptr i64 [[ZEXT]] to i32 addrspace(256)* // CHECK-X64: [[VALUE:%[0-9]+]] = load volatile i32, i32 addrspace(256)* [[PTR]], align 4 // CHECK-X64: ret i32 [[VALUE:%[0-9]+]] long long test__readgsqword(unsigned long Offset) { - return __readgsqword(Offset); + return __readgsqword(++Offset); } // CHECK-X64-LABEL: define dso_local i64 @test__readgsqword(i32 %Offset) -// CHECK-X64: [[ZEXT:%[0-9]+]] = zext i32 %Offset to i64 +// CHECK-X64: %inc = add i32 %Offset, 1 +// CHECK-X64: [[ZEXT:%[0-9]+]] = zext i32 %inc to i64 // CHECK-X64: [[PTR:%[0-9]+]] = inttoptr i64 [[ZEXT]] to i64 addrspace(256)* // CHECK-X64: [[VALUE:%[0-9]+]] = load volatile i64, i64 addrspace(256)* [[PTR]], align 8 // CHECK-X64: ret i64 [[VALUE:%[0-9]+]]
[PATCH] D50979: Eliminate instances of `EmitScalarExpr(E->getArg(n))` in EmitX86BuiltinExpr().
thakis closed this revision. thakis added a comment. r340348, thanks! https://reviews.llvm.org/D50979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51134: win: Omit ".exe" from clang and clang-cl driver-level diagnostics.
thakis created this revision. thakis added a reviewer: hans. Like https://reviews.llvm.org/D51133 but for clang. https://reviews.llvm.org/D51134 Files: clang/tools/driver/driver.cpp Index: clang/tools/driver/driver.cpp === --- clang/tools/driver/driver.cpp +++ clang/tools/driver/driver.cpp @@ -260,9 +260,9 @@ const std::string &Path) { // If the clang binary happens to be named cl.exe for compatibility reasons, // use clang-cl.exe as the prefix to avoid confusion between clang and MSVC. - StringRef ExeBasename(llvm::sys::path::filename(Path)); - if (ExeBasename.equals_lower("cl.exe")) -ExeBasename = "clang-cl.exe"; + StringRef ExeBasename(llvm::sys::path::stem(Path)); + if (ExeBasename.equals_lower("cl")) +ExeBasename = "clang-cl"; DiagClient->setPrefix(ExeBasename); } Index: clang/tools/driver/driver.cpp === --- clang/tools/driver/driver.cpp +++ clang/tools/driver/driver.cpp @@ -260,9 +260,9 @@ const std::string &Path) { // If the clang binary happens to be named cl.exe for compatibility reasons, // use clang-cl.exe as the prefix to avoid confusion between clang and MSVC. - StringRef ExeBasename(llvm::sys::path::filename(Path)); - if (ExeBasename.equals_lower("cl.exe")) -ExeBasename = "clang-cl.exe"; + StringRef ExeBasename(llvm::sys::path::stem(Path)); + if (ExeBasename.equals_lower("cl")) +ExeBasename = "clang-cl"; DiagClient->setPrefix(ExeBasename); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51134: win: Omit ".exe" from clang and clang-cl driver-level diagnostics.
thakis closed this revision. thakis added a comment. r340498, thanks! https://reviews.llvm.org/D51134 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46050: [Frontend] Avoid running plugins during code completion parse
thakis accepted this revision. thakis added inline comments. This revision is now accepted and ready to land. Comment at: test/Index/complete-and-plugins.c:3 + +// RUN: c-index-test -code-completion-at=%s:6:1 -load %llvmshlibdir/PrintFunctionNames%pluginext -add-plugin print-fns %s | FileCheck %s +// REQUIRES: plugins, examples nit: usually the RUN lines go above the C code, not below it. https://reviews.llvm.org/D46050 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46820: Fix __uuidof handling on non-type template parameter in C++17
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. lgtm, but: Comment at: test/SemaCXX/PR24986.cpp:12 + f<&__uuidof(0)>(); +} Maybe this test could be in test/SemaCXX/ms-uuid.cpp instead? Repository: rC Clang https://reviews.llvm.org/D46820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46820: Fix __uuidof handling on non-type template parameter in C++17
thakis closed this revision. thakis added a comment. r332614, thanks! Repository: rC Clang https://reviews.llvm.org/D46820 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46929: Fix a mangling failure on clang-cl C++17
thakis added a comment. Please do, tzik doesn't have commit access yet. Repository: rC Clang https://reviews.llvm.org/D46929 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46910: [Support] Avoid normalization in sys::getDefaultTargetTriple
thakis added a comment. This changes the default triple on Windows from x86_64-pc-win32 to x86_64-pc-windows-msvc. This breaks at least Repository: rC Clang https://reviews.llvm.org/D46910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46910: [Support] Avoid normalization in sys::getDefaultTargetTriple
thakis added a comment. (sorry, hit cmd-return accidentally, I will come in again…) Repository: rC Clang https://reviews.llvm.org/D46910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46910: [Support] Avoid normalization in sys::getDefaultTargetTriple
thakis added a comment. This changes the default triple on Windows from x86_64-pc-win32 to x86_64-pc-windows-msvc. This breaks at least lit's make_itanium_abi_triple() (http://llvm-cs.pcc.me.uk/utils/lit/lit/llvm/config.py#234) def make_itanium_abi_triple(self, triple): m = re.match(r'(\w+)-(\w+)-(\w+)', triple) if not m: self.lit_config.fatal( "Could not turn '%s' into Itanium ABI triple" % triple) if m.group(3).lower() != 'win32': # All non-win32 triples use the Itanium ABI. return triple return m.group(1) + '-' + m.group(2) + '-mingw32' which in turn breaks %itanium_abi_triple in lit tests, which then breaks some 257 tests on Windows. (Also visible on http://lab.llvm.org:8011/builders/clang-x64-ninja-win7 , but that bot has been broken for a long time.) So I'll revert this for now. Repository: rC Clang https://reviews.llvm.org/D46910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46910: [Support] Avoid normalization in sys::getDefaultTargetTriple
thakis added a comment. …hm looks like https://reviews.llvm.org/rL332750 touched files in both clang and llvm, which is probably why the diff looks super confusing on phab. I'll revert it in two pieces, I don't know how to commit changes to llvm and clang in one revision. Repository: rC Clang https://reviews.llvm.org/D46910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46910: [Support] Avoid normalization in sys::getDefaultTargetTriple
thakis added a comment. Reverted in r332822 / r332823. Repository: rC Clang https://reviews.llvm.org/D46910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46910: [Support] Avoid normalization in sys::getDefaultTargetTriple
thakis added a comment. > Sorry about the breakage, I wasn't aware of that test failure and never got > any email (probably because the bot has been red before). I'll try to fix > make_itanium_abi_triple and test it on my Windows box tomorrow before > resubmitting. Thanks, sounds good. Reading the history of the review a bit, it sounds like Reid did try to test this on Windows. My guess is that he didn't create a completely new build directory, and that cmake's cache made it so that he didn't see all the changes that are in here. (Our bots always blow away the cmake cache on each build for this reason.) So make sure to create a fresh build dir for each local iteration of the patch when you test this. > The change was made through monorepo and submitted via `git llvm push` which > allows changing multiple projects in one commit. Is there some toggle necessary to make it so that all parts of the patch show up on phab? For this issue, phab only displays the clang bit, which confused me for a while. Repository: rC Clang https://reviews.llvm.org/D46910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47480: clang-cl: Expose -no-canonical-prefixes
thakis created this revision. thakis added a reviewer: rnk. -no-canonical-prefixes is a weird flag: In gcc, it controls whether realpath() is called on the path of the driver binary. It's needed to support some usecases where gcc is symlinked to, see https://gcc.gnu.org/ml/gcc/2011-01/msg00429.html for some background. In clang, the resource dir is found relative to the compiler binary, and without -no-canonical-prefixes that's an absolute path. For clang, the main use case for -no-canonical-prefixes is to make the -resource-dir path added by the driver relative instead of absolute. Making it relative seems like the better default, but since neither clang not gcc have -canonical-prefixes without no- which makes changing the default tricky, and since some symlink behaviors do depend on the realpath() call at least for gcc, just expose -no-canonical-prefixes in clang-cl mode. Alternatively we could default to no-canonical-prefix-mode for clang-cl since it's less likely to be used in symlinked scenarios, but since you already need to about -no-canonical-prefixes for the non-clang-cl bits of your build, not hooking this of driver mode seems better to me. https://reviews.llvm.org/D47480 Files: include/clang/Driver/Options.td test/Driver/cl-options.c Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -2251,7 +2251,7 @@ def multiply__defined__unused : Separate<["-"], "multiply_defined_unused">; def multiply__defined : Separate<["-"], "multiply_defined">; def mwarn_nonportable_cfstrings : Flag<["-"], "mwarn-nonportable-cfstrings">, Group; -def no_canonical_prefixes : Flag<["-"], "no-canonical-prefixes">, Flags<[HelpHidden]>, +def no_canonical_prefixes : Flag<["-"], "no-canonical-prefixes">, Flags<[HelpHidden, CoreOption]>, HelpText<"Use relative instead of canonical paths">; def no_cpp_precomp : Flag<["-"], "no-cpp-precomp">, Group; def no_integrated_cpp : Flag<["-", "--"], "no-integrated-cpp">, Flags<[DriverOption]>; Index: test/Driver/cl-options.c === --- test/Driver/cl-options.c +++ test/Driver/cl-options.c @@ -591,6 +591,8 @@ // RUN: -flimit-debug-info \ // RUN: -flto \ // RUN: -fmerge-all-constants \ +// RUN: -no-canonical-prefixes \ +// RUN: -fno-coverage-mapping \ // RUN: --version \ // RUN: -Werror /Zs -- %s 2>&1 Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -2251,7 +2251,7 @@ def multiply__defined__unused : Separate<["-"], "multiply_defined_unused">; def multiply__defined : Separate<["-"], "multiply_defined">; def mwarn_nonportable_cfstrings : Flag<["-"], "mwarn-nonportable-cfstrings">, Group; -def no_canonical_prefixes : Flag<["-"], "no-canonical-prefixes">, Flags<[HelpHidden]>, +def no_canonical_prefixes : Flag<["-"], "no-canonical-prefixes">, Flags<[HelpHidden, CoreOption]>, HelpText<"Use relative instead of canonical paths">; def no_cpp_precomp : Flag<["-"], "no-cpp-precomp">, Group; def no_integrated_cpp : Flag<["-", "--"], "no-integrated-cpp">, Flags<[DriverOption]>; Index: test/Driver/cl-options.c === --- test/Driver/cl-options.c +++ test/Driver/cl-options.c @@ -591,6 +591,8 @@ // RUN: -flimit-debug-info \ // RUN: -flto \ // RUN: -fmerge-all-constants \ +// RUN: -no-canonical-prefixes \ +// RUN: -fno-coverage-mapping \ // RUN: --version \ // RUN: -Werror /Zs -- %s 2>&1 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47480: clang-cl: Expose -no-canonical-prefixes
thakis added a comment. I did test this locally before sending it out, and the -resource-dir arg passed to cc1 is relative with this patch: $ bin/clang-cl -no-canonical-prefixes -c test.cc -### clang version 7.0.0 Target: x86_64-pc-windows-msvc Thread model: posix InstalledDir: bin "bin/clang-cl" "-cc1" "-triple" "x86_64-pc-windows-msvc19.11.0" "-emit-obj" "-mrelax-all" "-mincremental-linker-compatible" "-disable-free" "-main-file-name" "test.cc" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-relaxed-aliasing" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-mllvm" "-x86-asm-syntax=intel" "-D_MT" "-flto-visibility-public-std" "--dependent-lib=libcmt" "--dependent-lib=oldnames" "-stack-protector" "2" "-fms-volatile" "-fdiagnostics-format" "msvc" "-dwarf-column-info" "-debugger-tuning=gdb" "-target-linker-version" "305" "-momit-leaf-frame-pointer" "-coverage-notes-file" "/Users/thakis/src/llvm-mono/test.gcno" "-resource-dir" "lib/clang/7.0.0" "-internal-isystem" "lib/clang/7.0.0/include" "-fdeprecated-macro" "-fdebug-compilation-dir" "/Users/thakis/src/llvm-mono" "-ferror-limit" "19" "-fmessage-length" "254" "-fno-use-cxa-atexit" "-fms-extensions" "-fms-compatibility" "-fms-compatibility-version=19.11" "-std=c++14" "-fdelayed-template-parsing" "-fobjc-runtime=gcc" "-fseh-exceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-o" "test.obj" "-x" "c++" "test.cc" driver.cpp handles this directly here http://llvm-cs.pcc.me.uk/tools/clang/tools/driver/driver.cpp#54 and here http://llvm-cs.pcc.me.uk/tools/clang/tools/driver/driver.cpp#390 -- what's the problem with the InitLLVM call you point at? https://reviews.llvm.org/D47480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47480: clang-cl: Expose -no-canonical-prefixes
thakis added a subscriber: rnk. thakis added a comment. But GetExecutablePath isn't called if -no-canonical-prefixes is passed, is it? (See the first link I pasted above) https://reviews.llvm.org/D47480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38291: clang-format/java: Unbreak genenrics formatting after r299952.
thakis created this revision. Herald added a subscriber: klimek. https://reviews.llvm.org/rL299952 merged '>>>' tokens into a single JavaRightLogicalShift token. This broke formatting of generics nested more than two deep, e.g. `Foo>>` because the '>>>' now weren't three '>' for parseAngle(). Luckily, just deleting JavaRightLogicalShift fixes things without breaking the test added in r299952, so do that. https://reviews.llvm.org/D38291 Files: lib/Format/FormatTokenLexer.cpp lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestJava.cpp Index: unittests/Format/FormatTestJava.cpp === --- unittests/Format/FormatTestJava.cpp +++ unittests/Format/FormatTestJava.cpp @@ -333,6 +333,11 @@ verifyFormat("Iterable a;"); verifyFormat("A.doSomething();"); + verifyFormat("A.>doSomething();"); + verifyFormat("A.>>doSomething();"); + verifyFormat("A.>>>doSomething();"); + + verifyFormat("OrderedPair>> p = null;"); verifyFormat("@Override\n" "public Map getAll() {}"); Index: lib/Format/TokenAnnotator.cpp === --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -47,7 +47,7 @@ if (NonTemplateLess.count(CurrentToken->Previous)) return false; -const FormatToken &Previous = *CurrentToken->Previous; +const FormatToken &Previous = *CurrentToken->Previous; // The '<'. if (Previous.Previous) { if (Previous.Previous->Tok.isLiteral()) return false; @@ -2323,7 +2323,7 @@ if (Left.is(TT_TemplateCloser) && Left.MatchingParen && Left.MatchingParen->Previous && Left.MatchingParen->Previous->is(tok::period)) -// A.DoSomething(); +// A.>>DoSomething(); return false; if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) return false; Index: lib/Format/FormatTokenLexer.cpp === --- lib/Format/FormatTokenLexer.cpp +++ lib/Format/FormatTokenLexer.cpp @@ -96,12 +96,8 @@ } if (Style.Language == FormatStyle::LK_Java) { -static const tok::TokenKind JavaRightLogicalShift[] = { -tok::greater, tok::greater, tok::greater}; static const tok::TokenKind JavaRightLogicalShiftAssign[] = { tok::greater, tok::greater, tok::greaterequal}; -if (tryMergeTokens(JavaRightLogicalShift, TT_BinaryOperator)) - return; if (tryMergeTokens(JavaRightLogicalShiftAssign, TT_BinaryOperator)) return; } Index: unittests/Format/FormatTestJava.cpp === --- unittests/Format/FormatTestJava.cpp +++ unittests/Format/FormatTestJava.cpp @@ -333,6 +333,11 @@ verifyFormat("Iterable a;"); verifyFormat("A.doSomething();"); + verifyFormat("A.>doSomething();"); + verifyFormat("A.>>doSomething();"); + verifyFormat("A.>>>doSomething();"); + + verifyFormat("OrderedPair>> p = null;"); verifyFormat("@Override\n" "public Map getAll() {}"); Index: lib/Format/TokenAnnotator.cpp === --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -47,7 +47,7 @@ if (NonTemplateLess.count(CurrentToken->Previous)) return false; -const FormatToken &Previous = *CurrentToken->Previous; +const FormatToken &Previous = *CurrentToken->Previous; // The '<'. if (Previous.Previous) { if (Previous.Previous->Tok.isLiteral()) return false; @@ -2323,7 +2323,7 @@ if (Left.is(TT_TemplateCloser) && Left.MatchingParen && Left.MatchingParen->Previous && Left.MatchingParen->Previous->is(tok::period)) -// A.DoSomething(); +// A.>>DoSomething(); return false; if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) return false; Index: lib/Format/FormatTokenLexer.cpp === --- lib/Format/FormatTokenLexer.cpp +++ lib/Format/FormatTokenLexer.cpp @@ -96,12 +96,8 @@ } if (Style.Language == FormatStyle::LK_Java) { -static const tok::TokenKind JavaRightLogicalShift[] = { -tok::greater, tok::greater, tok::greater}; static const tok::TokenKind JavaRightLogicalShiftAssign[] = { tok::greater, tok::greater, tok::greaterequal}; -if (tryMergeTokens(JavaRightLogicalShift, TT_BinaryOperator)) - return; if (tryMergeTokens(JavaRightLogicalShiftAssign, TT_BinaryOperator)) return; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38291: clang-format/java: Unbreak genenrics formatting after r299952.
thakis closed this revision. thakis added a comment. r314325, thanks! https://reviews.llvm.org/D38291 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38646: [MS] Raise the default value of _MSC_VER to 1910, which is in VS 2017
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. Thanks! Should probably get a release note too. https://reviews.llvm.org/D38646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38954: [Sema] -Wzero-as-null-pointer-constant: don't warn for system macros.
thakis added a comment. As said on the bug, this matches gcc's behavior, and with this you won't see this warning for NULL. I don't think this is better. Repository: rL LLVM https://reviews.llvm.org/D38954 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D18953: [ms][dll] #26935 Defining a dllimport function should cause it to be exported
thakis added inline comments. Comment at: cfe/trunk/lib/Sema/SemaDecl.cpp:5650 + NewImportAttr->getRange(), S.Context, + NewImportAttr->getSpellingListIndex())); +} else { NewImportAttr can be nullptr here, at least for invalid code. This change introduced https://bugs.llvm.org/show_bug.cgi?id=34981 , please take a look. Repository: rL LLVM https://reviews.llvm.org/D18953 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39104: Allow /showIncludes with /P
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. Thanks! https://reviews.llvm.org/D39104 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51545: Enable -Wtautological-unsigned-zero-compare under -Wextra
thakis added a comment. We don't match gcc's -Wextra behvior. We generally try to not put a ton of stuff in Wextra that isn't in -Wall. (We also generally don't put a lot of stuff in -Wall that isn't enabled by default.) So I don't think we want this. https://reviews.llvm.org/D51545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51635: clang-cl: Pass /Brepro to linker if it was passed to the compiler
thakis created this revision. thakis added a reviewer: hans. /Brepro currently is just an alias for -mno-incremental-linker-compatible and before this patch only controlled if we write a timestamp into the output obj file. But cl.exe also passes it on to link.exe (where it controls whether the final PE image timestamp really is a timestamp or a hash of the output). It's a bit weird to overload -mno-incremental-linker-compatible to also pass /Brepro to the linker, but all alternatives are a bit weird too. Open for suggestions though :-) https://reviews.llvm.org/D51635 Files: clang/lib/Driver/ToolChains/MSVC.cpp clang/test/Driver/msvc-link.c Index: clang/test/Driver/msvc-link.c === --- clang/test/Driver/msvc-link.c +++ clang/test/Driver/msvc-link.c @@ -3,6 +3,7 @@ // BASIC: "-out:a.exe" // BASIC: "-defaultlib:libcmt" // BASIC: "-nologo" +// BASIC-NOT: "-Brepro" // RUN: %clang -target i686-pc-windows-msvc -shared -o a.dll -### %s 2>&1 | FileCheck --check-prefix=DLL %s // DLL: link.exe" @@ -16,3 +17,14 @@ // LIBPATH: "-libpath:/usr/lib" // LIBPATH: "-nologo" +// RUN: %clang_cl /Brepro -### %s 2>&1 | FileCheck --check-prefix=REPRO %s +// REPRO: link.exe" +// REPRO: "-out:msvc-link.exe" +// REPRO: "-nologo" +// REPRO: "-Brepro" + +// RUN: %clang_cl /Brepro- -### %s 2>&1 | FileCheck --check-prefix=NOREPRO %s +// NOREPRO: link.exe" +// NOREPRO: "-out:msvc-link.exe" +// NOREPRO: "-nologo" +// NOREPRO-NOT: "-Brepro" Index: clang/lib/Driver/ToolChains/MSVC.cpp === --- clang/lib/Driver/ToolChains/MSVC.cpp +++ clang/lib/Driver/ToolChains/MSVC.cpp @@ -355,6 +355,15 @@ options::OPT__SLASH_Zd)) CmdArgs.push_back("-debug"); + // Pass on /Brepro if it was passed to the compiler. + // Note that /Brepro maps to -mno-incremental-linker-compatible. + bool DefaultIncrementalLinkerCompatible = + C.getDefaultToolChain().getTriple().isWindowsMSVCEnvironment(); + if (!Args.hasFlag(options::OPT_mincremental_linker_compatible, +options::OPT_mno_incremental_linker_compatible, +DefaultIncrementalLinkerCompatible)) +CmdArgs.push_back("-Brepro"); + bool DLL = Args.hasArg(options::OPT__SLASH_LD, options::OPT__SLASH_LDd, options::OPT_shared); if (DLL) { Index: clang/test/Driver/msvc-link.c === --- clang/test/Driver/msvc-link.c +++ clang/test/Driver/msvc-link.c @@ -3,6 +3,7 @@ // BASIC: "-out:a.exe" // BASIC: "-defaultlib:libcmt" // BASIC: "-nologo" +// BASIC-NOT: "-Brepro" // RUN: %clang -target i686-pc-windows-msvc -shared -o a.dll -### %s 2>&1 | FileCheck --check-prefix=DLL %s // DLL: link.exe" @@ -16,3 +17,14 @@ // LIBPATH: "-libpath:/usr/lib" // LIBPATH: "-nologo" +// RUN: %clang_cl /Brepro -### %s 2>&1 | FileCheck --check-prefix=REPRO %s +// REPRO: link.exe" +// REPRO: "-out:msvc-link.exe" +// REPRO: "-nologo" +// REPRO: "-Brepro" + +// RUN: %clang_cl /Brepro- -### %s 2>&1 | FileCheck --check-prefix=NOREPRO %s +// NOREPRO: link.exe" +// NOREPRO: "-out:msvc-link.exe" +// NOREPRO: "-nologo" +// NOREPRO-NOT: "-Brepro" Index: clang/lib/Driver/ToolChains/MSVC.cpp === --- clang/lib/Driver/ToolChains/MSVC.cpp +++ clang/lib/Driver/ToolChains/MSVC.cpp @@ -355,6 +355,15 @@ options::OPT__SLASH_Zd)) CmdArgs.push_back("-debug"); + // Pass on /Brepro if it was passed to the compiler. + // Note that /Brepro maps to -mno-incremental-linker-compatible. + bool DefaultIncrementalLinkerCompatible = + C.getDefaultToolChain().getTriple().isWindowsMSVCEnvironment(); + if (!Args.hasFlag(options::OPT_mincremental_linker_compatible, +options::OPT_mno_incremental_linker_compatible, +DefaultIncrementalLinkerCompatible)) +CmdArgs.push_back("-Brepro"); + bool DLL = Args.hasArg(options::OPT__SLASH_LD, options::OPT__SLASH_LDd, options::OPT_shared); if (DLL) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51354: Fix the -print-multi-directory flag to print the selected multilib.
thakis added a comment. The test fails on my system like so: -- FAIL: Clang :: Driver/print-multi-directory.c (4696 of 13174) TEST 'Clang :: Driver/print-multi-directory.c' FAILED Script: -- : 'RUN: at line 1'; /usr/local/google/home/thakis/src/llvm-build-goma/bin/clang -no-canonical-prefixes /usr/local/google/home/thakis/src/llvm-rw/tools/clang/test/Driver/print-multi-directory.c -### -o /usr/local/google/home/thakis/src/llvm-build-goma/tools/clang/test/Driver/Output/print-multi-directory.c.tmp.o 2>&1 -target i386-none-linux -print-multi-directory| /usr/local/google/home/thakis/src/llvm-build-goma/bin/FileCheck --check-prefix=CHECK-X86-MULTILIBS /usr/local/google/home/thakis/src/llvm-rw/tools/clang/test/Driver/print-multi-directory.c : 'RUN: at line 10'; /usr/local/google/home/thakis/src/llvm-build-goma/bin/clang -no-canonical-prefixes /usr/local/google/home/thakis/src/llvm-rw/tools/clang/test/Driver/print-multi-directory.c -### -o /usr/local/google/home/thakis/src/llvm-build-goma/tools/clang/test/Driver/Output/print-multi-directory.c.tmp.o 2>&1 -target i386-none-linux -m64 -print-multi-directory| /usr/local/google/home/thakis/src/llvm-build-goma/bin/FileCheck --check-prefix=CHECK-X86_64-MULTILIBS /usr/local/google/home/thakis/src/llvm-rw/tools/clang/test/Driver/print-multi-directory.c : 'RUN: at line 19'; /usr/local/google/home/thakis/src/llvm-build-goma/bin/clang -no-canonical-prefixes /usr/local/google/home/thakis/src/llvm-rw/tools/clang/test/Driver/print-multi-directory.c -### -o /usr/local/google/home/thakis/src/llvm-build-goma/tools/clang/test/Driver/Output/print-multi-directory.c.tmp.o 2>&1 -target arm-linux-androideabi21 -stdlib=libstdc++ -mthumb -B/usr/local/google/home/thakis/src/llvm-rw/tools/clang/test/Driver/Inputs/basic_android_ndk_tree --sysroot=/usr/local/google/home/thakis/src/llvm-rw/tools/clang/test/Driver/Inputs/basic_android_ndk_tree/sysroot -print-multi-directory| /usr/local/google/home/thakis/src/llvm-build-goma/bin/FileCheck --check-prefix=CHECK-ARM-MULTILIBS /usr/local/google/home/thakis/src/llvm-rw/tools/clang/test/Driver/print-multi-directory.c -- Exit Code: 1 Command Output (stderr): -- /usr/local/google/home/thakis/src/llvm-rw/tools/clang/test/Driver/print-multi-directory.c:6:25: error: CHECK-X86-MULTILIBS: expected string not found in input // CHECK-X86-MULTILIBS: 32 ^ :1:1: note: scanning from here clang version 8.0.0 (trunk 341389) ^ :1:28: note: possible intended match here clang version 8.0.0 (trunk 341389) ^ -- Repository: rC Clang https://reviews.llvm.org/D51354 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45179: [libc++] Add _LIBCPP_ENABLE_NODISCARD and _LIBCPP_NODISCARD_EXT to allow pre-C++2a [[nodiscard]]
thakis added a comment. What's the status here? Did this land? https://reviews.llvm.org/D45179 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51784: ms: Insert $$Z in mangling between directly consecutive parameter packs.
thakis created this revision. thakis added a reviewer: rnk. Fixes PR38783. For comparing: https://godbolt.org/z/XBSdiq https://reviews.llvm.org/D51784 Files: clang/lib/AST/MicrosoftMangle.cpp clang/test/CodeGenCXX/mangle-ms-templates.cpp Index: clang/test/CodeGenCXX/mangle-ms-templates.cpp === --- clang/test/CodeGenCXX/mangle-ms-templates.cpp +++ clang/test/CodeGenCXX/mangle-ms-templates.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s -// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s +// RUN: %clang_cc1 -std=c++11 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s template class Class { @@ -185,13 +185,33 @@ // Unlike Itanium, there is no character code to indicate an argument pack. // Tested with MSVC 2013, the first version which supports variadic templates. -template void variadic_fn_template(const Ts &...args) { } +template void variadic_fn_template(const Ts &...args); +template +void multi_variadic_fn(Ts... ts, Us... us); +template +void multi_variadic_mixed(Ts... ts, C c, Us... us); void variadic_fn_instantiate() { variadic_fn_template(0, 1, 3, 4); variadic_fn_template(0, 1, 'a', "b"); + + multi_variadic_fn(1, 2, 3, 4, 5); + multi_variadic_fn(1, 2, 3, 4, 5); + + multi_variadic_mixed(1, 2, 3); + multi_variadic_mixed(1, 2, 3, 4); } // CHECK: "??$variadic_fn_template@@@YAXABH000@Z" +// X64: "??$variadic_fn_template@@@YAXAEBH000@Z" // CHECK: "??$variadic_fn_template@HHD$$BY01D@@YAXABH0ABDAAY01$$CBD@Z" +// X64: "??$variadic_fn_template@HHD$$BY01D@@YAXAEBH0AEBDAEAY01$$CBD@Z" +// CHECK: "??$multi_variadic_fn@HH$$ZHHH@@YAXH@Z" +// X64: "??$multi_variadic_fn@HH$$ZHHH@@YAXH@Z" +// CHECK: "??$multi_variadic_fn@HHH$$ZHH@@YAXH@Z" +// X64: "??$multi_variadic_fn@HHH$$ZHH@@YAXH@Z" +// CHECK: "??$multi_variadic_mixed@HHH$$V@@YAXHHH@Z" +// X64: "??$multi_variadic_mixed@HHH$$V@@YAXHHH@Z" +// CHECK: "??$multi_variadic_mixed@@@YAX@Z" +// X64: "??$multi_variadic_mixed@@@YAX@Z" template struct VariadicClass { Index: clang/lib/AST/MicrosoftMangle.cpp === --- clang/lib/AST/MicrosoftMangle.cpp +++ clang/lib/AST/MicrosoftMangle.cpp @@ -1384,9 +1384,16 @@ assert(TPL->size() == TemplateArgs.size() && "size mismatch between args and parms!"); - unsigned Idx = 0; - for (const TemplateArgument &TA : TemplateArgs.asArray()) -mangleTemplateArg(TD, TA, TPL->getParam(Idx++)); + for (size_t i = 0; i < TemplateArgs.size(); ++i) { +const TemplateArgument &TA = TemplateArgs[i]; + +// Separate consecutive packs by $$Z. +if (i > 0 && TA.getKind() == TemplateArgument::Pack && +TemplateArgs[i - 1].getKind() == TemplateArgument::Pack) + Out << "$$Z"; + +mangleTemplateArg(TD, TA, TPL->getParam(i)); + } } void MicrosoftCXXNameMangler::mangleTemplateArg(const TemplateDecl *TD, Index: clang/test/CodeGenCXX/mangle-ms-templates.cpp === --- clang/test/CodeGenCXX/mangle-ms-templates.cpp +++ clang/test/CodeGenCXX/mangle-ms-templates.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s -// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s +// RUN: %clang_cc1 -std=c++11 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=i386-pc-win32 | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -fms-compatibility-version=19 -emit-llvm %s -o - -fms-extensions -fdelayed-template-parsing -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s template class Class { @@ -185,13 +185,33 @@ // Unlike Itanium, there is no character code to indicate an argument pack. // Tested with MSVC 2013, the first version which supports variadic templates. -template void variadic_fn_template(const Ts &...args) { } +template void variadic_fn_template(const Ts &...args); +template +void multi_variadic_fn(Ts... ts, Us... us); +template +void multi_variadic_mixed(Ts... ts, C c, Us... us); void variadic_fn_instantiate() { variadic_fn_template(0, 1, 3, 4); variadic_fn_template(0, 1, 'a', "b"); + + multi_variadic_fn(1, 2, 3, 4, 5); + multi_variadic_fn(1, 2, 3, 4, 5); + + multi_variadic_mixed(1, 2, 3); + multi_variadic_mixed(1, 2, 3, 4); } //
[PATCH] D51784: ms: Insert $$Z in mangling between directly consecutive parameter packs.
thakis added inline comments. Comment at: clang/test/CodeGenCXX/mangle-ms-templates.cpp:201 + multi_variadic_mixed(1, 2, 3); + multi_variadic_mixed(1, 2, 3, 4); } These notably don't get a $$Z because there's a regular template parameter in between. https://reviews.llvm.org/D51784 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49597: [ms] Fix mangling of vector types in QMM_Result contexts.
thakis created this revision. thakis added a reviewer: zturner. If QMM_Result is set (which it is for return types, RTTI descriptors, and exception type descriptors), tag types (structs, enums, classes, unions) get their qualifiers mangled in. __m64 and friends is a struct/union thingy in MSVC, but not in clang's headers. To make mangling work, we call `mangleArtificalTagType(TTK_Union/TTK_Struct` for the vector types to mangle them as tag types -- but the isa check when mangling in QMM_Result mode isn't true these vector types. Add an isArtificialTagType() function and check for that too. Fixes PR37276 and some other issues. I tried to audit all references to TagDecl and TagType in MicrosoftMangle.cpp to see if there are other places where we need to call mangleArtificalTagType(), but I couldn't find other places. I tried to audit all calls to mangleArtificalTagType() to see if isArtificialTagType() needs to handle more than just the vector types, but as far as I can tell all other types we use it for are types that MSVC can't handle at all (Objective-C types etc). https://reviews.llvm.org/D49597 Files: clang/lib/AST/MicrosoftMangle.cpp clang/test/CodeGenCXX/mangle-ms-vector-types.cpp Index: clang/test/CodeGenCXX/mangle-ms-vector-types.cpp === --- clang/test/CodeGenCXX/mangle-ms-vector-types.cpp +++ clang/test/CodeGenCXX/mangle-ms-vector-types.cpp @@ -1,30 +1,91 @@ -// RUN: %clang_cc1 -fms-extensions -ffreestanding -target-feature +avx -emit-llvm %s -o - -triple=i686-pc-win32 | FileCheck %s +// RUN: %clang_cc1 -fms-extensions -fcxx-exceptions -ffreestanding -target-feature +avx -emit-llvm %s -o - -triple=i686-pc-win32 | FileCheck %s #include #include #include +void thow(int i) { + switch (i) { +case 0: throw __m64(); +// CHECK: ??_R0?AT__m64@@@8 +// CHECK: _CT??_R0?AT__m64@@@88 +// CHECK: _CTA1?AT__m64@@ +// CHECK: _TI1?AT__m64@@ +case 1: throw __m128(); +// CHECK: ??_R0?AT__m128@@@8 +// CHECK: _CT??_R0?AT__m128@@@816 +// CHECK: _CTA1?AT__m128@@ +// CHECK: _TI1?AT__m128@@ +case 2: throw __m128d(); +// CHECK: ??_R0?AU__m128d@@@8 +// CHECK: _CT??_R0?AU__m128d@@@816 +// CHECK: _CTA1?AU__m128d@@ +// CHECK: _TI1?AU__m128d@@ +case 3: throw __m128i(); +// CHECK: ??_R0?AT__m128i@@@8 +// CHECK: _CT??_R0?AT__m128i@@@816 +// CHECK: _CTA1?AT__m128i@@ +// CHECK: _TI1?AT__m128i@@ +case 4: throw __m256(); +// CHECK: ??_R0?AT__m256@@@8 +// CHECK: _CT??_R0?AT__m256@@@832 +// CHECK: _CTA1?AT__m256@@ +// CHECK: _TI1?AT__m256@@ +case 5: throw __m256d(); +// CHECK: ??_R0?AU__m256d@@@8 +// CHECK: _CT??_R0?AU__m256d@@@832 +// CHECK: _CTA1?AU__m256d@@ +// CHECK: _TI1?AU__m256d@@ +case 6: throw __m256i(); +// CHECK: ??_R0?AT__m256@@@8 +// CHECK: _CT??_R0?AT__m256@@@832 +// CHECK: _CTA1?AT__m256@@ +// CHECK: _TI1?AT__m256@@ + } +} + void foo64(__m64) {} // CHECK: define dso_local void @"?foo64@@YAXT__m64@@@Z" +__m64 rfoo64() { return __m64(); } +// CHECK: define dso_local <1 x i64> @"?rfoo64@@YA?AT__m64@@XZ" + void foo128(__m128) {} // CHECK: define dso_local void @"?foo128@@YAXT__m128@@@Z" +__m128 rfoo128() { return __m128(); } +// CHECK: define dso_local <4 x float> @"?rfoo128@@YA?AT__m128@@XZ" + void foo128d(__m128d) {} // CHECK: define dso_local void @"?foo128d@@YAXU__m128d@@@Z" +__m128d rfoo128d() { return __m128d(); } +// CHECK: define dso_local <2 x double> @"?rfoo128d@@YA?AU__m128d@@XZ" + void foo128i(__m128i) {} // CHECK: define dso_local void @"?foo128i@@YAXT__m128i@@@Z" +__m128i rfoo128i() { return __m128i(); } +// CHECK: define dso_local <2 x i64> @"?rfoo128i@@YA?AT__m128i@@XZ" + void foo256(__m256) {} // CHECK: define dso_local void @"?foo256@@YAXT__m256@@@Z" +__m256 rfoo256() { return __m256(); } +// CHECK: define dso_local <8 x float> @"?rfoo256@@YA?AT__m256@@XZ" + void foo256d(__m256d) {} // CHECK: define dso_local void @"?foo256d@@YAXU__m256d@@@Z" +__m256d rfoo256d() { return __m256d(); } +// CHECK: define dso_local <4 x double> @"?rfoo256d@@YA?AU__m256d@@XZ" + void foo256i(__m256i) {} // CHECK: define dso_local void @"?foo256i@@YAXT__m256i@@@Z" +__m256i rfoo256i() { return __m256i(); } +// CHECK: define dso_local <4 x i64> @"?rfoo256i@@YA?AT__m256i@@XZ" + // We have a custom mangling for vector types not standardized by Intel. void foov8hi(__v8hi) {} // CHECK: define dso_local void @"?foov8hi@@YAXT?$__vector@F$07@__clang@@@Z" Index: clang/lib/AST/MicrosoftMangle.cpp === --- clang/lib/AST/MicrosoftMangle.cpp +++ clang/lib/AST/MicrosoftMangle.cpp @@ -337,6 +337,8 @@ void mangleArgumentType(QualType T, SourceRange Range); void manglePassObjectSizeArg(const PassObjectSizeAttr *POSA); + bool isArtificialTagType(QualType T) const; + // Declare manglers for every type class. #de
[PATCH] D49597: [ms] Fix mangling of vector types in QMM_Result contexts.
thakis added a comment. If you want to compare the CHECK lines to MSVC's output: https://godbolt.org/g/Cvf4p4 https://reviews.llvm.org/D49597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49606: [ms] Add __shiftleft128 / __shiftright128 intrinsics
thakis created this revision. thakis added a reviewer: craig.topper. cl.exe maps these to shld / shrd, so let's do the same. ISel has `Subtarget->isSHLDSlow()` to prevent use of these intrinsics on some machines, but honoring them feels a bit like trying to outsmart the intrinsics user, and there's n good way to get at that bit from here anyways. Fixes PR37755. (I tried for a while to implement this in C so that ISel could just do its thing, but couldn't hit the right pattern -- and ISel only does shld64, not shrd64, as far as I can tell.) https://reviews.llvm.org/D49606 Files: clang/lib/Headers/intrin.h clang/test/Headers/ms-intrin.cpp Index: clang/test/Headers/ms-intrin.cpp === --- clang/test/Headers/ms-intrin.cpp +++ clang/test/Headers/ms-intrin.cpp @@ -42,6 +42,8 @@ __stosw(0, 0, 0); #ifdef _M_X64 + __shiftleft128(1, 2, 3); + __shiftright128(1, 2, 3); __movsq(0, 0, 0); __stosq(0, 0, 0); #endif Index: clang/lib/Headers/intrin.h === --- clang/lib/Headers/intrin.h +++ clang/lib/Headers/intrin.h @@ -853,6 +853,18 @@ __asm__ volatile ("nop"); } #endif +#if defined(__x86_64__) +static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS +__shiftleft128(unsigned __int64 l, unsigned __int64 h, unsigned char d) { + __asm__ __volatile__ ("shldq %1, %2, %0" : "+r"(h) : "c"(d), "r"(l)); + return h; +} +static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS +__shiftright128(unsigned __int64 l, unsigned __int64 h, unsigned char d) { + __asm__ __volatile__ ("shrdq %1, %2, %0" : "+r"(l) : "c"(d), "r"(h)); + return l; +} +#endif /**\ |* Privileged intrinsics Index: clang/test/Headers/ms-intrin.cpp === --- clang/test/Headers/ms-intrin.cpp +++ clang/test/Headers/ms-intrin.cpp @@ -42,6 +42,8 @@ __stosw(0, 0, 0); #ifdef _M_X64 + __shiftleft128(1, 2, 3); + __shiftright128(1, 2, 3); __movsq(0, 0, 0); __stosq(0, 0, 0); #endif Index: clang/lib/Headers/intrin.h === --- clang/lib/Headers/intrin.h +++ clang/lib/Headers/intrin.h @@ -853,6 +853,18 @@ __asm__ volatile ("nop"); } #endif +#if defined(__x86_64__) +static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS +__shiftleft128(unsigned __int64 l, unsigned __int64 h, unsigned char d) { + __asm__ __volatile__ ("shldq %1, %2, %0" : "+r"(h) : "c"(d), "r"(l)); + return h; +} +static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS +__shiftright128(unsigned __int64 l, unsigned __int64 h, unsigned char d) { + __asm__ __volatile__ ("shrdq %1, %2, %0" : "+r"(l) : "c"(d), "r"(h)); + return l; +} +#endif /**\ |* Privileged intrinsics ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49606: [ms] Add __shiftleft128 / __shiftright128 intrinsics
thakis added a comment. We have __int128. If you think hitting the pattern is preferable to inline asm, I can try to give that a try, either via C or via CGBuiltin.cpp. https://reviews.llvm.org/D49606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49606: [ms] Add __shiftleft128 / __shiftright128 intrinsics
thakis updated this revision to Diff 156596. thakis edited the summary of this revision. https://reviews.llvm.org/D49606 Files: clang/lib/Headers/intrin.h clang/test/Headers/ms-intrin.cpp Index: clang/test/Headers/ms-intrin.cpp === --- clang/test/Headers/ms-intrin.cpp +++ clang/test/Headers/ms-intrin.cpp @@ -42,6 +42,8 @@ __stosw(0, 0, 0); #ifdef _M_X64 + __shiftleft128(1, 2, 3); + __shiftright128(1, 2, 3); __movsq(0, 0, 0); __stosq(0, 0, 0); #endif Index: clang/lib/Headers/intrin.h === --- clang/lib/Headers/intrin.h +++ clang/lib/Headers/intrin.h @@ -853,6 +853,20 @@ __asm__ volatile ("nop"); } #endif +#if defined(__x86_64__) +static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS +__shiftleft128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) { + unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l; + unsigned __int128 __res = __val << (__d & 63); + return (unsigned __int64)(__res >> 64); +} +static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS +__shiftright128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) { + unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l; + unsigned __int128 __res = __val >> (__d & 63); + return (unsigned __int64)__res; +} +#endif /**\ |* Privileged intrinsics Index: clang/test/Headers/ms-intrin.cpp === --- clang/test/Headers/ms-intrin.cpp +++ clang/test/Headers/ms-intrin.cpp @@ -42,6 +42,8 @@ __stosw(0, 0, 0); #ifdef _M_X64 + __shiftleft128(1, 2, 3); + __shiftright128(1, 2, 3); __movsq(0, 0, 0); __stosq(0, 0, 0); #endif Index: clang/lib/Headers/intrin.h === --- clang/lib/Headers/intrin.h +++ clang/lib/Headers/intrin.h @@ -853,6 +853,20 @@ __asm__ volatile ("nop"); } #endif +#if defined(__x86_64__) +static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS +__shiftleft128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) { + unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l; + unsigned __int128 __res = __val << (__d & 63); + return (unsigned __int64)(__res >> 64); +} +static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS +__shiftright128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) { + unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l; + unsigned __int128 __res = __val >> (__d & 63); + return (unsigned __int64)__res; +} +#endif /**\ |* Privileged intrinsics ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49606: [ms] Add __shiftleft128 / __shiftright128 intrinsics
thakis added a comment. Now with C builtins which get nicely optimized. https://reviews.llvm.org/D49606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49606: [ms] Add __shiftleft128 / __shiftright128 intrinsics
thakis added a comment. Isn't implementing this in plain old C the nicest approach anyhow, even once funnel shift exists? https://reviews.llvm.org/D49606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49606: [ms] Add __shiftleft128 / __shiftright128 intrinsics
thakis closed this revision. thakis added a comment. r337619, thanks! The hoisting point is a good one; will rewrite using funnelshift once that's possible :-) https://reviews.llvm.org/D49606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49597: [ms] Fix mangling of vector types in QMM_Result contexts.
thakis added a comment. rnk, since zturner is out until Thu, can you take a look? https://reviews.llvm.org/D49597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49597: [ms] Fix mangling of vector types in QMM_Result contexts.
thakis updated this revision to Diff 156858. thakis added a comment. Address comments. https://reviews.llvm.org/D49597 Files: clang/lib/AST/MicrosoftMangle.cpp clang/test/CodeGenCXX/mangle-ms-vector-types.cpp Index: clang/test/CodeGenCXX/mangle-ms-vector-types.cpp === --- clang/test/CodeGenCXX/mangle-ms-vector-types.cpp +++ clang/test/CodeGenCXX/mangle-ms-vector-types.cpp @@ -1,30 +1,91 @@ -// RUN: %clang_cc1 -fms-extensions -ffreestanding -target-feature +avx -emit-llvm %s -o - -triple=i686-pc-win32 | FileCheck %s +// RUN: %clang_cc1 -fms-extensions -fcxx-exceptions -ffreestanding -target-feature +avx -emit-llvm %s -o - -triple=i686-pc-win32 | FileCheck %s #include #include #include +void thow(int i) { + switch (i) { +case 0: throw __m64(); +// CHECK: ??_R0?AT__m64@@@8 +// CHECK: _CT??_R0?AT__m64@@@88 +// CHECK: _CTA1?AT__m64@@ +// CHECK: _TI1?AT__m64@@ +case 1: throw __m128(); +// CHECK: ??_R0?AT__m128@@@8 +// CHECK: _CT??_R0?AT__m128@@@816 +// CHECK: _CTA1?AT__m128@@ +// CHECK: _TI1?AT__m128@@ +case 2: throw __m128d(); +// CHECK: ??_R0?AU__m128d@@@8 +// CHECK: _CT??_R0?AU__m128d@@@816 +// CHECK: _CTA1?AU__m128d@@ +// CHECK: _TI1?AU__m128d@@ +case 3: throw __m128i(); +// CHECK: ??_R0?AT__m128i@@@8 +// CHECK: _CT??_R0?AT__m128i@@@816 +// CHECK: _CTA1?AT__m128i@@ +// CHECK: _TI1?AT__m128i@@ +case 4: throw __m256(); +// CHECK: ??_R0?AT__m256@@@8 +// CHECK: _CT??_R0?AT__m256@@@832 +// CHECK: _CTA1?AT__m256@@ +// CHECK: _TI1?AT__m256@@ +case 5: throw __m256d(); +// CHECK: ??_R0?AU__m256d@@@8 +// CHECK: _CT??_R0?AU__m256d@@@832 +// CHECK: _CTA1?AU__m256d@@ +// CHECK: _TI1?AU__m256d@@ +case 6: throw __m256i(); +// CHECK: ??_R0?AT__m256@@@8 +// CHECK: _CT??_R0?AT__m256@@@832 +// CHECK: _CTA1?AT__m256@@ +// CHECK: _TI1?AT__m256@@ + } +} + void foo64(__m64) {} // CHECK: define dso_local void @"?foo64@@YAXT__m64@@@Z" +__m64 rfoo64() { return __m64(); } +// CHECK: define dso_local <1 x i64> @"?rfoo64@@YA?AT__m64@@XZ" + void foo128(__m128) {} // CHECK: define dso_local void @"?foo128@@YAXT__m128@@@Z" +const __m128 rfoo128() { return __m128(); } +// CHECK: define dso_local <4 x float> @"?rfoo128@@YA?BT__m128@@XZ" + void foo128d(__m128d) {} // CHECK: define dso_local void @"?foo128d@@YAXU__m128d@@@Z" +volatile __m128d rfoo128d() { return __m128d(); } +// CHECK: define dso_local <2 x double> @"?rfoo128d@@YA?CU__m128d@@XZ" + void foo128i(__m128i) {} // CHECK: define dso_local void @"?foo128i@@YAXT__m128i@@@Z" +const volatile __m128i rfoo128i() { return __m128i(); } +// CHECK: define dso_local <2 x i64> @"?rfoo128i@@YA?DT__m128i@@XZ" + void foo256(__m256) {} // CHECK: define dso_local void @"?foo256@@YAXT__m256@@@Z" +__m256 rfoo256() { return __m256(); } +// CHECK: define dso_local <8 x float> @"?rfoo256@@YA?AT__m256@@XZ" + void foo256d(__m256d) {} // CHECK: define dso_local void @"?foo256d@@YAXU__m256d@@@Z" +__m256d rfoo256d() { return __m256d(); } +// CHECK: define dso_local <4 x double> @"?rfoo256d@@YA?AU__m256d@@XZ" + void foo256i(__m256i) {} // CHECK: define dso_local void @"?foo256i@@YAXT__m256i@@@Z" +__m256i rfoo256i() { return __m256i(); } +// CHECK: define dso_local <4 x i64> @"?rfoo256i@@YA?AT__m256i@@XZ" + // We have a custom mangling for vector types not standardized by Intel. void foov8hi(__v8hi) {} // CHECK: define dso_local void @"?foov8hi@@YAXT?$__vector@F$07@__clang@@@Z" Index: clang/lib/AST/MicrosoftMangle.cpp === --- clang/lib/AST/MicrosoftMangle.cpp +++ clang/lib/AST/MicrosoftMangle.cpp @@ -337,6 +337,8 @@ void mangleArgumentType(QualType T, SourceRange Range); void manglePassObjectSizeArg(const PassObjectSizeAttr *POSA); + bool isArtificialTagType(QualType T) const; + // Declare manglers for every type class. #define ABSTRACT_TYPE(CLASS, PARENT) #define NON_CANONICAL_TYPE(CLASS, PARENT) @@ -1751,7 +1753,7 @@ Quals.removeUnaligned(); if (Quals.hasObjCLifetime()) Quals = Quals.withoutObjCLifetime(); -if ((!IsPointer && Quals) || isa(T)) { +if ((!IsPointer && Quals) || isa(T) || isArtificialTagType(T)) { Out << '?'; mangleQualifiers(Quals, false); } @@ -2280,6 +2282,8 @@ mangleTagTypeKind(TD->getTagKind()); mangleName(TD); } + +// If you add a call to this, consider udpating isArtificialTagType() too. void MicrosoftCXXNameMangler::mangleArtificalTagType( TagTypeKind TK, StringRef UnqualifiedName, ArrayRef NestedNames) { // ::= {[]+ | []}? @ @@ -2468,6 +2472,26 @@ mangleArtificalTagType(TTK_Struct, TemplateMangling, {"__clang"}); } +// Returns true for types that mangleArtificalTagType() gets called for with +// TTK_Union, TTK_Struct, TTK_Class and where compatibility with MSVC's +// mangling matters. +// (It d
[PATCH] D49597: [ms] Fix mangling of vector types in QMM_Result contexts.
thakis marked 2 inline comments as done. thakis added a comment. Thanks! All done. https://reviews.llvm.org/D49597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D49597: [ms] Fix mangling of vector types in QMM_Result contexts.
thakis closed this revision. thakis added a comment. r337732, thanks! https://reviews.llvm.org/D49597 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41102: Setup clang-doc frontend framework
thakis added a comment. This should be in clang-tools-extra next to clang-tidy, clang-include-fixer, clangd etc, not in the main compiler repo, right? https://reviews.llvm.org/D41102 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34249: [libc++] Don't use UTIME_OMIT to detect utimensat on Apple
thakis added a comment. I went ahead and landed this with the comments requested by Duncan in r324385. (http://llvm.org/viewvc/llvm-project?view=revision&revision=324385) I'm also quoting Duncan's email reply to my comment, since that's not showing up on phab: """ Using runtime availability checking doesn't make sense for a system Libc++, as you point out. If we add runtime checks they ought to be non-default, and hidden behind configuration flags. Also, do I remember correctly that __builtin_available requires linking against Foundation (and thus the Obj-C runtime) for NSProcessInfo, or has that dependency been removed/avoided? It would be surprising for the C++ standard library to pull in the Objective-C runtime. A reasonable configuration option, but not a reasonable default behaviour IMO. """ https://reviews.llvm.org/D34249 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D36191: [CodeGen] Don't make availability attributes imply default visibility on macos
thakis added a comment. Herald added a subscriber: llvm-commits. What's the status here? Repository: rL LLVM https://reviews.llvm.org/D36191 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D36191: [CodeGen] Don't make availability attributes imply default visibility on macos
thakis added a comment. Err sorry, landed in https://reviews.llvm.org/rL310382. Repository: rL LLVM https://reviews.llvm.org/D36191 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43110: [Sema] Don't mark plain MS enums as fixed
thakis added a comment. Nice! Test? https://reviews.llvm.org/D43110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43221: Teach Wreturn-type, Wunreachable-code, and alpha.deadcode.UnreachableCode to treat __assume(0) like __builtin_unreachable.
thakis created this revision. thakis added reviewers: rsmith, rnk. Herald added a subscriber: whisperity. Fixes PR29134. https://reviews.llvm.org/D43221 Files: include/clang/AST/Expr.h lib/AST/Expr.cpp lib/Analysis/CFG.cpp lib/Analysis/ReachableCode.cpp lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp test/Analysis/unreachable-code-path.c test/Sema/return.c test/Sema/warn-unreachable.c Index: test/Sema/warn-unreachable.c === --- test/Sema/warn-unreachable.c +++ test/Sema/warn-unreachable.c @@ -468,6 +468,7 @@ else return x; __builtin_unreachable(); // expected no warning + __builtin_assume(0); // expected no warning } int pr13910_bar(int x) { @@ -485,16 +486,19 @@ return x; pr13910_foo(x); // expected-warning {{code will never be executed}} __builtin_unreachable(); // expected no warning + __builtin_assume(0); // expected no warning pr13910_foo(x); // expected-warning {{code will never be executed}} } void pr13910_noreturn() { raze(); __builtin_unreachable(); // expected no warning + __builtin_assume(0); // expected no warning } void pr13910_assert() { myassert(0 && "unreachable"); return; __builtin_unreachable(); // expected no warning + __builtin_assume(0); // expected no warning } Index: test/Sema/return.c === --- test/Sema/return.c +++ test/Sema/return.c @@ -283,6 +283,18 @@ goto lbl; } +int test36a(int b) { + if (b) +return 43; + __builtin_unreachable(); +} + +int test36b(int b) { + if (b) +return 43; + __builtin_assume(0); +} + // PR19074. void abort(void) __attribute__((noreturn)); #define av_assert0(cond) do {\ Index: test/Analysis/unreachable-code-path.c === --- test/Analysis/unreachable-code-path.c +++ test/Analysis/unreachable-code-path.c @@ -63,6 +63,7 @@ if (c) return; if (!c) return; __builtin_unreachable(); // no-warning + __builtin_assume(0); // no-warning } // Compile-time constant false positives Index: lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp === --- lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp +++ lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp @@ -132,7 +132,8 @@ ci != ce; ++ci) { if (Optional S = (*ci).getAs()) if (const CallExpr *CE = dyn_cast(S->getStmt())) { -if (CE->getBuiltinCallee() == Builtin::BI__builtin_unreachable) { +if (CE->getBuiltinCallee() == Builtin::BI__builtin_unreachable || +CE->isBuiltinAssumeFalse(Eng.getContext())) { foundUnreachable = true; break; } Index: lib/Analysis/ReachableCode.cpp === --- lib/Analysis/ReachableCode.cpp +++ lib/Analysis/ReachableCode.cpp @@ -66,6 +66,21 @@ return false; } +static bool isBuiltinAssumeFalse(const CFGBlock *B, const Stmt *S, + ASTContext &C) { + if (B->empty()) { +// Happens if S is B's terminator and B contains nothing else +// (e.g. a CFGBlock containing only a goto). +return false; + } + if (Optional CS = B->back().getAs()) { +if (const auto *CE = dyn_cast(CS->getStmt())) { + return CE->getCallee()->IgnoreCasts() == S && CE->isBuiltinAssumeFalse(C); +} + } + return false; +} + static bool isDeadReturn(const CFGBlock *B, const Stmt *S) { // Look to see if the current control flow ends with a 'return', and see if // 'S' is a substatement. The 'return' may not be the last element in the @@ -372,17 +387,18 @@ llvm::BitVector &Reachable; SmallVector WorkList; Preprocessor &PP; +ASTContext &C; typedef SmallVector, 12> DeferredLocsTy; DeferredLocsTy DeferredLocs; public: -DeadCodeScan(llvm::BitVector &reachable, Preprocessor &PP) +DeadCodeScan(llvm::BitVector &reachable, Preprocessor &PP, ASTContext &C) : Visited(reachable.size()), Reachable(reachable), - PP(PP) {} + PP(PP), C(C) {} void enqueue(const CFGBlock *block); unsigned scanBackwards(const CFGBlock *Start, @@ -600,7 +616,8 @@ if (isa(S)) { UK = reachable_code::UK_Break; - } else if (isTrivialDoWhile(B, S) || isBuiltinUnreachable(S)) { + } else if (isTrivialDoWhile(B, S) || isBuiltinUnreachable(S) || + isBuiltinAssumeFalse(B, S, C)) { return; } else if (isDeadReturn(B, S)) { @@ -693,7 +710,7 @@ if (reachable[block->getBlockID()]) continue; -DeadCodeScan DS(reachable, PP); +DeadCodeScan DS(reachable, PP, AC.getASTContext()); numReachable += DS.scanBackwards(block, CB); if (numReachable == cfg->getNumBlockIDs()) Index: lib/Analysis/CFG.cpp =
[PATCH] D43221: Teach Wreturn-type, Wunreachable-code, and alpha.deadcode.UnreachableCode to treat __assume(0) like __builtin_unreachable.
thakis closed this revision. thakis added a comment. r325052, thanks! https://reviews.llvm.org/D43221 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41512: [Sema] -Wtautological-constant-compare is too good. Cripple it.
thakis added a comment. FWIW we build with -Wall -Wextra and we disable this warning since it's in our (chromium's) opinion not useful on large real-world code. So I'm not sure it should be in -Wextra. (Also, I believe clang has historically tried to keep -Wall and -Wextra pretty similar?) Repository: rC Clang https://reviews.llvm.org/D41512 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43888: [clang-cl] Implement /X
thakis created this revision. thakis added a reviewer: hans. /X makes cl stop looking in %INCLUDE%. Implement this for clang-cl. As it turns out, the return in ToolChains/MSVC.cpp, AddClangSystemIncludeArgs() for -nostdlibinc is already in the right place (but -nostdlibinc isn't exposed by clang-cl), so just alias /X to that. https://reviews.llvm.org/D43888 Files: include/clang/Driver/CLCompatOptions.td test/Driver/cl-include.c Index: test/Driver/cl-include.c === --- test/Driver/cl-include.c +++ test/Driver/cl-include.c @@ -10,5 +10,16 @@ // RUN: env INCLUDE=/my/system/inc %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=STDINC // STDINC: "-internal-isystem" "/my/system/inc" -// RUN: env INCLUDE=/my/system/inc %clang_cl -nostdinc -### -- %s 2>&1 | FileCheck %s --check-prefix=NOSTDINC +// -nostdinc suppresses all of %INCLUDE%, clang resource dirs, and -imsvc dirs. +// RUN: env INCLUDE=/my/system/inc %clang_cl -nostdinc -imsvc /my/other/inc -### -- %s 2>&1 | FileCheck %s --check-prefix=NOSTDINC +// NOSTDINC: argument unused{{.*}}-imsvc // NOSTDINC-NOT: "-internal-isystem" "/my/system/inc" +// NOSTDINC-NOT: "-internal-isystem" "{{.*}}/lib/clang/{{.*}}/include" +// NOSTDINC-NOT: "-internal-isystem" "/my/other/inc" + +// /X suppresses %INCLUDE% but not clang resource dirs or -imsvc dirs. +// RUN: env INCLUDE=/my/system/inc %clang_cl /X -imsvc /my/other/inc -### -- %s 2>&1 | FileCheck %s --check-prefix=SLASHX +// SLASHX-NOT: "argument unused{{.*}}-imsvc" +// SLASHX-NOT: "-internal-isystem" "/my/system/inc" +// SLASHX: "-internal-isystem" "{{.*}}/lib/clang/{{.*}}/include" +// SLASHX: "-internal-isystem" "/my/other/inc" Index: include/clang/Driver/CLCompatOptions.td === --- include/clang/Driver/CLCompatOptions.td +++ include/clang/Driver/CLCompatOptions.td @@ -164,6 +164,9 @@ AliasArgs<["no-deprecated-declarations"]>; def _SLASH_vd : CLJoined<"vd">, HelpText<"Control vtordisp placement">, Alias; +def _SLASH_X : CLFlag<"X">, + HelpText<"Don't add %INCLUDE% to the include search path">, + Alias; def _SLASH_Zc_sizedDealloc : CLFlag<"Zc:sizedDealloc">, HelpText<"Enable C++14 sized global deallocation functions">, Alias; @@ -386,7 +389,6 @@ def _SLASH_V : CLFlag<"V">; def _SLASH_WL : CLFlag<"WL">; def _SLASH_Wp64 : CLFlag<"Wp64">; -def _SLASH_X : CLFlag<"X">; def _SLASH_Yd : CLFlag<"Yd">; def _SLASH_Yl : CLJoined<"Yl">; def _SLASH_Za : CLFlag<"Za">; Index: test/Driver/cl-include.c === --- test/Driver/cl-include.c +++ test/Driver/cl-include.c @@ -10,5 +10,16 @@ // RUN: env INCLUDE=/my/system/inc %clang_cl -### -- %s 2>&1 | FileCheck %s --check-prefix=STDINC // STDINC: "-internal-isystem" "/my/system/inc" -// RUN: env INCLUDE=/my/system/inc %clang_cl -nostdinc -### -- %s 2>&1 | FileCheck %s --check-prefix=NOSTDINC +// -nostdinc suppresses all of %INCLUDE%, clang resource dirs, and -imsvc dirs. +// RUN: env INCLUDE=/my/system/inc %clang_cl -nostdinc -imsvc /my/other/inc -### -- %s 2>&1 | FileCheck %s --check-prefix=NOSTDINC +// NOSTDINC: argument unused{{.*}}-imsvc // NOSTDINC-NOT: "-internal-isystem" "/my/system/inc" +// NOSTDINC-NOT: "-internal-isystem" "{{.*}}/lib/clang/{{.*}}/include" +// NOSTDINC-NOT: "-internal-isystem" "/my/other/inc" + +// /X suppresses %INCLUDE% but not clang resource dirs or -imsvc dirs. +// RUN: env INCLUDE=/my/system/inc %clang_cl /X -imsvc /my/other/inc -### -- %s 2>&1 | FileCheck %s --check-prefix=SLASHX +// SLASHX-NOT: "argument unused{{.*}}-imsvc" +// SLASHX-NOT: "-internal-isystem" "/my/system/inc" +// SLASHX: "-internal-isystem" "{{.*}}/lib/clang/{{.*}}/include" +// SLASHX: "-internal-isystem" "/my/other/inc" Index: include/clang/Driver/CLCompatOptions.td === --- include/clang/Driver/CLCompatOptions.td +++ include/clang/Driver/CLCompatOptions.td @@ -164,6 +164,9 @@ AliasArgs<["no-deprecated-declarations"]>; def _SLASH_vd : CLJoined<"vd">, HelpText<"Control vtordisp placement">, Alias; +def _SLASH_X : CLFlag<"X">, + HelpText<"Don't add %INCLUDE% to the include search path">, + Alias; def _SLASH_Zc_sizedDealloc : CLFlag<"Zc:sizedDealloc">, HelpText<"Enable C++14 sized global deallocation functions">, Alias; @@ -386,7 +389,6 @@ def _SLASH_V : CLFlag<"V">; def _SLASH_WL : CLFlag<"WL">; def _SLASH_Wp64 : CLFlag<"Wp64">; -def _SLASH_X : CLFlag<"X">; def _SLASH_Yd : CLFlag<"Yd">; def _SLASH_Yl : CLJoined<"Yl">; def _SLASH_Za : CLFlag<"Za">; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43888: [clang-cl] Implement /X
thakis closed this revision. thakis added a comment. r326357, thanks! https://reviews.llvm.org/D43888 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43980: Push a function scope when parsing function bodies without a declaration
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. Fix LGTM, one optional comment below. Comment at: clang/lib/Sema/SemaDecl.cpp:12412 +// anyway so we can try to parse the function body. +PushFunctionScope(); return D; Feels a bit long-term risky since ActOnStartOfFunctionDef() and ActOnFinishFunctionBody() both need to know about this special-case invariant. Maybe it's worth to add a FakeFunctionScopeCount member to sema in +assert builds, and to increment that here, assert it's > 0 in the other place and decrement it there, and then assert it's 0 at end of TU? Comment at: clang/test/SemaCXX/pr36536.cpp:19 + // this when they forget to close a namespace, and we'd generate far fewer + // errors if names in Foo were in scope. + // expected-error@+1 {{unknown type name 'NameInClass'}} Not 100% clear to me what the FIXME is here. Maybe "FIXME: We should improve our recovery to redeclare" if that's what's meant. https://reviews.llvm.org/D43980 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44039: [Sema] Make getCurFunction() return null outside function parsing
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. Good luck! I think the forward-looking statement in https://reviews.llvm.org/D43980 about this change here is a bit off, see below. The hasLocalStorage() comment below is probably the only interesting comment. Comment at: clang/include/clang/Sema/Sema.h:1320 sema::FunctionScopeInfo *getCurFunction() const { -return FunctionScopes.back(); +return FunctionScopes.empty() ? nullptr : FunctionScopes.back(); } The other patch description said "This means the FunctionScopes stack will often be empty, which will make getCurFunction() assert" -- did you change your mind, or did you mean "which will make the caller of getCurFunction() crash when it uses the null pointer"? Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:635 -/// CheckFallThroughForFunctionDef - Check that we don't fall off the end of a +/// CheckFallThroughForBody - Check that we don't fall off the end of a /// function that should return a value. Check that we don't fall off the end nit: Just remove everything up to and including the `-` – we no longer repeat function names in comments. Comment at: clang/lib/Sema/SemaDecl.cpp:11328 - if (var->getType().isDestructedType() == QualType::DK_nontrivial_c_struct) + if (var->hasLocalStorage() && + var->getType().isDestructedType() == QualType::DK_nontrivial_c_struct) the hasLocalStorage() check addition here seems unrelated? Comment at: clang/lib/Sema/SemaExprCXX.cpp:1117 - const unsigned MaxFunctionScopesIndex = FunctionScopeIndexToStopAt ? -*FunctionScopeIndexToStopAt : FunctionScopes.size() - 1; + const int MaxFunctionScopesIndex = FunctionScopeIndexToStopAt + ? *FunctionScopeIndexToStopAt Maybe add "// can be -1 if there's no current function scope and FunctionScopeIndexToStopAt is not set" since that seems pretty subtle. https://reviews.llvm.org/D44039 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44223: [ms] Emit vtordisp initializers in a deterministic order.
thakis created this revision. thakis added a reviewer: rnk. No effective behavior change, just for cleanliness. Fixes PR36159. https://reviews.llvm.org/D44223 Files: lib/CodeGen/MicrosoftCXXABI.cpp Index: lib/CodeGen/MicrosoftCXXABI.cpp === --- lib/CodeGen/MicrosoftCXXABI.cpp +++ lib/CodeGen/MicrosoftCXXABI.cpp @@ -1196,15 +1196,22 @@ unsigned AS = getThisAddress(CGF).getAddressSpace(); llvm::Value *Int8This = nullptr; // Initialize lazily. - for (VBOffsets::const_iterator I = VBaseMap.begin(), E = VBaseMap.end(); -I != E; ++I) { -if (!I->second.hasVtorDisp()) + // Emit vtordisps in vbase offset order, to have deterministic output. + typedef VBOffsets::value_type VBaseEntry; + SmallVector VBases(VBaseMap.begin(), VBaseMap.end()); + std::stable_sort(VBases.begin(), VBases.end(), + [](const VBaseEntry &a, const VBaseEntry &b) { + return a.second.VBaseOffset < b.second.VBaseOffset; + }); + + for (const VBaseEntry E : VBases) { +if (!E.second.hasVtorDisp()) continue; llvm::Value *VBaseOffset = -GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, I->first); +GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, E.first); uint64_t ConstantVBaseOffset = -Layout.getVBaseClassOffset(I->first).getQuantity(); +Layout.getVBaseClassOffset(E.first).getQuantity(); // vtorDisp_for_vbase = vbptr[vbase_idx] - offsetof(RD, vbase). llvm::Value *VtorDispValue = Builder.CreateSub( Index: lib/CodeGen/MicrosoftCXXABI.cpp === --- lib/CodeGen/MicrosoftCXXABI.cpp +++ lib/CodeGen/MicrosoftCXXABI.cpp @@ -1196,15 +1196,22 @@ unsigned AS = getThisAddress(CGF).getAddressSpace(); llvm::Value *Int8This = nullptr; // Initialize lazily. - for (VBOffsets::const_iterator I = VBaseMap.begin(), E = VBaseMap.end(); -I != E; ++I) { -if (!I->second.hasVtorDisp()) + // Emit vtordisps in vbase offset order, to have deterministic output. + typedef VBOffsets::value_type VBaseEntry; + SmallVector VBases(VBaseMap.begin(), VBaseMap.end()); + std::stable_sort(VBases.begin(), VBases.end(), + [](const VBaseEntry &a, const VBaseEntry &b) { + return a.second.VBaseOffset < b.second.VBaseOffset; + }); + + for (const VBaseEntry E : VBases) { +if (!E.second.hasVtorDisp()) continue; llvm::Value *VBaseOffset = -GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, I->first); +GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, E.first); uint64_t ConstantVBaseOffset = -Layout.getVBaseClassOffset(I->first).getQuantity(); +Layout.getVBaseClassOffset(E.first).getQuantity(); // vtorDisp_for_vbase = vbptr[vbase_idx] - offsetof(RD, vbase). llvm::Value *VtorDispValue = Builder.CreateSub( ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44223: [ms] Emit vtordisp initializers in a deterministic order.
thakis added inline comments. Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:1207 + + for (const VBaseEntry E : VBases) { +if (!E.second.hasVtorDisp()) (I added the missing `&` here locally.) https://reviews.llvm.org/D44223 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44223: [ms] Emit vtordisp initializers in a deterministic order.
thakis updated this revision to Diff 137463. thakis added a comment. Herald added a subscriber: mgrang. sort unstably https://reviews.llvm.org/D44223 Files: lib/CodeGen/MicrosoftCXXABI.cpp Index: lib/CodeGen/MicrosoftCXXABI.cpp === --- lib/CodeGen/MicrosoftCXXABI.cpp +++ lib/CodeGen/MicrosoftCXXABI.cpp @@ -1196,15 +1196,21 @@ unsigned AS = getThisAddress(CGF).getAddressSpace(); llvm::Value *Int8This = nullptr; // Initialize lazily. - for (VBOffsets::const_iterator I = VBaseMap.begin(), E = VBaseMap.end(); -I != E; ++I) { -if (!I->second.hasVtorDisp()) + // Emit vtordisps in vbase offset order, to have deterministic output. + typedef VBOffsets::value_type VBase; + SmallVector VBases(VBaseMap.begin(), VBaseMap.end()); + std::sort(VBases.begin(), VBases.end(), [](const VBase &a, const VBase &b) { +return a.second.VBaseOffset < b.second.VBaseOffset; + }); + + for (const VBase &V : VBases) { +if (!V.second.hasVtorDisp()) continue; llvm::Value *VBaseOffset = -GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, I->first); +GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, V.first); uint64_t ConstantVBaseOffset = -Layout.getVBaseClassOffset(I->first).getQuantity(); +Layout.getVBaseClassOffset(V.first).getQuantity(); // vtorDisp_for_vbase = vbptr[vbase_idx] - offsetof(RD, vbase). llvm::Value *VtorDispValue = Builder.CreateSub( Index: lib/CodeGen/MicrosoftCXXABI.cpp === --- lib/CodeGen/MicrosoftCXXABI.cpp +++ lib/CodeGen/MicrosoftCXXABI.cpp @@ -1196,15 +1196,21 @@ unsigned AS = getThisAddress(CGF).getAddressSpace(); llvm::Value *Int8This = nullptr; // Initialize lazily. - for (VBOffsets::const_iterator I = VBaseMap.begin(), E = VBaseMap.end(); -I != E; ++I) { -if (!I->second.hasVtorDisp()) + // Emit vtordisps in vbase offset order, to have deterministic output. + typedef VBOffsets::value_type VBase; + SmallVector VBases(VBaseMap.begin(), VBaseMap.end()); + std::sort(VBases.begin(), VBases.end(), [](const VBase &a, const VBase &b) { +return a.second.VBaseOffset < b.second.VBaseOffset; + }); + + for (const VBase &V : VBases) { +if (!V.second.hasVtorDisp()) continue; llvm::Value *VBaseOffset = -GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, I->first); +GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, V.first); uint64_t ConstantVBaseOffset = -Layout.getVBaseClassOffset(I->first).getQuantity(); +Layout.getVBaseClassOffset(V.first).getQuantity(); // vtorDisp_for_vbase = vbptr[vbase_idx] - offsetof(RD, vbase). llvm::Value *VtorDispValue = Builder.CreateSub( ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44223: [ms] Emit vtordisp initializers in a deterministic order.
thakis updated this revision to Diff 137470. thakis added a comment. rnk comment https://reviews.llvm.org/D44223 Files: lib/CodeGen/MicrosoftCXXABI.cpp Index: lib/CodeGen/MicrosoftCXXABI.cpp === --- lib/CodeGen/MicrosoftCXXABI.cpp +++ lib/CodeGen/MicrosoftCXXABI.cpp @@ -1196,15 +1196,15 @@ unsigned AS = getThisAddress(CGF).getAddressSpace(); llvm::Value *Int8This = nullptr; // Initialize lazily. - for (VBOffsets::const_iterator I = VBaseMap.begin(), E = VBaseMap.end(); -I != E; ++I) { -if (!I->second.hasVtorDisp()) + for (const CXXBaseSpecifier &S : RD->vbases()) { +const CXXRecordDecl *VBase = S.getType()->getAsCXXRecordDecl(); +if (!VBaseMap.find(VBase)->second.hasVtorDisp()) continue; llvm::Value *VBaseOffset = -GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, I->first); +GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, VBase); uint64_t ConstantVBaseOffset = -Layout.getVBaseClassOffset(I->first).getQuantity(); +Layout.getVBaseClassOffset(VBase).getQuantity(); // vtorDisp_for_vbase = vbptr[vbase_idx] - offsetof(RD, vbase). llvm::Value *VtorDispValue = Builder.CreateSub( Index: lib/CodeGen/MicrosoftCXXABI.cpp === --- lib/CodeGen/MicrosoftCXXABI.cpp +++ lib/CodeGen/MicrosoftCXXABI.cpp @@ -1196,15 +1196,15 @@ unsigned AS = getThisAddress(CGF).getAddressSpace(); llvm::Value *Int8This = nullptr; // Initialize lazily. - for (VBOffsets::const_iterator I = VBaseMap.begin(), E = VBaseMap.end(); -I != E; ++I) { -if (!I->second.hasVtorDisp()) + for (const CXXBaseSpecifier &S : RD->vbases()) { +const CXXRecordDecl *VBase = S.getType()->getAsCXXRecordDecl(); +if (!VBaseMap.find(VBase)->second.hasVtorDisp()) continue; llvm::Value *VBaseOffset = -GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, I->first); +GetVirtualBaseClassOffset(CGF, getThisAddress(CGF), RD, VBase); uint64_t ConstantVBaseOffset = -Layout.getVBaseClassOffset(I->first).getQuantity(); +Layout.getVBaseClassOffset(VBase).getQuantity(); // vtorDisp_for_vbase = vbptr[vbase_idx] - offsetof(RD, vbase). llvm::Value *VtorDispValue = Builder.CreateSub( ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44223: [ms] Emit vtordisp initializers in a deterministic order.
thakis marked an inline comment as done. thakis added inline comments. Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:1206 + + for (const VBase &V : VBases) { +if (!V.second.hasVtorDisp()) rnk wrote: > I think we can avoid the sort altogether if we iterate `RD->vbases()`, which > should already be in layout order, and then do lookup into `VBaseMap`. That's way nicer, thanks. Done. https://reviews.llvm.org/D44223 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44223: [ms] Emit vtordisp initializers in a deterministic order.
thakis closed this revision. thakis marked an inline comment as done. thakis added a comment. r326960, thanks! https://reviews.llvm.org/D44223 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D16403: Add scope information to CFG
thakis added a comment. Since this affects analysis-based warnings, have you checked if this patch has any effect on compile times? Repository: rL LLVM https://reviews.llvm.org/D16403 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44630: [ms] Parse #pragma optimize and ignore it behind its own flag
thakis accepted this revision. thakis added a comment. Awesome, thanks! One nit below: Comment at: include/clang/Basic/DiagnosticParseKinds.td:973 +def warn_pragma_optimize : Warning< + "'#pragma optimize' is not supported; use '#pragma clang optimize on|off' instead">, + InGroup; Is `pragma clang optimize` really what we want to recommend here? `pragma optimize` is used in practice mostly to work around cl.exe compiler bugs, or to disable inlining. In neither case, `pragma clang optimize` is what you'd really want to use. Maybe just omit everything after ; and instead add a blurb about this in DiagnosticDocs.td ? https://reviews.llvm.org/D44630 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44826: Add -Wunused-using, a warning that finds unused using declarations.
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. Looks great. Comment at: docs/ReleaseNotes.rst:126 +namespace n { class C; } +using n::C; // Never actually used. + Maybe include an example with a using directive and a namespace alias as well. Comment at: docs/ReleaseNotes.rst:139 + used in conjunction with ``-Werror`` and as a result, the new warnings + are turned into new errors. + nit: I'd omit this paragraph -- this is true for all warnings and not special for this warning. Comment at: include/clang/Basic/DiagnosticGroups.td:828-829 // -Wunused-local-typedefs = -Wunused-local-typedef +def : DiagGroup<"unused-usings", [UnusedUsing]>; +// -Wunused-usings = -Wunused-using CarlosAlbertoEnciso wrote: > lebedev.ri wrote: > > Why? gcc compatibility? > No particular reason. I just follow the 'unused-local-typedefs' model. > If there is not objection from others reviewers, I will drop the gcc > compatibility. Does gcc have a `-Wunused-usings`? As far as I can tell it doesn't, so I agree not having the alias makes sense. -Wunused-local-typedefs is here because gcc has that flag. https://reviews.llvm.org/D44826 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47480: clang-cl: Expose -no-canonical-prefixes
thakis closed this revision. thakis added a comment. r333761, thanks! https://reviews.llvm.org/D47480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47480: clang-cl: Expose -no-canonical-prefixes
thakis marked 2 inline comments as done. thakis added inline comments. Comment at: test/Driver/cl-options.c:595 +// RUN: -no-canonical-prefixes \ +// RUN: -fno-coverage-mapping \ // RUN: --version \ rnk wrote: > takuto.ikuta wrote: > > Is this related to this change? > It's a test for a previous change that I made. Sorry, I missed this. It was a mistake, I removed this line again in r333762. https://reviews.llvm.org/D47480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47956: [MS] Consder constexpr globals to be inline, as in C++17
thakis added inline comments. Comment at: clang/lib/Sema/SemaDecl.cpp:6597 + (getLangOpts().CPlusPlus17 || + Context.getTargetInfo().getCXXABI().isMicrosoft())) NewVD->setImplicitlyInline(); Is this related to /Zc:externConstexpr / PR36413? If so, maybe we should do the standards-conforming thing by default and ask people to pass /Zc:externConstexpr- if they need ABI compat? Want to add a FIXME about doing this in the AST in the source too? https://reviews.llvm.org/D47956 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47578: Do not enforce absolute path argv0 in windows
thakis added a comment. ruiu: This review has now gone on for a week, with one cycle per day due to timezones. Since the comments are fairly minor nits, do you think you could address them yourself while landing this, in the interest of not spending another week on this? https://reviews.llvm.org/D47578 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D45179: [libc++] Add _LIBCPP_FORCE_NODISCARD define to force-enable nodiscard in pre-C++17
thakis added a comment. What's the status here? The MS STL has this feature under _HAS_NODISCARD and it's super useful. Repository: rCXX libc++ https://reviews.llvm.org/D45179 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48224: Don't let test/Driver/no-canonical-prefixes.c form a symlink cycle the second time it runs.
thakis created this revision. thakis added a reviewer: chandlerc. The test makes %t.fake a symlink to %t.real by running `ln -sf %t.real %t.fake`. If %t.fake already is a symlink to %t.real when this runs (e.g. if the test has run before), then this effectively becomes `ln -sf %t.real %t.real`, symlinking the directory to itself. At least on my mac, this leads to the directory containing itself. As fix, just remove %t.fake before creating the symlink. To clean up build dirs on bots, also remove %t.real for a while. https://reviews.llvm.org/D48224 Files: test/Driver/no-canonical-prefixes.c Index: test/Driver/no-canonical-prefixes.c === --- test/Driver/no-canonical-prefixes.c +++ test/Driver/no-canonical-prefixes.c @@ -1,9 +1,14 @@ // Due to ln -sf: // REQUIRES: shell +// RUN: rm -rf %t.real // RUN: mkdir -p %t.real // RUN: cd %t.real // RUN: ln -sf %clang test-clang // RUN: cd .. +// Important to remove %t.fake: If it already is a symlink to %t.real when +// `ln -sf %t.real %t.fake` runs, then that would symlink %t.real to itself, +// forming a cycle. +// RUN: rm -rf %t.fake // RUN: ln -sf %t.real %t.fake // RUN: cd %t.fake // RUN: ./test-clang -v -S %s 2>&1 | FileCheck --check-prefix=CANONICAL %s Index: test/Driver/no-canonical-prefixes.c === --- test/Driver/no-canonical-prefixes.c +++ test/Driver/no-canonical-prefixes.c @@ -1,9 +1,14 @@ // Due to ln -sf: // REQUIRES: shell +// RUN: rm -rf %t.real // RUN: mkdir -p %t.real // RUN: cd %t.real // RUN: ln -sf %clang test-clang // RUN: cd .. +// Important to remove %t.fake: If it already is a symlink to %t.real when +// `ln -sf %t.real %t.fake` runs, then that would symlink %t.real to itself, +// forming a cycle. +// RUN: rm -rf %t.fake // RUN: ln -sf %t.real %t.fake // RUN: cd %t.fake // RUN: ./test-clang -v -S %s 2>&1 | FileCheck --check-prefix=CANONICAL %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48224: Don't let test/Driver/no-canonical-prefixes.c form a symlink cycle the second time it runs.
thakis closed this revision. thakis added a comment. r334972, thanks! https://reviews.llvm.org/D48224 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48296: clang-cl: Emit normal narrowing diagnostics for initializer lists if -fmsc-version is at least 1900 (i.e. MSVC2015).
thakis created this revision. thakis added a reviewer: rnk. Diagnostics for narrowing conversions in initializer lists are currently DefaultIgnored in Microsoft mode. But MSVC 2015 did add warnings about narrowing conversions (C2397), so clang-cl can remove its special case code if MSCompatibilityVersion is new enough. (In MSVC, C2397 is just a warning and in clang it's default-mapped to an error, but it can be remapped, and disabled with -Wno-c++11-narrowing, so that should be fine.) Fixes PR37314. https://reviews.llvm.org/D48296 Files: clang/lib/Sema/SemaInit.cpp clang/test/SemaCXX/ms-initlist-narrowing.cpp Index: clang/test/SemaCXX/ms-initlist-narrowing.cpp === --- /dev/null +++ clang/test/SemaCXX/ms-initlist-narrowing.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions -fms-compatibility-version=19.0 -std=c++11 + +int ai[] = { 1, 2.0 }; // expected-error {{type 'double' cannot be narrowed to 'int' in initializer list}} expected-note {{silence}} + +template +struct Agg { + T t; +}; + +void f(int i) { + // Constant expression. + Agg f8 = {1E50}; // expected-error {{constant expression evaluates to 1.00e+50 which cannot be narrowed to type 'float'}} expected-note {{silence}} + + // Non-constant expression. + double d = 1.0; + Agg f2 = {d}; // expected-error {{non-constant-expression cannot be narrowed from type 'double' to 'float'}} expected-note {{silence}} +} Index: clang/lib/Sema/SemaInit.cpp === --- clang/lib/Sema/SemaInit.cpp +++ clang/lib/Sema/SemaInit.cpp @@ -8360,40 +8360,49 @@ // No narrowing occurred. return; - case NK_Type_Narrowing: + case NK_Type_Narrowing: { // This was a floating-to-integer conversion, which is always considered a // narrowing conversion even if the value is a constant and can be // represented exactly as an integer. -S.Diag(PostInit->getLocStart(), - (S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus11) - ? diag::warn_init_list_type_narrowing - : diag::ext_init_list_type_narrowing) - << PostInit->getSourceRange() - << PreNarrowingType.getLocalUnqualifiedType() - << EntityType.getLocalUnqualifiedType(); -break; - - case NK_Constant_Narrowing: +bool DiagErr = +S.getLangOpts().CPlusPlus11 && +(!S.getLangOpts().MicrosoftExt || + S.getLangOpts().isCompatibleWithMSVC(LangOptions::MSVC2015)); +S.Diag(PostInit->getLocStart(), !DiagErr +? diag::warn_init_list_type_narrowing +: diag::ext_init_list_type_narrowing) +<< PostInit->getSourceRange() +<< PreNarrowingType.getLocalUnqualifiedType() +<< EntityType.getLocalUnqualifiedType(); + } break; + + case NK_Constant_Narrowing: { // A constant value was narrowed. +bool DiagErr = +S.getLangOpts().CPlusPlus11 && +(!S.getLangOpts().MicrosoftExt || + S.getLangOpts().isCompatibleWithMSVC(LangOptions::MSVC2015)); S.Diag(PostInit->getLocStart(), - (S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus11) - ? diag::warn_init_list_constant_narrowing - : diag::ext_init_list_constant_narrowing) - << PostInit->getSourceRange() - << ConstantValue.getAsString(S.getASTContext(), ConstantType) - << EntityType.getLocalUnqualifiedType(); -break; - - case NK_Variable_Narrowing: + !DiagErr ? diag::warn_init_list_constant_narrowing +: diag::ext_init_list_constant_narrowing) +<< PostInit->getSourceRange() +<< ConstantValue.getAsString(S.getASTContext(), ConstantType) +<< EntityType.getLocalUnqualifiedType(); + } break; + + case NK_Variable_Narrowing: { // A variable's value may have been narrowed. +bool DiagErr = +S.getLangOpts().CPlusPlus11 && +(!S.getLangOpts().MicrosoftExt || + S.getLangOpts().isCompatibleWithMSVC(LangOptions::MSVC2015)); S.Diag(PostInit->getLocStart(), - (S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus11) - ? diag::warn_init_list_variable_narrowing - : diag::ext_init_list_variable_narrowing) - << PostInit->getSourceRange() - << PreNarrowingType.getLocalUnqualifiedType() - << EntityType.getLocalUnqualifiedType(); -break; + !DiagErr ? diag::warn_init_list_variable_narrowing +: diag::ext_init_list_variable_narrowing) +<< PostInit->getSourceRange() +<< PreNarrowingType.getLocalUnqualifiedType() +<< EntityType.getLocalUnqualifiedType(); + } break; } SmallString<128> StaticCast; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/m
[PATCH] D48296: clang-cl: Emit normal narrowing diagnostics for initializer lists if -fmsc-version is at least 1900 (i.e. MSVC2015).
thakis added a comment. Thanks! I'd keep it DefaultIgnored: I'd be annoyed if I'd get these by default in C++98 mode. https://reviews.llvm.org/D48296 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48296: clang-cl: Emit normal narrowing diagnostics for initializer lists if -fmsc-version is at least 1900 (i.e. MSVC2015).
thakis updated this revision to Diff 151844. thakis marked 2 inline comments as done. thakis added a comment. comments https://reviews.llvm.org/D48296 Files: clang/lib/Sema/SemaInit.cpp clang/test/SemaCXX/ms-initlist-narrowing.cpp Index: clang/test/SemaCXX/ms-initlist-narrowing.cpp === --- /dev/null +++ clang/test/SemaCXX/ms-initlist-narrowing.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions -fms-compatibility-version=19.0 -std=c++11 + +int ai[] = { 1, 2.0 }; // expected-error {{type 'double' cannot be narrowed to 'int' in initializer list}} expected-note {{silence}} + +template +struct Agg { + T t; +}; + +void f(int i) { + // Constant expression. + Agg f8 = {1E50}; // expected-error {{constant expression evaluates to 1.00e+50 which cannot be narrowed to type 'float'}} expected-note {{silence}} + + // Non-constant expression. + double d = 1.0; + Agg f2 = {d}; // expected-error {{non-constant-expression cannot be narrowed from type 'double' to 'float'}} expected-note {{silence}} +} Index: clang/lib/Sema/SemaInit.cpp === --- clang/lib/Sema/SemaInit.cpp +++ clang/lib/Sema/SemaInit.cpp @@ -8331,6 +8331,11 @@ dump(llvm::errs()); } +static bool NarrowingErrs(const LangOptions &L) { + return L.CPlusPlus11 && + (!L.MicrosoftExt || L.isCompatibleWithMSVC(LangOptions::MSVC2015)); +} + static void DiagnoseNarrowingInInitList(Sema &S, const ImplicitConversionSequence &ICS, QualType PreNarrowingType, @@ -8364,35 +8369,34 @@ // This was a floating-to-integer conversion, which is always considered a // narrowing conversion even if the value is a constant and can be // represented exactly as an integer. -S.Diag(PostInit->getLocStart(), - (S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus11) - ? diag::warn_init_list_type_narrowing - : diag::ext_init_list_type_narrowing) - << PostInit->getSourceRange() - << PreNarrowingType.getLocalUnqualifiedType() - << EntityType.getLocalUnqualifiedType(); +S.Diag(PostInit->getLocStart(), NarrowingErrs(S.getLangOpts()) +? diag::ext_init_list_type_narrowing +: diag::warn_init_list_type_narrowing) +<< PostInit->getSourceRange() +<< PreNarrowingType.getLocalUnqualifiedType() +<< EntityType.getLocalUnqualifiedType(); break; case NK_Constant_Narrowing: // A constant value was narrowed. S.Diag(PostInit->getLocStart(), - (S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus11) - ? diag::warn_init_list_constant_narrowing - : diag::ext_init_list_constant_narrowing) - << PostInit->getSourceRange() - << ConstantValue.getAsString(S.getASTContext(), ConstantType) - << EntityType.getLocalUnqualifiedType(); + NarrowingErrs(S.getLangOpts()) + ? diag::ext_init_list_constant_narrowing + : diag::warn_init_list_constant_narrowing) +<< PostInit->getSourceRange() +<< ConstantValue.getAsString(S.getASTContext(), ConstantType) +<< EntityType.getLocalUnqualifiedType(); break; case NK_Variable_Narrowing: // A variable's value may have been narrowed. S.Diag(PostInit->getLocStart(), - (S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus11) - ? diag::warn_init_list_variable_narrowing - : diag::ext_init_list_variable_narrowing) - << PostInit->getSourceRange() - << PreNarrowingType.getLocalUnqualifiedType() - << EntityType.getLocalUnqualifiedType(); + NarrowingErrs(S.getLangOpts()) + ? diag::ext_init_list_variable_narrowing + : diag::warn_init_list_variable_narrowing) +<< PostInit->getSourceRange() +<< PreNarrowingType.getLocalUnqualifiedType() +<< EntityType.getLocalUnqualifiedType(); break; } Index: clang/test/SemaCXX/ms-initlist-narrowing.cpp === --- /dev/null +++ clang/test/SemaCXX/ms-initlist-narrowing.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions -fms-compatibility-version=19.0 -std=c++11 + +int ai[] = { 1, 2.0 }; // expected-error {{type 'double' cannot be narrowed to 'int' in initializer list}} expected-note {{silence}} + +template +struct Agg { + T t; +}; + +void f(int i) { + // Constant expression. + Agg f8 = {1E50}; // expected-error {{constant expression evaluates to 1.00e+50 which cannot be narrowed to type 'float'}} expected-note {{silence}} + + // Non-constant expression. + double d = 1.0; + Agg f2 = {d}; // expected-error {{non-constant
[PATCH] D48296: clang-cl: Emit normal narrowing diagnostics for initializer lists if -fmsc-version is at least 1900 (i.e. MSVC2015).
thakis closed this revision. thakis added a comment. r335082, thanks! https://reviews.llvm.org/D48296 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47956: [MS] Consder constexpr globals to be inline, as in C++17
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. Thanks for explaining, makes sense to me. https://reviews.llvm.org/D47956 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48426: [clang-cl] Don't emit dllexport inline functions etc. from pch files (PR37801)
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. Looks like pretty straightforward plumbing. I can't think of a better place than ASTContext either. I think this is fine with your two XXXs just removed. Exciting build time wins! Comment at: lib/AST/ASTContext.cpp:9557 + if (D->isFromASTFile() && !BuildingPCHWithObjectFile) { +assert(getExternalSource() && "It's from an AST file; must be a source."); +// On Windows, PCH files are built together with an object file. If this nit: s/be/have/ https://reviews.llvm.org/D48426 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48426: [clang-cl] Don't emit dllexport inline functions etc. from pch files (PR37801)
thakis added a comment. PCHs aren't compatible with themselves if only the compiler revision changes, so I'm not sure changing that field should be worse than a regular compiler revision update (which happens at every commit). But I don't know what this field is for. I don't remember any trouble from me changing it though, and if it was bad to change it I'd hope there'd be a comment right above the field telling us why. (If I had run into problems, I would've expected me to add a comment like this.) https://reviews.llvm.org/D48426 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48426: [clang-cl] Don't emit dllexport inline functions etc. from pch files (PR37801)
thakis added inline comments. Comment at: lib/AST/ASTContext.cpp:9563 +if (getExternalSource()->DeclIsFromPCHWithObjectFile(D)) + return false; + } It'd be good to add a comment (and a test) explaining why / how _referenced_ inline functions still get emitted for inlining. https://reviews.llvm.org/D48426 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48426: [clang-cl] Don't emit dllexport inline functions etc. from pch files (PR37801)
thakis added inline comments. Comment at: test/CodeGen/pch-dllexport.cpp:41 + +void use() { baz(); } + There still isn't a non-dllexported-but-referenced inline function in here as far as I can see. Am I just missing it? https://reviews.llvm.org/D48426 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47698: [ASTImporter] import macro source locations
thakis added a comment. This code is live when reading pchs, correct? Does this have any measurable perf impact on deserializing pchs for, say, Cocoa.h or Windows.h? Repository: rC Clang https://reviews.llvm.org/D47698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53434: Java annotation declaration being handled correctly
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. Thanks for the fix! Do you happen to know what had regressed this? Repository: rC Clang https://reviews.llvm.org/D53434 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53457: clang-cl: Add "/Xdriver:" pass-through arg support.
thakis added a comment. Comment from the peanut gallery: - I like the whitelist model for gcc-style flags. It allows us to curate them (and `/?` output) since many don't make much sense in the cl world. - I like the idea behind this patch (and /clang: seems like a good spelling) Repository: rC Clang https://reviews.llvm.org/D53457 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D55491: Implement TemplateArgument dumping in terms of Visitor
thakis added a comment. Out of interest, what's the motivation for this? It seems to add way more code than it removes, so there must be some other advantage, but the patch description doesn't say. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55491/new/ https://reviews.llvm.org/D55491 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D56732: [clang] [test] Disable Python binding tests w/ LLVM_ENABLE_PIC=OFF
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. Thanks! I can't easily test this since only some of our bots see this and I don't have a Linux box at hand, but it looks like it should work and I can verify on the bots once this is in :) Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56732/new/ https://reviews.llvm.org/D56732 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D57150: [HeaderSearch] don't immediately request that headers are opened in getFileAndSuggestModule().
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. Thanks for the fix! Nice test too. Let's land this and see if anything breaks :-) On the 8.0, I'd probably recommend reverting your change instead, since this feels like a subtle change that might have unintended consequences somewhere. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57150/new/ https://reviews.llvm.org/D57150 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D57165: [FileManager] Revert r347205 to avoid PCH file-descriptor leak.
thakis added inline comments. Comment at: lib/Basic/FileManager.cpp:295 + llvm::sys::path::remove_dots(AbsPath, /*remove_dot_dot=*/true); + UFE.RealPathName = AbsPath.str(); +} Should this call fillRealPathName() (which was added after your change)? Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57165/new/ https://reviews.llvm.org/D57165 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D57165: [FileManager] Revert r347205 to avoid PCH file-descriptor leak.
thakis accepted this revision. thakis added a comment. This revision is now accepted and ready to land. lgtm, but lebtm with call to fillRealPathName() Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57165/new/ https://reviews.llvm.org/D57165 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D57127: [analyzer] Port RetainSummaryManager to the new GenericCall interface, decouple ARCMT from the analyzer
thakis added a comment. Can you elaborate a bit in what sense this decouples ARCMT from the analyzer? Can CLANG_ENABLE_STATIC_ANALYZER now be set independently of CLANG_ENABLE_ARCMT? Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57127/new/ https://reviews.llvm.org/D57127 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D57127: [analyzer] Port RetainSummaryManager to the new GenericCall interface, decouple ARCMT from the analyzer
thakis added a comment. Also, isn't lib/Analysis a strange place for this? lib/Analysis is used by the compiler proper (CodeGen, Sema, …), while RetainSummaryManager is only used by tooling-like things (static analyzer, arcmigrate). Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57127/new/ https://reviews.llvm.org/D57127 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits