Re: [PATCH] D11476: Marked call instruction in thunk function with musttail attribute when applicable
rnk added a comment. Musttail is currently x86 only, unfortunately. I started making it work for AArch64, but it was pretty hard and I gave up to work on other things. That aside, musttail is also somewhat optimization hostile. It interacts with the inliner in surprising ways. All in all, I'd rather not do this. Repository: rL LLVM http://reviews.llvm.org/D11476 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
[PATCH] D11742: Add -gcodeview and -gdwarf to control which type Clang emits
rnk created this revision. rnk added reviewers: dblaikie, hans. rnk added a subscriber: cfe-commits. By default, 'clang' emits dwarf and 'clang-cl' emits codeview. You can force emission of one or both by passing -gcodeview and -gdwarf to either driver. http://reviews.llvm.org/D11742 Files: include/clang/Driver/CLCompatOptions.td include/clang/Driver/Options.td include/clang/Frontend/CodeGenOptions.def lib/CodeGen/CodeGenModule.cpp lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp test/CodeGen/dwarf-version.c test/Driver/cl-options.c Index: test/Driver/cl-options.c === --- test/Driver/cl-options.c +++ test/Driver/cl-options.c @@ -360,6 +360,10 @@ // RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 21 | FileCheck -check-prefix=ThreadSafeStatics %s // ThreadSafeStatics-NOT: -fno-threadsafe-statics +// RUN: %clang_cl /Z7 /c -### -- %s 21 | FileCheck -check-prefix=Z7 %s +// Z7: -gline-tables-only +// Z7: -gcodeview + // RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 21 | FileCheck -check-prefix=CXX11 %s // CXX11: -std=c++11 Index: test/CodeGen/dwarf-version.c === --- test/CodeGen/dwarf-version.c +++ test/CodeGen/dwarf-version.c @@ -2,6 +2,9 @@ // RUN: %clang -target x86_64-linux-gnu -gdwarf-3 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER3 // RUN: %clang -target x86_64-linux-gnu -gdwarf-4 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4 // RUN: %clang -target x86_64-linux-gnu -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4 +// RUN: %clang -target x86_64-linux-gnu -gdwarf -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4 +// RUN: %clang -target x86_64-linux-gnu -gdwarf -gcodeview -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4 --check-prefix=CODEVIEW +// RUN: %clang -target x86_64-linux-gnu -gcodeview -S -emit-llvm -o - %s | FileCheck %s --check-prefix=NODWARF --check-prefix=CODEVIEW // RUN: %clang -target x86_64-apple-darwin -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER2 // RUN: %clang -target powerpc-unknown-openbsd -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER2 // RUN: %clang -target powerpc-unknown-freebsd -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER2 @@ -13,3 +16,7 @@ // VER2: !{i32 2, !Dwarf Version, i32 2} // VER3: !{i32 2, !Dwarf Version, i32 3} // VER4: !{i32 2, !Dwarf Version, i32 4} + +// NODWARF-NOT: !Dwarf Version +// CODEVIEW: !{i32 2, !CodeView, i32 1} +// NODWARF-NOT: !Dwarf Version Index: lib/Frontend/CompilerInvocation.cpp === --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -410,16 +410,20 @@ Opts.setDebugInfo(CodeGenOptions::LimitedDebugInfo); } Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info); + if (Args.hasArg(OPT_gcodeview)) { +Opts.EmitCodeView = true; +Opts.DwarfVersion = 0; + } else if (Opts.getDebugInfo() != CodeGenOptions::NoDebugInfo) { +// Default Dwarf version is 4 if we are generating debug information. +Opts.DwarfVersion = 4; + } Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file); if (Args.hasArg(OPT_gdwarf_2)) Opts.DwarfVersion = 2; else if (Args.hasArg(OPT_gdwarf_3)) Opts.DwarfVersion = 3; else if (Args.hasArg(OPT_gdwarf_4)) Opts.DwarfVersion = 4; - else if (Opts.getDebugInfo() != CodeGenOptions::NoDebugInfo) -// Default Dwarf version is 4 if we are generating debug information. -Opts.DwarfVersion = 4; if (const Arg *A = Args.getLastArg(OPT_emit_llvm_uselists, OPT_no_emit_llvm_uselists)) Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -3678,6 +3678,9 @@ } } + // Forward -gcodeview. + Args.AddLastArg(CmdArgs, options::OPT_gcodeview); + // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now. Args.ClaimAllArgs(options::OPT_g_flags_Group); if (Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info, @@ -5269,6 +5272,12 @@ /*default=*/false)) CmdArgs.push_back(-fno-rtti-data); + // Emit CodeView if -Z7 is present. + if (Args.hasFlag(options::OPT__SLASH_Z7, options::OPT_INVALID, false)) { +CmdArgs.push_back(-gline-tables-only); +CmdArgs.push_back(-gcodeview); + } + const Driver D = getToolChain().getDriver(); EHFlags EH = parseClangCLEHFlags(D, Args); // FIXME: Do something with NoExceptC. @@ -8975,7 +8984,8 @@ A-getOption().getID() == options::OPT_fdata_sections ? /Gw : /Gw-); if (Args.hasArg(options::OPT_fsyntax_only)) CmdArgs.push_back(/Zs); - if (Args.hasArg(options::OPT_g_Flag, options::OPT_gline_tables_only)) + if (Args.hasArg(options::OPT_g_Flag, options::OPT_gline_tables_only, +
Re: [PATCH] D11476: Marked call instruction in thunk function with musttail attribute when applicable
rnk added a comment. In http://reviews.llvm.org/D11476#217006, @aaboud wrote: Thanks for the comment. So, do you suggest that we use tail instead of musttail? Would it be fine to use tail here? Yeah, adding tail is fine. Repository: rL LLVM http://reviews.llvm.org/D11476 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11298: Convert a few classes over to use the new TrailingObjects helper.
rnk added a comment. I'd rather hold of on stamping this and let Richard look at it, since it changes AST pretty heavily. Comment at: include/clang/AST/DeclTemplate.h:146 @@ -140,1 +145,3 @@ +template size_t N class FixedSizeTemplateParameterListStorage { + char Mem[TemplateParameterList::totalSizeToAllocNamedDecl *(N)]; Won't this reduce the alignment of this structure to 1? http://reviews.llvm.org/D11298 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11594: Fix NAME.1 comdat name for replaced GlobalVariable
rnk accepted this revision. rnk added a reviewer: rnk. rnk added a comment. This revision is now accepted and ready to land. lgtm with slightly tighter test case. Comment at: tools/clang/test/CodeGenCXX/vtable-key-function-win-comdat.cpp:18 @@ +17,2 @@ +// CHECK: $_ZTS6Test1a = comdat any +// CHECK-NOT: $_ZTI6Test1a.1 = comdat any Can you also CHECK that the vtable definition has the right name, linkage, and uses this comdat? Repository: rL LLVM http://reviews.llvm.org/D11594 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11551: Now that -Wmicrosoft warnings are split up, rename -Wmsvc-include to -Wmicrosoft-include
rnk accepted this revision. rnk added a comment. This revision is now accepted and ready to land. lgtm http://reviews.llvm.org/D11551 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D9000: [MSVC] Improved __noop support (https://llvm.org/bugs/show_bug.cgi?id=14081)
rnk added a comment. I don't think you've addressed Richard's concerns convincingly. He feels that having more Sema-global contexts is the wrong way to go, and if this is the cost of more accurate __noop support, then maybe it's not worth it. http://reviews.llvm.org/D9000 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D1623: Support __builtin_ms_va_list.
rnk added a comment. We can easily codegen `__builtin_ms_va_start()` and `end()` to `llvm.vastart` / `llvm.vaend`, because the first *has* to live in the win64 function and the second is a no-op. We should remove the FIXME about lowering `__builtin_ms_va_arg()` in LLVM instead of clang, because you can use it from a SysV function and it should work: consider implementing Win64 printf by calling an internal SysV vfprintf implementation. We also need to implement `__builtin_ms_va_copy()` in Clang for the same reason, but that's easy, since it's always a simple pointer load and store. Charles, are you actively working on this or should I just fix up the patch and submit it? http://reviews.llvm.org/D1623 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11504: Split -Wmicrosoft into many detailed warnings.
rnk added a comment. This feels too fine-grained to me, but I could be convinced either way. Someone somewhere will probably be thankful that they can turn off *just* -Wmicrosoft-void-pseudo-destructor. @majnemer, what do you think? Comment at: include/clang/Basic/DiagnosticGroups.td:722 @@ +721,3 @@ +def MicrosoftFixedEnum : DiagGroupmicrosoft-fixed-enum; +def MicrosoftExceptionEllipsis : DiagGroupmicrosoft-exception-ellipsis; +def MicrosoftSealed : DiagGroupmicrosoft-sealed; I think we can merge this with MicrosoftExceptionSpec, they are both about EH specification relaxations. Comment at: include/clang/Basic/DiagnosticGroups.td:724 @@ +723,3 @@ +def MicrosoftSealed : DiagGroupmicrosoft-sealed; +def MicrosoftPragmaComment : DiagGroupmicrosoft-pragma-comment; +def MicrosoftUnqualifiedFriend : DiagGroupmicrosoft-unqualified-friend; Let's kill this, we can use the -Wignored-pragmas group for it. Comment at: include/clang/Basic/DiagnosticParseKinds.td:944 @@ -943,3 +943,3 @@ def warn_pragma_comment_ignored : Warning'#pragma comment %0' ignored, - InGroupMicrosoft; + InGroupMicrosoftPragmaComment; // - #pragma detect_mismatch Let's put this in the IgnoredPragmas group. http://reviews.llvm.org/D11504 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D1623: Support __builtin_ms_va_list.
rnk added inline comments. Comment at: include/clang/AST/Expr.h:3724-3726 @@ -3722,3 +3723,5 @@ - TypeSourceInfo *getWrittenTypeInfo() const { return TInfo; } - void setWrittenTypeInfo(TypeSourceInfo *TI) { TInfo = TI; } + /// Returns whether this is really a Win64 ABI va_arg expression. + bool isMicrosoftABI() const { return TInfo.getInt(); } + void setIsMicrosoftABI(bool IsMS) { TInfo.setInt(IsMS); } + This seems unfortunate. Richard, why do we even have a VAArgExpr instead of just leaving it as a builtin CallExpr like __builtin_va_start? Just history? http://reviews.llvm.org/D1623 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11504: Split -Wmicrosoft into many detailed warnings.
rnk accepted this revision. rnk added a comment. This revision is now accepted and ready to land. Sounds good, let's go with these then. http://reviews.llvm.org/D11504 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11148: [ARM] Implement -Wa, -mfpu and friends for assemblers
rnk accepted this revision. rnk added a comment. This revision is now accepted and ready to land. lgtm Comment at: lib/Driver/Tools.cpp:742-743 @@ +741,4 @@ + // Honor -mhwdiv=. ClangAs gives preference to -Wa,-mhwdiv=. + const Arg *HDivArg = Args.getLastArg(options::OPT_mhwdiv_EQ); + if (WaHdiv) { +if (HDivArg) Can you make the capitalization of the 'd' in `HDivArg` and `WaHdiv` match? I don't care which way you go. http://reviews.llvm.org/D11148 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11466: Correct x86_64 Android fp128 mangled name
rnk added inline comments. Comment at: test/CodeGen/x86-long-double.cpp:1-12 @@ +1,13 @@ +// RUN: %clang -target x86_64-linux-android -emit-llvm -O -S -o - %s \ +// RUN:| FileCheck %s --check-prefix=A64 +// RUN: %clang -target x86_64-linux-gnu -emit-llvm -O -S -o - %s \ +// RUN:| FileCheck %s --check-prefix=G64 +// RUN: %clang -target powerpc64-linux-gnu -emit-llvm -O -S -o - %s \ +// RUN:| FileCheck %s --check-prefix=P64 +// RUN: %clang -target i686-linux-android -emit-llvm -O -S -o - %s \ +// RUN:| FileCheck %s --check-prefix=A32 +// RUN: %clang -target i686-linux-gnu -emit-llvm -O -S -o - %s \ +// RUN:| FileCheck %s --check-prefix=G32 +// RUN: %clang -target powerpc-linux-gnu -emit-llvm -O -S -o - %s \ +// RUN:| FileCheck %s --check-prefix=P32 + Don't use %clang in CodeGen tests. http://reviews.llvm.org/D11466 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11405: [MS ABI] Hook clang up to the new EH instructions
rnk accepted this revision. rnk added a comment. This revision is now accepted and ready to land. lgtm, but we need the LLVM side first obviously. http://reviews.llvm.org/D11405 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11466: Correct x86_64 Android fp128 mangled name
rnk accepted this revision. rnk added a reviewer: rnk. rnk added a comment. This revision is now accepted and ready to land. lgtm http://reviews.llvm.org/D11466 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11437: Correct x86_64 fp128 calling convention
rnk added inline comments. Comment at: lib/CodeGen/TargetInfo.cpp:1861-1866 @@ -1860,8 +1860,8 @@ Current = Integer; } else if ((k == BuiltinType::Float || k == BuiltinType::Double) || (k == BuiltinType::LongDouble getTarget().getTriple().isOSNaCl())) { Current = SSE; } else if (k == BuiltinType::LongDouble) { Lo = X87; Hi = X87Up; Any reason we can't do the same fp classification here like we do below for complex types? Comment at: lib/CodeGen/TargetInfo.cpp:1975-1976 @@ -1974,4 +1975,1 @@ -else if (ET == getContext().DoubleTy || - (ET == getContext().LongDoubleTy - getTarget().getTriple().isOSNaCl())) Lo = Hi = SSE; Nice, I like this simplification. Comment at: lib/CodeGen/TargetInfo.cpp:2528 @@ -2520,1 +2527,3 @@ classifyReturnType(QualType RetTy) const { + // TODO: Simplify classify to handle f128 according to AMD64 ABI. + if (const BuiltinType *BT = RetTy-getAsBuiltinType()) { Why can't we classify IEEEQuad long doubles as SSE in the usual `classify()` implementation? Comment at: lib/CodeGen/TargetInfo.cpp:2667 @@ -2652,1 +2666,3 @@ { + // TODO: Simplify classifyArgumentType to handle f128 according to AMD64 ABI. + if (const BuiltinType *BT = Ty-getAsBuiltinType()) { ditto http://reviews.llvm.org/D11437 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11466: Correct x86_64 Android fp128 mangled name
rnk added a comment. Thanks, this seems almost done. Sorry for missing the -O on the first round. Comment at: test/CodeGen/long_double_fp128.cpp:1 @@ +1,2 @@ +// RUN: %clang_cc1 -triple x86_64-linux-android -emit-llvm -O -o - %s \ +// RUN:| FileCheck %s --check-prefix=A64 I don't think these tests need optimizations (-O). http://reviews.llvm.org/D11466 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11237: Add support for -rtlib option and -stdlib option to the mingw driver
This revision was automatically updated to reflect the committed changes. Closed by commit rL242905: [mingw] Add support for -rtlib option and -stdlib option to the mingw driver (authored by rnk). Changed prior to commit: http://reviews.llvm.org/D11237?vs=30322id=30359#toc Repository: rL LLVM http://reviews.llvm.org/D11237 Files: cfe/trunk/lib/Driver/MinGWToolChain.cpp cfe/trunk/lib/Driver/Tools.cpp Index: cfe/trunk/lib/Driver/Tools.cpp === --- cfe/trunk/lib/Driver/Tools.cpp +++ cfe/trunk/lib/Driver/Tools.cpp @@ -2247,8 +2247,7 @@ // Until ARM libraries are build separately, we have them all in one library static StringRef getArchNameForCompilerRTLib(const ToolChain TC) { - if (TC.getTriple().isOSWindows() - !TC.getTriple().isWindowsItaniumEnvironment() + if (TC.getTriple().isWindowsMSVCEnvironment() TC.getArch() == llvm::Triple::x86) return i386; if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb) @@ -2274,10 +2273,12 @@ : ; bool IsOSWindows = TC.getTriple().isOSWindows(); + bool IsITANMSVCWindows = TC.getTriple().isWindowsMSVCEnvironment() || + TC.getTriple().isWindowsItaniumEnvironment(); StringRef Arch = getArchNameForCompilerRTLib(TC); - const char *Prefix = IsOSWindows ? : lib; + const char *Prefix = IsITANMSVCWindows ? : lib; const char *Suffix = - Shared ? (IsOSWindows ? .dll : .so) : (IsOSWindows ? .lib : .a); + Shared ? (IsOSWindows ? .dll : .so) : (IsITANMSVCWindows ? .lib : .a); SmallString128 Path = getCompilerRTLibDir(TC); llvm::sys::path::append(Path, Prefix + Twine(clang_rt.) + Component + - + @@ -7840,6 +7841,7 @@ static void AddLibgcc(const llvm::Triple Triple, const Driver D, ArgStringList CmdArgs, const ArgList Args) { bool isAndroid = Triple.getEnvironment() == llvm::Triple::Android; + bool isCygMing = Triple.isOSCygMing(); bool StaticLibgcc = Args.hasArg(options::OPT_static_libgcc) || Args.hasArg(options::OPT_static); if (!D.CCCIsCXX()) @@ -7849,10 +7851,10 @@ if (D.CCCIsCXX()) CmdArgs.push_back(-lgcc); } else { -if (!D.CCCIsCXX()) +if (!D.CCCIsCXX() !isCygMing) CmdArgs.push_back(--as-needed); CmdArgs.push_back(-lgcc_s); -if (!D.CCCIsCXX()) +if (!D.CCCIsCXX() !isCygMing) CmdArgs.push_back(--no-as-needed); } @@ -8934,15 +8936,10 @@ if (Args.hasArg(options::OPT_mthreads)) CmdArgs.push_back(-lmingwthrd); CmdArgs.push_back(-lmingw32); - if (Args.hasArg(options::OPT_shared) || - Args.hasArg(options::OPT_shared_libgcc) || - !Args.hasArg(options::OPT_static_libgcc)) { -CmdArgs.push_back(-lgcc_s); -CmdArgs.push_back(-lgcc); - } else { -CmdArgs.push_back(-lgcc); -CmdArgs.push_back(-lgcc_eh); - } + + // Add libgcc or compiler-rt. + AddRunTimeLibs(getToolChain(), getToolChain().getDriver(), CmdArgs, Args); + CmdArgs.push_back(-lmoldname); CmdArgs.push_back(-lmingwex); CmdArgs.push_back(-lmsvcrt); Index: cfe/trunk/lib/Driver/MinGWToolChain.cpp === --- cfe/trunk/lib/Driver/MinGWToolChain.cpp +++ cfe/trunk/lib/Driver/MinGWToolChain.cpp @@ -192,16 +192,18 @@ if (DriverArgs.hasArg(options::OPT_nostdlibinc)) return; - llvm::SmallString1024 IncludeDir(GccLibDir); - llvm::sys::path::append(IncludeDir, include); - addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str()); - IncludeDir += -fixed; + if (GetRuntimeLibType(DriverArgs) == ToolChain::RLT_Libgcc) { +llvm::SmallString1024 IncludeDir(GccLibDir); +llvm::sys::path::append(IncludeDir, include); +addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str()); +IncludeDir += -fixed; #ifdef LLVM_ON_UNIX - // openSUSE - addSystemInclude(DriverArgs, CC1Args, - /usr/x86_64-w64-mingw32/sys-root/mingw/include); +// openSUSE +addSystemInclude(DriverArgs, CC1Args, + /usr/x86_64-w64-mingw32/sys-root/mingw/include); #endif - addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str()); +addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str()); + } addSystemInclude(DriverArgs, CC1Args, Base + Arch + include); addSystemInclude(DriverArgs, CC1Args, Base + include); } @@ -212,19 +214,29 @@ DriverArgs.hasArg(options::OPT_nostdincxx)) return; - llvm::SmallVectorllvm::SmallString1024, 4 CppIncludeBases; - CppIncludeBases.emplace_back(Base); - llvm::sys::path::append(CppIncludeBases[0], Arch, include, c++); - CppIncludeBases.emplace_back(Base); - llvm::sys::path::append(CppIncludeBases[1], Arch, include, c++, Ver); - CppIncludeBases.emplace_back(Base); - llvm::sys::path::append(CppIncludeBases[2], include, c++, Ver); - CppIncludeBases.emplace_back(GccLibDir); - llvm::sys::path::append(CppIncludeBases[3], include, c++); -
r242905 - [mingw] Add support for -rtlib option and -stdlib option to the mingw driver
Author: rnk Date: Wed Jul 22 11:01:38 2015 New Revision: 242905 URL: http://llvm.org/viewvc/llvm-project?rev=242905view=rev Log: [mingw] Add support for -rtlib option and -stdlib option to the mingw driver Now clang should be able to use compiler-rt and libc++ on mingw. Based on a patch by Martell Malone. Differential Revision: http://reviews.llvm.org/D11237 Modified: cfe/trunk/lib/Driver/MinGWToolChain.cpp cfe/trunk/lib/Driver/Tools.cpp Modified: cfe/trunk/lib/Driver/MinGWToolChain.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MinGWToolChain.cpp?rev=242905r1=242904r2=242905view=diff == --- cfe/trunk/lib/Driver/MinGWToolChain.cpp (original) +++ cfe/trunk/lib/Driver/MinGWToolChain.cpp Wed Jul 22 11:01:38 2015 @@ -192,16 +192,18 @@ void MinGW::AddClangSystemIncludeArgs(co if (DriverArgs.hasArg(options::OPT_nostdlibinc)) return; - llvm::SmallString1024 IncludeDir(GccLibDir); - llvm::sys::path::append(IncludeDir, include); - addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str()); - IncludeDir += -fixed; + if (GetRuntimeLibType(DriverArgs) == ToolChain::RLT_Libgcc) { +llvm::SmallString1024 IncludeDir(GccLibDir); +llvm::sys::path::append(IncludeDir, include); +addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str()); +IncludeDir += -fixed; #ifdef LLVM_ON_UNIX - // openSUSE - addSystemInclude(DriverArgs, CC1Args, - /usr/x86_64-w64-mingw32/sys-root/mingw/include); +// openSUSE +addSystemInclude(DriverArgs, CC1Args, + /usr/x86_64-w64-mingw32/sys-root/mingw/include); #endif - addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str()); +addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str()); + } addSystemInclude(DriverArgs, CC1Args, Base + Arch + include); addSystemInclude(DriverArgs, CC1Args, Base + include); } @@ -212,19 +214,29 @@ void MinGW::AddClangCXXStdlibIncludeArgs DriverArgs.hasArg(options::OPT_nostdincxx)) return; - llvm::SmallVectorllvm::SmallString1024, 4 CppIncludeBases; - CppIncludeBases.emplace_back(Base); - llvm::sys::path::append(CppIncludeBases[0], Arch, include, c++); - CppIncludeBases.emplace_back(Base); - llvm::sys::path::append(CppIncludeBases[1], Arch, include, c++, Ver); - CppIncludeBases.emplace_back(Base); - llvm::sys::path::append(CppIncludeBases[2], include, c++, Ver); - CppIncludeBases.emplace_back(GccLibDir); - llvm::sys::path::append(CppIncludeBases[3], include, c++); - for (auto CppIncludeBase : CppIncludeBases) { -CppIncludeBase += llvm::sys::path::get_separator(); -addSystemInclude(DriverArgs, CC1Args, CppIncludeBase); -addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + Arch); -addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + backward); + switch (GetCXXStdlibType(DriverArgs)) { + case ToolChain::CST_Libcxx: +addSystemInclude(DriverArgs, CC1Args, Base+ include + + llvm::sys::path::get_separator() + c++ + + llvm::sys::path::get_separator() + v1); +break; + + case ToolChain::CST_Libstdcxx: +llvm::SmallVectorllvm::SmallString1024, 4 CppIncludeBases; +CppIncludeBases.emplace_back(Base); +llvm::sys::path::append(CppIncludeBases[0], Arch, include, c++); +CppIncludeBases.emplace_back(Base); +llvm::sys::path::append(CppIncludeBases[1], Arch, include, c++, Ver); +CppIncludeBases.emplace_back(Base); +llvm::sys::path::append(CppIncludeBases[2], include, c++, Ver); +CppIncludeBases.emplace_back(GccLibDir); +llvm::sys::path::append(CppIncludeBases[3], include, c++); +for (auto CppIncludeBase : CppIncludeBases) { + CppIncludeBase += llvm::sys::path::get_separator(); + addSystemInclude(DriverArgs, CC1Args, CppIncludeBase); + addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + Arch); + addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + backward); +} +break; } } Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=242905r1=242904r2=242905view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Wed Jul 22 11:01:38 2015 @@ -2247,8 +2247,7 @@ static void CollectArgsForIntegratedAsse // Until ARM libraries are build separately, we have them all in one library static StringRef getArchNameForCompilerRTLib(const ToolChain TC) { - if (TC.getTriple().isOSWindows() - !TC.getTriple().isWindowsItaniumEnvironment() + if (TC.getTriple().isWindowsMSVCEnvironment() TC.getArch() == llvm::Triple::x86) return i386; if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb) @@ -2274,10 +2273,12 @@ SmallString128 tools::getCompilerRT(co : ; bool IsOSWindows =
Re: [PATCH] D11237: Add support for -rtlib option and -stdlib option to the mingw driver
rnk accepted this revision. rnk added a comment. This revision is now accepted and ready to land. In http://reviews.llvm.org/D11237#208710, @martell wrote: I hope this is what you meant rnk :) I see, your change was better as it was. I put back AddLibGCC and I'm going to commit it like that. Please test it and let me know if it still works, and then we can try to merge to 3.7. http://reviews.llvm.org/D11237 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11237: Add support for -rtlib option and -stdlib option to the mingw driver
rnk added inline comments. Comment at: tools/clang/lib/Driver/Tools.cpp:7845 @@ -7838,2 +7844,3 @@ bool isAndroid = Triple.getEnvironment() == llvm::Triple::Android; + bool isWindows = Triple.getOS() == llvm::Triple::Win32; bool StaticLibgcc = Args.hasArg(options::OPT_static_libgcc) || I had to change this to `Triple.isOSCygMing()` to make the existing windows-cross toolchain driver test pass. It expected --as-needed to be passed along. http://reviews.llvm.org/D11237 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11405: [MS ABI] Hook clang up to the new EH instructions
rnk added inline comments. Comment at: include/clang/Basic/LangOptions.def:111 @@ -110,2 +110,3 @@ LANGOPT(SjLjExceptions, 1, 0, setjmp-longjump exception handling) +LANGOPT(NewMSEH , 1, 0, new IR representation for MS exceptions) LANGOPT(TraditionalCPP, 1, 0, traditional CPP emulation) Seems like it should be a CodeGenOption. Comment at: lib/CodeGen/CGCleanup.cpp:907 @@ +906,3 @@ +llvm::BasicBlock *NextAction = getEHDispatchBlock(EHParent); +if (CGM.getLangOpts().NewMSEH getTarget().getCXXABI().isMicrosoft()) { + if (NextAction) Should we do anything to synchronize these getCXXABI checks with the EHPersonality? At the very least, I think it's more intuitive to the reader to make the decisions about the IR we use to be based on the personality. Probably the right thing to do here is to declare EHPersonality in CGCleanup.h, and then acknowledge that CGCleanup.h is actually CGException.h. Sounds like a separable patch. Comment at: lib/CodeGen/CGException.cpp:897 @@ +896,3 @@ +EHCatchScope catchScope) { + llvm::BasicBlock *dispatchBlock = catchScope.getCachedEHDispatchBlock(); + assert(dispatchBlock); Should we rename the locals here according to the prevailing LLVM style? Comment at: lib/CodeGen/CGException.cpp:911 @@ +910,3 @@ +llvm::Value *typeValue = handler.Type; +assert((typeValue != nullptr || handler.isCatchAll())); +if (!typeValue) Drop the extra parens? Comment at: lib/CodeGen/CGException.cpp:944 @@ -824,3 +943,3 @@ /// It is an invariant that the dispatch block already exists. -static void emitCatchDispatchBlock(CodeGenFunction CGF, - EHCatchScope catchScope) { +static llvm::BasicBlock *emitCatchDispatchBlock(CodeGenFunction CGF, +EHCatchScope catchScope) { Please add a comment documenting what the return value is. I'm thinking: If the catchblock instructions are used for EH dispatch, then the basic block holding the final catchendblock instruction is returned. http://reviews.llvm.org/D11405 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11148: [ARM] Implement -Wa, -mfpu and friends for assemblers
rnk added a comment. Sorry for ignoring this. I looked at it, didn't like the approach, but couldn't think of a better one. Here's a dumb idea: what if we alias -Wa,-mcpu= to -mcpu=? This would have the unintended side effect of making -Wa,-mcpu affect the CPU used for *compilation* in addition to assembly, but that seems like not a very big deal. If that's OK, it solves the whole getLastArg problem without complicating the driver C++ code. Comment at: lib/Driver/Tools.cpp:536 @@ +535,3 @@ +if (Value.startswith(-mcpu=)) +CPU = Value.substr(6); +if (Value.startswith(-march=)) You probably want to clang-format the patch. http://reviews.llvm.org/D11148 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11437: Correct x86_64 fp128 mangled name and return/varargs types
rnk added a comment. We really should not use the general LLVM IR type conversion machinery to decide how we are classifying our arguments. There are existing instances of us doing this, but we should strive to eliminate them. I think the right approach is probably to check `getLongDoubleFormat()`, see if it is `APFloat::IEEEquad` or `APFloat::x86DoubleExtended`, and pick memory, sse, or x87 classifications based on that. http://reviews.llvm.org/D11437 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11440: Move EHPersonality to CGCleanup
rnk accepted this revision. rnk added a comment. This revision is now accepted and ready to land. lgtm http://reviews.llvm.org/D11440 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11237: Add support for -rtlib option and -stdlib option to the mingw driver
rnk added inline comments. Comment at: tools/clang/lib/Driver/Tools.cpp:9087 @@ -9075,3 +9086,3 @@ - AddLibGCC(Args, CmdArgs); + AddRuntime(TC, Args, CmdArgs); You still don't need this, see the static helper `AddRunTimeLibs()` in Tools.cpp. It already has all this logic, and shares it across tools. We should make the mingw linker tool use it, just like the gnutools linker does. http://reviews.llvm.org/D11237 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r242710 - Fix code completion tests to use an explicit modules cache path
Author: rnk Date: Mon Jul 20 16:22:46 2015 New Revision: 242710 URL: http://llvm.org/viewvc/llvm-project?rev=242710view=rev Log: Fix code completion tests to use an explicit modules cache path Otherwise the stale module cache data may cause the test to fail. These two tests are new and are the only instances of c-index-test with -fmodules that doesn't have an explicit module cache path. Modified: cfe/trunk/test/CodeCompletion/macros-in-modules.c cfe/trunk/test/CodeCompletion/macros-in-modules.m Modified: cfe/trunk/test/CodeCompletion/macros-in-modules.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/macros-in-modules.c?rev=242710r1=242709r2=242710view=diff == --- cfe/trunk/test/CodeCompletion/macros-in-modules.c (original) +++ cfe/trunk/test/CodeCompletion/macros-in-modules.c Mon Jul 20 16:22:46 2015 @@ -2,7 +2,7 @@ // RUN: echo 'module Foo { header foo.h }' %t/module.modulemap // RUN: echo '#define FOO_MACRO 42' %t/foo.h // RUN: c-index-test -code-completion-at=%s:9:1 -I %t %s | FileCheck %s -// RUN: c-index-test -code-completion-at=%s:9:1 -I %t -fmodules %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:9:1 -I %t -fmodules -fmodules-cache-path=%t %s | FileCheck %s #include foo.h int x = Modified: cfe/trunk/test/CodeCompletion/macros-in-modules.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/macros-in-modules.m?rev=242710r1=242709r2=242710view=diff == --- cfe/trunk/test/CodeCompletion/macros-in-modules.m (original) +++ cfe/trunk/test/CodeCompletion/macros-in-modules.m Mon Jul 20 16:22:46 2015 @@ -1,7 +1,7 @@ // RUN: rm -rf %t mkdir %t // RUN: echo 'module Foo { header foo.h }' %t/module.modulemap // RUN: echo '#define FOO_MACRO 42' %t/foo.h -// RUN: c-index-test -code-completion-at=%s:8:1 -I %t -fmodules %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:8:1 -I %t -fmodules-cache-path=%t -fmodules %s | FileCheck %s @import Foo; int x = ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: r242650 - [modules] Don't save uninteresting identifiers, and don't consider identifiers
On Sun, Jul 19, 2015 at 2:41 PM, Richard Smith richard-l...@metafoo.co.uk wrote: @@ -794,8 +795,15 @@ IdentifierInfo *ASTIdentifierLookupTrait // Set or check the various bits in the IdentifierInfo structure. // Token IDs are read-only. if (HasRevertedTokenIDToIdentifier II-getTokenID() != tok::identifier) -II-RevertTokenIDToIdentifier(); - II-setObjCOrBuiltinID(ObjCOrBuiltinID); +II-revertTokenIDToIdentifier(); + if (!F.isModule()) +II-setObjCOrBuiltinID(ObjCOrBuiltinID); + else if (HasRevertedBuiltin II-getBuiltinID()) { +II-revertBuiltin(); +assert((II-hasRevertedBuiltin() || +II-getObjCOrBuiltinID() == ObjCOrBuiltinID) + Incorrect ObjC keyword or builtin ID); + } assert(II-isExtensionToken() == ExtensionToken Incorrect extension token flag); (void)ExtensionToken; This assert is tripping for me locally on Windows. ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r242704 - Fix a case where we forgot to make a static local variable comdat
Author: rnk Date: Mon Jul 20 15:35:30 2015 New Revision: 242704 URL: http://llvm.org/viewvc/llvm-project?rev=242704view=rev Log: Fix a case where we forgot to make a static local variable comdat Sometimes we can provide an initializer for static locals, in which case we sometimes might need to change the type. Changing the type requires making a new LLVM GlobalVariable, and in this codepath we were forgetting to transfer the comdat. Fixes PR23838. Patch by Ivan Garramona. Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp cfe/trunk/test/CodeGenCXX/static-init.cpp Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=242704r1=242703r2=242704view=diff == --- cfe/trunk/lib/CodeGen/CGDecl.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDecl.cpp Mon Jul 20 15:35:30 2015 @@ -311,6 +311,7 @@ CodeGenFunction::AddInitializerToStaticV OldGV-getThreadLocalMode(), CGM.getContext().getTargetAddressSpace(D.getType())); GV-setVisibility(OldGV-getVisibility()); +GV-setComdat(OldGV-getComdat()); // Steal the name of the old global GV-takeName(OldGV); Modified: cfe/trunk/test/CodeGenCXX/static-init.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/static-init.cpp?rev=242704r1=242703r2=242704view=diff == --- cfe/trunk/test/CodeGenCXX/static-init.cpp (original) +++ cfe/trunk/test/CodeGenCXX/static-init.cpp Mon Jul 20 15:35:30 2015 @@ -9,6 +9,7 @@ // CHECK: @_ZZ2h2vE1i = linkonce_odr global i32 0, comdat, align // CHECK: @_ZGVZ2h2vE1i = linkonce_odr global i64 0, comdat{{$}} // CHECK: @_ZZN5test1L6getvarEiE3var = internal constant [4 x i32] [i32 1, i32 0, i32 2, i32 4], align 16 +// CHECK: @_ZZN5test414useStaticLocalEvE3obj = linkonce_odr global %struct.test4::HasVTable zeroinitializer, comdat, align 8 struct A { A(); @@ -154,3 +155,19 @@ namespace test3 { // CHECK-LABEL: define void @_ZN5test31BC2Ev( // CHECK-LABEL: define void @_ZN5test31BC1Ev( } + +// We forgot to set the comdat when replacing the global with a different type. +namespace test4 { +struct HasVTable { + virtual void f(); +}; +inline HasVTable useStaticLocal() { + static HasVTable obj; + return obj; +} +void useit() { + useStaticLocal(); +} +// CHECK: define linkonce_odr dereferenceable(8) %struct.test4::HasVTable* @_ZN5test414useStaticLocalEv() +// CHECK: ret %struct.test4::HasVTable* @_ZZN5test414useStaticLocalEvE3obj +} ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11085: compiler-rt: add support for mingw-w64 in builtins
rnk added a comment. I went ahead and landed the patch. I missed the part of the message where you mentioned that Yaron wasn't going to land it. Thanks! Repository: rL LLVM http://reviews.llvm.org/D11085 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11085: compiler-rt: add support for mingw-w64 in builtins
This revision was automatically updated to reflect the committed changes. Closed by commit rL242539: compiler-rt: add support for mingw-w64 in builtins (authored by rnk). Changed prior to commit: http://reviews.llvm.org/D11085?vs=29593id=30011#toc Repository: rL LLVM http://reviews.llvm.org/D11085 Files: compiler-rt/trunk/CMakeLists.txt compiler-rt/trunk/lib/builtins/CMakeLists.txt compiler-rt/trunk/lib/builtins/enable_execute_stack.c Index: compiler-rt/trunk/CMakeLists.txt === --- compiler-rt/trunk/CMakeLists.txt +++ compiler-rt/trunk/CMakeLists.txt @@ -164,7 +164,7 @@ # We support running instrumented tests when we're not cross compiling # and target a UNIX-like system or Windows. # We can run tests on Android even when we are cross-compiling. -if((${CMAKE_HOST_SYSTEM} STREQUAL ${CMAKE_SYSTEM} AND (UNIX OR MSVC)) OR ANDROID +if((${CMAKE_HOST_SYSTEM} STREQUAL ${CMAKE_SYSTEM} AND (UNIX OR WIN32)) OR ANDROID OR COMPILER_RT_EMULATOR) option(COMPILER_RT_CAN_EXECUTE_TESTS Can we execute instrumented tests ON) else() Index: compiler-rt/trunk/lib/builtins/CMakeLists.txt === --- compiler-rt/trunk/lib/builtins/CMakeLists.txt +++ compiler-rt/trunk/lib/builtins/CMakeLists.txt @@ -154,6 +154,12 @@ x86_64/floatundixf.S ${GENERIC_SOURCES}) +if(WIN32) + set(x86_64_SOURCES + ${x86_64_SOURCES} + x86_64/chkstk.S) +endif() + set(i386_SOURCES i386/ashldi3.S i386/ashrdi3.S @@ -171,6 +177,12 @@ i386/umoddi3.S ${GENERIC_SOURCES}) +if(WIN32) + set(i386_SOURCES + ${i386_SOURCES} + i386/chkstk.S) +endif() + set(i686_SOURCES ${i386_SOURCES}) @@ -260,7 +272,7 @@ add_custom_target(builtins) -if (NOT WIN32) +if (NOT WIN32 OR MINGW) foreach (arch x86_64 i386 i686 arm) if (CAN_TARGET_${arch}) # Filter out generic versions of routines that are re-implemented in Index: compiler-rt/trunk/lib/builtins/enable_execute_stack.c === --- compiler-rt/trunk/lib/builtins/enable_execute_stack.c +++ compiler-rt/trunk/lib/builtins/enable_execute_stack.c @@ -10,17 +10,24 @@ #include int_lib.h +#ifndef _WIN32 #include sys/mman.h +#endif /* #include config.h * FIXME: CMake - include when cmake system is ready. * Remove #define HAVE_SYSCONF 1 line. */ #define HAVE_SYSCONF 1 +#ifdef _WIN32 +#include windef.h +#include winbase.h +#else #ifndef __APPLE__ #include unistd.h #endif /* __APPLE__ */ +#endif /* _WIN32 */ #if __LP64__ #define TRAMPOLINE_SIZE 48 @@ -40,6 +47,12 @@ __enable_execute_stack(void* addr) { +#if _WIN32 + MEMORY_BASIC_INFORMATION mbi; + if (!VirtualQuery (addr, mbi, sizeof(mbi))) + return; /* We should probably assert here because there is no return value */ + VirtualProtect (mbi.BaseAddress, mbi.RegionSize, PAGE_EXECUTE_READWRITE, mbi.Protect); +#else #if __APPLE__ /* On Darwin, pagesize is always 4096 bytes */ const uintptr_t pageSize = 4096; @@ -55,4 +68,5 @@ unsigned char* endPage = (unsigned char*)((p+TRAMPOLINE_SIZE+pageSize) pageAlignMask); size_t length = endPage - startPage; (void) mprotect((void *)startPage, length, PROT_READ | PROT_WRITE | PROT_EXEC); +#endif } Index: compiler-rt/trunk/CMakeLists.txt === --- compiler-rt/trunk/CMakeLists.txt +++ compiler-rt/trunk/CMakeLists.txt @@ -164,7 +164,7 @@ # We support running instrumented tests when we're not cross compiling # and target a UNIX-like system or Windows. # We can run tests on Android even when we are cross-compiling. -if((${CMAKE_HOST_SYSTEM} STREQUAL ${CMAKE_SYSTEM} AND (UNIX OR MSVC)) OR ANDROID +if((${CMAKE_HOST_SYSTEM} STREQUAL ${CMAKE_SYSTEM} AND (UNIX OR WIN32)) OR ANDROID OR COMPILER_RT_EMULATOR) option(COMPILER_RT_CAN_EXECUTE_TESTS Can we execute instrumented tests ON) else() Index: compiler-rt/trunk/lib/builtins/CMakeLists.txt === --- compiler-rt/trunk/lib/builtins/CMakeLists.txt +++ compiler-rt/trunk/lib/builtins/CMakeLists.txt @@ -154,6 +154,12 @@ x86_64/floatundixf.S ${GENERIC_SOURCES}) +if(WIN32) + set(x86_64_SOURCES + ${x86_64_SOURCES} + x86_64/chkstk.S) +endif() + set(i386_SOURCES i386/ashldi3.S i386/ashrdi3.S @@ -171,6 +177,12 @@ i386/umoddi3.S ${GENERIC_SOURCES}) +if(WIN32) + set(i386_SOURCES + ${i386_SOURCES} + i386/chkstk.S) +endif() + set(i686_SOURCES ${i386_SOURCES}) @@ -260,7 +272,7 @@ add_custom_target(builtins) -if (NOT WIN32) +if (NOT WIN32 OR MINGW) foreach (arch x86_64 i386 i686 arm) if (CAN_TARGET_${arch}) # Filter out generic versions of routines that are re-implemented in Index: compiler-rt/trunk/lib/builtins/enable_execute_stack.c
Re: [PATCH] D11207: Enable recognition of __declspec for PS4
rnk added inline comments. Comment at: include/clang/Basic/LangOptions.def:81 @@ -80,2 +80,3 @@ LANGOPT(ObjC2 , 1, 0, Objective-C 2) +LANGOPT(SceExt, 1, 0, Sony PlayStation(R) extensions) BENIGN_LANGOPT(ObjCDefaultSynthProperties , 1, 0, dberlin wrote: silvas wrote: wristow wrote: rnk wrote: How do you guys feel about sony vs. sce? I know we abbreviated Microsoft to MS, but I think a lot of folks don't know that the full name of the particular company involved is Sony Computer Entertainment. If -fsce-extensions is already used in build systems, I'm OK leaving the flag as is. I'm mostly concerned with SceExt. We do already have '-target x86_64-scei-ps4', and we have other pending changes that use 'sce' (rather than 'scei') that I expect will appear very soon. So we (Sony) are leaning toward continuing with 'sce'. Sony is way too broad. The company Sony does everything from image sensors to banking insurance to lithium batteries to public transit turnstiles to laparoscopic surgery equipment. We don't represent the entire company Sony, nor is there any reason to believe that anything we are doing applies to Sony as a whole. Please don't use (R) here. It should be unnecessary (and we don't do it for others). Sounds like it's going to be SCE, then. Would it be accurate to put Sony Computer Entertainment extensions in the comment, since that's what's being abbreviated? http://reviews.llvm.org/D11207 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] ignore __declspec(novtable) on non-Windows platforms
On Fri, Jul 17, 2015 at 4:45 AM, Aaron Ballman aa...@aaronballman.com wrote: On Thu, Jul 16, 2015 at 8:42 PM, Bob Wilson bob.wil...@apple.com wrote: Clang used to silently ignore __declspec(novtable) for all platforms, but it is now implemented for Windows. However, we don’t check if the target is Windows. This does not work when using the Itanium ABI, where the class layout for complex class hierarchies is stored in the vtable. Leaving the vtable uninitialized on non-Windows platforms does not work in that case. It might be possible to honor the novtable attribute in some simple cases and either report an error or ignore it in more complex situations, but it’s not clear if that would be worthwhile. There is also value in having a simple and predictable behavior, so I am proposed the attached patch which simply ignores novtable on non-Windows platforms. I think it might actually be worth making it work. I have vague recollections of Chromium developers wondering how to do the equivalent size saving optimization on non-Windows targets. We'd have to pin down what makes a complex class hierarchy. I'm assuming the fix would be to emit the vptr store if the class has virtual bases. MSVC supports an Itanium build target. What does __declspec(novtable) do there with the complex class layouts? I don't have Visual Studio installed with support for Itanium, otherwise I would test this myself. I think Bob is talking about the Itanium C++ ABI, which I don't think MSVC ever implemented. If they did, I wouldn't be surprised if they simply ignored this declspec. ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11085: compiler-rt: add support for mingw-w64 in builtins
rnk added a comment. In http://reviews.llvm.org/D11085#207187, @martell wrote: Hi rnk thanks for landing it. its missing the 2 chkstk.S files in the commit ? Woops, r242540. Repository: rL LLVM http://reviews.llvm.org/D11085 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D10272: Fix alignment issues in Clang.
rnk accepted this revision. rnk added a reviewer: rnk. rnk added a comment. This revision is now accepted and ready to land. lgtm http://reviews.llvm.org/D10272 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11207: Enable recognition of __declspec for PS4
rnk added a subscriber: rnk. rnk added a comment. Seems reasonable. Comment at: include/clang/Basic/LangOptions.def:81 @@ -80,2 +80,3 @@ LANGOPT(ObjC2 , 1, 0, Objective-C 2) +LANGOPT(SceExt, 1, 0, Sony PlayStation(R) extensions) BENIGN_LANGOPT(ObjCDefaultSynthProperties , 1, 0, How do you guys feel about sony vs. sce? I know we abbreviated Microsoft to MS, but I think a lot of folks don't know that the full name of the particular company involved is Sony Computer Entertainment. If -fsce-extensions is already used in build systems, I'm OK leaving the flag as is. I'm mostly concerned with SceExt. http://reviews.llvm.org/D11207 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r242309 - Run clang-format on Tools.h, the indentation is inconsistent
Author: rnk Date: Wed Jul 15 12:58:55 2015 New Revision: 242309 URL: http://llvm.org/viewvc/llvm-project?rev=242309view=rev Log: Run clang-format on Tools.h, the indentation is inconsistent Modified: cfe/trunk/lib/Driver/Tools.h Modified: cfe/trunk/lib/Driver/Tools.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=242309r1=242308r2=242309view=diff == --- cfe/trunk/lib/Driver/Tools.h (original) +++ cfe/trunk/lib/Driver/Tools.h Wed Jul 15 12:58:55 2015 @@ -19,14 +19,14 @@ #include llvm/Support/Compiler.h namespace clang { - class ObjCRuntime; +class ObjCRuntime; namespace driver { - class Command; - class Driver; +class Command; +class Driver; namespace toolchains { - class MachO; +class MachO; } namespace tools { @@ -40,159 +40,153 @@ using llvm::opt::ArgStringList; SmallString128 getCompilerRT(const ToolChain TC, StringRef Component, bool Shared = false); - /// \brief Clang compiler tool. - class LLVM_LIBRARY_VISIBILITY Clang : public Tool { - public: -static const char *getBaseInputName(const llvm::opt::ArgList Args, -const InputInfo Input); -static const char *getBaseInputStem(const llvm::opt::ArgList Args, -const InputInfoList Inputs); -static const char *getDependencyFileName(const llvm::opt::ArgList Args, - const InputInfoList Inputs); - - private: -void AddPreprocessingOptions(Compilation C, const JobAction JA, - const Driver D, - const llvm::opt::ArgList Args, - llvm::opt::ArgStringList CmdArgs, - const InputInfo Output, - const InputInfoList Inputs) const; - -void AddAArch64TargetArgs(const llvm::opt::ArgList Args, - llvm::opt::ArgStringList CmdArgs) const; -void AddARMTargetArgs(const llvm::opt::ArgList Args, - llvm::opt::ArgStringList CmdArgs, - bool KernelOrKext) const; -void AddARM64TargetArgs(const llvm::opt::ArgList Args, +/// \brief Clang compiler tool. +class LLVM_LIBRARY_VISIBILITY Clang : public Tool { +public: + static const char *getBaseInputName(const llvm::opt::ArgList Args, + const InputInfo Input); + static const char *getBaseInputStem(const llvm::opt::ArgList Args, + const InputInfoList Inputs); + static const char *getDependencyFileName(const llvm::opt::ArgList Args, + const InputInfoList Inputs); + +private: + void AddPreprocessingOptions(Compilation C, const JobAction JA, + const Driver D, const llvm::opt::ArgList Args, + llvm::opt::ArgStringList CmdArgs, + const InputInfo Output, + const InputInfoList Inputs) const; + + void AddAArch64TargetArgs(const llvm::opt::ArgList Args, llvm::opt::ArgStringList CmdArgs) const; -void AddMIPSTargetArgs(const llvm::opt::ArgList Args, - llvm::opt::ArgStringList CmdArgs) const; -void AddPPCTargetArgs(const llvm::opt::ArgList Args, + void AddARMTargetArgs(const llvm::opt::ArgList Args, +llvm::opt::ArgStringList CmdArgs, +bool KernelOrKext) const; + void AddARM64TargetArgs(const llvm::opt::ArgList Args, llvm::opt::ArgStringList CmdArgs) const; -void AddR600TargetArgs(const llvm::opt::ArgList Args, - llvm::opt::ArgStringList CmdArgs) const; -void AddSparcTargetArgs(const llvm::opt::ArgList Args, -llvm::opt::ArgStringList CmdArgs) const; -void AddSystemZTargetArgs(const llvm::opt::ArgList Args, - llvm::opt::ArgStringList CmdArgs) const; -void AddX86TargetArgs(const llvm::opt::ArgList Args, + void AddMIPSTargetArgs(const llvm::opt::ArgList Args, + llvm::opt::ArgStringList CmdArgs) const; + void AddPPCTargetArgs(const llvm::opt::ArgList Args, +llvm::opt::ArgStringList CmdArgs) const; + void AddR600TargetArgs(const llvm::opt::ArgList Args, + llvm::opt::ArgStringList CmdArgs) const; + void AddSparcTargetArgs(const llvm::opt::ArgList Args, llvm::opt::ArgStringList CmdArgs) const; -void AddHexagonTargetArgs(const llvm::opt::ArgList Args, - llvm::opt::ArgStringList CmdArgs) const; + void AddSystemZTargetArgs(const llvm::opt::ArgList Args, +llvm::opt::ArgStringList CmdArgs)
Re: [PATCH] D11233: [MS Compat] Allow _Atomic(Type) and 'struct _Atomic' to coexist
rnk added a comment. This seems like a better solution. I assume you manually tested with MSVC's atomic. Comment at: test/SemaCXX/MicrosoftCompatibility.cpp:13 @@ -13,5 +12,3 @@ _Atomic(int) z; -#else struct _Atomic {}; Did you want to add a test for the base specifier case? http://reviews.llvm.org/D11233 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: r241620 - Wrap clang modules and pch files in an object file container.
On Tue, Jul 7, 2015 at 2:01 PM, Benjamin Kramer benny@gmail.com wrote: Going through the entire compiler stack (IR, selectiondag, ...) just to dump some bytes in an object files seems excessive. Can't you just drive MC directly? This would Has something been done to address this? All the semantic tools (libclang, tooling, clang-check, clang-tidy) should *not* have to depend on clang codegen. ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r242346 - [clang-cl] Use the Windows response file tokenizer
Author: rnk Date: Wed Jul 15 17:42:37 2015 New Revision: 242346 URL: http://llvm.org/viewvc/llvm-project?rev=242346view=rev Log: [clang-cl] Use the Windows response file tokenizer We were still using the Unix response file tokenizer for all driver modes. This was difficult to get right in the beginning because there is a circular dependency. The Driver class also can't officially determine its mode until it can see all possible --driver-mode= flags, and those flags could come from the response file. Now we use the Windows parsing algorithm if the program name looks like clang-cl, or if the --driver-mode=cl flag is present on the main command line. Fixes PR23709. Reviewers: hans Differential Revision: http://reviews.llvm.org/D11229 Added: cfe/trunk/test/Driver/cl-response-file.c Modified: cfe/trunk/lib/Driver/Job.cpp cfe/trunk/tools/driver/driver.cpp Modified: cfe/trunk/lib/Driver/Job.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Job.cpp?rev=242346r1=242345r2=242346view=diff == --- cfe/trunk/lib/Driver/Job.cpp (original) +++ cfe/trunk/lib/Driver/Job.cpp Wed Jul 15 17:42:37 2015 @@ -98,7 +98,9 @@ void Command::writeResponseFile(raw_ostr return; } - // In regular response files, we send all arguments to the response file + // In regular response files, we send all arguments to the response file. + // Wrapping all arguments in double quotes ensures that both Unix tools and + // Windows tools understand the response file. for (const char *Arg : Arguments) { OS ''; Added: cfe/trunk/test/Driver/cl-response-file.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-response-file.c?rev=242346view=auto == --- cfe/trunk/test/Driver/cl-response-file.c (added) +++ cfe/trunk/test/Driver/cl-response-file.c Wed Jul 15 17:42:37 2015 @@ -0,0 +1,13 @@ +// Don't attempt slash switches on msys bash. +// REQUIRES: shell-preserves-root + +// Test that we use the Windows tokenizer for clang-cl response files. The +// trailing backslash before the space should be interpreted as a literal +// backslash. PR23709 + + + +// RUN: echo '/I%S\Inputs\cl-response-file\ /DFOO=2' %t.rsp +// RUN: %clang_cl /c -### @%t.rsp -- %s 21 | FileCheck %s + +// CHECK: -D FOO=2 -I {{.*}}\\Inputs\\cl-response-file\\ Modified: cfe/trunk/tools/driver/driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=242346r1=242345r2=242346view=diff == --- cfe/trunk/tools/driver/driver.cpp (original) +++ cfe/trunk/tools/driver/driver.cpp Wed Jul 15 17:42:37 2015 @@ -231,8 +231,18 @@ static const DriverSuffix *FindDriverSuf return nullptr; } -static void ParseProgName(SmallVectorImplconst char * ArgVector, - std::setstd::string SavedStrings) { +/// Normalize the program name from argv[0] by stripping the file extension if +/// present and lower-casing the string on Windows. +static std::string normalizeProgramName(const char *Argv0) { + std::string ProgName = llvm::sys::path::stem(Argv0); +#ifdef LLVM_ON_WIN32 + // Transform to lowercase for case insensitive file systems. + std::transform(ProgName.begin(), ProgName.end(), ProgName.begin(), ::tolower); +#endif + return ProgName; +} + +static const DriverSuffix *parseDriverSuffix(StringRef ProgName) { // Try to infer frontend type and default target from the program name by // comparing it against DriverSuffixes in order. @@ -240,54 +250,53 @@ static void ParseProgName(SmallVectorImp // E.g. x86_64-linux-clang as interpreted as suffix clang with target // prefix x86_64-linux. If such a target prefix is found, is gets added via // -target as implicit first argument. - - std::string ProgName =llvm::sys::path::stem(ArgVector[0]); -#ifdef LLVM_ON_WIN32 - // Transform to lowercase for case insensitive file systems. - ProgName = StringRef(ProgName).lower(); -#endif - - StringRef ProgNameRef = ProgName; - const DriverSuffix *DS = FindDriverSuffix(ProgNameRef); + const DriverSuffix *DS = FindDriverSuffix(ProgName); if (!DS) { // Try again after stripping any trailing version number: // clang++3.5 - clang++ -ProgNameRef = ProgNameRef.rtrim(0123456789.); -DS = FindDriverSuffix(ProgNameRef); +ProgName = ProgName.rtrim(0123456789.); +DS = FindDriverSuffix(ProgName); } if (!DS) { // Try again after stripping trailing -component. // clang++-tot - clang++ -ProgNameRef = ProgNameRef.slice(0, ProgNameRef.rfind('-')); -DS = FindDriverSuffix(ProgNameRef); +ProgName = ProgName.slice(0, ProgName.rfind('-')); +DS = FindDriverSuffix(ProgName); } + return DS; +} - if (DS) { -if (const char *Flag = DS-ModeFlag) { - // Add Flag to the arguments. - auto it =
Re: [PATCH] D11229: [clang-cl] Use the Windows response file tokenizer
This revision was automatically updated to reflect the committed changes. Closed by commit rL242346: [clang-cl] Use the Windows response file tokenizer (authored by rnk). Changed prior to commit: http://reviews.llvm.org/D11229?vs=29799id=29843#toc Repository: rL LLVM http://reviews.llvm.org/D11229 Files: cfe/trunk/lib/Driver/Job.cpp cfe/trunk/test/Driver/cl-response-file.c cfe/trunk/tools/driver/driver.cpp Index: cfe/trunk/test/Driver/cl-response-file.c === --- cfe/trunk/test/Driver/cl-response-file.c +++ cfe/trunk/test/Driver/cl-response-file.c @@ -0,0 +1,13 @@ +// Don't attempt slash switches on msys bash. +// REQUIRES: shell-preserves-root + +// Test that we use the Windows tokenizer for clang-cl response files. The +// trailing backslash before the space should be interpreted as a literal +// backslash. PR23709 + + + +// RUN: echo '/I%S\Inputs\cl-response-file\ /DFOO=2' %t.rsp +// RUN: %clang_cl /c -### @%t.rsp -- %s 21 | FileCheck %s + +// CHECK: -D FOO=2 -I {{.*}}\\Inputs\\cl-response-file\\ Index: cfe/trunk/lib/Driver/Job.cpp === --- cfe/trunk/lib/Driver/Job.cpp +++ cfe/trunk/lib/Driver/Job.cpp @@ -98,7 +98,9 @@ return; } - // In regular response files, we send all arguments to the response file + // In regular response files, we send all arguments to the response file. + // Wrapping all arguments in double quotes ensures that both Unix tools and + // Windows tools understand the response file. for (const char *Arg : Arguments) { OS ''; Index: cfe/trunk/tools/driver/driver.cpp === --- cfe/trunk/tools/driver/driver.cpp +++ cfe/trunk/tools/driver/driver.cpp @@ -231,63 +231,72 @@ return nullptr; } -static void ParseProgName(SmallVectorImplconst char * ArgVector, - std::setstd::string SavedStrings) { +/// Normalize the program name from argv[0] by stripping the file extension if +/// present and lower-casing the string on Windows. +static std::string normalizeProgramName(const char *Argv0) { + std::string ProgName = llvm::sys::path::stem(Argv0); +#ifdef LLVM_ON_WIN32 + // Transform to lowercase for case insensitive file systems. + std::transform(ProgName.begin(), ProgName.end(), ProgName.begin(), ::tolower); +#endif + return ProgName; +} + +static const DriverSuffix *parseDriverSuffix(StringRef ProgName) { // Try to infer frontend type and default target from the program name by // comparing it against DriverSuffixes in order. // If there is a match, the function tries to identify a target as prefix. // E.g. x86_64-linux-clang as interpreted as suffix clang with target // prefix x86_64-linux. If such a target prefix is found, is gets added via // -target as implicit first argument. - - std::string ProgName =llvm::sys::path::stem(ArgVector[0]); -#ifdef LLVM_ON_WIN32 - // Transform to lowercase for case insensitive file systems. - ProgName = StringRef(ProgName).lower(); -#endif - - StringRef ProgNameRef = ProgName; - const DriverSuffix *DS = FindDriverSuffix(ProgNameRef); + const DriverSuffix *DS = FindDriverSuffix(ProgName); if (!DS) { // Try again after stripping any trailing version number: // clang++3.5 - clang++ -ProgNameRef = ProgNameRef.rtrim(0123456789.); -DS = FindDriverSuffix(ProgNameRef); +ProgName = ProgName.rtrim(0123456789.); +DS = FindDriverSuffix(ProgName); } if (!DS) { // Try again after stripping trailing -component. // clang++-tot - clang++ -ProgNameRef = ProgNameRef.slice(0, ProgNameRef.rfind('-')); -DS = FindDriverSuffix(ProgNameRef); +ProgName = ProgName.slice(0, ProgName.rfind('-')); +DS = FindDriverSuffix(ProgName); } + return DS; +} - if (DS) { -if (const char *Flag = DS-ModeFlag) { - // Add Flag to the arguments. - auto it = ArgVector.begin(); - if (it != ArgVector.end()) -++it; - ArgVector.insert(it, Flag); -} - -StringRef::size_type LastComponent = ProgNameRef.rfind( -'-', ProgNameRef.size() - strlen(DS-Suffix)); -if (LastComponent == StringRef::npos) - return; - -// Infer target from the prefix. -StringRef Prefix = ProgNameRef.slice(0, LastComponent); -std::string IgnoredError; -if (llvm::TargetRegistry::lookupTarget(Prefix, IgnoredError)) { - auto it = ArgVector.begin(); - if (it != ArgVector.end()) -++it; - const char *arr[] = { -target, GetStableCStr(SavedStrings, Prefix) }; - ArgVector.insert(it, std::begin(arr), std::end(arr)); -} +static void insertArgsFromProgramName(StringRef ProgName, + const DriverSuffix *DS, + SmallVectorImplconst char * ArgVector, + std::setstd::string SavedStrings) { + if
[PATCH] D11229: [clang-cl] Use the Windows response file tokenizer
rnk created this revision. rnk added a reviewer: hans. rnk added a subscriber: cfe-commits. We were still using the Unix response file tokenizer for all driver modes. This was difficult to get right in the beginning because there is a circular dependency. The Driver class also can't officially determine its mode until it can see all possible --driver-mode= flags, and those flags could come from the response file. Now we use the Windows parsing algorithm if the program name looks like clang-cl, or if the --driver-mode=cl flag is present on the main command line. http://reviews.llvm.org/D11229 Files: lib/Driver/Job.cpp test/Driver/cl-response-file.c tools/driver/driver.cpp Index: tools/driver/driver.cpp === --- tools/driver/driver.cpp +++ tools/driver/driver.cpp @@ -231,63 +231,72 @@ return nullptr; } -static void ParseProgName(SmallVectorImplconst char * ArgVector, - std::setstd::string SavedStrings) { +/// Normalize the program name from argv[0] by stripping the file extension if +/// present and lower-casing the string on Windows. +static std::string normalizeProgramName(const char *Argv0) { + std::string ProgName = llvm::sys::path::stem(Argv0); +#ifdef LLVM_ON_WIN32 + // Transform to lowercase for case insensitive file systems. + ProgName = StringRef(ProgName).lower(); +#endif + return ProgName; +} + +static const DriverSuffix *parseDriverSuffix(StringRef ProgName) { // Try to infer frontend type and default target from the program name by // comparing it against DriverSuffixes in order. // If there is a match, the function tries to identify a target as prefix. // E.g. x86_64-linux-clang as interpreted as suffix clang with target // prefix x86_64-linux. If such a target prefix is found, is gets added via // -target as implicit first argument. - - std::string ProgName =llvm::sys::path::stem(ArgVector[0]); -#ifdef LLVM_ON_WIN32 - // Transform to lowercase for case insensitive file systems. - ProgName = StringRef(ProgName).lower(); -#endif - - StringRef ProgNameRef = ProgName; - const DriverSuffix *DS = FindDriverSuffix(ProgNameRef); + const DriverSuffix *DS = FindDriverSuffix(ProgName); if (!DS) { // Try again after stripping any trailing version number: // clang++3.5 - clang++ -ProgNameRef = ProgNameRef.rtrim(0123456789.); -DS = FindDriverSuffix(ProgNameRef); +ProgName = ProgName.rtrim(0123456789.); +DS = FindDriverSuffix(ProgName); } if (!DS) { // Try again after stripping trailing -component. // clang++-tot - clang++ -ProgNameRef = ProgNameRef.slice(0, ProgNameRef.rfind('-')); -DS = FindDriverSuffix(ProgNameRef); +ProgName = ProgName.slice(0, ProgName.rfind('-')); +DS = FindDriverSuffix(ProgName); } + return DS; +} - if (DS) { -if (const char *Flag = DS-ModeFlag) { - // Add Flag to the arguments. - auto it = ArgVector.begin(); - if (it != ArgVector.end()) -++it; - ArgVector.insert(it, Flag); -} +static void insertArgsFromProgramName(StringRef ProgName, + const DriverSuffix *DS, + SmallVectorImplconst char * ArgVector, + std::setstd::string SavedStrings) { + if (!DS) +return; + + if (const char *Flag = DS-ModeFlag) { +// Add Flag to the arguments. +auto it = ArgVector.begin(); +if (it != ArgVector.end()) + ++it; +ArgVector.insert(it, Flag); + } -StringRef::size_type LastComponent = ProgNameRef.rfind( -'-', ProgNameRef.size() - strlen(DS-Suffix)); -if (LastComponent == StringRef::npos) - return; - -// Infer target from the prefix. -StringRef Prefix = ProgNameRef.slice(0, LastComponent); -std::string IgnoredError; -if (llvm::TargetRegistry::lookupTarget(Prefix, IgnoredError)) { - auto it = ArgVector.begin(); - if (it != ArgVector.end()) -++it; - const char *arr[] = { -target, GetStableCStr(SavedStrings, Prefix) }; - ArgVector.insert(it, std::begin(arr), std::end(arr)); -} + StringRef::size_type LastComponent = ProgName.rfind( + '-', ProgName.size() - strlen(DS-Suffix)); + if (LastComponent == StringRef::npos) +return; + + // Infer target from the prefix. + StringRef Prefix = ProgName.slice(0, LastComponent); + std::string IgnoredError; + if (llvm::TargetRegistry::lookupTarget(Prefix, IgnoredError)) { +auto it = ArgVector.begin(); +if (it != ArgVector.end()) + ++it; +const char *arr[] = { -target, GetStableCStr(SavedStrings, Prefix) }; +ArgVector.insert(it, std::begin(arr), std::end(arr)); } } @@ -380,16 +389,29 @@ return 1; } + std::string ProgName = normalizeProgramName(argv[0]); + const DriverSuffix *DS = parseDriverSuffix(ProgName); + llvm::BumpPtrAllocator A; llvm::BumpPtrStringSaver Saver(A);
Re: [PATCH] D11237: Add support for -rtlib option and -stdlib option to the mingw driver
rnk added inline comments. Comment at: tools/clang/lib/Driver/MinGWToolChain.cpp:206 @@ +205,3 @@ + +ToolChain::RuntimeLibType MinGW::GetRuntimeLibType(const ArgList Args) const{ + if (Arg *A = Args.getLastArg(options::OPT_rtlib_EQ)) { You don't need to override this, you can simply override GetDefaultRuntimeLibType() and leave the base class behavior for this. Comment at: tools/clang/lib/Driver/ToolChains.h:546-552 @@ -545,2 +545,9 @@ llvm::opt::ArgStringList CC1Args) const override; + void AddCXXStdlibLibArgs(const llvm::opt::ArgList Args, + llvm::opt::ArgStringList CmdArgs) const override; + + CXXStdlibType GetCXXStdlibType( + const llvm::opt::ArgList Args) const override; + RuntimeLibType GetRuntimeLibType( + const llvm::opt::ArgList Args) const override; So far as I can tell, none of these overrides have any functionality change other than creating a place for TODOs. I'd rather just wait until we're ready to change the behavior, and then we can see how to do it with the least duplication. Comment at: tools/clang/lib/Driver/Tools.cpp:9064 @@ -9053,3 +9063,3 @@ - AddLibGCC(Args, CmdArgs); + AddRuntime(TC, Args, CmdArgs); Can't this just be AddRunTimeLibs() and then it won't require changing AddLibGCC? Comment at: tools/clang/lib/Driver/Tools.cpp:9085 @@ -9074,3 +9084,3 @@ else if (!LinkerName.equals_lower(lld)) -AddLibGCC(Args, CmdArgs); +AddRuntime(TC, Args, CmdArgs); } ditto http://reviews.llvm.org/D11237 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11168: Avoid passing objects with __declspec(align) members by value (PR24113) - clang part
rnk added inline comments. Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:23 @@ -22,3 +22,3 @@ -bool NotUnaryOperator(const ast_type_traits::DynTypedNode DynNode, ASTMatchFinder *Finder, BoundNodesTreeBuilder *Builder, The lack of here and below was probably a bug. :) http://reviews.llvm.org/D11168 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r242176 - [clang-cl] Disable C++ exceptions a different way
Author: rnk Date: Tue Jul 14 13:16:48 2015 New Revision: 242176 URL: http://llvm.org/viewvc/llvm-project?rev=242176view=rev Log: [clang-cl] Disable C++ exceptions a different way Rather than making -fexceptions a core option that enables C++ EH in clang-cl, users can use the '-Xclang -fexceptions -Xclang -fcxx-exceptions' flag set. We weren't going to expose -fexceptions in clang-cl in the long run, so this way we don't add and then remove a flag. Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/cl-eh.cpp Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=242176r1=242175r2=242176view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Tue Jul 14 13:16:48 2015 @@ -512,7 +512,7 @@ def femit_all_decls : Flag[-], femit HelpTextEmit all declarations, even if unused; def fencoding_EQ : Joined[-], fencoding=, Groupf_Group; def ferror_limit_EQ : Joined[-], ferror-limit=, Groupf_Group, Flags[CoreOption]; -def fexceptions : Flag[-], fexceptions, Groupf_Group, Flags[CC1Option, CoreOption], +def fexceptions : Flag[-], fexceptions, Groupf_Group, Flags[CC1Option], HelpTextEnable support for exception handling; def fexcess_precision_EQ : Joined[-], fexcess-precision=, Groupclang_ignored_gcc_optimization_f_Group; Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=242176r1=242175r2=242176view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Tue Jul 14 13:16:48 2015 @@ -5086,13 +5086,9 @@ static EHFlags parseClangCLEHFlags(const } } - // Only enable C++ exceptions if the user opts into it by passing - // -fexceptions. Lots of build systems implicitly pass /EHsc when users don't - // actually need it. - // FIXME: Remove this when they work out of the box. - if (!Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions, -/*default=*/false)) -EH = EHFlags(); + // FIXME: Disable C++ EH completely, until it becomes more reliable. Users + // can use -Xclang to manually enable C++ EH until then. + EH = EHFlags(); return EH; } Modified: cfe/trunk/test/Driver/cl-eh.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-eh.cpp?rev=242176r1=242175r2=242176view=diff == --- cfe/trunk/test/Driver/cl-eh.cpp (original) +++ cfe/trunk/test/Driver/cl-eh.cpp Tue Jul 14 13:16:48 2015 @@ -4,9 +4,7 @@ // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. -// RUN: %clang_cl /c /EHsc -fexceptions -### -- %s 21 | FileCheck -check-prefix=EHscfex %s -// EHscfex: -fcxx-exceptions -// EHscfex: -fexceptions +// FIXME: When C++ EH works, we can make this flag turn things back on. // RUN: %clang_cl /c /EHsc -### -- %s 21 | FileCheck -check-prefix=EHsc %s // EHsc-NOT: -fcxx-exceptions @@ -20,14 +18,14 @@ // EHs_EHc_-NOT: -fcxx-exceptions // EHs_EHc_-NOT: -fexceptions -// RUN: %clang_cl /c /EHs- /EHs -fexceptions -### -- %s 21 | FileCheck -check-prefix=EHs_EHs %s -// EHs_EHs: -fcxx-exceptions -// EHs_EHs: -fexceptions - -// RUN: %clang_cl /c /EHs- /EHsa -fexceptions -### -- %s 21 | FileCheck -check-prefix=EHs_EHa %s -// EHs_EHa: -fcxx-exceptions -// EHs_EHa: -fexceptions +// RUN: %clang_cl /c /EHs- /EHs -### -- %s 21 | FileCheck -check-prefix=EHs_EHs %s +// EHs_EHs-NOT: -fcxx-exceptions +// EHs_EHs-NOT: -fexceptions + +// RUN: %clang_cl /c /EHs- /EHsa -### -- %s 21 | FileCheck -check-prefix=EHs_EHa %s +// EHs_EHa-NOT: -fcxx-exceptions +// EHs_EHa-NOT: -fexceptions -// RUN: %clang_cl /c /EHinvalid -fexceptions -### -- %s 21 | FileCheck -check-prefix=EHinvalid %s +// RUN: %clang_cl /c /EHinvalid -### -- %s 21 | FileCheck -check-prefix=EHinvalid %s // EHinvalid: error: invalid value 'invalid' in '/EH' // EHinvalid-NOT: error: ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: r241952 - Disable C++ EH by default for clang-cl and MSVC environments
OK, I did it in r242176. On Mon, Jul 13, 2015 at 2:12 PM, Nico Weber tha...@chromium.org wrote: On Mon, Jul 13, 2015 at 1:54 PM, Reid Kleckner r...@google.com wrote: On Mon, Jul 13, 2015 at 1:19 PM, Nico Weber tha...@chromium.org wrote: On Fri, Jul 10, 2015 at 3:25 PM, Reid Kleckner r...@kleckner.net wrote: Author: rnk Date: Fri Jul 10 17:25:44 2015 New Revision: 241952 URL: http://llvm.org/viewvc/llvm-project?rev=241952view=rev https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D241952-26view-3Drevd=AwMFaQc=8hUWFZcy2Z-Za5rBPlktOQr=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxkm=43o64PHy3PY8fHJJNk57N4dKCjTig5KKi1cqeZpMalAs=O0MLvnqUJxG7KxnI0pjrsDPb7T4jFApDMs_sXczWSxUe= Log: Disable C++ EH by default for clang-cl and MSVC environments We don't need any more bug reports from users telling us that MSVC-style C++ exceptions are broken. Developers and adventurous users can still test the existing functionality by passing along -fexceptions to either clang or clang-cl. Cool. Is it really worth it to make -fexceptions a core option though? One day, exceptions will work and then /EHsc does the right thing. Until then, regular users shouldn't use -fexceptions, and irregular users can use -Xclang -fexceptions (which makes this look unsupported, just like it is). Well, you really need to do '-Xclang -fcxx-exceptions -Xclang -fexceptions', which is pretty heinous. …which is ok since regular people shouldn't do this anyways, no? ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: r241952 - Disable C++ EH by default for clang-cl and MSVC environments
On Mon, Jul 13, 2015 at 1:19 PM, Nico Weber tha...@chromium.org wrote: On Fri, Jul 10, 2015 at 3:25 PM, Reid Kleckner r...@kleckner.net wrote: Author: rnk Date: Fri Jul 10 17:25:44 2015 New Revision: 241952 URL: http://llvm.org/viewvc/llvm-project?rev=241952view=rev https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D241952-26view-3Drevd=AwMFaQc=8hUWFZcy2Z-Za5rBPlktOQr=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxkm=43o64PHy3PY8fHJJNk57N4dKCjTig5KKi1cqeZpMalAs=O0MLvnqUJxG7KxnI0pjrsDPb7T4jFApDMs_sXczWSxUe= Log: Disable C++ EH by default for clang-cl and MSVC environments We don't need any more bug reports from users telling us that MSVC-style C++ exceptions are broken. Developers and adventurous users can still test the existing functionality by passing along -fexceptions to either clang or clang-cl. Cool. Is it really worth it to make -fexceptions a core option though? One day, exceptions will work and then /EHsc does the right thing. Until then, regular users shouldn't use -fexceptions, and irregular users can use -Xclang -fexceptions (which makes this look unsupported, just like it is). Well, you really need to do '-Xclang -fcxx-exceptions -Xclang -fexceptions', which is pretty heinous. ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11109: basic code generation for use-after-dtor
rnk added a subscriber: rnk. Comment at: lib/CodeGen/CGClass.cpp:1456 @@ +1455,3 @@ + if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor) { +const ASTRecordLayout Layout = +getContext().getASTRecordLayout(Dtor-getParent()); Would you mind factoring this out to a helper function? Most readers of clang irgen probably aren't interested in this instrumentation. http://reviews.llvm.org/D11109 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11071: Add Windows ARM targets for mingw and cygwin to clang
rnk accepted this revision. rnk added a comment. This revision is now accepted and ready to land. lgtm http://reviews.llvm.org/D11071 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11075: LLVM gen correct asm info for mingw and cygwin arm targets
rnk accepted this revision. rnk added a comment. This revision is now accepted and ready to land. lgtm with those tests Comment at: lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp:282-285 @@ -281,6 +281,6 @@ MAI = new ARMMCAsmInfoDarwin(TheTriple); - else if (TheTriple.isWindowsItaniumEnvironment()) + else if (TheTriple.isWindowsItaniumEnvironment() || TheTriple.isOSCygMing()) MAI = new ARMCOFFMCAsmInfoGNU(); else if (TheTriple.isWindowsMSVCEnvironment()) MAI = new ARMCOFFMCAsmInfoMicrosoft(); else It's probably cleaner to flip the order to this: else if (TheTriple.isWindowsMSVCEnvironment()) MAI = new ARMCOFFMCAsmInfoMicrosoft(); else if (TheTriple.isOSWindows()) MAI = new ARMCOFFMCAsmInfoGNU(); else ... We basically have the MS environment and then the GNU-ish everything else one. Comment at: test/CodeGen/ARM/Windows/no-arm-mode.ll:9 @@ -5,1 +8,3 @@ + +; CHECK-GNU: does not support ARM mode execution OK, so mingw will presumably also be focusing on a thumb-only, winrt, environment? Comment at: test/CodeGen/ARM/Windows/pic.ll:6 @@ -3,2 +5,3 @@ +; RUN: | FileCheck %s -check-prefix CHECK-GNU @external = external global i8 Can you add a comment about the purpose of this test? Is the code sequence below actually a PIC sequence? http://reviews.llvm.org/D11075 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r241952 - Disable C++ EH by default for clang-cl and MSVC environments
Author: rnk Date: Fri Jul 10 17:25:44 2015 New Revision: 241952 URL: http://llvm.org/viewvc/llvm-project?rev=241952view=rev Log: Disable C++ EH by default for clang-cl and MSVC environments We don't need any more bug reports from users telling us that MSVC-style C++ exceptions are broken. Developers and adventurous users can still test the existing functionality by passing along -fexceptions to either clang or clang-cl. Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/cl-eh.cpp Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=241952r1=241951r2=241952view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Fri Jul 10 17:25:44 2015 @@ -506,7 +506,7 @@ def femit_all_decls : Flag[-], femit HelpTextEmit all declarations, even if unused; def fencoding_EQ : Joined[-], fencoding=, Groupf_Group; def ferror_limit_EQ : Joined[-], ferror-limit=, Groupf_Group, Flags[CoreOption]; -def fexceptions : Flag[-], fexceptions, Groupf_Group, Flags[CC1Option], +def fexceptions : Flag[-], fexceptions, Groupf_Group, Flags[CC1Option, CoreOption], HelpTextEnable support for exception handling; def fexcess_precision_EQ : Joined[-], fexcess-precision=, Groupclang_ignored_gcc_optimization_f_Group; Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=241952r1=241951r2=241952view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Fri Jul 10 17:25:44 2015 @@ -2041,17 +2041,6 @@ shouldUseExceptionTablesForObjCException Triple.getArch() == llvm::Triple::arm)); } -// exceptionSettings() exists to share the logic between -cc1 and linker -// invocations. -static bool exceptionSettings(const ArgList Args, const llvm::Triple Triple) { - if (Arg *A = Args.getLastArg(options::OPT_fexceptions, - options::OPT_fno_exceptions)) -if (A-getOption().matches(options::OPT_fexceptions)) - return true; - - return false; -} - /// Adds exception related arguments to the driver command arguments. There's a /// master flag, -fexceptions and also language specific flags to enable/disable /// C++ and Objective-C exceptions. This makes it possible to for example @@ -2075,8 +2064,9 @@ static void addExceptionArgs(const ArgLi return; } - // Gather the exception settings from the command line arguments. - bool EH = exceptionSettings(Args, Triple); + // See if the user explicitly enabled exceptions. + bool EH = Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions, + false); // Obj-C exceptions are enabled by default, regardless of -fexceptions. This // is not necessarily sensible, but follows GCC. @@ -2089,8 +2079,11 @@ static void addExceptionArgs(const ArgLi } if (types::isCXX(InputType)) { -bool CXXExceptionsEnabled = -Triple.getArch() != llvm::Triple::xcore !Triple.isPS4CPU(); +// Disable C++ EH by default on XCore, PS4, and MSVC. +// FIXME: Remove MSVC from this list once things work. +bool CXXExceptionsEnabled = Triple.getArch() != llvm::Triple::xcore +!Triple.isPS4CPU() +!Triple.isWindowsMSVCEnvironment(); Arg *ExceptionArg = Args.getLastArg( options::OPT_fcxx_exceptions, options::OPT_fno_cxx_exceptions, options::OPT_fexceptions, options::OPT_fno_exceptions); @@ -5040,6 +5033,7 @@ struct EHFlags { /// The default is /EHs-c-, meaning cleanups are disabled. static EHFlags parseClangCLEHFlags(const Driver D, const ArgList Args) { EHFlags EH; + std::vectorstd::string EHArgs = Args.getAllArgValues(options::OPT__SLASH_EH); for (auto EHVal : EHArgs) { @@ -5061,6 +5055,15 @@ static EHFlags parseClangCLEHFlags(const break; } } + + // Only enable C++ exceptions if the user opts into it by passing + // -fexceptions. Lots of build systems implicitly pass /EHsc when users don't + // actually need it. + // FIXME: Remove this when they work out of the box. + if (!Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions, +/*default=*/false)) +EH = EHFlags(); + return EH; } @@ -9102,7 +9105,9 @@ void XCore::Linker::ConstructJob(Compila if (Args.hasArg(options::OPT_v)) CmdArgs.push_back(-v); - if (exceptionSettings(Args, getToolChain().getTriple())) + // Pass -fexceptions through to the linker if it was present. + if (Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions, + false)) CmdArgs.push_back(-fexceptions);
Re: r241811 - [CodeCompletion] Don't crash on member inits of templated constructors.
The new test fails for me on Windows: Command 6: D:/src/llvm/build/./bin\c-index-test.EXE -code-completion-at=D:\src\llvm\tools\clang\test\Index\complete-ctor-inits.cpp:22:10 D:\src\llvm\tools\clang\test\Index\complete-ctor-inits.cpp Command 6 Result: 0 Command 6 Output: Command 6 Stderr: D:\src\llvm\tools\clang\test\Index\complete-ctor-inits.cpp:29:8: error: expected '{' Number FIX-ITs = 0 Command 7: D:/src/llvm/build/./bin\FileCheck.EXE -check-prefix=CHECK-CC4 D:\src\llvm\tools\clang\test\Index\complete-ctor-inits.cpp Command 7 Result: 1 Command 7 Output: Command 7 Stderr: D:\src\llvm\tools\clang\test\Index\complete-ctor-inits.cpp:55:15: error: expected string not found in input // CHECK-CC4: MemberRef:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (7) ^ stdin:1:1: note: scanning from here Completion contexts: ^ On Thu, Jul 9, 2015 at 8:31 AM, Benjamin Kramer benny@googlemail.com wrote: Author: d0k Date: Thu Jul 9 10:31:10 2015 New Revision: 241811 URL: http://llvm.org/viewvc/llvm-project?rev=241811view=rev Log: [CodeCompletion] Don't crash on member inits of templated constructors. Also fixes a crash (on invalid) member functions with a colon initializer. PR23948. Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp cfe/trunk/test/Index/complete-ctor-inits.cpp Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=241811r1=241810r2=241811view=diff == --- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original) +++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Thu Jul 9 10:31:10 2015 @@ -4409,9 +4409,12 @@ void Sema::CodeCompleteOperatorName(Scop void Sema::CodeCompleteConstructorInitializer( Decl *ConstructorD, ArrayRef CXXCtorInitializer * Initializers) { - PrintingPolicy Policy = getCompletionPrintingPolicy(*this); - CXXConstructorDecl *Constructor -= static_castCXXConstructorDecl *(ConstructorD); + if (!ConstructorD) +return; + + AdjustDeclIfTemplate(ConstructorD); + + CXXConstructorDecl *Constructor = dyn_castCXXConstructorDecl(ConstructorD); if (!Constructor) return; @@ -4435,6 +4438,7 @@ void Sema::CodeCompleteConstructorInitia // Add completions for base classes. CodeCompletionBuilder Builder(Results.getAllocator(), Results.getCodeCompletionTUInfo()); + PrintingPolicy Policy = getCompletionPrintingPolicy(*this); bool SawLastInitializer = Initializers.empty(); CXXRecordDecl *ClassDecl = Constructor-getParent(); for (const auto Base : ClassDecl-bases()) { Modified: cfe/trunk/test/Index/complete-ctor-inits.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-ctor-inits.cpp?rev=241811r1=241810r2=241811view=diff == --- cfe/trunk/test/Index/complete-ctor-inits.cpp (original) +++ cfe/trunk/test/Index/complete-ctor-inits.cpp Thu Jul 9 10:31:10 2015 @@ -17,6 +17,18 @@ struct Z : public Xint, public Y { Z::Z() : ::Xint(0), Virt(), b(), c() { } +struct PR23948 { + templateclass size PR23948() +: + {} + + templateclass size void invalid() +: + {} + + int a; +}; + // RUN: c-index-test -code-completion-at=%s:18:10 %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: MemberRef:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (35) // CHECK-CC1: MemberRef:{TypedText b}{LeftParen (}{Placeholder args}{RightParen )} (35) @@ -38,3 +50,7 @@ Z::Z() : ::Xint(0), Virt(), b(), c() { // CHECK-CC3: MemberRef:{TypedText c}{LeftParen (}{Placeholder args}{RightParen )} (7) // CHECK-CC3-NOT: NotImplemented:{TypedText Virt}{LeftParen (}{Placeholder args}{RightParen )} // CHECK-CC3: NotImplemented:{TypedText Y}{LeftParen (}{Placeholder args}{RightParen )} (35) + +// RUN: c-index-test -code-completion-at=%s:22:10 %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: MemberRef:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (7) +// RUN: c-index-test -code-completion-at=%s:26:10 %s ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D11048: CFI: Emit correct bit set information if RTTI is disabled under MS ABI.
rnk accepted this revision. rnk added a comment. This revision is now accepted and ready to land. lgtm http://reviews.llvm.org/D11048 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r241878 - Re-enable 32-bit SEH after the alignment fix
Author: rnk Date: Thu Jul 9 19:16:25 2015 New Revision: 241878 URL: http://llvm.org/viewvc/llvm-project?rev=241878view=rev Log: Re-enable 32-bit SEH after the alignment fix Modified: cfe/trunk/include/clang/Basic/TargetInfo.h cfe/trunk/lib/CodeGen/CGException.cpp cfe/trunk/lib/Sema/SemaStmt.cpp cfe/trunk/test/CodeGen/exceptions-seh-finally.c cfe/trunk/test/CodeGen/exceptions-seh.c Modified: cfe/trunk/include/clang/Basic/TargetInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=241878r1=241877r2=241878view=diff == --- cfe/trunk/include/clang/Basic/TargetInfo.h (original) +++ cfe/trunk/include/clang/Basic/TargetInfo.h Thu Jul 9 19:16:25 2015 @@ -812,7 +812,8 @@ public: /// \brief Whether the target supports SEH __try. bool isSEHTrySupported() const { return getTriple().isOSWindows() - getTriple().getArch() == llvm::Triple::x86_64; + (getTriple().getArch() == llvm::Triple::x86 || +getTriple().getArch() == llvm::Triple::x86_64); } /// \brief Return true if {|} are normal characters in the asm string. Modified: cfe/trunk/lib/CodeGen/CGException.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=241878r1=241877r2=241878view=diff == --- cfe/trunk/lib/CodeGen/CGException.cpp (original) +++ cfe/trunk/lib/CodeGen/CGException.cpp Thu Jul 9 19:16:25 2015 @@ -1280,10 +1280,6 @@ llvm::BasicBlock *CodeGenFunction::getEH } void CodeGenFunction::EmitSEHTryStmt(const SEHTryStmt S) { - // Reject __try on unsupported targets. - if (!getContext().getTargetInfo().isSEHTrySupported()) -ErrorUnsupported(S, SEH '__try' on this target); - EnterSEHTryStmt(S); { JumpDest TryExit = getJumpDestInCurrentScope(__try.__leave); Modified: cfe/trunk/lib/Sema/SemaStmt.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=241878r1=241877r2=241878view=diff == --- cfe/trunk/lib/Sema/SemaStmt.cpp (original) +++ cfe/trunk/lib/Sema/SemaStmt.cpp Thu Jul 9 19:16:25 2015 @@ -3650,6 +3650,10 @@ StmtResult Sema::ActOnSEHTryBlock(bool I else Diag(TryLoc, diag::err_seh_try_outside_functions); + // Reject __try on unsupported targets. + if (!Context.getTargetInfo().isSEHTrySupported()) +Diag(TryLoc, diag::err_seh_try_unsupported); + return SEHTryStmt::Create(Context, IsCXXTry, TryLoc, TryBlock, Handler); } Modified: cfe/trunk/test/CodeGen/exceptions-seh-finally.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh-finally.c?rev=241878r1=241877r2=241878view=diff == --- cfe/trunk/test/CodeGen/exceptions-seh-finally.c (original) +++ cfe/trunk/test/CodeGen/exceptions-seh-finally.c Thu Jul 9 19:16:25 2015 @@ -1,6 +1,5 @@ // RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s -// FIXME: Re-enable 32-bit SEH. -// RUNX: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s void abort(void) __attribute__((noreturn)); void might_crash(void); Modified: cfe/trunk/test/CodeGen/exceptions-seh.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh.c?rev=241878r1=241877r2=241878view=diff == --- cfe/trunk/test/CodeGen/exceptions-seh.c (original) +++ cfe/trunk/test/CodeGen/exceptions-seh.c Thu Jul 9 19:16:25 2015 @@ -1,8 +1,7 @@ // RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -o - \ // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X64 -// FIXME: Re-enable 32-bit SEH. -// RUNX: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - \ -// RUNX: | FileCheck %s --check-prefix=CHECK --check-prefix=X86 +// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X86 void try_body(int numerator, int denominator, int *myres) { *myres = numerator / denominator; ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r241704 - [SEH] Re-enable SEH on x86 Windows after r241699
Author: rnk Date: Wed Jul 8 13:27:10 2015 New Revision: 241704 URL: http://llvm.org/viewvc/llvm-project?rev=241704view=rev Log: [SEH] Re-enable SEH on x86 Windows after r241699 Modified: cfe/trunk/include/clang/Basic/TargetInfo.h cfe/trunk/test/CodeGen/exceptions-seh-finally.c cfe/trunk/test/CodeGen/exceptions-seh.c Modified: cfe/trunk/include/clang/Basic/TargetInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=241704r1=241703r2=241704view=diff == --- cfe/trunk/include/clang/Basic/TargetInfo.h (original) +++ cfe/trunk/include/clang/Basic/TargetInfo.h Wed Jul 8 13:27:10 2015 @@ -812,7 +812,8 @@ public: /// \brief Whether the target supports SEH __try. bool isSEHTrySupported() const { return getTriple().isOSWindows() - getTriple().getArch() == llvm::Triple::x86_64; + (getTriple().getArch() == llvm::Triple::x86 || +getTriple().getArch() == llvm::Triple::x86_64); } /// \brief Return true if {|} are normal characters in the asm string. Modified: cfe/trunk/test/CodeGen/exceptions-seh-finally.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh-finally.c?rev=241704r1=241703r2=241704view=diff == --- cfe/trunk/test/CodeGen/exceptions-seh-finally.c (original) +++ cfe/trunk/test/CodeGen/exceptions-seh-finally.c Wed Jul 8 13:27:10 2015 @@ -1,6 +1,5 @@ // RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s -// FIXME: Re-enable 32-bit SEH. -// RUNX: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s void abort(void) __attribute__((noreturn)); void might_crash(void); Modified: cfe/trunk/test/CodeGen/exceptions-seh.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh.c?rev=241704r1=241703r2=241704view=diff == --- cfe/trunk/test/CodeGen/exceptions-seh.c (original) +++ cfe/trunk/test/CodeGen/exceptions-seh.c Wed Jul 8 13:27:10 2015 @@ -1,8 +1,7 @@ // RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -o - \ // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X64 -// FIXME: Re-enable 32-bit SEH. -// RUNX: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - \ -// RUNX: | FileCheck %s --check-prefix=CHECK --check-prefix=X86 +// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X86 void try_body(int numerator, int denominator, int *myres) { *myres = numerator / denominator; ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D10949: A step towards getting libclang tests working on Windows
rnk accepted this revision. rnk added a reviewer: rnk. rnk added a comment. lgtm Repository: rL LLVM http://reviews.llvm.org/D10949 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r241761 - Disable 32-bit SEH, again
Author: rnk Date: Wed Jul 8 18:57:03 2015 New Revision: 241761 URL: http://llvm.org/viewvc/llvm-project?rev=241761view=rev Log: Disable 32-bit SEH, again Move the diagnostic back to codegen so that we can compile ATL on the self-host bot. We don't actually end up emitting code for the __try, so the diagnostic won't be hit. Modified: cfe/trunk/include/clang/Basic/TargetInfo.h cfe/trunk/lib/CodeGen/CGException.cpp cfe/trunk/lib/Sema/SemaStmt.cpp cfe/trunk/test/CodeGen/exceptions-seh-finally.c cfe/trunk/test/CodeGen/exceptions-seh.c Modified: cfe/trunk/include/clang/Basic/TargetInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=241761r1=241760r2=241761view=diff == --- cfe/trunk/include/clang/Basic/TargetInfo.h (original) +++ cfe/trunk/include/clang/Basic/TargetInfo.h Wed Jul 8 18:57:03 2015 @@ -812,8 +812,7 @@ public: /// \brief Whether the target supports SEH __try. bool isSEHTrySupported() const { return getTriple().isOSWindows() - (getTriple().getArch() == llvm::Triple::x86 || -getTriple().getArch() == llvm::Triple::x86_64); + getTriple().getArch() == llvm::Triple::x86_64; } /// \brief Return true if {|} are normal characters in the asm string. Modified: cfe/trunk/lib/CodeGen/CGException.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=241761r1=241760r2=241761view=diff == --- cfe/trunk/lib/CodeGen/CGException.cpp (original) +++ cfe/trunk/lib/CodeGen/CGException.cpp Wed Jul 8 18:57:03 2015 @@ -1280,6 +1280,10 @@ llvm::BasicBlock *CodeGenFunction::getEH } void CodeGenFunction::EmitSEHTryStmt(const SEHTryStmt S) { + // Reject __try on unsupported targets. + if (!getContext().getTargetInfo().isSEHTrySupported()) +ErrorUnsupported(S, SEH '__try' on this target); + EnterSEHTryStmt(S); { JumpDest TryExit = getJumpDestInCurrentScope(__try.__leave); Modified: cfe/trunk/lib/Sema/SemaStmt.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=241761r1=241760r2=241761view=diff == --- cfe/trunk/lib/Sema/SemaStmt.cpp (original) +++ cfe/trunk/lib/Sema/SemaStmt.cpp Wed Jul 8 18:57:03 2015 @@ -3650,10 +3650,6 @@ StmtResult Sema::ActOnSEHTryBlock(bool I else Diag(TryLoc, diag::err_seh_try_outside_functions); - // Reject __try on unsupported targets. - if (!Context.getTargetInfo().isSEHTrySupported()) -Diag(TryLoc, diag::err_seh_try_unsupported); - return SEHTryStmt::Create(Context, IsCXXTry, TryLoc, TryBlock, Handler); } Modified: cfe/trunk/test/CodeGen/exceptions-seh-finally.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh-finally.c?rev=241761r1=241760r2=241761view=diff == --- cfe/trunk/test/CodeGen/exceptions-seh-finally.c (original) +++ cfe/trunk/test/CodeGen/exceptions-seh-finally.c Wed Jul 8 18:57:03 2015 @@ -1,5 +1,6 @@ // RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s +// FIXME: Re-enable 32-bit SEH. +// RUNX: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s void abort(void) __attribute__((noreturn)); void might_crash(void); Modified: cfe/trunk/test/CodeGen/exceptions-seh.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh.c?rev=241761r1=241760r2=241761view=diff == --- cfe/trunk/test/CodeGen/exceptions-seh.c (original) +++ cfe/trunk/test/CodeGen/exceptions-seh.c Wed Jul 8 18:57:03 2015 @@ -1,7 +1,8 @@ // RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -o - \ // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X64 -// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - \ -// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X86 +// FIXME: Re-enable 32-bit SEH. +// RUNX: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - \ +// RUNX: | FileCheck %s --check-prefix=CHECK --check-prefix=X86 void try_body(int numerator, int denominator, int *myres) { *myres = numerator / denominator; ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r241644 - [SEH] Switch from frameaddress(0) to localaddress
Author: rnk Date: Tue Jul 7 18:23:31 2015 New Revision: 241644 URL: http://llvm.org/viewvc/llvm-project?rev=241644view=rev Log: [SEH] Switch from frameaddress(0) to localaddress This should do the right thing for stack realignment prologues. Modified: cfe/trunk/lib/CodeGen/CGException.cpp cfe/trunk/test/CodeGen/exceptions-seh-finally.c cfe/trunk/test/CodeGen/exceptions-seh-leave.c cfe/trunk/test/CodeGen/exceptions-seh.c cfe/trunk/test/CodeGenCXX/exceptions-seh.cpp Modified: cfe/trunk/lib/CodeGen/CGException.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=241644r1=241643r2=241644view=diff == --- cfe/trunk/lib/CodeGen/CGException.cpp (original) +++ cfe/trunk/lib/CodeGen/CGException.cpp Tue Jul 7 18:23:31 2015 @@ -1310,9 +1310,8 @@ struct PerformSEHFinally : EHScopeStack: // Compute the two argument values. QualType ArgTys[2] = {Context.UnsignedCharTy, Context.VoidPtrTy}; -llvm::Value *FrameAddr = CGM.getIntrinsic(llvm::Intrinsic::frameaddress); -llvm::Value *FP = -CGF.Builder.CreateCall(FrameAddr, {CGF.Builder.getInt32(0)}); +llvm::Value *LocalAddrFn = CGM.getIntrinsic(llvm::Intrinsic::localaddress); +llvm::Value *FP = CGF.Builder.CreateCall(LocalAddrFn, {}); llvm::Value *IsForEH = llvm::ConstantInt::get(CGF.ConvertType(ArgTys[0]), F.isForEHCleanup()); Args.add(RValue::get(IsForEH), ArgTys[0]); Modified: cfe/trunk/test/CodeGen/exceptions-seh-finally.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh-finally.c?rev=241644r1=241643r2=241644view=diff == --- cfe/trunk/test/CodeGen/exceptions-seh-finally.c (original) +++ cfe/trunk/test/CodeGen/exceptions-seh-finally.c Tue Jul 7 18:23:31 2015 @@ -19,14 +19,14 @@ void basic_finally(void) { // CHECK: to label %[[invoke_cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] // // CHECK: [[invoke_cont]] -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK: call void @\01?fin$0@0@basic_finally@@({{i8( zeroext)?}} 0, i8* %[[fp]]) // CHECK-NEXT: ret void // // CHECK: [[lpad]] // CHECK-NEXT: landingpad // CHECK-NEXT: cleanup -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK: call void @\01?fin$0@0@basic_finally@@({{i8( zeroext)?}} 1, i8* %[[fp]]) // CHECK: resume { i8*, i32 } @@ -59,7 +59,7 @@ l: // CHECK: to label %[[invoke_cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] // // CHECK: [[invoke_cont]] -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK: call void @\01?fin$0@0@label_in_finally@@({{i8( zeroext)?}} 0, i8* %[[fp]]) // CHECK: ret void @@ -86,14 +86,14 @@ void use_abnormal_termination(void) { // CHECK: to label %[[invoke_cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] // // CHECK: [[invoke_cont]] -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK: call void @\01?fin$0@0@use_abnormal_termination@@({{i8( zeroext)?}} 0, i8* %[[fp]]) // CHECK: ret void // // CHECK: [[lpad]] // CHECK-NEXT: landingpad // CHECK-NEXT: cleanup -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK: call void @\01?fin$0@0@use_abnormal_termination@@({{i8( zeroext)?}} 1, i8* %[[fp]]) // CHECK: resume { i8*, i32 } Modified: cfe/trunk/test/CodeGen/exceptions-seh-leave.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh-leave.c?rev=241644r1=241643r2=241644view=diff == --- cfe/trunk/test/CodeGen/exceptions-seh-leave.c (original) +++ cfe/trunk/test/CodeGen/exceptions-seh-leave.c Tue Jul 7 18:23:31 2015 @@ -74,7 +74,7 @@ int __leave_with___finally_simple() { // CHECK-NEXT: br label %[[tryleave:[^ ]*]] // CHECK-NOT: store i32 23 // CHECK: [[tryleave]] -// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK-NEXT: call void @\01?fin$0@0@__leave_with___finally_simple@@(i8 0, i8* %[[fp]]) // __finally block doesn't return, __finally.cont doesn't exist. @@ -94,7 +94,7 @@ int __leave_with___finally_noreturn() { // CHECK-NEXT: br label %[[tryleave:[^ ]*]] // CHECK-NOT: store i32 23 // CHECK: [[tryleave]] -// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK-NEXT: call void @\01?fin$0@0@__leave_with___finally_noreturn@@(i8 0, i8* %[[fp]]) // The normal case. @@ -118,7 +118,7 @@ int __leave_with___finally() { // CHECK-NEXT:
r241634 - Update clang for intrinsic rename of framerecover to localrecover
Author: rnk Date: Tue Jul 7 17:26:07 2015 New Revision: 241634 URL: http://llvm.org/viewvc/llvm-project?rev=241634view=rev Log: Update clang for intrinsic rename of framerecover to localrecover Modified: cfe/trunk/lib/CodeGen/CGException.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.h cfe/trunk/test/CodeGen/exceptions-seh.c cfe/trunk/test/CodeGenCXX/exceptions-seh-filter-captures.cpp Modified: cfe/trunk/lib/CodeGen/CGException.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=241634r1=241633r2=241634view=diff == --- cfe/trunk/lib/CodeGen/CGException.cpp (original) +++ cfe/trunk/lib/CodeGen/CGException.cpp Tue Jul 7 17:26:07 2015 @@ -1396,13 +1396,13 @@ llvm::Value *CodeGenFunction::recoverAdd CGBuilderTy Builder(AllocaInsertPt); if (auto *ParentAlloca = dyn_castllvm::AllocaInst(ParentVar)) { // Mark the variable escaped if nobody else referenced it and compute the -// frameescape index. +// localescape index. auto InsertPair = ParentCGF.EscapedLocals.insert( std::make_pair(ParentAlloca, ParentCGF.EscapedLocals.size())); int FrameEscapeIdx = InsertPair.first-second; -// call i8* @llvm.framerecover(i8* bitcast(@parentFn), i8* %fp, i32 N) +// call i8* @llvm.localrecover(i8* bitcast(@parentFn), i8* %fp, i32 N) llvm::Function *FrameRecoverFn = llvm::Intrinsic::getDeclaration( -CGM.getModule(), llvm::Intrinsic::framerecover); +CGM.getModule(), llvm::Intrinsic::localrecover); llvm::Constant *ParentI8Fn = llvm::ConstantExpr::getBitCast(ParentCGF.CurFn, Int8PtrTy); RecoverCall = Builder.CreateCall( @@ -1411,12 +1411,12 @@ llvm::Value *CodeGenFunction::recoverAdd } else { // If the parent didn't have an alloca, we're doing some nested outlining. -// Just clone the existing framerecover call, but tweak the FP argument to +// Just clone the existing localrecover call, but tweak the FP argument to // use our FP value. All other arguments are constants. auto *ParentRecover = castllvm::IntrinsicInst(ParentVar-stripPointerCasts()); -assert(ParentRecover-getIntrinsicID() == llvm::Intrinsic::framerecover - expected alloca or framerecover in parent LocalDeclMap); +assert(ParentRecover-getIntrinsicID() == llvm::Intrinsic::localrecover + expected alloca or localrecover in parent LocalDeclMap); RecoverCall = castllvm::CallInst(ParentRecover-clone()); RecoverCall-setArgOperand(1, ParentFP); RecoverCall-insertBefore(AllocaInsertPt); @@ -1468,7 +1468,7 @@ void CodeGenFunction::EmitCapturedLocals ParentFP = AI; } - // Create llvm.framerecover calls for all captures. + // Create llvm.localrecover calls for all captures. for (const VarDecl *VD : Finder.Captures) { if (isaImplicitParamDecl(VD)) { CGM.ErrorUnsupported(VD, 'this' captured by SEH); Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=241634r1=241633r2=241634view=diff == --- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original) +++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Tue Jul 7 17:26:07 2015 @@ -284,7 +284,7 @@ void CodeGenFunction::FinishFunction(Sou Builder.ClearInsertionPoint(); } - // If some of our locals escaped, insert a call to llvm.frameescape in the + // If some of our locals escaped, insert a call to llvm.localescape in the // entry block. if (!EscapedLocals.empty()) { // Invert the map from local to index into a simple vector. There should be @@ -294,7 +294,7 @@ void CodeGenFunction::FinishFunction(Sou for (auto Pair : EscapedLocals) EscapeArgs[Pair.second] = Pair.first; llvm::Function *FrameEscapeFn = llvm::Intrinsic::getDeclaration( -CGM.getModule(), llvm::Intrinsic::frameescape); +CGM.getModule(), llvm::Intrinsic::localescape); CGBuilderTy(AllocaInsertPt).CreateCall(FrameEscapeFn, EscapeArgs); } Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=241634r1=241633r2=241634view=diff == --- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original) +++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Tue Jul 7 17:26:07 2015 @@ -888,7 +888,7 @@ private: DeclMapTy LocalDeclMap; /// Track escaped local variables with auto storage. Used during SEH - /// outlining to produce a call to llvm.frameescape. + /// outlining to produce a call to llvm.localescape. llvm::DenseMapllvm::AllocaInst *, int EscapedLocals; /// LabelMap - This keeps track of the LLVM basic block for each C label. @@ -2068,13 +2068,13 @@
Re: [PATCH] D10907: [CodeGen] Correctly handle base classes which are passed in memory
rnk accepted this revision. This revision is now accepted and ready to land. lgtm http://reviews.llvm.org/D10907 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D10949: A step towards getting libclang tests working on Windows
Comment at: tools/clang/include/clang-c/BuildSystem.h:92 @@ +91,3 @@ + */ +CINDEX_LINKAGE void clang_free(char *out_buffer_ptr); + out_buffer_ptr doesn't make sense as a parameter name; it is not an out param. Probably 'buffer' or something is fine. Repository: rL LLVM http://reviews.llvm.org/D10949 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D10272: Fix alignment issues in Clang.
I think there were issues with trailing arrays, which is why Clang ended up settling on this pattern in the first place. Barring significant changes, I think wrapping this up with some library code is the way to go. That's kind of what we were thinking with getTrailingObjects(). :-) I think for the oddball cases like multiple trailing arrays, we can do stuff like this: FunctionTemplateDecl * const *getTemplates() const { return getTrailingObjectsFunctionTemplateDecl*const(getTemplateArgs()[NumArgs-1]); } In general, we probably want to lay out trailing arrays in order of higher alignments to lower alignments to avoid the extra alignment code, and if we get it wrong, the wrapper will tell us. For the DeclRefExpr::getFoundDeclInternal() case, I could see adding some kind of wrapper struct with 8 byte alignment around the found found Decl pointer. As far as documentation goes, I'd rather update the Doxygen to indicate which classes have trailing data. Most of the commonly used classes like DeclRefExpr are already annotated as such. Another benefit of the getTrailingObjects wrapper is that we can static_assert that the class with trailing data is `final`. In conclusion, I guess I would like to push for this wrapper. It seems like it moves incrementally closer towards the better end state that you want, which is less pointer arithmetic and casts sprinkled across the AST. Sound reasonable? http://reviews.llvm.org/D10272 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] D10272: Fix alignment issues in Clang.
rnk added a subscriber: rnk. Most of actual fixes look good, but this adds an awful lot of static_asserts, and they are very far from the code implementing the trailing object array idiom. I chatted with Richard, and he suggested that wrap up the `reinterpret_castT(this + 1)` idiom into something higher level. We could write a helper like this: namespace llvm { template TrailingTy, LeadingTy TrailingTy *getTrailingObjects(LeadingTy *Obj) { static_assert(llvm::AlignOfLeadingTy::Alignment = llvm::AlignOfTrailingTy::Alignment, TrailingTy requires more alignment than LeadingTy provides); return reinterpret_castTrailingTy *(Obj + 1); } } The static_assert message ends up being less specific, but clang at least will print out the template instantiation backtrace, which should make it easy to figure out. This pattern should work so long as the trailing type is complete before the definition of the accessor, but the TemplateSpecializationType and TemplateArgument case is probably won't work. We should probably do the static_assert manually in the constructor in that case. The constructor also implements the trailing object array idiom, so again it keeps the assert closer to the relevant implementation. What do you think? Comment at: include/clang/AST/Type.h:3974-3980 @@ -3948,2 +3973,9 @@ }; +// static_assert(llvm::AlignOfTemplateSpecializationType::Alignment = +// llvm::AlignOfTemplateArgument::Alignment, Alignment is insufficient for +// objects appended to TemplateSpecializationType); +// static_assert(llvm::AlignOfTemplateArgument::Alignment = +// llvm::AlignOfQualType::Alignment, Alignment is insufficient for objects +// appended to TemplateSpecializationType); +// ^ Moved after class TemplateArgument, as it is is forward declared here. This still appears to be an issue? http://reviews.llvm.org/D10272 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r241533 - Revert Revert 241171, 241187, 241199 (32-bit SEH).
Author: rnk Date: Mon Jul 6 19:36:30 2015 New Revision: 241533 URL: http://llvm.org/viewvc/llvm-project?rev=241533view=rev Log: Revert Revert 241171, 241187, 241199 (32-bit SEH). This reverts commit r241244, but restricts SEH support to Win64. This way, Chromium builds will still fall back on TUs with SEH, and Clang developers can work on this incrementally upstream while patching this small predicate locally. It'll also make it easier to review small fixes. Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Basic/TargetInfo.h cfe/trunk/lib/CodeGen/CGException.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.h cfe/trunk/lib/Sema/SemaStmt.cpp cfe/trunk/test/CodeGen/exceptions-seh-finally.c cfe/trunk/test/CodeGen/exceptions-seh-leave.c cfe/trunk/test/CodeGen/exceptions-seh.c Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=241533r1=241532r2=241533view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jul 6 19:36:30 2015 @@ -5578,6 +5578,8 @@ def err_seh_try_outside_functions : Erro cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls; def err_mixing_cxx_try_seh_try : Error cannot use C++ 'try' in the same function as SEH '__try'; +def err_seh_try_unsupported : Error + SEH '__try' is not supported on this target; def note_conflicting_try_here : Note conflicting %0 here; def warn_jump_out_of_seh_finally : Warning Modified: cfe/trunk/include/clang/Basic/TargetInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=241533r1=241532r2=241533view=diff == --- cfe/trunk/include/clang/Basic/TargetInfo.h (original) +++ cfe/trunk/include/clang/Basic/TargetInfo.h Mon Jul 6 19:36:30 2015 @@ -809,6 +809,12 @@ public: return TLSSupported; } + /// \brief Whether the target supports SEH __try. + bool isSEHTrySupported() const { +return getTriple().isOSWindows() + getTriple().getArch() == llvm::Triple::x86_64; + } + /// \brief Return true if {|} are normal characters in the asm string. /// /// If this returns false (the default), then {abc|xyz} is syntax Modified: cfe/trunk/lib/CodeGen/CGException.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=241533r1=241532r2=241533view=diff == --- cfe/trunk/lib/CodeGen/CGException.cpp (original) +++ cfe/trunk/lib/CodeGen/CGException.cpp Mon Jul 6 19:36:30 2015 @@ -20,6 +20,7 @@ #include clang/AST/StmtCXX.h #include clang/AST/StmtObjC.h #include clang/AST/StmtVisitor.h +#include clang/Basic/TargetBuiltins.h #include llvm/IR/CallSite.h #include llvm/IR/Intrinsics.h #include llvm/IR/IntrinsicInst.h @@ -1279,14 +1280,6 @@ llvm::BasicBlock *CodeGenFunction::getEH } void CodeGenFunction::EmitSEHTryStmt(const SEHTryStmt S) { - // FIXME: Implement SEH on other architectures. - const llvm::Triple T = CGM.getTarget().getTriple(); - if (T.getArch() != llvm::Triple::x86_64 || - !T.isKnownWindowsMSVCEnvironment()) { -ErrorUnsupported(S, __try statement); -return; - } - EnterSEHTryStmt(S); { JumpDest TryExit = getJumpDestInCurrentScope(__try.__leave); @@ -1311,24 +1304,28 @@ struct PerformSEHFinally : EHScopeStack: void Emit(CodeGenFunction CGF, Flags F) override { ASTContext Context = CGF.getContext(); -QualType ArgTys[2] = {Context.UnsignedCharTy, Context.VoidPtrTy}; -FunctionProtoType::ExtProtoInfo EPI; -const auto *FTP = castFunctionType( -Context.getFunctionType(Context.VoidTy, ArgTys, EPI)); +CodeGenModule CGM = CGF.CGM; CallArgList Args; + +// Compute the two argument values. +QualType ArgTys[2] = {Context.UnsignedCharTy, Context.VoidPtrTy}; +llvm::Value *FrameAddr = CGM.getIntrinsic(llvm::Intrinsic::frameaddress); +llvm::Value *FP = +CGF.Builder.CreateCall(FrameAddr, {CGF.Builder.getInt32(0)}); llvm::Value *IsForEH = llvm::ConstantInt::get(CGF.ConvertType(ArgTys[0]), F.isForEHCleanup()); Args.add(RValue::get(IsForEH), ArgTys[0]); - -CodeGenModule CGM = CGF.CGM; -llvm::Value *Zero = llvm::ConstantInt::get(CGM.Int32Ty, 0); -llvm::Value *FrameAddr = CGM.getIntrinsic(llvm::Intrinsic::frameaddress); -llvm::Value *FP = CGF.Builder.CreateCall(FrameAddr, Zero); Args.add(RValue::get(FP), ArgTys[1]); +// Arrange a two-arg function info and type. +FunctionProtoType::ExtProtoInfo EPI; +const auto *FPT = castFunctionProtoType( +
r241187 - [SEH] Delete the 32-bit IR lowering for __finally blocks and use x64
Author: rnk Date: Wed Jul 1 16:00:00 2015 New Revision: 241187 URL: http://llvm.org/viewvc/llvm-project?rev=241187view=rev Log: [SEH] Delete the 32-bit IR lowering for __finally blocks and use x64 32-bit finally funclets are intended to be called both directly from the parent function and indirectly from the EH runtime. Because we aren't contorting LLVM's X86 prologue to match MSVC's, calling the finally block directly passes in a different value of EBP than the one that the runtime provides. We need an adapter thunk to adjust EBP to the expected value. However, WinEHPrepare already has to solve this problem when cleanups are not pre-outlined, so we can go ahead and rely on it rather than duplicating work. Now we only do the llvm.x86.seh.recoverfp dance for 32-bit SEH filter functions. Modified: cfe/trunk/lib/CodeGen/CGException.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.h cfe/trunk/test/CodeGen/exceptions-seh-finally.c cfe/trunk/test/CodeGen/exceptions-seh.c Modified: cfe/trunk/lib/CodeGen/CGException.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=241187r1=241186r2=241187view=diff == --- cfe/trunk/lib/CodeGen/CGException.cpp (original) +++ cfe/trunk/lib/CodeGen/CGException.cpp Wed Jul 1 16:00:00 2015 @@ -1306,37 +1306,27 @@ struct PerformSEHFinally : EHScopeStack: ASTContext Context = CGF.getContext(); CodeGenModule CGM = CGF.CGM; -// In 64-bit, we call the child function with arguments. In 32-bit, we store -// zero in the parent frame and use framerecover to check the value. -const CGFunctionInfo *FnInfo; CallArgList Args; -if (CGF.getTarget().getTriple().getArch() != llvm::Triple::x86) { - // Compute the two argument values. - QualType ArgTys[2] = {Context.UnsignedCharTy, Context.VoidPtrTy}; - llvm::Value *FrameAddr = CGM.getIntrinsic(llvm::Intrinsic::frameaddress); - llvm::Value *FP = - CGF.Builder.CreateCall(FrameAddr, {CGF.Builder.getInt32(0)}); - llvm::Value *IsForEH = - llvm::ConstantInt::get(CGF.ConvertType(ArgTys[0]), F.isForEHCleanup()); - Args.add(RValue::get(IsForEH), ArgTys[0]); - Args.add(RValue::get(FP), ArgTys[1]); - - // Arrange a two-arg function info and type. - FunctionProtoType::ExtProtoInfo EPI; - const auto *FPT = castFunctionProtoType( - Context.getFunctionType(Context.VoidTy, ArgTys, EPI)); - FnInfo = CGM.getTypes().arrangeFreeFunctionCall(Args, FPT, - /*chainCall=*/false); -} else { - // Emit the zero store if this is normal control flow. There are no - // explicit arguments. - if (F.isForNormalCleanup() CGF.ChildAbnormalTerminationSlot) -CGF.Builder.CreateStore(CGF.Builder.getInt32(0), -CGF.ChildAbnormalTerminationSlot); - FnInfo = CGM.getTypes().arrangeNullaryFunction(); -} -CGF.EmitCall(*FnInfo, OutlinedFinally, ReturnValueSlot(), Args); +// Compute the two argument values. +QualType ArgTys[2] = {Context.UnsignedCharTy, Context.VoidPtrTy}; +llvm::Value *FrameAddr = CGM.getIntrinsic(llvm::Intrinsic::frameaddress); +llvm::Value *FP = +CGF.Builder.CreateCall(FrameAddr, {CGF.Builder.getInt32(0)}); +llvm::Value *IsForEH = +llvm::ConstantInt::get(CGF.ConvertType(ArgTys[0]), F.isForEHCleanup()); +Args.add(RValue::get(IsForEH), ArgTys[0]); +Args.add(RValue::get(FP), ArgTys[1]); + +// Arrange a two-arg function info and type. +FunctionProtoType::ExtProtoInfo EPI; +const auto *FPT = castFunctionProtoType( +Context.getFunctionType(Context.VoidTy, ArgTys, EPI)); +const CGFunctionInfo FnInfo = +CGM.getTypes().arrangeFreeFunctionCall(Args, FPT, + /*chainCall=*/false); + +CGF.EmitCall(FnInfo, OutlinedFinally, ReturnValueSlot(), Args); } }; } @@ -1347,14 +1337,13 @@ struct CaptureFinder : ConstStmtVisitor CodeGenFunction ParentCGF; const VarDecl *ParentThis; SmallVectorconst VarDecl *, 4 Captures; - llvm::Value *AbnormalTermination = nullptr; llvm::Value *SEHCodeSlot = nullptr; CaptureFinder(CodeGenFunction ParentCGF, const VarDecl *ParentThis) : ParentCGF(ParentCGF), ParentThis(ParentThis) {} // Return true if we need to do any capturing work. bool foundCaptures() { -return !Captures.empty() || AbnormalTermination || SEHCodeSlot; +return !Captures.empty() || SEHCodeSlot; } void Visit(const Stmt *S) { @@ -1388,15 +1377,6 @@ struct CaptureFinder : ConstStmtVisitor unsigned ID = E-getBuiltinCallee(); switch (ID) { -case Builtin::BI__abnormal_termination: -case Builtin::BI_abnormal_termination: - // This is the simple case where we are the outermost finally. All we - // have to do here is make sure we escape this
r241171 - [SEH] Add 32-bit lowering for SEH __try
Author: rnk Date: Wed Jul 1 12:10:10 2015 New Revision: 241171 URL: http://llvm.org/viewvc/llvm-project?rev=241171view=rev Log: [SEH] Add 32-bit lowering for SEH __try This re-lands r236052 and adds support for __exception_code(). In 32-bit SEH, the exception code is not available in eax. It is only available in the filter function, and now we arrange to load it and store it into an escaped variable in the parent frame. As a consequence, we have to disable the catch i8* null optimization on 32-bit and always generate a filter function. We can re-enable the optimization if we detect an __except block that doesn't use the exception code, but this probably isn't worth optimizing. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D10852 Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Basic/TargetInfo.h cfe/trunk/lib/CodeGen/CGException.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.h cfe/trunk/lib/Sema/SemaStmt.cpp cfe/trunk/test/CodeGen/exceptions-seh-finally.c cfe/trunk/test/CodeGen/exceptions-seh-leave.c cfe/trunk/test/CodeGen/exceptions-seh.c Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=241171r1=241170r2=241171view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jul 1 12:10:10 2015 @@ -5574,6 +5574,8 @@ def err_seh_try_outside_functions : Erro cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls; def err_mixing_cxx_try_seh_try : Error cannot use C++ 'try' in the same function as SEH '__try'; +def err_seh_try_unsupported : Error + SEH '__try' is not supported on this target; def note_conflicting_try_here : Note conflicting %0 here; def warn_jump_out_of_seh_finally : Warning Modified: cfe/trunk/include/clang/Basic/TargetInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=241171r1=241170r2=241171view=diff == --- cfe/trunk/include/clang/Basic/TargetInfo.h (original) +++ cfe/trunk/include/clang/Basic/TargetInfo.h Wed Jul 1 12:10:10 2015 @@ -804,6 +804,11 @@ public: return TLSSupported; } + /// \brief Whether the target supports SEH __try. + bool isSEHTrySupported() const { +return getTriple().isOSWindows(); + } + /// \brief Return true if {|} are normal characters in the asm string. /// /// If this returns false (the default), then {abc|xyz} is syntax Modified: cfe/trunk/lib/CodeGen/CGException.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=241171r1=241170r2=241171view=diff == --- cfe/trunk/lib/CodeGen/CGException.cpp (original) +++ cfe/trunk/lib/CodeGen/CGException.cpp Wed Jul 1 12:10:10 2015 @@ -20,6 +20,7 @@ #include clang/AST/StmtCXX.h #include clang/AST/StmtObjC.h #include clang/AST/StmtVisitor.h +#include clang/Basic/TargetBuiltins.h #include llvm/IR/CallSite.h #include llvm/IR/Intrinsics.h #include llvm/IR/IntrinsicInst.h @@ -1279,14 +1280,6 @@ llvm::BasicBlock *CodeGenFunction::getEH } void CodeGenFunction::EmitSEHTryStmt(const SEHTryStmt S) { - // FIXME: Implement SEH on other architectures. - const llvm::Triple T = CGM.getTarget().getTriple(); - if (T.getArch() != llvm::Triple::x86_64 || - !T.isKnownWindowsMSVCEnvironment()) { -ErrorUnsupported(S, __try statement); -return; - } - EnterSEHTryStmt(S); { JumpDest TryExit = getJumpDestInCurrentScope(__try.__leave); @@ -1311,25 +1304,39 @@ struct PerformSEHFinally : EHScopeStack: void Emit(CodeGenFunction CGF, Flags F) override { ASTContext Context = CGF.getContext(); -QualType ArgTys[2] = {Context.UnsignedCharTy, Context.VoidPtrTy}; -FunctionProtoType::ExtProtoInfo EPI; -const auto *FTP = castFunctionType( -Context.getFunctionType(Context.VoidTy, ArgTys, EPI)); +CodeGenModule CGM = CGF.CGM; +// In 64-bit, we call the child function with arguments. In 32-bit, we store +// zero in the parent frame and use framerecover to check the value. +const CGFunctionInfo *FnInfo; CallArgList Args; -llvm::Value *IsForEH = -llvm::ConstantInt::get(CGF.ConvertType(ArgTys[0]), F.isForEHCleanup()); -Args.add(RValue::get(IsForEH), ArgTys[0]); +if (CGF.getTarget().getTriple().getArch() != llvm::Triple::x86) { + // Compute the two argument values. + QualType ArgTys[2] = {Context.UnsignedCharTy, Context.VoidPtrTy}; + llvm::Value *FrameAddr = CGM.getIntrinsic(llvm::Intrinsic::frameaddress); + llvm::Value *FP = +
Re: [PATCH] [SEH] Add 32-bit lowering for SEH __try
REPOSITORY rL LLVM http://reviews.llvm.org/D10852 Files: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Basic/TargetInfo.h cfe/trunk/lib/CodeGen/CGException.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.h cfe/trunk/lib/Sema/SemaStmt.cpp cfe/trunk/test/CodeGen/exceptions-seh-finally.c cfe/trunk/test/CodeGen/exceptions-seh-leave.c cfe/trunk/test/CodeGen/exceptions-seh.c EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ Index: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp === --- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp +++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp @@ -45,12 +45,12 @@ LambdaThisCaptureField(nullptr), NormalCleanupDest(nullptr), NextCleanupDestIndex(1), FirstBlockInfo(nullptr), EHResumeBlock(nullptr), ExceptionSlot(nullptr), EHSelectorSlot(nullptr), - AbnormalTerminationSlot(nullptr), SEHPointersDecl(nullptr), - DebugInfo(CGM.getModuleDebugInfo()), DisableDebugInfo(false), - DidCallStackSave(false), IndirectBranch(nullptr), PGO(cgm), - SwitchInsn(nullptr), SwitchWeights(nullptr), CaseRangeBlock(nullptr), - UnreachableBlock(nullptr), NumReturnExprs(0), NumSimpleReturnExprs(0), - CXXABIThisDecl(nullptr), CXXABIThisValue(nullptr), CXXThisValue(nullptr), + DebugInfo(CGM.getModuleDebugInfo()), + DisableDebugInfo(false), DidCallStackSave(false), IndirectBranch(nullptr), + PGO(cgm), SwitchInsn(nullptr), SwitchWeights(nullptr), + CaseRangeBlock(nullptr), UnreachableBlock(nullptr), NumReturnExprs(0), + NumSimpleReturnExprs(0), CXXABIThisDecl(nullptr), + CXXABIThisValue(nullptr), CXXThisValue(nullptr), CXXDefaultInitExprThis(nullptr), CXXStructorImplicitParamDecl(nullptr), CXXStructorImplicitParamValue(nullptr), OutermostConditional(nullptr), CurLexicalScope(nullptr), TerminateLandingPad(nullptr), Index: cfe/trunk/lib/CodeGen/CodeGenFunction.h === --- cfe/trunk/lib/CodeGen/CodeGenFunction.h +++ cfe/trunk/lib/CodeGen/CodeGenFunction.h @@ -324,11 +324,21 @@ /// write the current selector value into this alloca. llvm::AllocaInst *EHSelectorSlot; - llvm::AllocaInst *AbnormalTerminationSlot; + /// Entering and leaving an SEH __try / __finally scope causes stores to this + /// slot. + llvm::Value *ChildAbnormalTerminationSlot = nullptr; + + /// The SEH __abnormal_termination() intrinsic lowers down to loads from this + /// slot from a parent function. + llvm::Value *AbnormalTerminationSlot = nullptr; + + /// A stack of exception code slots. Entering an __except block pushes a slot + /// on the stack and leaving pops one. The __exception_code() intrinsic loads + /// a value from the top of the stack. + SmallVectorllvm::Value *, 1 SEHCodeSlotStack; - /// The implicit parameter to SEH filter functions of type - /// 'EXCEPTION_POINTERS*'. - ImplicitParamDecl *SEHPointersDecl; + /// Value returned by __exception_info intrinsic. + llvm::Value *SEHInfo = nullptr; /// Emits a landing pad for the current EH stack. llvm::BasicBlock *EmitLandingPad(); @@ -2048,26 +2058,36 @@ void EnterSEHTryStmt(const SEHTryStmt S); void ExitSEHTryStmt(const SEHTryStmt S); - void startOutlinedSEHHelper(CodeGenFunction ParentCGF, StringRef Name, - QualType RetTy, FunctionArgList Args, + void startOutlinedSEHHelper(CodeGenFunction ParentCGF, bool IsFilter, const Stmt *OutlinedStmt); llvm::Function *GenerateSEHFilterFunction(CodeGenFunction ParentCGF, const SEHExceptStmt Except); llvm::Function *GenerateSEHFinallyFunction(CodeGenFunction ParentCGF, const SEHFinallyStmt Finally); - void EmitSEHExceptionCodeSave(); + void EmitSEHExceptionCodeSave(CodeGenFunction ParentCGF, +llvm::Value *ParentFP, +llvm::Value *EntryEBP); llvm::Value *EmitSEHExceptionCode(); llvm::Value *EmitSEHExceptionInfo(); llvm::Value *EmitSEHAbnormalTermination(); /// Scan the outlined statement for captures from the parent function. For /// each capture, mark the capture as escaped and emit a call to /// llvm.framerecover. Insert the framerecover result into the LocalDeclMap. void EmitCapturedLocals(CodeGenFunction ParentCGF, const Stmt *OutlinedStmt, - llvm::Value *ParentFP); + bool IsFilter); + + /// Recovers the address of a local in a parent function. ParentVar is the + /// address of the variable used in the immediate parent function. It can + /// either be an alloca or a call to llvm.framerecover if there are nested + /// outlined functions. ParentFP is the frame pointer of the
Re: [PATCH] Mingw-w64 driver for clang
lgtm, thanks! http://reviews.llvm.org/D5268 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] [Support] Lazy load of dbghlp.dll on Windows
Thanks, lgtm! REPOSITORY rL LLVM http://reviews.llvm.org/D10737 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r241199 - [SEH] Update EmitCapturedLocals to match r241187
Author: rnk Date: Wed Jul 1 17:33:45 2015 New Revision: 241199 URL: http://llvm.org/viewvc/llvm-project?rev=241199view=rev Log: [SEH] Update EmitCapturedLocals to match r241187 It was still using frameaddress(1) to get the parent FP, even though it had the value it wanted as a parameter. Modified: cfe/trunk/lib/CodeGen/CGException.cpp cfe/trunk/test/CodeGen/exceptions-seh.c Modified: cfe/trunk/lib/CodeGen/CGException.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=241199r1=241198r2=241199view=diff == --- cfe/trunk/lib/CodeGen/CGException.cpp (original) +++ cfe/trunk/lib/CodeGen/CGException.cpp Wed Jul 1 17:33:45 2015 @@ -1447,15 +1447,11 @@ void CodeGenFunction::EmitCapturedLocals llvm::Value *EntryEBP = nullptr; llvm::Value *ParentFP; - if (CGM.getTarget().getTriple().getArch() != llvm::Triple::x86) { -// On x64, the parent FP is passed as the second argument. -auto AI = CurFn-arg_begin(); -++AI; -ParentFP = AI; - } else { -// The end of the EH registration is passed in as the EBP physical register. -// We can recover that with llvm.frameaddress(1), and adjust that to -// recover the parent's true frame pointer. + if (IsFilter CGM.getTarget().getTriple().getArch() == llvm::Triple::x86) { +// 32-bit SEH filters need to be careful about FP recovery. The end of the +// EH registration is passed in as the EBP physical register. We can +// recover that with llvm.frameaddress(1), and adjust that to recover the +// parent's true frame pointer. CGBuilderTy Builder(AllocaInsertPt); EntryEBP = Builder.CreateCall( CGM.getIntrinsic(llvm::Intrinsic::frameaddress), {Builder.getInt32(1)}); @@ -1464,11 +1460,12 @@ void CodeGenFunction::EmitCapturedLocals llvm::Constant *ParentI8Fn = llvm::ConstantExpr::getBitCast(ParentCGF.CurFn, Int8PtrTy); ParentFP = Builder.CreateCall(RecoverFPIntrin, {ParentI8Fn, EntryEBP}); - -// Inlining will break llvm.frameaddress(1), so disable it. -// FIXME: We could teach the inliner about the special meaning of -// frameaddress, framerecover, and frameescape to remove this limitation. -CurFn-addFnAttr(llvm::Attribute::NoInline); + } else { +// Otherwise, for x64 and 32-bit finally functions, the parent FP is the +// second parameter. +auto AI = CurFn-arg_begin(); +++AI; +ParentFP = AI; } // Create llvm.framerecover calls for all captures. Modified: cfe/trunk/test/CodeGen/exceptions-seh.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh.c?rev=241199r1=241198r2=241199view=diff == --- cfe/trunk/test/CodeGen/exceptions-seh.c (original) +++ cfe/trunk/test/CodeGen/exceptions-seh.c Wed Jul 1 17:33:45 2015 @@ -168,21 +168,20 @@ int nested_try(void) { // CHECK: load i32, i32* // CHECK: icmp eq i32 %{{.*}}, 123 -static unsigned g = 0; -void basic_finally(void) { - ++g; +int basic_finally(int g) { __try { j(); } __finally { ---g; +++g; } + return g; } -// CHECK-LABEL: define void @basic_finally() +// CHECK-LABEL: define i32 @basic_finally(i32 %g) // X64-SAME: personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) // X86-SAME: personality i8* bitcast (i32 (...)* @_except_handler3 to i8*) -// CHECK: load i32, i32* @g -// CHECK: add i32 %{{.*}}, 1 -// CHECK: store i32 %{{.*}}, i32* @g +// CHECK: %[[g_addr:[^ ]*]] = alloca i32, align 4 +// CHECK: call void (...) @llvm.frameescape(i32* %[[g_addr]]) +// CHECK: store i32 %g, i32* %[[g_addr]] // // CHECK: invoke void @j() // CHECK: to label %[[cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] @@ -190,7 +189,8 @@ void basic_finally(void) { // CHECK: [[cont]] // CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) // CHECK: call void @\01?fin$0@0@basic_finally@@({{i8( zeroext)?}} 0, i8* %[[fp]]) -// CHECK: ret void +// CHECK: load i32, i32* %[[g_addr]], align 4 +// CHECK: ret i32 // // CHECK: [[lpad]] // CHECK: landingpad { i8*, i32 } @@ -199,10 +199,11 @@ void basic_finally(void) { // CHECK: call void @\01?fin$0@0@basic_finally@@({{i8( zeroext)?}} 1, i8* %[[fp]]) // CHECK: resume -// CHECK: define internal void @\01?fin$0@0@basic_finally@@({{.*}}) -// CHECK: load i32, i32* @g, align 4 -// CHECK: add i32 %{{.*}}, -1 -// CHECK: store i32 %{{.*}}, i32* @g, align 4 +// CHECK: define internal void @\01?fin$0@0@basic_finally@@({{i8( zeroext)?}} %abnormal_termination, i8* %frame_pointer) +// CHECK: call i8* @llvm.framerecover(i8* bitcast (i32 (i32)* @basic_finally to i8*), i8* %frame_pointer, i32 0) +// CHECK: load i32, i32* %{{.*}}, align 4 +// CHECK: add nsw i32 %{{.*}}, 1 +// CHECK: store i32 %{{.*}}, i32* %{{.*}}, align 4 // CHECK: ret void int returns_int(void);
r241077 - [clang-cl] Use /arch: to set the base target CPU
Author: rnk Date: Tue Jun 30 11:32:04 2015 New Revision: 241077 URL: http://llvm.org/viewvc/llvm-project?rev=241077view=rev Log: [clang-cl] Use /arch: to set the base target CPU The main effect of this change is that /arch:IA32 will use i386 as the CPU, while clang-cl will continue to default to pentium4 (aka SSE2 plus the usual other features). /arch:AVX and /arch:AVX2 will also now enable the other features available in sandybridge and haswell respectively, which is consistent with MSDN. Modified: cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/cl-x86-flags.c Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=241077r1=241076r2=241077view=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Tue Jun 30 11:32:04 2015 @@ -1386,6 +1386,28 @@ static const char *getX86TargetCPU(const return Args.MakeArgString(CPU); } + if (const Arg *A = Args.getLastArg(options::OPT__SLASH_arch)) { +// Mapping built by referring to X86TargetInfo::getDefaultFeatures(). +StringRef Arch = A-getValue(); +const char *CPU; +if (Triple.getArch() == llvm::Triple::x86) { + CPU = llvm::StringSwitchconst char *(Arch) +.Case(IA32, i386) +.Case(SSE, pentium3) +.Case(SSE2, pentium4) +.Case(AVX, sandybridge) +.Case(AVX2, haswell) +.Default(nullptr); +} else { + CPU = llvm::StringSwitchconst char *(Arch) +.Case(AVX, sandybridge) +.Case(AVX2, haswell) +.Default(nullptr); +} +if (CPU) + return CPU; + } + // Select the default CPU if none was given (or detection failed). if (Triple.getArch() != llvm::Triple::x86_64 Modified: cfe/trunk/test/Driver/cl-x86-flags.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-x86-flags.c?rev=241077r1=241076r2=241077view=diff == --- cfe/trunk/test/Driver/cl-x86-flags.c (original) +++ cfe/trunk/test/Driver/cl-x86-flags.c Tue Jun 30 11:32:04 2015 @@ -8,10 +8,10 @@ // RUN: --target=i386-pc-win32 -### -- 21 %s | FileCheck -check-prefix=MFLAGS %s // MFLAGS-NOT: argument unused during compilation -// -arch:IA32 is no-op. // RUN: %clang_cl -m32 -arch:IA32 --target=i386 -### -- 21 %s | FileCheck -check-prefix=IA32 %s -// IA32-NOT: argument unused during compilation +// IA32: -target-cpu i386 // IA32-NOT: -target-feature +// IA32-NOT: argument unused during compilation // RUN: %clang_cl -m32 -arch:ia32 --target=i386 -### -- 21 %s | FileCheck -check-prefix=ia32 %s // ia32: argument unused during compilation @@ -22,6 +22,7 @@ // IA3264-NOT: -target-feature // RUN: %clang_cl -m32 -arch:SSE --target=i386 -### -- 21 %s | FileCheck -check-prefix=SSE %s +// SSE: -target-cpu pentium3 // SSE: -target-feature // SSE: +sse // SSE-NOT: argument unused during compilation @@ -31,6 +32,7 @@ // sse-NOT: -target-feature // RUN: %clang_cl -m32 -arch:SSE2 --target=i386 -### -- 21 %s | FileCheck -check-prefix=SSE2 %s +// SSE2: -target-cpu pentium4 // SSE2: -target-feature // SSE2: +sse2 // SSE2-NOT: argument unused during compilation @@ -42,12 +44,14 @@ // RUN: %clang_cl -m64 -arch:SSE --target=x86_64 -### -- 21 %s | FileCheck -check-prefix=SSE64 %s // SSE64: argument unused during compilation // SSE64-NOT: -target-feature +// SSE64-NOT: pentium3 // RUN: %clang_cl -m64 -arch:SSE2 --target=x86_64 -### -- 21 %s | FileCheck -check-prefix=SSE264 %s // SSE264: argument unused during compilation // SSE264-NOT: -target-feature // RUN: %clang_cl -m32 -arch:AVX --target=i386 -### -- 21 %s | FileCheck -check-prefix=AVX %s +// AVX: -target-cpu sandybridge // AVX: -target-feature // AVX: +avx @@ -56,6 +60,7 @@ // avx-NOT: -target-feature // RUN: %clang_cl -m32 -arch:AVX2 --target=i386 -### -- 21 %s | FileCheck -check-prefix=AVX2 %s +// AVX2: -target-cpu haswell // AVX2: -target-feature // AVX2: +avx2 @@ -64,6 +69,7 @@ // avx2-NOT: -target-feature // RUN: %clang_cl -m64 -arch:AVX --target=x86_64 -### -- 21 %s | FileCheck -check-prefix=AVX64 %s +// AVX64: -target-cpu sandybridge // AVX64: -target-feature // AVX64: +avx @@ -72,6 +78,7 @@ // avx64-NOT: -target-feature // RUN: %clang_cl -m64 -arch:AVX2 --target=x86_64 -### -- 21 %s | FileCheck -check-prefix=AVX264 %s +// AVX264: -target-cpu haswell // AVX264: -target-feature // AVX264: +avx2 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] [Support] Lazy load of dbghlp.dll on Windows
I'm fine with the dynamic approach over the delayload approach. We use this DLL so infrequently that it's fine. REPOSITORY rL LLVM Comment at: configure:8661 @@ -8660,3 +8660,1 @@ -{ echo $as_me:$LINENO: checking for main in -limagehlp 5 -echo $ECHO_N checking for main in -limagehlp... $ECHO_C 6; } configure is a generated file. You want to change llvm/autoconf/configure.ac, and let Eric run autoconf to update this file. http://reviews.llvm.org/D10737 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
[PATCH] [SEH] Add 32-bit lowering for SEH __try
Hi majnemer, This re-lands r236052 and adds support for __exception_code(). In 32-bit SEH, the exception code is not available in eax. It is only available in the filter function, and now we arrange to load it and store it into an escaped variable in the parent frame. As a consequence, we have to disable the catch i8* null optimization on 32-bit and always generate a filter function. We can re-enable the optimization if we detect an __except block that doesn't use the exception code, but this probably isn't worth optimizing. http://reviews.llvm.org/D10852 Files: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/TargetInfo.h lib/CodeGen/CGException.cpp lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/CodeGenFunction.h lib/Sema/SemaStmt.cpp test/CodeGen/exceptions-seh-finally.c test/CodeGen/exceptions-seh-leave.c test/CodeGen/exceptions-seh.c EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ Index: include/clang/Basic/DiagnosticSemaKinds.td === --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -5574,6 +5574,8 @@ cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls; def err_mixing_cxx_try_seh_try : Error cannot use C++ 'try' in the same function as SEH '__try'; +def err_seh_try_unsupported : Error + SEH '__try' is not supported on this target; def note_conflicting_try_here : Note conflicting %0 here; def warn_jump_out_of_seh_finally : Warning Index: include/clang/Basic/TargetInfo.h === --- include/clang/Basic/TargetInfo.h +++ include/clang/Basic/TargetInfo.h @@ -804,6 +804,11 @@ return TLSSupported; } + /// \brief Whether the target supports SEH __try. + bool isSEHTrySupported() const { +return getTriple().isOSWindows(); + } + /// \brief Return true if {|} are normal characters in the asm string. /// /// If this returns false (the default), then {abc|xyz} is syntax Index: lib/CodeGen/CGException.cpp === --- lib/CodeGen/CGException.cpp +++ lib/CodeGen/CGException.cpp @@ -20,6 +20,7 @@ #include clang/AST/StmtCXX.h #include clang/AST/StmtObjC.h #include clang/AST/StmtVisitor.h +#include clang/Basic/TargetBuiltins.h #include llvm/IR/CallSite.h #include llvm/IR/Intrinsics.h #include llvm/IR/IntrinsicInst.h @@ -1279,14 +1280,6 @@ } void CodeGenFunction::EmitSEHTryStmt(const SEHTryStmt S) { - // FIXME: Implement SEH on other architectures. - const llvm::Triple T = CGM.getTarget().getTriple(); - if (T.getArch() != llvm::Triple::x86_64 || - !T.isKnownWindowsMSVCEnvironment()) { -ErrorUnsupported(S, __try statement); -return; - } - EnterSEHTryStmt(S); { JumpDest TryExit = getJumpDestInCurrentScope(__try.__leave); @@ -1311,25 +1304,39 @@ void Emit(CodeGenFunction CGF, Flags F) override { ASTContext Context = CGF.getContext(); -QualType ArgTys[2] = {Context.UnsignedCharTy, Context.VoidPtrTy}; -FunctionProtoType::ExtProtoInfo EPI; -const auto *FTP = castFunctionType( -Context.getFunctionType(Context.VoidTy, ArgTys, EPI)); +CodeGenModule CGM = CGF.CGM; +// In 64-bit, we call the child function with arguments. In 32-bit, we store +// zero in the parent frame and use framerecover to check the value. +const CGFunctionInfo *FnInfo; CallArgList Args; -llvm::Value *IsForEH = -llvm::ConstantInt::get(CGF.ConvertType(ArgTys[0]), F.isForEHCleanup()); -Args.add(RValue::get(IsForEH), ArgTys[0]); +if (CGF.getTarget().getTriple().getArch() == llvm::Triple::x86_64) { + // Compute the two argument values. + QualType ArgTys[2] = {Context.UnsignedCharTy, Context.VoidPtrTy}; + llvm::Value *FrameAddr = CGM.getIntrinsic(llvm::Intrinsic::frameaddress); + llvm::Value *FP = + CGF.Builder.CreateCall(FrameAddr, {CGF.Builder.getInt32(0)}); + llvm::Value *IsForEH = + llvm::ConstantInt::get(CGF.ConvertType(ArgTys[0]), F.isForEHCleanup()); + Args.add(RValue::get(IsForEH), ArgTys[0]); + Args.add(RValue::get(FP), ArgTys[1]); + + // Arrange a two-arg function info and type. + FunctionProtoType::ExtProtoInfo EPI; + const auto *FPT = castFunctionProtoType( + Context.getFunctionType(Context.VoidTy, ArgTys, EPI)); + FnInfo = CGM.getTypes().arrangeFreeFunctionCall(Args, FPT, + /*chainCall=*/false); +} else { + // Emit the zero store if this is normal control flow. There are no + // explicit arguments. + if (F.isForNormalCleanup() CGF.ChildAbnormalTerminationSlot) +CGF.Builder.CreateStore(CGF.Builder.getInt32(0), +CGF.ChildAbnormalTerminationSlot); + FnInfo = CGM.getTypes().arrangeNullaryFunction(); +
Re: [PATCH] [Support] Lazy load of dbghlp.dll on Windows
Can you remove the configure and cmake test for libimagehlp along with this? Don't worry about regenerating autoconf, I can get Eric to do that. REPOSITORY rL LLVM http://reviews.llvm.org/D10737 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] Mingw-w64 driver for clang
This came up again on cfe-dev. We should at least get something in tree. Yaron, if you could put together a patch that merges in your change I'd be happy to review it. :) http://reviews.llvm.org/D5268 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [Patch] (take 2) New EliminateAvailableExternally pass / Pass down -flto
Back from vacation myself. It's that time of year. :) lgtm On Tue, Jun 23, 2015 at 11:39 AM, Teresa Johnson tejohn...@google.com wrote: On Thu, Jun 11, 2015 at 8:17 PM, Teresa Johnson tejohn...@google.com wrote: Hi Nico, Sorry about that. Since I am heading out on vacation for a week tomorrow I went ahead and reverted for now. Teresa On Thu, Jun 11, 2015 at 6:07 PM, Nico Weber tha...@chromium.org wrote: Hi Teresa, this (well, 239480 really) seems to break building dynamic libraries pretty decisively: https://code.google.com/p/chromium/issues/detail?id=499508#c3 Can you take a look, and if it takes a while to investigate, revert this for now? Thanks, Nico I am back from vacation and found what was happening here. The attached patches are largely the same as the original ones but contain a fix for this issue (llvm patch) and a new test created from Nico's reduced test (clang patch). The broken code was compiled -fvisibility=hidden, and this caused the thunk to SyncMessageFilter::Send (_ZThn16_N17SyncMessageFilter4SendEP7Message), which is available_externally, to also be marked hidden. With my patch, we eliminated the function's body and turned it into a declaration, which was still marked hidden as I wasn't modifying visibility. During AsmPrinter::doFinalization, EmitVisibility is called on all function declarations in the module, which caused this symbol to get hidden visibility (via a resulting call to MCSymbolELF::setVisibility). The linker then complained because it was undefined and hidden. Before my patch, code gen suppressed the emission of this function since it was available externally, and as a result, EmitVisibility, and thus MCSymbolELF::setVisibility, were simply never called. The undefined symbol then ended up with the default visibility. It seems to me that this essentially worked by luck. I've fixed this by changing the visibility on globals to DefaultVisibility when we eliminate their definitions in the new EliminateAvailableExternally pass. Patches attached. Tests (including the new one) all pass. Ok to commit? Thanks, Teresa On Wed, Jun 10, 2015 at 10:49 AM, Teresa Johnson tejohn...@google.com wrote: Author: tejohnson Date: Wed Jun 10 12:49:45 2015 New Revision: 239481 URL: http://llvm.org/viewvc/llvm-project?rev=239481view=rev Log: Pass down the -flto option to the -cc1 job, and from there into the CodeGenOptions and onto the PassManagerBuilder. This enables gating the new EliminateAvailableExternally module pass on whether we are preparing for LTO. If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not included as we want to preserve available externally functions for possible link time inlining. -- Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413 ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] [Clang/CodeGen] Prevent crash if destructor class is not accessible
Lgtm Sent from phone http://reviews.llvm.org/D10508 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] [Clang/CodeGen] Prevent crash if destructor class is not accessible
Lgtm Sent from phone On Jun 19, 2015 5:14 PM, Davide Italiano dccitali...@gmail.com wrote: Reordered checks as suggested. Anders Carlsson LGTM'd the change. Reid, do you think we can go forward and check this in? http://reviews.llvm.org/D10508 Files: lib/CodeGen/CGClass.cpp test/CodeGenCXX/destructor-crash.cpp Index: lib/CodeGen/CGClass.cpp === --- lib/CodeGen/CGClass.cpp +++ lib/CodeGen/CGClass.cpp @@ -1297,6 +1297,10 @@ if (BaseClassDecl-hasTrivialDestructor()) return true; + // Give up if the destructor is not accessible. + if (!BaseClassDecl-getDestructor()) +return false; + if (!BaseClassDecl-getDestructor()-hasTrivialBody()) return false; Index: test/CodeGenCXX/destructor-crash.cpp === --- test/CodeGenCXX/destructor-crash.cpp +++ test/CodeGenCXX/destructor-crash.cpp @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 %s -emit-llvm -std=c++11 -o %t + +struct A { + ~A(); +}; + +struct B { + A a; +}; + +struct C { + union { +B b; + }; + + ~C() noexcept; +}; + +C::~C() noexcept {} EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] [Clang/CodeGen] Prevent crash if destructor class is not accessible
Comment at: lib/CodeGen/CGClass.cpp:1296-1302 @@ -1295,5 +1295,9 @@ { + // Give up if the destructor is not accessible. + if (!BaseClassDecl-getDestructor()) +return false; + // If the destructor is trivial we don't have to check anything else. if (BaseClassDecl-hasTrivialDestructor()) return true; I suspect you want to reorder these checks. The triviality check is a bittest, and getDestructor() may perform lookup. http://reviews.llvm.org/D10508 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] CFI: Implement bitset emission for the Microsoft ABI.
Looks good Comment at: lib/AST/MicrosoftMangle.cpp:2765 @@ +2764,3 @@ + Linkage L = RD-getLinkageInternal(); + if (L == InternalLinkage || L == UniqueExternalLinkage) { +// This part of the identifier needs to be unique across all translation What about NoLinkage, which I believe applies to types declared in functions? This check appears equivalent to !RD-isExternallyVisible(), which I think is probably what you want. This is the test case I'm imagining: foo.h: struct A { virtual int f(); }; void use_a(A); a.cpp: static void f() { struct B : A { virtual int f() { return 1; } } b; use_a(b); } b.cpp: static void f() { struct B : A { virtual int f() { return 2; } } b; use_a(b); } It seems like you'd need two distinct tags for B, right? Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:1701-1705 @@ -1600,3 +1700,7 @@ MicrosoftVTableContext::MethodVFTableLocation ML = CGM.getMicrosoftVTableContext().getMethodVFTableLocation(GD); + if (CGF.SanOpts.has(SanitizerKind::CFIVCall)) +CGF.EmitVTablePtrCheck(getClassAtVTableLocation(getContext(), GD, ML), + VTable, CodeGenFunction::CFITCK_VCall, Loc); + Sigh. I wish we didn't have to do this. We should be able to provide the record decl that originally established the vftable slot in the method location, but it's not easy and requires a good understanding of the MS vftable code, which is pretty opaque. So let's do this for now. I guess your algorithm also computes something subtly different. In this example, you'll get B when calling f: struct A { virtual void f(); }; struct B : A { virtual void g(); }; Whereas I would think of it as being the vftable introduced by A. http://reviews.llvm.org/D10520 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] [ARM] Don't hard code metadata arguments
lgtm http://reviews.llvm.org/D10507 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r239920 - [fixit] Use overwriteChangedFiles() to deal with Windows mapped files
Author: rnk Date: Wed Jun 17 12:47:30 2015 New Revision: 239920 URL: http://llvm.org/viewvc/llvm-project?rev=239920view=rev Log: [fixit] Use overwriteChangedFiles() to deal with Windows mapped files Fixes one instance of PR17960. Added: cfe/trunk/test/FixIt/fixit-large-file.cpp Modified: cfe/trunk/include/clang/Rewrite/Frontend/FixItRewriter.h cfe/trunk/lib/Frontend/Rewrite/FixItRewriter.cpp cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp Modified: cfe/trunk/include/clang/Rewrite/Frontend/FixItRewriter.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Rewrite/Frontend/FixItRewriter.h?rev=239920r1=239919r2=239920view=diff == --- cfe/trunk/include/clang/Rewrite/Frontend/FixItRewriter.h (original) +++ cfe/trunk/include/clang/Rewrite/Frontend/FixItRewriter.h Wed Jun 17 12:47:30 2015 @@ -27,7 +27,7 @@ class FileEntry; class FixItOptions { public: - FixItOptions() : FixWhatYouCan(false), + FixItOptions() : InPlace(false), FixWhatYouCan(false), FixOnlyWarnings(false), Silent(false) { } virtual ~FixItOptions(); @@ -41,6 +41,10 @@ public: /// virtual std::string RewriteFilename(const std::string Filename, int fd) = 0; + /// True if files should be updated in place. RewriteFilename is only called + /// if this is false. + bool InPlace; + /// \brief Whether to abort fixing a file when not all errors could be fixed. bool FixWhatYouCan; Modified: cfe/trunk/lib/Frontend/Rewrite/FixItRewriter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/FixItRewriter.cpp?rev=239920r1=239919r2=239920view=diff == --- cfe/trunk/lib/Frontend/Rewrite/FixItRewriter.cpp (original) +++ cfe/trunk/lib/Frontend/Rewrite/FixItRewriter.cpp Wed Jun 17 12:47:30 2015 @@ -81,6 +81,13 @@ bool FixItRewriter::WriteFixedFiles( RewritesReceiver Rec(Rewrite); Editor.applyRewrites(Rec); + if (FixItOpts-InPlace) { +// Overwriting open files on Windows is tricky, but the rewriter can do it +// for us. +Rewrite.overwriteChangedFiles(); +return false; + } + for (iterator I = buffer_begin(), E = buffer_end(); I != E; ++I) { const FileEntry *Entry = Rewrite.getSourceMgr().getFileEntryForID(I-first); int fd; Modified: cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp?rev=239920r1=239919r2=239920view=diff == --- cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp (original) +++ cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp Wed Jun 17 12:47:30 2015 @@ -48,9 +48,10 @@ FixItAction::CreateASTConsumer(CompilerI namespace { class FixItRewriteInPlace : public FixItOptions { public: + FixItRewriteInPlace() { InPlace = true; } + std::string RewriteFilename(const std::string Filename, int fd) override { -fd = -1; -return Filename; +llvm_unreachable(don't call RewriteFilename for inplace rewrites); } }; Added: cfe/trunk/test/FixIt/fixit-large-file.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit-large-file.cpp?rev=239920view=auto == --- cfe/trunk/test/FixIt/fixit-large-file.cpp (added) +++ cfe/trunk/test/FixIt/fixit-large-file.cpp Wed Jun 17 12:47:30 2015 @@ -0,0 +1,318 @@ +// Don't modify the source in place, since it might be readonly. +// RUN: cp %s %t.cpp +// RUN: not %clang_cc1 -fixit %t.cpp 21 | FileCheck %s + +struct A { int x; }; +int foo(A *p) { + return p.x; +} + +// CHECK: error: member reference type 'A *' is a pointer; did you mean to use '-'? +// CHECK: note: FIX-IT applied suggested code changes +// CHECK-NOT: error: + +// The following comment block makes the file at least 16K, which causes clang +// to mmap it. This caused an issue with clang on Windows, where you cannot +// write a file which is currently mapped. +// +// xxx +// xxx +// xxx +// xxx +// xxx +// xxx +// xxx +// xxx +// xxx +// xxx +//
Re: [PATCH] [Clang/CodeGen] Prevent crash if destructor class is not accessible
Any reason not to add the test case you have? REPOSITORY rL LLVM http://reviews.llvm.org/D10508 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r239765 - Fix submodule test to pass on content addressable filesystems where inodes would collide
Author: rnk Date: Mon Jun 15 16:21:17 2015 New Revision: 239765 URL: http://llvm.org/viewvc/llvm-project?rev=239765view=rev Log: Fix submodule test to pass on content addressable filesystems where inodes would collide Modified: cfe/trunk/test/Modules/Inputs/submodules-merge-defs/use-defs-2.h cfe/trunk/test/Modules/Inputs/submodules-merge-defs/use-defs.h Modified: cfe/trunk/test/Modules/Inputs/submodules-merge-defs/use-defs-2.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/submodules-merge-defs/use-defs-2.h?rev=239765r1=239764r2=239765view=diff == --- cfe/trunk/test/Modules/Inputs/submodules-merge-defs/use-defs-2.h (original) +++ cfe/trunk/test/Modules/Inputs/submodules-merge-defs/use-defs-2.h Mon Jun 15 16:21:17 2015 @@ -1 +1,2 @@ +// use-defs-2.h #include defs.h Modified: cfe/trunk/test/Modules/Inputs/submodules-merge-defs/use-defs.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/submodules-merge-defs/use-defs.h?rev=239765r1=239764r2=239765view=diff == --- cfe/trunk/test/Modules/Inputs/submodules-merge-defs/use-defs.h (original) +++ cfe/trunk/test/Modules/Inputs/submodules-merge-defs/use-defs.h Mon Jun 15 16:21:17 2015 @@ -1 +1,2 @@ +// use-defs.h #include defs.h ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r239757 - Wildcard out some SSA value names from the ACLE intrinsic test case
Author: rnk Date: Mon Jun 15 15:55:43 2015 New Revision: 239757 URL: http://llvm.org/viewvc/llvm-project?rev=239757view=rev Log: Wildcard out some SSA value names from the ACLE intrinsic test case Modified: cfe/trunk/test/CodeGen/arm_acle.c Modified: cfe/trunk/test/CodeGen/arm_acle.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm_acle.c?rev=239757r1=239756r2=239757view=diff == --- cfe/trunk/test/CodeGen/arm_acle.c (original) +++ cfe/trunk/test/CodeGen/arm_acle.c Mon Jun 15 15:55:43 2015 @@ -368,8 +368,8 @@ void *test_rsrp() { } // ARM-LABEL: test_wsr -// AArch64: call void @llvm.write_register.i64(metadata !1, i64 %1) -// AArch32: call void @llvm.write_register.i32(metadata !3, i32 %v) +// AArch64: call void @llvm.write_register.i64(metadata !1, i64 %{{.*}}) +// AArch32: call void @llvm.write_register.i32(metadata !3, i32 %{{.*}}) void test_wsr(uint32_t v) { #ifdef __ARM_32BIT_STATE __arm_wsr(cp1:2:c3:c4:5, v); @@ -379,8 +379,8 @@ void test_wsr(uint32_t v) { } // ARM-LABEL: test_wsr64 -// AArch64: call void @llvm.write_register.i64(metadata !1, i64 %v) -// AArch32: call void @llvm.write_register.i64(metadata !4, i64 %v) +// AArch64: call void @llvm.write_register.i64(metadata !1, i64 %{{.*}}) +// AArch32: call void @llvm.write_register.i64(metadata !4, i64 %{{.*}}) void test_wsr64(uint64_t v) { #ifdef __ARM_32BIT_STATE __arm_wsr64(cp1:2:c3, v); @@ -390,8 +390,8 @@ void test_wsr64(uint64_t v) { } // ARM-LABEL: test_wsrp -// AArch64: call void @llvm.write_register.i64(metadata !2, i64 %1) -// AArch32: call void @llvm.write_register.i32(metadata !5, i32 %1) +// AArch64: call void @llvm.write_register.i64(metadata !2, i64 %{{.*}}) +// AArch32: call void @llvm.write_register.i32(metadata !5, i32 %{{.*}}) void test_wsrp(void *v) { __arm_wsrp(sysreg, v); } ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] [ms] Do lookup in dependent base classes also when overload resolution fails (PR23810)
Oh dear, this is when error recovery and ms compatibility hacks get in the way of each other. :-( http://reviews.llvm.org/D10369 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r239416 - Disable style-on-command-line test on Windows
Author: rnk Date: Tue Jun 9 12:47:59 2015 New Revision: 239416 URL: http://llvm.org/viewvc/llvm-project?rev=239416view=rev Log: Disable style-on-command-line test on Windows Modified: cfe/trunk/test/Format/style-on-command-line.cpp Modified: cfe/trunk/test/Format/style-on-command-line.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/style-on-command-line.cpp?rev=239416r1=239415r2=239416view=diff == --- cfe/trunk/test/Format/style-on-command-line.cpp (original) +++ cfe/trunk/test/Format/style-on-command-line.cpp Tue Jun 9 12:47:59 2015 @@ -29,3 +29,7 @@ void f() { int*i; int j; } + +// On Windows, the 'rm' commands fail when the previous process is still alive. +// This happens enough to make the test useless. +// REQUIRES: shell ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: r239402 - Remove rm invocations where the file is immediately rewritten later.
This came up last week: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2015-June/043376.html I just disabled the test in r239416. On Tue, Jun 9, 2015 at 5:41 AM, Benjamin Kramer benny@googlemail.com wrote: Author: d0k Date: Tue Jun 9 07:41:02 2015 New Revision: 239402 URL: http://llvm.org/viewvc/llvm-project?rev=239402view=rev Log: Remove rm invocations where the file is immediately rewritten later. This may or may not help making this test less flaky on windows. There's a race condition in lit somewhere. Modified: cfe/trunk/test/Format/style-on-command-line.cpp Modified: cfe/trunk/test/Format/style-on-command-line.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/style-on-command-line.cpp?rev=239402r1=239401r2=239402view=diff == --- cfe/trunk/test/Format/style-on-command-line.cpp (original) +++ cfe/trunk/test/Format/style-on-command-line.cpp Tue Jun 9 07:41:02 2015 @@ -3,13 +3,11 @@ // RUN: clang-format -style={BasedOnStyle: LLVM, IndentWidth: 7} %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK2 %s // RUN: clang-format -style={BasedOnStyle: invalid, IndentWidth: 7} -fallback-style=LLVM %t.cpp 21 | FileCheck -strict-whitespace -check-prefix=CHECK3 %s // RUN: clang-format -style={lsjd} %t.cpp -fallback-style=LLVM 21 | FileCheck -strict-whitespace -check-prefix=CHECK4 %s -// RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format // RUN: printf BasedOnStyle: google\nIndentWidth: 5\n %T/.clang-format // RUN: clang-format -style=file %t.cpp 21 | FileCheck -strict-whitespace -check-prefix=CHECK5 %s // RUN: printf \n %T/.clang-format // RUN: clang-format -style=file -fallback-style=webkit %t.cpp 21 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s -// RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format -// RUN: [ ! -e %T/_clang-format ] || rm %T/_clang-format +// RUN: rm %T/.clang-format // RUN: printf BasedOnStyle: google\nIndentWidth: 6\n %T/_clang-format // RUN: clang-format -style=file %t.cpp 21 | FileCheck -strict-whitespace -check-prefix=CHECK7 %s // RUN: clang-format -style={BasedOnStyle: LLVM, PointerBindsToType: true} %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK8 %s ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
r239415 - Re-land r236052, [SEH] Add 32-bit lowering code for __try
Author: rnk Date: Tue Jun 9 12:47:50 2015 New Revision: 239415 URL: http://llvm.org/viewvc/llvm-project?rev=239415view=rev Log: Re-land r236052, [SEH] Add 32-bit lowering code for __try This reverts r236167. LLVM should be ready for this now. Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Basic/TargetInfo.h cfe/trunk/lib/CodeGen/CGException.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.h cfe/trunk/lib/Sema/SemaStmt.cpp cfe/trunk/test/CodeGen/exceptions-seh-finally.c cfe/trunk/test/CodeGen/exceptions-seh.c Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=239415r1=239414r2=239415view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jun 9 12:47:50 2015 @@ -5559,6 +5559,8 @@ def err_seh_try_outside_functions : Erro cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls; def err_mixing_cxx_try_seh_try : Error cannot use C++ 'try' in the same function as SEH '__try'; +def err_seh_try_unsupported : Error + SEH '__try' is not supported on this target; def note_conflicting_try_here : Note conflicting %0 here; def warn_jump_out_of_seh_finally : Warning Modified: cfe/trunk/include/clang/Basic/TargetInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=239415r1=239414r2=239415view=diff == --- cfe/trunk/include/clang/Basic/TargetInfo.h (original) +++ cfe/trunk/include/clang/Basic/TargetInfo.h Tue Jun 9 12:47:50 2015 @@ -797,6 +797,11 @@ public: return TLSSupported; } + /// \brief Whether the target supports SEH __try. + bool isSEHTrySupported() const { +return getTriple().isOSWindows(); + } + /// \brief Return true if {|} are normal characters in the asm string. /// /// If this returns false (the default), then {abc|xyz} is syntax Modified: cfe/trunk/lib/CodeGen/CGException.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=239415r1=239414r2=239415view=diff == --- cfe/trunk/lib/CodeGen/CGException.cpp (original) +++ cfe/trunk/lib/CodeGen/CGException.cpp Tue Jun 9 12:47:50 2015 @@ -20,6 +20,7 @@ #include clang/AST/StmtCXX.h #include clang/AST/StmtObjC.h #include clang/AST/StmtVisitor.h +#include clang/Basic/TargetBuiltins.h #include llvm/IR/CallSite.h #include llvm/IR/Intrinsics.h #include llvm/IR/IntrinsicInst.h @@ -1274,14 +1275,6 @@ llvm::BasicBlock *CodeGenFunction::getEH } void CodeGenFunction::EmitSEHTryStmt(const SEHTryStmt S) { - // FIXME: Implement SEH on other architectures. - const llvm::Triple T = CGM.getTarget().getTriple(); - if (T.getArch() != llvm::Triple::x86_64 || - !T.isKnownWindowsMSVCEnvironment()) { -ErrorUnsupported(S, __try statement); -return; - } - EnterSEHTryStmt(S); { JumpDest TryExit = getJumpDestInCurrentScope(__try.__leave); @@ -1306,25 +1299,39 @@ struct PerformSEHFinally : EHScopeStack: void Emit(CodeGenFunction CGF, Flags F) override { ASTContext Context = CGF.getContext(); -QualType ArgTys[2] = {Context.UnsignedCharTy, Context.VoidPtrTy}; -FunctionProtoType::ExtProtoInfo EPI; -const auto *FTP = castFunctionType( -Context.getFunctionType(Context.VoidTy, ArgTys, EPI)); +CodeGenModule CGM = CGF.CGM; +// In 64-bit, we call the child function with arguments. In 32-bit, we store +// zero in the parent frame and use framerecover to check the value. +const CGFunctionInfo *FnInfo; CallArgList Args; -llvm::Value *IsForEH = -llvm::ConstantInt::get(CGF.ConvertType(ArgTys[0]), F.isForEHCleanup()); -Args.add(RValue::get(IsForEH), ArgTys[0]); +if (CGF.getTarget().getTriple().getArch() == llvm::Triple::x86_64) { + // Compute the two argument values. + QualType ArgTys[2] = {Context.UnsignedCharTy, Context.VoidPtrTy}; + llvm::Value *FrameAddr = CGM.getIntrinsic(llvm::Intrinsic::frameaddress); + llvm::Value *FP = + CGF.Builder.CreateCall(FrameAddr, {CGF.Builder.getInt32(0)}); + llvm::Value *IsForEH = + llvm::ConstantInt::get(CGF.ConvertType(ArgTys[0]), F.isForEHCleanup()); + Args.add(RValue::get(IsForEH), ArgTys[0]); + Args.add(RValue::get(FP), ArgTys[1]); + + // Arrange a two-arg function info and type. + FunctionProtoType::ExtProtoInfo EPI; + const auto *FPT = castFunctionProtoType( + Context.getFunctionType(Context.VoidTy, ArgTys, EPI)); + FnInfo = CGM.getTypes().arrangeFreeFunctionCall(Args, FPT, +
r239417 - Revert Re-land r236052, [SEH] Add 32-bit lowering code for __try
Author: rnk Date: Tue Jun 9 12:49:42 2015 New Revision: 239417 URL: http://llvm.org/viewvc/llvm-project?rev=239417view=rev Log: Revert Re-land r236052, [SEH] Add 32-bit lowering code for __try This reverts commit r239415. This was committed accidentally, LLVM isn't ready for this. Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Basic/TargetInfo.h cfe/trunk/lib/CodeGen/CGException.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.h cfe/trunk/lib/Sema/SemaStmt.cpp cfe/trunk/test/CodeGen/exceptions-seh-finally.c cfe/trunk/test/CodeGen/exceptions-seh.c Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=239417r1=239416r2=239417view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jun 9 12:49:42 2015 @@ -5559,8 +5559,6 @@ def err_seh_try_outside_functions : Erro cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls; def err_mixing_cxx_try_seh_try : Error cannot use C++ 'try' in the same function as SEH '__try'; -def err_seh_try_unsupported : Error - SEH '__try' is not supported on this target; def note_conflicting_try_here : Note conflicting %0 here; def warn_jump_out_of_seh_finally : Warning Modified: cfe/trunk/include/clang/Basic/TargetInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=239417r1=239416r2=239417view=diff == --- cfe/trunk/include/clang/Basic/TargetInfo.h (original) +++ cfe/trunk/include/clang/Basic/TargetInfo.h Tue Jun 9 12:49:42 2015 @@ -797,11 +797,6 @@ public: return TLSSupported; } - /// \brief Whether the target supports SEH __try. - bool isSEHTrySupported() const { -return getTriple().isOSWindows(); - } - /// \brief Return true if {|} are normal characters in the asm string. /// /// If this returns false (the default), then {abc|xyz} is syntax Modified: cfe/trunk/lib/CodeGen/CGException.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=239417r1=239416r2=239417view=diff == --- cfe/trunk/lib/CodeGen/CGException.cpp (original) +++ cfe/trunk/lib/CodeGen/CGException.cpp Tue Jun 9 12:49:42 2015 @@ -20,7 +20,6 @@ #include clang/AST/StmtCXX.h #include clang/AST/StmtObjC.h #include clang/AST/StmtVisitor.h -#include clang/Basic/TargetBuiltins.h #include llvm/IR/CallSite.h #include llvm/IR/Intrinsics.h #include llvm/IR/IntrinsicInst.h @@ -1275,6 +1274,14 @@ llvm::BasicBlock *CodeGenFunction::getEH } void CodeGenFunction::EmitSEHTryStmt(const SEHTryStmt S) { + // FIXME: Implement SEH on other architectures. + const llvm::Triple T = CGM.getTarget().getTriple(); + if (T.getArch() != llvm::Triple::x86_64 || + !T.isKnownWindowsMSVCEnvironment()) { +ErrorUnsupported(S, __try statement); +return; + } + EnterSEHTryStmt(S); { JumpDest TryExit = getJumpDestInCurrentScope(__try.__leave); @@ -1299,39 +1306,25 @@ struct PerformSEHFinally : EHScopeStack: void Emit(CodeGenFunction CGF, Flags F) override { ASTContext Context = CGF.getContext(); -CodeGenModule CGM = CGF.CGM; +QualType ArgTys[2] = {Context.UnsignedCharTy, Context.VoidPtrTy}; +FunctionProtoType::ExtProtoInfo EPI; +const auto *FTP = castFunctionType( +Context.getFunctionType(Context.VoidTy, ArgTys, EPI)); -// In 64-bit, we call the child function with arguments. In 32-bit, we store -// zero in the parent frame and use framerecover to check the value. -const CGFunctionInfo *FnInfo; CallArgList Args; -if (CGF.getTarget().getTriple().getArch() == llvm::Triple::x86_64) { - // Compute the two argument values. - QualType ArgTys[2] = {Context.UnsignedCharTy, Context.VoidPtrTy}; - llvm::Value *FrameAddr = CGM.getIntrinsic(llvm::Intrinsic::frameaddress); - llvm::Value *FP = - CGF.Builder.CreateCall(FrameAddr, {CGF.Builder.getInt32(0)}); - llvm::Value *IsForEH = - llvm::ConstantInt::get(CGF.ConvertType(ArgTys[0]), F.isForEHCleanup()); - Args.add(RValue::get(IsForEH), ArgTys[0]); - Args.add(RValue::get(FP), ArgTys[1]); - - // Arrange a two-arg function info and type. - FunctionProtoType::ExtProtoInfo EPI; - const auto *FPT = castFunctionProtoType( - Context.getFunctionType(Context.VoidTy, ArgTys, EPI)); - FnInfo = CGM.getTypes().arrangeFreeFunctionCall(Args, FPT, - /*chainCall=*/false); -} else { - // Emit the zero store if this is normal control flow.
Re: r239402 - Remove rm invocations where the file is immediately rewritten later.
I honestly think the right approach here is to substitute our own robust implementation of rm on Windows. We can do it in the lit shell emulator. On Tue, Jun 9, 2015 at 10:53 AM, Reid Kleckner r...@google.com wrote: This came up last week: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2015-June/043376.html I just disabled the test in r239416. On Tue, Jun 9, 2015 at 5:41 AM, Benjamin Kramer benny@googlemail.com wrote: Author: d0k Date: Tue Jun 9 07:41:02 2015 New Revision: 239402 URL: http://llvm.org/viewvc/llvm-project?rev=239402view=rev Log: Remove rm invocations where the file is immediately rewritten later. This may or may not help making this test less flaky on windows. There's a race condition in lit somewhere. Modified: cfe/trunk/test/Format/style-on-command-line.cpp Modified: cfe/trunk/test/Format/style-on-command-line.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/style-on-command-line.cpp?rev=239402r1=239401r2=239402view=diff == --- cfe/trunk/test/Format/style-on-command-line.cpp (original) +++ cfe/trunk/test/Format/style-on-command-line.cpp Tue Jun 9 07:41:02 2015 @@ -3,13 +3,11 @@ // RUN: clang-format -style={BasedOnStyle: LLVM, IndentWidth: 7} %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK2 %s // RUN: clang-format -style={BasedOnStyle: invalid, IndentWidth: 7} -fallback-style=LLVM %t.cpp 21 | FileCheck -strict-whitespace -check-prefix=CHECK3 %s // RUN: clang-format -style={lsjd} %t.cpp -fallback-style=LLVM 21 | FileCheck -strict-whitespace -check-prefix=CHECK4 %s -// RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format // RUN: printf BasedOnStyle: google\nIndentWidth: 5\n %T/.clang-format // RUN: clang-format -style=file %t.cpp 21 | FileCheck -strict-whitespace -check-prefix=CHECK5 %s // RUN: printf \n %T/.clang-format // RUN: clang-format -style=file -fallback-style=webkit %t.cpp 21 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s -// RUN: [ ! -e %T/.clang-format ] || rm %T/.clang-format -// RUN: [ ! -e %T/_clang-format ] || rm %T/_clang-format +// RUN: rm %T/.clang-format // RUN: printf BasedOnStyle: google\nIndentWidth: 6\n %T/_clang-format // RUN: clang-format -style=file %t.cpp 21 | FileCheck -strict-whitespace -check-prefix=CHECK7 %s // RUN: clang-format -style={BasedOnStyle: LLVM, PointerBindsToType: true} %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK8 %s ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: r238877 - [MSVC Compatibility] Permit static_cast from void-ptr to function-ptr
This warns on C-style casts, which it should not: $ ninja check [68/414] Building CXX object lib\ExecutionEngine\RuntimeDyld\CMakeFiles\LLVMRuntimeDyld.dir\RTDyldMemoryManager.cpp.obj ..\lib\ExecutionEngine\RuntimeDyld\RTDyldMemoryManager.cpp(61,6) : warning: static_cast between pointer-to-function and pointer-to-object is a Microsoft extension [-Wmicrosoft] ((void (*)(void *))rf)(p); ^~~~ ..\lib\ExecutionEngine\RuntimeDyld\RTDyldMemoryManager.cpp(74,6) : warning: static_cast between pointer-to-function and pointer-to-object is a Microsoft extension [-Wmicrosoft] ((void (*)(void *))df)(p); ^~~~ 2 warnings generated. On Tue, Jun 2, 2015 at 3:15 PM, David Majnemer david.majne...@gmail.com wrote: Author: majnemer Date: Tue Jun 2 17:15:12 2015 New Revision: 238877 URL: http://llvm.org/viewvc/llvm-project?rev=238877view=rev Log: [MSVC Compatibility] Permit static_cast from void-ptr to function-ptr The MSVC 2013 and 2015 implementation of std::atomic is specialized for pointer types. The member functions are implemented using a static_cast from void-ptr to function-ptr which is not allowed in the standard. Permit this conversion if -fms-compatibility is present. This fixes PR23733. Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaCast.cpp cfe/trunk/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=238877r1=238876r2=238877view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jun 2 17:15:12 2015 @@ -5390,6 +5390,10 @@ def err_bad_const_cast_dest : Error which is not a reference, pointer-to-object, or pointer-to-data-member; def ext_cast_fn_obj : Extension cast between pointer-to-function and pointer-to-object is an extension; +def ext_ms_cast_fn_obj : ExtWarn + static_cast between pointer-to-function and pointer-to-object is a + Microsoft extension, + InGroupMicrosoft; def warn_cxx98_compat_cast_fn_obj : Warning cast between pointer-to-function and pointer-to-object is incompatible with C++98, InGroupCXX98CompatPedantic, DefaultIgnore; Modified: cfe/trunk/lib/Sema/SemaCast.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCast.cpp?rev=238877r1=238876r2=238877view=diff == --- cfe/trunk/lib/Sema/SemaCast.cpp (original) +++ cfe/trunk/lib/Sema/SemaCast.cpp Tue Jun 2 17:15:12 2015 @@ -1081,6 +1081,14 @@ static TryCastResult TryStaticCast(Sema Kind = CK_BitCast; return TC_Success; } + +// Microsoft permits static_cast from 'pointer-to-void' to +// 'pointer-to-function'. +if (Self.getLangOpts().MSVCCompat DestPointee-isFunctionType()) { + Self.Diag(OpRange.getBegin(), diag::ext_ms_cast_fn_obj) OpRange; + Kind = CK_BitCast; + return TC_Success; +} } else if (DestType-isObjCObjectPointerType()) { // allow both c-style cast and static_cast of objective-c pointers as Modified: cfe/trunk/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp?rev=238877r1=238876r2=238877view=diff == --- cfe/trunk/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp (original) +++ cfe/trunk/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp Tue Jun 2 17:15:12 2015 @@ -6,3 +6,5 @@ enum ENUM; // expected-warning {{forward ENUM *var = 0; ENUM var2 = (ENUM)3; enum ENUM1* var3 = 0;// expected-warning {{forward references to 'enum' types are a Microsoft extension}} + +void (*PR23733)() = static_castvoid (*)()((void *)0); // expected-warning {{static_cast between pointer-to-function and pointer-to-object is a Microsoft extension}} ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] [CodeGen] Reuse stack space from unused function results (with more accurate unused result detection)
lgtm, let's give it a shot REPOSITORY rL LLVM http://reviews.llvm.org/D10042 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] [CodeGen] Reuse stack space from unused function results (with more accurate unused result detection)
REPOSITORY rL LLVM Comment at: lib/CodeGen/CGCall.h:158-159 @@ -157,3 +157,4 @@ class ReturnValueSlot { llvm::PointerIntPairllvm::Value *, 1, bool Value; +bool IsUnused = false; There's another low alignment bit here, you should really fold it in here to keep this thing pointer-sized. You can either nest PointerIntPair twice or use `PointerIntPairllvm::Value *, 2, unsigned` Value and then do bitwise arithmetic in the helpers. Comment at: lib/CodeGen/CGExprAgg.cpp:65 @@ -63,4 +64,3 @@ public: - AggExprEmitter(CodeGenFunction cgf, AggValueSlot Dest) -: CGF(cgf), Builder(CGF.Builder), Dest(Dest) { - } + AggExprEmitter(CodeGenFunction cgf, AggValueSlot Dest, bool isResultUnused) +: CGF(cgf), Builder(CGF.Builder), Dest(Dest), You can follow the convention for Dest and name the parameter after the member with the same case. It's correct. http://reviews.llvm.org/D10042 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] [CodeGen] Reuse stack space from unused function results (with more accurate unused result detection)
Can you add some negative lifetime tests? These would be corner case situations like the original Twine bug where we thought the call result was unused but it's actually consumed by someone. REPOSITORY rL LLVM Comment at: lib/CodeGen/CGExprAgg.cpp:1398 @@ -1396,2 +1397,3 @@ - AggExprEmitter(*this, Slot).Visit(const_castExpr*(E)); + bool isResultUnused = !isaconst MaterializeTemporaryExpr(E); + AggExprEmitter(*this, Slot, isResultUnused).Visit(const_castExpr*(E)); This condition doesn't seem right. You can Slot.isIgnored(), which should do the trick, though. :) http://reviews.llvm.org/D10042 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] On {mips, mipsel, mips64, mips64el}-freebsd, we need to pass any -G option to the assembler.
Comment at: lib/Driver/Tools.cpp:6746-6748 @@ +6745,5 @@ + if (Arg *A = Args.getLastArg(options::OPT_G)) { +StringRef v = A-getValue(); +CmdArgs.push_back(Args.MakeArgString(-G + v)); +A-claim(); + } Any reason not to do `A-render(Args, CmdArgs);`? http://reviews.llvm.org/D10137 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] Bug 19462 - Use the INSTALL(EXPORT ...) to export CMake definitions
lgtm, let's do it, I think this just got lost for a bit. http://reviews.llvm.org/D7623 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: r238238 - __declspec is not a core Clang language extension. Instead, require -fms-extensions or -fborland to enable the language extension.
Doesn't cygwin do what mingw does, which is define __declspec to __attribute__? On Wed, May 27, 2015 at 1:48 PM, Aaron Ballman aa...@aaronballman.com wrote: On Wed, May 27, 2015 at 12:27 PM, Rafael EspĂndola rafael.espind...@gmail.com wrote: Maybe this broke cygwin: http://bb.pgr.jp/builders/clang-3stage-i686-cygwin/builds/1060/steps/make_quick/logs/stdio It did, and I am in contact with Takumi about the appropriate fix for it. We could revert until then if this is causing heartache. ~Aaron On 26 May 2015 at 15:44, Aaron Ballman aa...@aaronballman.com wrote: Author: aaronballman Date: Tue May 26 14:44:52 2015 New Revision: 238238 URL: http://llvm.org/viewvc/llvm-project?rev=238238view=rev Log: __declspec is not a core Clang language extension. Instead, require -fms-extensions or -fborland to enable the language extension. Note: __declspec is also temporarily enabled when compiling for a CUDA target because there are implementation details relying on __declspec(property) support currently. When those details change, __declspec should be disabled for CUDA targets. Modified: cfe/trunk/docs/ReleaseNotes.rst cfe/trunk/include/clang/Basic/TokenKinds.def cfe/trunk/include/clang/Parse/Parser.h cfe/trunk/lib/Basic/IdentifierTable.cpp cfe/trunk/lib/Parse/ParseDecl.cpp cfe/trunk/test/CodeGen/dllexport.c cfe/trunk/test/CodeGen/dllimport.c cfe/trunk/test/CodeGen/ms-volatile.c cfe/trunk/test/CodeGen/windows-on-arm-dllimport-dllexport.c cfe/trunk/test/CodeGen/windows-on-arm-stack-probe-size.c cfe/trunk/test/CodeGenCXX/PR19955.cpp cfe/trunk/test/CodeGenCXX/dllexport.cpp cfe/trunk/test/CodeGenCXX/dllimport-rtti.cpp cfe/trunk/test/CodeGenCXX/dllimport.cpp cfe/trunk/test/CodeGenCXX/microsoft-abi-vftables.cpp cfe/trunk/test/CodeGenCXX/pr20897.cpp cfe/trunk/test/Layout/ms-x86-alias-avoidance-padding.cpp cfe/trunk/test/Layout/ms-x86-aligned-tail-padding.cpp cfe/trunk/test/Layout/ms-x86-basic-layout.cpp cfe/trunk/test/Layout/ms-x86-empty-layout.c cfe/trunk/test/Layout/ms-x86-empty-nonvirtual-bases.cpp cfe/trunk/test/Layout/ms-x86-empty-virtual-base.cpp cfe/trunk/test/Layout/ms-x86-lazy-empty-nonvirtual-base.cpp cfe/trunk/test/Layout/ms-x86-pack-and-align.cpp cfe/trunk/test/Layout/ms-x86-size-alignment-fail.cpp cfe/trunk/test/Layout/ms-x86-vfvb-alignment.cpp cfe/trunk/test/Layout/ms-x86-vfvb-sharing.cpp cfe/trunk/test/Parser/cxx-ambig-init-templ.cpp cfe/trunk/test/Rewriter/missing-dllimport.c cfe/trunk/test/Sema/dllexport.c cfe/trunk/test/Sema/dllimport.c cfe/trunk/test/Sema/ms-inline-asm.c cfe/trunk/test/Sema/pragma-ms_struct.c cfe/trunk/test/SemaCXX/dllexport-pr22591.cpp cfe/trunk/test/SemaCXX/dllexport.cpp cfe/trunk/test/SemaCXX/dllimport.cpp cfe/trunk/test/SemaCXX/generalized-deprecated.cpp Modified: cfe/trunk/docs/ReleaseNotes.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=238238r1=238237r2=238238view=diff == --- cfe/trunk/docs/ReleaseNotes.rst (original) +++ cfe/trunk/docs/ReleaseNotes.rst Tue May 26 14:44:52 2015 @@ -47,7 +47,10 @@ sections with improvements to Clang's su Major New Features -- -- Feature ... +- Use of the ``__declspec`` language extension for declaration attributes now +requires passing the -fms-extensions or -fborland compiler flag. This language +extension is also enabled when compiling CUDA code, but its use should be +viewed as an implementation detail that is subject to change. Improvements to Clang's diagnostics Modified: cfe/trunk/include/clang/Basic/TokenKinds.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=238238r1=238237r2=238238view=diff == --- cfe/trunk/include/clang/Basic/TokenKinds.def (original) +++ cfe/trunk/include/clang/Basic/TokenKinds.def Tue May 26 14:44:52 2015 @@ -458,7 +458,7 @@ KEYWORD(__private_extern__ , KE KEYWORD(__module_private__ , KEYALL) // Microsoft Extension. -KEYWORD(__declspec , KEYALL) +KEYWORD(__declspec , KEYMS|KEYBORLAND) KEYWORD(__cdecl , KEYALL) KEYWORD(__stdcall , KEYALL) KEYWORD(__fastcall , KEYALL) Modified: cfe/trunk/include/clang/Parse/Parser.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=238238r1=238237r2=238238view=diff == --- cfe/trunk/include/clang/Parse/Parser.h (original) +++ cfe/trunk/include/clang/Parse/Parser.h Tue May 26 14:44:52
Re: [PATCH] [CodeGen] Reuse stack space from unused function results (with more accurate unused result detection)
I don't think this is the right approach. The code that you're reusing is in theory checking the same thing as codegen, but the implementations are distant, unrelated, and I suspect out of sync. I think this will probably be easier to handle in AggExprEmitter, which has more accurate information about its destinations. You might also want to use the cleanup mechanism instead of trying to manually insert IR after emitting the function call. We should probably add a helper for pushing a CallLifetimeEnd cleanup that takes the slot address and size. REPOSITORY rL LLVM http://reviews.llvm.org/D10042 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Re: [PATCH] Fix for #pragma warning to work correctly with 1-4: specifiers
lgtm, thanks! http://reviews.llvm.org/D9856 EMAIL PREFERENCES http://reviews.llvm.org/settings/panel/emailpreferences/ ___ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits