[PATCH] D34444: Teach codegen to work in incremental processing mode.
v.g.vassilev added a comment. In https://reviews.llvm.org/D3#818030, @rjmccall wrote: > In https://reviews.llvm.org/D3#812836, @v.g.vassilev wrote: > > > In https://reviews.llvm.org/D3#812418, @rjmccall wrote: > > > > > In https://reviews.llvm.org/D3#795175, @v.g.vassilev wrote: > > > > > > > @rjmccall, thanks for the prompt and thorough reply. > > > > > > > > In https://reviews.llvm.org/D3#793311, @rjmccall wrote: > > > > > > > > > Okay. In that case, I see two problems, one major and one > > > > > potentially major. > > > > > > > > > > > > > > > > > > > > This is a very accurate diagnosis which took us 5 years to discover > > > > on an empirical basis ;) > > > > > > > > > You could've asked at any time. :) > > > > > > True. I am not really sure I knew what to ask, though ;) > > > We're open to general "I'm trying to do this and having problems" questions > on the mailing lists. You probably would've needed to know to CC me > specifically, though; sadly, I can't keep up with all the lists I need to. Good to know. Thanks! I will come back to you once I get rid of our O(100) clang patches to discuss what would be the best way of supporting incremental compilation. >>> That's quite brittle, because that code is only executed in a code path >>> that only you are using, and you're not adding any tests. I would greatly >>> prefer a change to IRGen's core assumptions, as suggested. >> >> I am open to changing this code as well. That should probably be another >> review. > > I agree. Are you comfortable with blocking this review until that lands? It > seems like it would significantly change this. I am afraid that will slow down (if not suspend) our efforts to upstream our local patches. This patch is pretty fundamental for cling and if we change it now, I will have to go back and rework our implementation. I'd be much more comfortable in reworking it once we run on vanilla clang (then efforts seems easier to justify on our end). It seems to me that despite being suboptimal, it is not very intrusive and it would effect only on our use case. I can keep track of such patches and come back to you for advice how to do them best. Would that make sense? > > >>> I feel it is important that there be a way to inform an ASTConsumer that no >>> further requests will be made of it, something other than calling its >>> destructor. I would like you to make sure that the ASTConsumer interface >>> supports that and that that call is not made too soon in your alternate >>> processing mode. >> >> Do you have a preference of a name of this new interface? > > Maybe just "finish"? > > John. Repository: rL LLVM https://reviews.llvm.org/D3 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] Add warning to clang-reorder-fields when dependencies of init-list exprs are violated
Hi, Sam, many thanks for the patch, I'm sorry I didn't notice it earlier. Do you mind uploading your patch to Phabricator, see https://llvm.org/docs/Phabricator.html for instructions, so it would be easier to review / discuss the changes. Kind regards, Alexander Shaposhnikov On Sun, Jul 9, 2017 at 2:11 PM, Sam Conrad via cfe-commits < cfe-commits@lists.llvm.org> wrote: > This adds a warning emitted by clang-reorder-fields when the reordering > fields breaks dependencies in the initializer list (such that > -Wuninitialized would warn). For example, given: > Foo::Foo(int x) > : a(x) > , b(a) {} > > Reordering fields to [b,a] gives: > Foo::Foo(int x) > : b(a) > , a(x) {} > > Emits the warning: > 2: Warning: reordering field a after b makes a uninitialized when used in > init expression. > > The patch also reformats a few lines that were over 80 columns wide. > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35137: [Driver] Honor -isysroot for Linux targets
yan12125 updated this revision to Diff 10. yan12125 added a comment. Add a test and fix repeated call to defaultSysRoot() Repository: rL LLVM https://reviews.llvm.org/D35137 Files: include/clang/Driver/Driver.h lib/Driver/Driver.cpp lib/Driver/ToolChains/Linux.cpp lib/Driver/ToolChains/Linux.h test/Driver/linux-header-search.cpp Index: test/Driver/linux-header-search.cpp === --- test/Driver/linux-header-search.cpp +++ test/Driver/linux-header-search.cpp @@ -29,6 +29,18 @@ // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ // RUN: -target x86_64-unknown-linux-gnu \ // RUN: -stdlib=libc++ \ +// RUN: -ccc-install-dir %S/Inputs/basic_linux_libcxx_tree/usr/bin \ +// RUN: -isysroot %S/Inputs/basic_linux_libcxx_tree \ +// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck --check-prefix=CHECK-ISYSROOT %s +// CHECK-ISYSROOT: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-ISYSROOT: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK-ISYSROOT: "-internal-isystem" "[[SYSROOT]]/usr/bin/../include/c++/v1" +// CHECK-ISYSROOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include" +// +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target x86_64-unknown-linux-gnu \ +// RUN: -stdlib=libc++ \ // RUN: -ccc-install-dir %S/Inputs/basic_linux_tree/usr/bin \ // RUN: --sysroot=%S/Inputs/basic_linux_libcxxv2_tree \ // RUN: --gcc-toolchain="" \ Index: lib/Driver/ToolChains/Linux.h === --- lib/Driver/ToolChains/Linux.h +++ lib/Driver/ToolChains/Linux.h @@ -40,6 +40,7 @@ void addProfileRTLibs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const override; virtual std::string computeSysRoot() const; + virtual std::string computeIncludeSysRoot() const; virtual std::string getDynamicLinker(const llvm::opt::ArgList &Args) const; @@ -48,6 +49,7 @@ protected: Tool *buildAssembler() const override; Tool *buildLinker() const override; + std::string defaultSysRoot() const; }; } // end namespace toolchains Index: lib/Driver/ToolChains/Linux.cpp === --- lib/Driver/ToolChains/Linux.cpp +++ lib/Driver/ToolChains/Linux.cpp @@ -380,10 +380,7 @@ return new tools::gnutools::Assembler(*this); } -std::string Linux::computeSysRoot() const { - if (!getDriver().SysRoot.empty()) -return getDriver().SysRoot; - +std::string Linux::defaultSysRoot() const { if (!GCCInstallation.isValid() || !tools::isMipsArch(getTriple().getArch())) return std::string(); @@ -410,6 +407,20 @@ return std::string(); } +std::string Linux::computeSysRoot() const { + if (!getDriver().SysRoot.empty()) +return getDriver().SysRoot; + + return defaultSysRoot(); +} + +std::string Linux::computeIncludeSysRoot() const { + if (!getDriver().IncludeSysRoot.empty()) +return getDriver().IncludeSysRoot; + + return computeSysRoot(); +} + std::string Linux::getDynamicLinker(const ArgList &Args) const { const llvm::Triple::ArchType Arch = getArch(); const llvm::Triple &Triple = getTriple(); @@ -541,7 +552,7 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs, ArgStringList &CC1Args) const { const Driver &D = getDriver(); - std::string SysRoot = computeSysRoot(); + std::string SysRoot = computeIncludeSysRoot(); if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc)) return; @@ -732,8 +743,8 @@ // If this is a development, non-installed, clang, libcxx will // not be found at ../include/c++ but it likely to be found at // one of the following two locations: - DetectLibcxxIncludePath(getDriver().SysRoot + "/usr/local/include/c++"), - DetectLibcxxIncludePath(getDriver().SysRoot + "/usr/include/c++") }; + DetectLibcxxIncludePath(getDriver().IncludeSysRoot + "/usr/local/include/c++"), + DetectLibcxxIncludePath(getDriver().IncludeSysRoot + "/usr/include/c++") }; for (const auto &IncludePath : LibCXXIncludePathCandidates) { if (IncludePath.empty() || !getVFS().exists(IncludePath)) continue; Index: lib/Driver/Driver.cpp === --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -88,7 +88,8 @@ : Opts(createDriverOptTable()), Diags(Diags), VFS(std::move(VFS)), Mode(GCCMode), SaveTemps(SaveTempsNone), BitcodeEmbed(EmbedNone), LTOMode(LTOK_None), ClangExecutable(ClangExecutable), - SysRoot(DEFAULT_SYSROOT), UseStdLib(true), + SysRoot(DEFAULT_SYSROOT), IncludeSysRoot(DEFAULT_SYSROOT), + UseStdLib(true), DriverTitle("clang LLVM compiler"), CCPrintOptionsFilename(nullptr), CCPrintHeadersFilename(nullptr), CCLogDiagnosticsFilename(nullptr), CCCPrintBindings(false), CCPrintHe
[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags
yamaguchi updated this revision to Diff 107778. yamaguchi added a comment. Fixed test and update diff according to Rui's comment. https://reviews.llvm.org/D35759 Files: clang/lib/Driver/Driver.cpp clang/test/Driver/autocomplete.c clang/utils/bash-autocomplete.sh llvm/lib/Option/OptTable.cpp Index: llvm/lib/Option/OptTable.cpp === --- llvm/lib/Option/OptTable.cpp +++ llvm/lib/Option/OptTable.cpp @@ -235,7 +235,9 @@ continue; for (int I = 0; In.Prefixes[I]; I++) { - std::string S = std::string(In.Prefixes[I]) + std::string(In.Name); + std::string S = std::string(In.Prefixes[I]) + std::string(In.Name) + "\t"; + if (In.HelpText) +S += In.HelpText; if (StringRef(S).startswith(Cur)) Ret.push_back(S); } Index: clang/utils/bash-autocomplete.sh === --- clang/utils/bash-autocomplete.sh +++ clang/utils/bash-autocomplete.sh @@ -57,7 +57,7 @@ # expand ~ to $HOME eval local path=${COMP_WORDS[0]} - flags=$( "$path" --autocomplete="$arg" 2>/dev/null ) + flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e 's/\t.*//' ) # If clang is old that it does not support --autocomplete, # fall back to the filename completion. if [[ "$?" != 0 ]]; then Index: clang/test/Driver/autocomplete.c === --- clang/test/Driver/autocomplete.c +++ clang/test/Driver/autocomplete.c @@ -1,46 +1,91 @@ // RUN: %clang --autocomplete=-fsyn | FileCheck %s -check-prefix=FSYN // FSYN: -fsyntax-only -// RUN: %clang --autocomplete=-s | FileCheck %s -check-prefix=STD -// STD: -std={{.*}}-stdlib= +// RUN: %clang --autocomplete=-std= | FileCheck %s -check-prefix=STD +// STD: -std= Language standard to compile for // RUN: %clang --autocomplete=foo | FileCheck %s -check-prefix=FOO // FOO-NOT: foo // RUN: %clang --autocomplete=-stdlib=,l | FileCheck %s -check-prefix=STDLIB -// STDLIB: libc++ libstdc++ +// STDLIB: libc++ +// STDLIB-NEXT: libstdc++ // RUN: %clang --autocomplete=-stdlib=, | FileCheck %s -check-prefix=STDLIBALL -// STDLIBALL: libc++ libstdc++ platform +// STDLIBALL: libc++ +// STDLIBALL-NEXT: libstdc++ +// STDLIBALL-NEXT: platform // RUN: %clang --autocomplete=-meabi,d | FileCheck %s -check-prefix=MEABI // MEABI: default // RUN: %clang --autocomplete=-meabi, | FileCheck %s -check-prefix=MEABIALL -// MEABIALL: 4 5 default gnu +// MEABIALL: 4 +// MEABIALL-NEXT: 5 +// MEABIALL-NEXT: default +// MEABIALL-NEXT: gnu // RUN: %clang --autocomplete=-cl-std=,CL2 | FileCheck %s -check-prefix=CLSTD // CLSTD: CL2.0 // RUN: %clang --autocomplete=-cl-std=, | FileCheck %s -check-prefix=CLSTDALL -// CLSTDALL: cl CL cl1.1 CL1.1 cl1.2 CL1.2 cl2.0 CL2.0 +// CLSTDALL: cl +// CLSTDALL-NEXT: CL +// CLSTDALL-NEXT: cl1.1 +// CLSTDALL-NEXT: CL1.1 +// CLSTDALL-NEXT: cl1.2 +// CLSTDALL-NEXT: CL1.2 +// CLSTDALL-NEXT: cl2.0 +// CLSTDALL-NEXT: CL2.0 // RUN: %clang --autocomplete=-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER // FNOSANICOVER: func // RUN: %clang --autocomplete=-fno-sanitize-coverage=, | FileCheck %s -check-prefix=FNOSANICOVERALL -// FNOSANICOVERALL: 8bit-counters bb edge func indirect-calls inline-8bit-counters no-prune trace-bb trace-cmp trace-div trace-gep trace-pc trace-pc-guard +// FNOSANICOVERALL: 8bit-counters +// FNOSANICOVERALL-NEXT: bb +// FNOSANICOVERALL-NEXT: edge +// FNOSANICOVERALL-NEXT: func +// FNOSANICOVERALL-NEXT: indirect-calls +// FNOSANICOVERALL-NEXT: inline-8bit-counters +// FNOSANICOVERALL-NEXT: no-prune +// FNOSANICOVERALL-NEXT: trace-bb +// FNOSANICOVERALL-NEXT: trace-cmp +// FNOSANICOVERALL-NEXT: trace-div +// FNOSANICOVERALL-NEXT: trace-gep +// FNOSANICOVERALL-NEXT: trace-pc +// FNOSANICOVERALL-NEXT: trace-pc-guard // RUN: %clang --autocomplete=-ffp-contract=, | FileCheck %s -check-prefix=FFPALL -// FFPALL: fast off on +// FFPALL: fast +// FFPALL-NEXT: off +// FFPALL-NEXT: on // RUN: %clang --autocomplete=-flto=, | FileCheck %s -check-prefix=FLTOALL -// FLTOALL: full thin +// FLTOALL: full +// FLTOALL-NEXT: thin // RUN: %clang --autocomplete=-fveclib=, | FileCheck %s -check-prefix=FVECLIBALL -// FVECLIBALL: Accelerate none SVML +// FVECLIBALL: Accelerate +// FVECLIBALL-NEXT: none +// FVECLIBALL-NEXT: SVML // RUN: %clang --autocomplete=-fshow-overloads=, | FileCheck %s -check-prefix=FSOVERALL -// FSOVERALL: all best +// FSOVERALL: all +// FSOVERALL-NEXT: best // RUN: %clang --autocomplete=-fvisibility=, | FileCheck %s -check-prefix=FVISIBILITYALL -// FVISIBILITYALL: default hidden +// FVISIBILITYALL: default +// FVISIBILITYALL-NEXT: hidden // RUN: %clang --autocomplete=-mfloat-abi=, | FileCheck %s -check-prefix=MFLOATABIALL -// MFLOATABIALL: hard soft softfp +// MFLOATABIALL: hard +// MFLOATABIALL-NEXT: soft +// MFLOATABIALL-NEXT: softfp // RUN: %clang --autocomplete=-mthread-model, | FileCheck %s -check-prefix=MTHR
[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags
yamaguchi added inline comments. Comment at: llvm/lib/Option/OptTable.cpp:240 if (StringRef(S).startswith(Cur)) -Ret.push_back(S); +Ret.push_back(S + "\t" + std::string(StringRef(In.HelpText))); } ruiu wrote: > I believe > > Ret.push_back(S + "\t" + In.HelpText); > > should just work. Thanks for pointing out, but I think it segfaults because In.HelpText might be a nullptr. So I update diff to check if it's nullptr or not, which seems more obvious. https://reviews.llvm.org/D35759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags
yamaguchi updated this revision to Diff 107779. yamaguchi added a comment. Add newline after the end of the line. https://reviews.llvm.org/D35759 Files: clang/lib/Driver/Driver.cpp clang/test/Driver/autocomplete.c clang/utils/bash-autocomplete.sh llvm/lib/Option/OptTable.cpp Index: llvm/lib/Option/OptTable.cpp === --- llvm/lib/Option/OptTable.cpp +++ llvm/lib/Option/OptTable.cpp @@ -235,7 +235,9 @@ continue; for (int I = 0; In.Prefixes[I]; I++) { - std::string S = std::string(In.Prefixes[I]) + std::string(In.Name); + std::string S = std::string(In.Prefixes[I]) + std::string(In.Name) + "\t"; + if (In.HelpText) +S += In.HelpText; if (StringRef(S).startswith(Cur)) Ret.push_back(S); } Index: clang/utils/bash-autocomplete.sh === --- clang/utils/bash-autocomplete.sh +++ clang/utils/bash-autocomplete.sh @@ -57,7 +57,7 @@ # expand ~ to $HOME eval local path=${COMP_WORDS[0]} - flags=$( "$path" --autocomplete="$arg" 2>/dev/null ) + flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e 's/\t.*//' ) # If clang is old that it does not support --autocomplete, # fall back to the filename completion. if [[ "$?" != 0 ]]; then Index: clang/test/Driver/autocomplete.c === --- clang/test/Driver/autocomplete.c +++ clang/test/Driver/autocomplete.c @@ -1,46 +1,91 @@ // RUN: %clang --autocomplete=-fsyn | FileCheck %s -check-prefix=FSYN // FSYN: -fsyntax-only -// RUN: %clang --autocomplete=-s | FileCheck %s -check-prefix=STD -// STD: -std={{.*}}-stdlib= +// RUN: %clang --autocomplete=-std= | FileCheck %s -check-prefix=STD +// STD: -std= Language standard to compile for // RUN: %clang --autocomplete=foo | FileCheck %s -check-prefix=FOO // FOO-NOT: foo // RUN: %clang --autocomplete=-stdlib=,l | FileCheck %s -check-prefix=STDLIB -// STDLIB: libc++ libstdc++ +// STDLIB: libc++ +// STDLIB-NEXT: libstdc++ // RUN: %clang --autocomplete=-stdlib=, | FileCheck %s -check-prefix=STDLIBALL -// STDLIBALL: libc++ libstdc++ platform +// STDLIBALL: libc++ +// STDLIBALL-NEXT: libstdc++ +// STDLIBALL-NEXT: platform // RUN: %clang --autocomplete=-meabi,d | FileCheck %s -check-prefix=MEABI // MEABI: default // RUN: %clang --autocomplete=-meabi, | FileCheck %s -check-prefix=MEABIALL -// MEABIALL: 4 5 default gnu +// MEABIALL: 4 +// MEABIALL-NEXT: 5 +// MEABIALL-NEXT: default +// MEABIALL-NEXT: gnu // RUN: %clang --autocomplete=-cl-std=,CL2 | FileCheck %s -check-prefix=CLSTD // CLSTD: CL2.0 // RUN: %clang --autocomplete=-cl-std=, | FileCheck %s -check-prefix=CLSTDALL -// CLSTDALL: cl CL cl1.1 CL1.1 cl1.2 CL1.2 cl2.0 CL2.0 +// CLSTDALL: cl +// CLSTDALL-NEXT: CL +// CLSTDALL-NEXT: cl1.1 +// CLSTDALL-NEXT: CL1.1 +// CLSTDALL-NEXT: cl1.2 +// CLSTDALL-NEXT: CL1.2 +// CLSTDALL-NEXT: cl2.0 +// CLSTDALL-NEXT: CL2.0 // RUN: %clang --autocomplete=-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER // FNOSANICOVER: func // RUN: %clang --autocomplete=-fno-sanitize-coverage=, | FileCheck %s -check-prefix=FNOSANICOVERALL -// FNOSANICOVERALL: 8bit-counters bb edge func indirect-calls inline-8bit-counters no-prune trace-bb trace-cmp trace-div trace-gep trace-pc trace-pc-guard +// FNOSANICOVERALL: 8bit-counters +// FNOSANICOVERALL-NEXT: bb +// FNOSANICOVERALL-NEXT: edge +// FNOSANICOVERALL-NEXT: func +// FNOSANICOVERALL-NEXT: indirect-calls +// FNOSANICOVERALL-NEXT: inline-8bit-counters +// FNOSANICOVERALL-NEXT: no-prune +// FNOSANICOVERALL-NEXT: trace-bb +// FNOSANICOVERALL-NEXT: trace-cmp +// FNOSANICOVERALL-NEXT: trace-div +// FNOSANICOVERALL-NEXT: trace-gep +// FNOSANICOVERALL-NEXT: trace-pc +// FNOSANICOVERALL-NEXT: trace-pc-guard // RUN: %clang --autocomplete=-ffp-contract=, | FileCheck %s -check-prefix=FFPALL -// FFPALL: fast off on +// FFPALL: fast +// FFPALL-NEXT: off +// FFPALL-NEXT: on // RUN: %clang --autocomplete=-flto=, | FileCheck %s -check-prefix=FLTOALL -// FLTOALL: full thin +// FLTOALL: full +// FLTOALL-NEXT: thin // RUN: %clang --autocomplete=-fveclib=, | FileCheck %s -check-prefix=FVECLIBALL -// FVECLIBALL: Accelerate none SVML +// FVECLIBALL: Accelerate +// FVECLIBALL-NEXT: none +// FVECLIBALL-NEXT: SVML // RUN: %clang --autocomplete=-fshow-overloads=, | FileCheck %s -check-prefix=FSOVERALL -// FSOVERALL: all best +// FSOVERALL: all +// FSOVERALL-NEXT: best // RUN: %clang --autocomplete=-fvisibility=, | FileCheck %s -check-prefix=FVISIBILITYALL -// FVISIBILITYALL: default hidden +// FVISIBILITYALL: default +// FVISIBILITYALL-NEXT: hidden // RUN: %clang --autocomplete=-mfloat-abi=, | FileCheck %s -check-prefix=MFLOATABIALL -// MFLOATABIALL: hard soft softfp +// MFLOATABIALL: hard +// MFLOATABIALL-NEXT: soft +// MFLOATABIALL-NEXT: softfp // RUN: %clang --autocomplete=-mthread-model, | FileCheck %s -check-prefix=MTHREADMODELALL -//
[PATCH] D35762: [Bash-autocompletion] Fixed typo and add '-' after -Wno
yamaguchi created this revision. -Wno- was autocompleted as -Wno, so fixed this typo. https://reviews.llvm.org/D35762 Files: clang/lib/Basic/DiagnosticIDs.cpp clang/test/Driver/autocomplete.c Index: clang/test/Driver/autocomplete.c === --- clang/test/Driver/autocomplete.c +++ clang/test/Driver/autocomplete.c @@ -42,5 +42,5 @@ // MRELOCMODEL_CC1: -mrelocation-model // RUN: %clang --autocomplete=-Wma | FileCheck %s -check-prefix=WARNING // WARNING: -Wmacro-redefined -Wmain -Wmain-return-type -Wmalformed-warning-check -Wmany-braces-around-scalar-init -Wmax-unsigned-zero -// RUN: %clang --autocomplete=-Wnoinvalid-pp- | FileCheck %s -check-prefix=NOWARNING -// NOWARNING: -Wnoinvalid-pp-token +// RUN: %clang --autocomplete=-Wno-invalid-pp- | FileCheck %s -check-prefix=NOWARNING +// NOWARNING: -Wno-invalid-pp-token Index: clang/lib/Basic/DiagnosticIDs.cpp === --- clang/lib/Basic/DiagnosticIDs.cpp +++ clang/lib/Basic/DiagnosticIDs.cpp @@ -516,7 +516,7 @@ std::string Diag(DiagGroupNames + I + 1, DiagGroupNames[I]); I += DiagGroupNames[I] + 1; Res.push_back("-W" + Diag); -Res.push_back("-Wno" + Diag); +Res.push_back("-Wno-" + Diag); } return Res; Index: clang/test/Driver/autocomplete.c === --- clang/test/Driver/autocomplete.c +++ clang/test/Driver/autocomplete.c @@ -42,5 +42,5 @@ // MRELOCMODEL_CC1: -mrelocation-model // RUN: %clang --autocomplete=-Wma | FileCheck %s -check-prefix=WARNING // WARNING: -Wmacro-redefined -Wmain -Wmain-return-type -Wmalformed-warning-check -Wmany-braces-around-scalar-init -Wmax-unsigned-zero -// RUN: %clang --autocomplete=-Wnoinvalid-pp- | FileCheck %s -check-prefix=NOWARNING -// NOWARNING: -Wnoinvalid-pp-token +// RUN: %clang --autocomplete=-Wno-invalid-pp- | FileCheck %s -check-prefix=NOWARNING +// NOWARNING: -Wno-invalid-pp-token Index: clang/lib/Basic/DiagnosticIDs.cpp === --- clang/lib/Basic/DiagnosticIDs.cpp +++ clang/lib/Basic/DiagnosticIDs.cpp @@ -516,7 +516,7 @@ std::string Diag(DiagGroupNames + I + 1, DiagGroupNames[I]); I += DiagGroupNames[I] + 1; Res.push_back("-W" + Diag); -Res.push_back("-Wno" + Diag); +Res.push_back("-Wno-" + Diag); } return Res; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r308823 - [NFC, documentation] Prefer the term expansion instead of macro instantiation
Author: faisalv Date: Sat Jul 22 05:04:37 2017 New Revision: 308823 URL: http://llvm.org/viewvc/llvm-project?rev=308823&view=rev Log: [NFC, documentation] Prefer the term expansion instead of macro instantiation ... in the few remaining places where this was not corrected. Modified: cfe/trunk/docs/InternalsManual.rst Modified: cfe/trunk/docs/InternalsManual.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/InternalsManual.rst?rev=308823&r1=308822&r2=308823&view=diff == --- cfe/trunk/docs/InternalsManual.rst (original) +++ cfe/trunk/docs/InternalsManual.rst Sat Jul 22 05:04:37 2017 @@ -493,11 +493,11 @@ source code of the program. Important d In practice, the ``SourceLocation`` works together with the ``SourceManager`` class to encode two pieces of information about a location: its spelling -location and its instantiation location. For most tokens, these will be the +location and its expansion location. For most tokens, these will be the same. However, for a macro expansion (or tokens that came from a ``_Pragma`` directive) these will describe the location of the characters corresponding to the token and the location where the token was used (i.e., the macro -instantiation point or the location of the ``_Pragma`` itself). +expansion point or the location of the ``_Pragma`` itself). The Clang front-end inherently depends on the location of a token being tracked correctly. If it is ever incorrect, the front-end may get confused and die. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags
yamaguchi updated this revision to Diff 107781. yamaguchi added a comment. Update diff. Delete trailing whitespace so that -stdlib= autocompletion works correctly. https://reviews.llvm.org/D35759 Files: clang/lib/Driver/Driver.cpp clang/test/Driver/autocomplete.c clang/utils/bash-autocomplete.sh llvm/lib/Option/OptTable.cpp Index: llvm/lib/Option/OptTable.cpp === --- llvm/lib/Option/OptTable.cpp +++ llvm/lib/Option/OptTable.cpp @@ -235,7 +235,9 @@ continue; for (int I = 0; In.Prefixes[I]; I++) { - std::string S = std::string(In.Prefixes[I]) + std::string(In.Name); + std::string S = std::string(In.Prefixes[I]) + std::string(In.Name) + "\t"; + if (In.HelpText) +S += In.HelpText; if (StringRef(S).startswith(Cur)) Ret.push_back(S); } Index: clang/utils/bash-autocomplete.sh === --- clang/utils/bash-autocomplete.sh +++ clang/utils/bash-autocomplete.sh @@ -57,7 +57,7 @@ # expand ~ to $HOME eval local path=${COMP_WORDS[0]} - flags=$( "$path" --autocomplete="$arg" 2>/dev/null ) + flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e 's/\t.*.\s*$//' ) # If clang is old that it does not support --autocomplete, # fall back to the filename completion. if [[ "$?" != 0 ]]; then Index: clang/test/Driver/autocomplete.c === --- clang/test/Driver/autocomplete.c +++ clang/test/Driver/autocomplete.c @@ -1,46 +1,91 @@ // RUN: %clang --autocomplete=-fsyn | FileCheck %s -check-prefix=FSYN // FSYN: -fsyntax-only -// RUN: %clang --autocomplete=-s | FileCheck %s -check-prefix=STD -// STD: -std={{.*}}-stdlib= +// RUN: %clang --autocomplete=-std= | FileCheck %s -check-prefix=STD +// STD: -std= Language standard to compile for // RUN: %clang --autocomplete=foo | FileCheck %s -check-prefix=FOO // FOO-NOT: foo // RUN: %clang --autocomplete=-stdlib=,l | FileCheck %s -check-prefix=STDLIB -// STDLIB: libc++ libstdc++ +// STDLIB: libc++ +// STDLIB-NEXT: libstdc++ // RUN: %clang --autocomplete=-stdlib=, | FileCheck %s -check-prefix=STDLIBALL -// STDLIBALL: libc++ libstdc++ platform +// STDLIBALL: libc++ +// STDLIBALL-NEXT: libstdc++ +// STDLIBALL-NEXT: platform // RUN: %clang --autocomplete=-meabi,d | FileCheck %s -check-prefix=MEABI // MEABI: default // RUN: %clang --autocomplete=-meabi, | FileCheck %s -check-prefix=MEABIALL -// MEABIALL: 4 5 default gnu +// MEABIALL: 4 +// MEABIALL-NEXT: 5 +// MEABIALL-NEXT: default +// MEABIALL-NEXT: gnu // RUN: %clang --autocomplete=-cl-std=,CL2 | FileCheck %s -check-prefix=CLSTD // CLSTD: CL2.0 // RUN: %clang --autocomplete=-cl-std=, | FileCheck %s -check-prefix=CLSTDALL -// CLSTDALL: cl CL cl1.1 CL1.1 cl1.2 CL1.2 cl2.0 CL2.0 +// CLSTDALL: cl +// CLSTDALL-NEXT: CL +// CLSTDALL-NEXT: cl1.1 +// CLSTDALL-NEXT: CL1.1 +// CLSTDALL-NEXT: cl1.2 +// CLSTDALL-NEXT: CL1.2 +// CLSTDALL-NEXT: cl2.0 +// CLSTDALL-NEXT: CL2.0 // RUN: %clang --autocomplete=-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER // FNOSANICOVER: func // RUN: %clang --autocomplete=-fno-sanitize-coverage=, | FileCheck %s -check-prefix=FNOSANICOVERALL -// FNOSANICOVERALL: 8bit-counters bb edge func indirect-calls inline-8bit-counters no-prune trace-bb trace-cmp trace-div trace-gep trace-pc trace-pc-guard +// FNOSANICOVERALL: 8bit-counters +// FNOSANICOVERALL-NEXT: bb +// FNOSANICOVERALL-NEXT: edge +// FNOSANICOVERALL-NEXT: func +// FNOSANICOVERALL-NEXT: indirect-calls +// FNOSANICOVERALL-NEXT: inline-8bit-counters +// FNOSANICOVERALL-NEXT: no-prune +// FNOSANICOVERALL-NEXT: trace-bb +// FNOSANICOVERALL-NEXT: trace-cmp +// FNOSANICOVERALL-NEXT: trace-div +// FNOSANICOVERALL-NEXT: trace-gep +// FNOSANICOVERALL-NEXT: trace-pc +// FNOSANICOVERALL-NEXT: trace-pc-guard // RUN: %clang --autocomplete=-ffp-contract=, | FileCheck %s -check-prefix=FFPALL -// FFPALL: fast off on +// FFPALL: fast +// FFPALL-NEXT: off +// FFPALL-NEXT: on // RUN: %clang --autocomplete=-flto=, | FileCheck %s -check-prefix=FLTOALL -// FLTOALL: full thin +// FLTOALL: full +// FLTOALL-NEXT: thin // RUN: %clang --autocomplete=-fveclib=, | FileCheck %s -check-prefix=FVECLIBALL -// FVECLIBALL: Accelerate none SVML +// FVECLIBALL: Accelerate +// FVECLIBALL-NEXT: none +// FVECLIBALL-NEXT: SVML // RUN: %clang --autocomplete=-fshow-overloads=, | FileCheck %s -check-prefix=FSOVERALL -// FSOVERALL: all best +// FSOVERALL: all +// FSOVERALL-NEXT: best // RUN: %clang --autocomplete=-fvisibility=, | FileCheck %s -check-prefix=FVISIBILITYALL -// FVISIBILITYALL: default hidden +// FVISIBILITYALL: default +// FVISIBILITYALL-NEXT: hidden // RUN: %clang --autocomplete=-mfloat-abi=, | FileCheck %s -check-prefix=MFLOATABIALL -// MFLOATABIALL: hard soft softfp +// MFLOATABIALL: hard +// MFLOATABIALL-NEXT: soft +// MFLOATABIALL-NEXT: softfp // RUN: %clang --autocomplete=-mthread-
[PATCH] D35762: [Bash-autocompletion] Fixed typo and add '-' after -Wno
teemperor accepted this revision. teemperor added a comment. This revision is now accepted and ready to land. Thanks for the quick fix, LGTM! https://reviews.llvm.org/D35762 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r308824 - [Bash-autocompletion] Fixed typo and add '-' after -Wno
Author: yamaguchi Date: Sat Jul 22 05:35:15 2017 New Revision: 308824 URL: http://llvm.org/viewvc/llvm-project?rev=308824&view=rev Log: [Bash-autocompletion] Fixed typo and add '-' after -Wno Summary: -Wno- was autocompleted as -Wno, so fixed this typo. Differential Revision: https://reviews.llvm.org/D35762 Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp cfe/trunk/test/Driver/autocomplete.c Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=308824&r1=308823&r2=308824&view=diff == --- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original) +++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Sat Jul 22 05:35:15 2017 @@ -516,7 +516,7 @@ std::vector DiagnosticIDs:: std::string Diag(DiagGroupNames + I + 1, DiagGroupNames[I]); I += DiagGroupNames[I] + 1; Res.push_back("-W" + Diag); -Res.push_back("-Wno" + Diag); +Res.push_back("-Wno-" + Diag); } return Res; Modified: cfe/trunk/test/Driver/autocomplete.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/autocomplete.c?rev=308824&r1=308823&r2=308824&view=diff == --- cfe/trunk/test/Driver/autocomplete.c (original) +++ cfe/trunk/test/Driver/autocomplete.c Sat Jul 22 05:35:15 2017 @@ -42,5 +42,5 @@ // MRELOCMODEL_CC1: -mrelocation-model // RUN: %clang --autocomplete=-Wma | FileCheck %s -check-prefix=WARNING // WARNING: -Wmacro-redefined -Wmain -Wmain-return-type -Wmalformed-warning-check -Wmany-braces-around-scalar-init -Wmax-unsigned-zero -// RUN: %clang --autocomplete=-Wnoinvalid-pp- | FileCheck %s -check-prefix=NOWARNING -// NOWARNING: -Wnoinvalid-pp-token +// RUN: %clang --autocomplete=-Wno-invalid-pp- | FileCheck %s -check-prefix=NOWARNING +// NOWARNING: -Wno-invalid-pp-token ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35762: [Bash-autocompletion] Fixed typo and add '-' after -Wno
This revision was automatically updated to reflect the committed changes. Closed by commit rL308824: [Bash-autocompletion] Fixed typo and add '-' after -Wno (authored by yamaguchi). Changed prior to commit: https://reviews.llvm.org/D35762?vs=107780&id=107782#toc Repository: rL LLVM https://reviews.llvm.org/D35762 Files: cfe/trunk/lib/Basic/DiagnosticIDs.cpp cfe/trunk/test/Driver/autocomplete.c Index: cfe/trunk/lib/Basic/DiagnosticIDs.cpp === --- cfe/trunk/lib/Basic/DiagnosticIDs.cpp +++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp @@ -516,7 +516,7 @@ std::string Diag(DiagGroupNames + I + 1, DiagGroupNames[I]); I += DiagGroupNames[I] + 1; Res.push_back("-W" + Diag); -Res.push_back("-Wno" + Diag); +Res.push_back("-Wno-" + Diag); } return Res; Index: cfe/trunk/test/Driver/autocomplete.c === --- cfe/trunk/test/Driver/autocomplete.c +++ cfe/trunk/test/Driver/autocomplete.c @@ -42,5 +42,5 @@ // MRELOCMODEL_CC1: -mrelocation-model // RUN: %clang --autocomplete=-Wma | FileCheck %s -check-prefix=WARNING // WARNING: -Wmacro-redefined -Wmain -Wmain-return-type -Wmalformed-warning-check -Wmany-braces-around-scalar-init -Wmax-unsigned-zero -// RUN: %clang --autocomplete=-Wnoinvalid-pp- | FileCheck %s -check-prefix=NOWARNING -// NOWARNING: -Wnoinvalid-pp-token +// RUN: %clang --autocomplete=-Wno-invalid-pp- | FileCheck %s -check-prefix=NOWARNING +// NOWARNING: -Wno-invalid-pp-token Index: cfe/trunk/lib/Basic/DiagnosticIDs.cpp === --- cfe/trunk/lib/Basic/DiagnosticIDs.cpp +++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp @@ -516,7 +516,7 @@ std::string Diag(DiagGroupNames + I + 1, DiagGroupNames[I]); I += DiagGroupNames[I] + 1; Res.push_back("-W" + Diag); -Res.push_back("-Wno" + Diag); +Res.push_back("-Wno-" + Diag); } return Res; Index: cfe/trunk/test/Driver/autocomplete.c === --- cfe/trunk/test/Driver/autocomplete.c +++ cfe/trunk/test/Driver/autocomplete.c @@ -42,5 +42,5 @@ // MRELOCMODEL_CC1: -mrelocation-model // RUN: %clang --autocomplete=-Wma | FileCheck %s -check-prefix=WARNING // WARNING: -Wmacro-redefined -Wmain -Wmain-return-type -Wmalformed-warning-check -Wmany-braces-around-scalar-init -Wmax-unsigned-zero -// RUN: %clang --autocomplete=-Wnoinvalid-pp- | FileCheck %s -check-prefix=NOWARNING -// NOWARNING: -Wnoinvalid-pp-token +// RUN: %clang --autocomplete=-Wno-invalid-pp- | FileCheck %s -check-prefix=NOWARNING +// NOWARNING: -Wno-invalid-pp-token ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35613: Add Support for Generic Reference Counting Annotations in RetainCountChecker
malhar1995 added a comment. @dcoughlin Ping. Repository: rL LLVM https://reviews.llvm.org/D35613 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34444: Teach codegen to work in incremental processing mode.
rjmccall added a comment. In https://reviews.llvm.org/D3#818047, @v.g.vassilev wrote: > >> I am open to changing this code as well. That should probably be another > >> review. > > > > I agree. Are you comfortable with blocking this review until that lands? > > It seems like it would significantly change this. > > I am afraid that will slow down (if not suspend) our efforts to upstream our > local patches. This patch is pretty fundamental for cling and if we change it > now, I will have to go back and rework our implementation. I'd be much more > comfortable in reworking it once we run on vanilla clang (then efforts seems > easier to justify on our end). > > It seems to me that despite being suboptimal, it is not very intrusive and it > would effect only on our use case. I can keep track of such patches and come > back to you for advice how to do them best. Would that make sense? My concern is that efforts to upstream patches are doomed to get bogged down anyway, and in the meantime we'll have however much more untestable code. But we have some of that anyway, so it's at least not novel. I'm willing to accept it. John. Repository: rL LLVM https://reviews.llvm.org/D3 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35718: [clang-tidy] Do not issue fixit for explicit template specializations
flx updated this revision to Diff 107786. https://reviews.llvm.org/D35718 Files: clang-tidy/performance/UnnecessaryValueParamCheck.cpp test/clang-tidy/performance-unnecessary-value-param.cpp Index: test/clang-tidy/performance-unnecessary-value-param.cpp === --- test/clang-tidy/performance-unnecessary-value-param.cpp +++ test/clang-tidy/performance-unnecessary-value-param.cpp @@ -348,3 +348,14 @@ ExpensiveToCopyType E; NegativeUsingConstructor S(E); } + +template +void templateFunction(T) { +} + +template<> +void templateFunction(ExpensiveToCopyType E) { + // CHECK-MESSAGES: [[@LINE-1]]:64: warning: the parameter 'E' is copied + // CHECK-FIXES: void templateFunction(ExpensiveToCopyType E) { + E.constReference(); +} Index: clang-tidy/performance/UnnecessaryValueParamCheck.cpp === --- clang-tidy/performance/UnnecessaryValueParamCheck.cpp +++ clang-tidy/performance/UnnecessaryValueParamCheck.cpp @@ -58,6 +58,18 @@ return Matches.empty(); } +bool isExplicitTemplateSpecialization(const FunctionDecl &Function) { + if (const auto *SpecializationInfo = Function.getTemplateSpecializationInfo()) +if (SpecializationInfo->getTemplateSpecializationKind() == +TSK_ExplicitSpecialization) + return true; + if (const auto *Method = llvm::dyn_cast(&Function)) +if (Method->getTemplatedKind() == FunctionDecl::TK_MemberSpecialization && +Method->getMemberSpecializationInfo()->isExplicitSpecialization()) + return true; + return false; +} + } // namespace UnnecessaryValueParamCheck::UnnecessaryValueParamCheck( @@ -133,9 +145,11 @@ // 2. the function is virtual as it might break overrides // 3. the function is referenced outside of a call expression within the //compilation unit as the signature change could introduce build errors. + // 4. the function is an explicit template specialization. const auto *Method = llvm::dyn_cast(Function); if (Param->getLocStart().isMacroID() || (Method && Method->isVirtual()) || - isReferencedOutsideOfCallExpr(*Function, *Result.Context)) + isReferencedOutsideOfCallExpr(*Function, *Result.Context) || + isExplicitTemplateSpecialization(*Function)) return; for (const auto *FunctionDecl = Function; FunctionDecl != nullptr; FunctionDecl = FunctionDecl->getPreviousDecl()) { Index: test/clang-tidy/performance-unnecessary-value-param.cpp === --- test/clang-tidy/performance-unnecessary-value-param.cpp +++ test/clang-tidy/performance-unnecessary-value-param.cpp @@ -348,3 +348,14 @@ ExpensiveToCopyType E; NegativeUsingConstructor S(E); } + +template +void templateFunction(T) { +} + +template<> +void templateFunction(ExpensiveToCopyType E) { + // CHECK-MESSAGES: [[@LINE-1]]:64: warning: the parameter 'E' is copied + // CHECK-FIXES: void templateFunction(ExpensiveToCopyType E) { + E.constReference(); +} Index: clang-tidy/performance/UnnecessaryValueParamCheck.cpp === --- clang-tidy/performance/UnnecessaryValueParamCheck.cpp +++ clang-tidy/performance/UnnecessaryValueParamCheck.cpp @@ -58,6 +58,18 @@ return Matches.empty(); } +bool isExplicitTemplateSpecialization(const FunctionDecl &Function) { + if (const auto *SpecializationInfo = Function.getTemplateSpecializationInfo()) +if (SpecializationInfo->getTemplateSpecializationKind() == +TSK_ExplicitSpecialization) + return true; + if (const auto *Method = llvm::dyn_cast(&Function)) +if (Method->getTemplatedKind() == FunctionDecl::TK_MemberSpecialization && +Method->getMemberSpecializationInfo()->isExplicitSpecialization()) + return true; + return false; +} + } // namespace UnnecessaryValueParamCheck::UnnecessaryValueParamCheck( @@ -133,9 +145,11 @@ // 2. the function is virtual as it might break overrides // 3. the function is referenced outside of a call expression within the //compilation unit as the signature change could introduce build errors. + // 4. the function is an explicit template specialization. const auto *Method = llvm::dyn_cast(Function); if (Param->getLocStart().isMacroID() || (Method && Method->isVirtual()) || - isReferencedOutsideOfCallExpr(*Function, *Result.Context)) + isReferencedOutsideOfCallExpr(*Function, *Result.Context) || + isExplicitTemplateSpecialization(*Function)) return; for (const auto *FunctionDecl = Function; FunctionDecl != nullptr; FunctionDecl = FunctionDecl->getPreviousDecl()) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35729: [Frontend] - Mark some ASTUnit methods as const
hamzasood added a comment. Could someone commit this for me? I don't have access. https://reviews.llvm.org/D35729 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35763: [Bash-completion] Fixed a bug that file doesn't autocompleted after =
yamaguchi created this revision. File path wasn't autocompleted after `-fmodule-cache-path=[tab]`, so fixed this bug by checking if $flags contains only a newline or not. https://reviews.llvm.org/D35763 Files: clang/utils/bash-autocomplete.sh Index: clang/utils/bash-autocomplete.sh === --- clang/utils/bash-autocomplete.sh +++ clang/utils/bash-autocomplete.sh @@ -65,10 +65,14 @@ return fi - if [[ "$cur" == '=' ]]; then -COMPREPLY=( $( compgen -W "$flags" -- "") ) - elif [[ "$flags" == "" || "$arg" == "" ]]; then + # When clang does not emit any possible autocompletion, or user pushed tab after " ", + # just autocomplete files. + if [[ "$flags" == "$(echo -e '\n')" || "$arg" == "" ]]; then +# If -foo= and there was no possible values, autocomplete files. +[[ "$cur" == '=' || "$cur" == -*= ]] && cur="" _clang_filedir + elif [[ "$cur" == '=' ]]; then +COMPREPLY=( $( compgen -W "$flags" -- "") ) else # Bash automatically appends a space after '=' by default. # Disable it so that it works nicely for options in the form of -foo=bar. Index: clang/utils/bash-autocomplete.sh === --- clang/utils/bash-autocomplete.sh +++ clang/utils/bash-autocomplete.sh @@ -65,10 +65,14 @@ return fi - if [[ "$cur" == '=' ]]; then -COMPREPLY=( $( compgen -W "$flags" -- "") ) - elif [[ "$flags" == "" || "$arg" == "" ]]; then + # When clang does not emit any possible autocompletion, or user pushed tab after " ", + # just autocomplete files. + if [[ "$flags" == "$(echo -e '\n')" || "$arg" == "" ]]; then +# If -foo= and there was no possible values, autocomplete files. +[[ "$cur" == '=' || "$cur" == -*= ]] && cur="" _clang_filedir + elif [[ "$cur" == '=' ]]; then +COMPREPLY=( $( compgen -W "$flags" -- "") ) else # Bash automatically appends a space after '=' by default. # Disable it so that it works nicely for options in the form of -foo=bar. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags
ruiu added inline comments. Comment at: clang/lib/Driver/Driver.cpp:1303 + llvm::outs() << S << "\n"; +llvm::outs() << "\n"; return false; You want to print out just one '\n' at end instead of two, no? https://reviews.llvm.org/D35759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags
yamaguchi updated this revision to Diff 107790. yamaguchi added a comment. Update diff. Use llvm::join because we don't want to print two '\n's. https://reviews.llvm.org/D35759 Files: clang/lib/Driver/Driver.cpp clang/test/Driver/autocomplete.c clang/utils/bash-autocomplete.sh llvm/lib/Option/OptTable.cpp Index: llvm/lib/Option/OptTable.cpp === --- llvm/lib/Option/OptTable.cpp +++ llvm/lib/Option/OptTable.cpp @@ -235,7 +235,9 @@ continue; for (int I = 0; In.Prefixes[I]; I++) { - std::string S = std::string(In.Prefixes[I]) + std::string(In.Name); + std::string S = std::string(In.Prefixes[I]) + std::string(In.Name) + "\t"; + if (In.HelpText) +S += In.HelpText; if (StringRef(S).startswith(Cur)) Ret.push_back(S); } Index: clang/utils/bash-autocomplete.sh === --- clang/utils/bash-autocomplete.sh +++ clang/utils/bash-autocomplete.sh @@ -57,7 +57,7 @@ # expand ~ to $HOME eval local path=${COMP_WORDS[0]} - flags=$( "$path" --autocomplete="$arg" 2>/dev/null ) + flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e 's/\t.*.\s*$//' ) # If clang is old that it does not support --autocomplete, # fall back to the filename completion. if [[ "$?" != 0 ]]; then Index: clang/test/Driver/autocomplete.c === --- clang/test/Driver/autocomplete.c +++ clang/test/Driver/autocomplete.c @@ -1,46 +1,91 @@ // RUN: %clang --autocomplete=-fsyn | FileCheck %s -check-prefix=FSYN // FSYN: -fsyntax-only -// RUN: %clang --autocomplete=-s | FileCheck %s -check-prefix=STD -// STD: -std={{.*}}-stdlib= +// RUN: %clang --autocomplete=-std= | FileCheck %s -check-prefix=STD +// STD: -std= Language standard to compile for // RUN: %clang --autocomplete=foo | FileCheck %s -check-prefix=FOO // FOO-NOT: foo // RUN: %clang --autocomplete=-stdlib=,l | FileCheck %s -check-prefix=STDLIB -// STDLIB: libc++ libstdc++ +// STDLIB: libc++ +// STDLIB-NEXT: libstdc++ // RUN: %clang --autocomplete=-stdlib=, | FileCheck %s -check-prefix=STDLIBALL -// STDLIBALL: libc++ libstdc++ platform +// STDLIBALL: libc++ +// STDLIBALL-NEXT: libstdc++ +// STDLIBALL-NEXT: platform // RUN: %clang --autocomplete=-meabi,d | FileCheck %s -check-prefix=MEABI // MEABI: default // RUN: %clang --autocomplete=-meabi, | FileCheck %s -check-prefix=MEABIALL -// MEABIALL: 4 5 default gnu +// MEABIALL: 4 +// MEABIALL-NEXT: 5 +// MEABIALL-NEXT: default +// MEABIALL-NEXT: gnu // RUN: %clang --autocomplete=-cl-std=,CL2 | FileCheck %s -check-prefix=CLSTD // CLSTD: CL2.0 // RUN: %clang --autocomplete=-cl-std=, | FileCheck %s -check-prefix=CLSTDALL -// CLSTDALL: cl CL cl1.1 CL1.1 cl1.2 CL1.2 cl2.0 CL2.0 +// CLSTDALL: cl +// CLSTDALL-NEXT: CL +// CLSTDALL-NEXT: cl1.1 +// CLSTDALL-NEXT: CL1.1 +// CLSTDALL-NEXT: cl1.2 +// CLSTDALL-NEXT: CL1.2 +// CLSTDALL-NEXT: cl2.0 +// CLSTDALL-NEXT: CL2.0 // RUN: %clang --autocomplete=-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER // FNOSANICOVER: func // RUN: %clang --autocomplete=-fno-sanitize-coverage=, | FileCheck %s -check-prefix=FNOSANICOVERALL -// FNOSANICOVERALL: 8bit-counters bb edge func indirect-calls inline-8bit-counters no-prune trace-bb trace-cmp trace-div trace-gep trace-pc trace-pc-guard +// FNOSANICOVERALL: 8bit-counters +// FNOSANICOVERALL-NEXT: bb +// FNOSANICOVERALL-NEXT: edge +// FNOSANICOVERALL-NEXT: func +// FNOSANICOVERALL-NEXT: indirect-calls +// FNOSANICOVERALL-NEXT: inline-8bit-counters +// FNOSANICOVERALL-NEXT: no-prune +// FNOSANICOVERALL-NEXT: trace-bb +// FNOSANICOVERALL-NEXT: trace-cmp +// FNOSANICOVERALL-NEXT: trace-div +// FNOSANICOVERALL-NEXT: trace-gep +// FNOSANICOVERALL-NEXT: trace-pc +// FNOSANICOVERALL-NEXT: trace-pc-guard // RUN: %clang --autocomplete=-ffp-contract=, | FileCheck %s -check-prefix=FFPALL -// FFPALL: fast off on +// FFPALL: fast +// FFPALL-NEXT: off +// FFPALL-NEXT: on // RUN: %clang --autocomplete=-flto=, | FileCheck %s -check-prefix=FLTOALL -// FLTOALL: full thin +// FLTOALL: full +// FLTOALL-NEXT: thin // RUN: %clang --autocomplete=-fveclib=, | FileCheck %s -check-prefix=FVECLIBALL -// FVECLIBALL: Accelerate none SVML +// FVECLIBALL: Accelerate +// FVECLIBALL-NEXT: none +// FVECLIBALL-NEXT: SVML // RUN: %clang --autocomplete=-fshow-overloads=, | FileCheck %s -check-prefix=FSOVERALL -// FSOVERALL: all best +// FSOVERALL: all +// FSOVERALL-NEXT: best // RUN: %clang --autocomplete=-fvisibility=, | FileCheck %s -check-prefix=FVISIBILITYALL -// FVISIBILITYALL: default hidden +// FVISIBILITYALL: default +// FVISIBILITYALL-NEXT: hidden // RUN: %clang --autocomplete=-mfloat-abi=, | FileCheck %s -check-prefix=MFLOATABIALL -// MFLOATABIALL: hard soft softfp +// MFLOATABIALL: hard +// MFLOATABIALL-NEXT: soft +// MFLOATABIALL-NEXT: softfp // RUN: %clang --autocomplete=-mthread-model, | FileCheck %
[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags
ruiu added inline comments. Comment at: clang/utils/bash-autocomplete.sh:60 eval local path=${COMP_WORDS[0]} - flags=$( "$path" --autocomplete="$arg" 2>/dev/null ) + flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e 's/\t.*.\s*$//' ) # If clang is old that it does not support --autocomplete, `\t.*.\s*` doesn't seem to make much sense to me. Isn't `\t.*` enough? https://reviews.llvm.org/D35759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags
yamaguchi updated this revision to Diff 107791. yamaguchi added a comment. Update diff according to Rui's comment. https://reviews.llvm.org/D35759 Files: clang/lib/Driver/Driver.cpp clang/test/Driver/autocomplete.c clang/utils/bash-autocomplete.sh llvm/lib/Option/OptTable.cpp Index: llvm/lib/Option/OptTable.cpp === --- llvm/lib/Option/OptTable.cpp +++ llvm/lib/Option/OptTable.cpp @@ -235,7 +235,9 @@ continue; for (int I = 0; In.Prefixes[I]; I++) { - std::string S = std::string(In.Prefixes[I]) + std::string(In.Name); + std::string S = std::string(In.Prefixes[I]) + std::string(In.Name) + "\t"; + if (In.HelpText) +S += In.HelpText; if (StringRef(S).startswith(Cur)) Ret.push_back(S); } Index: clang/utils/bash-autocomplete.sh === --- clang/utils/bash-autocomplete.sh +++ clang/utils/bash-autocomplete.sh @@ -57,7 +57,7 @@ # expand ~ to $HOME eval local path=${COMP_WORDS[0]} - flags=$( "$path" --autocomplete="$arg" 2>/dev/null ) + flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e 's/\t.*//' ) # If clang is old that it does not support --autocomplete, # fall back to the filename completion. if [[ "$?" != 0 ]]; then Index: clang/test/Driver/autocomplete.c === --- clang/test/Driver/autocomplete.c +++ clang/test/Driver/autocomplete.c @@ -1,46 +1,91 @@ // RUN: %clang --autocomplete=-fsyn | FileCheck %s -check-prefix=FSYN // FSYN: -fsyntax-only -// RUN: %clang --autocomplete=-s | FileCheck %s -check-prefix=STD -// STD: -std={{.*}}-stdlib= +// RUN: %clang --autocomplete=-std= | FileCheck %s -check-prefix=STD +// STD: -std= Language standard to compile for // RUN: %clang --autocomplete=foo | FileCheck %s -check-prefix=FOO // FOO-NOT: foo // RUN: %clang --autocomplete=-stdlib=,l | FileCheck %s -check-prefix=STDLIB -// STDLIB: libc++ libstdc++ +// STDLIB: libc++ +// STDLIB-NEXT: libstdc++ // RUN: %clang --autocomplete=-stdlib=, | FileCheck %s -check-prefix=STDLIBALL -// STDLIBALL: libc++ libstdc++ platform +// STDLIBALL: libc++ +// STDLIBALL-NEXT: libstdc++ +// STDLIBALL-NEXT: platform // RUN: %clang --autocomplete=-meabi,d | FileCheck %s -check-prefix=MEABI // MEABI: default // RUN: %clang --autocomplete=-meabi, | FileCheck %s -check-prefix=MEABIALL -// MEABIALL: 4 5 default gnu +// MEABIALL: 4 +// MEABIALL-NEXT: 5 +// MEABIALL-NEXT: default +// MEABIALL-NEXT: gnu // RUN: %clang --autocomplete=-cl-std=,CL2 | FileCheck %s -check-prefix=CLSTD // CLSTD: CL2.0 // RUN: %clang --autocomplete=-cl-std=, | FileCheck %s -check-prefix=CLSTDALL -// CLSTDALL: cl CL cl1.1 CL1.1 cl1.2 CL1.2 cl2.0 CL2.0 +// CLSTDALL: cl +// CLSTDALL-NEXT: CL +// CLSTDALL-NEXT: cl1.1 +// CLSTDALL-NEXT: CL1.1 +// CLSTDALL-NEXT: cl1.2 +// CLSTDALL-NEXT: CL1.2 +// CLSTDALL-NEXT: cl2.0 +// CLSTDALL-NEXT: CL2.0 // RUN: %clang --autocomplete=-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER // FNOSANICOVER: func // RUN: %clang --autocomplete=-fno-sanitize-coverage=, | FileCheck %s -check-prefix=FNOSANICOVERALL -// FNOSANICOVERALL: 8bit-counters bb edge func indirect-calls inline-8bit-counters no-prune trace-bb trace-cmp trace-div trace-gep trace-pc trace-pc-guard +// FNOSANICOVERALL: 8bit-counters +// FNOSANICOVERALL-NEXT: bb +// FNOSANICOVERALL-NEXT: edge +// FNOSANICOVERALL-NEXT: func +// FNOSANICOVERALL-NEXT: indirect-calls +// FNOSANICOVERALL-NEXT: inline-8bit-counters +// FNOSANICOVERALL-NEXT: no-prune +// FNOSANICOVERALL-NEXT: trace-bb +// FNOSANICOVERALL-NEXT: trace-cmp +// FNOSANICOVERALL-NEXT: trace-div +// FNOSANICOVERALL-NEXT: trace-gep +// FNOSANICOVERALL-NEXT: trace-pc +// FNOSANICOVERALL-NEXT: trace-pc-guard // RUN: %clang --autocomplete=-ffp-contract=, | FileCheck %s -check-prefix=FFPALL -// FFPALL: fast off on +// FFPALL: fast +// FFPALL-NEXT: off +// FFPALL-NEXT: on // RUN: %clang --autocomplete=-flto=, | FileCheck %s -check-prefix=FLTOALL -// FLTOALL: full thin +// FLTOALL: full +// FLTOALL-NEXT: thin // RUN: %clang --autocomplete=-fveclib=, | FileCheck %s -check-prefix=FVECLIBALL -// FVECLIBALL: Accelerate none SVML +// FVECLIBALL: Accelerate +// FVECLIBALL-NEXT: none +// FVECLIBALL-NEXT: SVML // RUN: %clang --autocomplete=-fshow-overloads=, | FileCheck %s -check-prefix=FSOVERALL -// FSOVERALL: all best +// FSOVERALL: all +// FSOVERALL-NEXT: best // RUN: %clang --autocomplete=-fvisibility=, | FileCheck %s -check-prefix=FVISIBILITYALL -// FVISIBILITYALL: default hidden +// FVISIBILITYALL: default +// FVISIBILITYALL-NEXT: hidden // RUN: %clang --autocomplete=-mfloat-abi=, | FileCheck %s -check-prefix=MFLOATABIALL -// MFLOATABIALL: hard soft softfp +// MFLOATABIALL: hard +// MFLOATABIALL-NEXT: soft +// MFLOATABIALL-NEXT: softfp // RUN: %clang --autocomplete=-mthread-model, | FileCheck %s -check-prefix=MTHREADMODELALL -//
[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags
ruiu accepted this revision. ruiu added a comment. This revision is now accepted and ready to land. LGTM So, this patch changes the format of the --autocomplete option in an incompatible way. The bash completion script that will be shipped with LLVM 5.0 will not be able to read the output of --autocomplete after you make this change. Do you want to merge this into 5.0? https://reviews.llvm.org/D35759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags
yamaguchi added a comment. @ruiu Yeah, we are planning to merge this to 5.0, so that clang Driver interface will be compatible among further versions. https://reviews.llvm.org/D35759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35763: [Bash-completion] Fixed a bug that file doesn't autocompleted after =
ruiu accepted this revision. ruiu added a comment. This revision is now accepted and ready to land. LGTM https://reviews.llvm.org/D35763 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r308827 - Fix grammar-o in comment.
Author: nico Date: Sat Jul 22 08:16:42 2017 New Revision: 308827 URL: http://llvm.org/viewvc/llvm-project?rev=308827&view=rev Log: Fix grammar-o in comment. Modified: libcxx/trunk/include/__config Modified: libcxx/trunk/include/__config URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=308827&r1=308826&r2=308827&view=diff == --- libcxx/trunk/include/__config (original) +++ libcxx/trunk/include/__config Sat Jul 22 08:16:42 2017 @@ -55,11 +55,11 @@ #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT // Fix deque iterator type in order to support incomplete types. #define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE -// Fix undefined behavior in how std::list stores it's linked nodes. +// Fix undefined behavior in how std::list stores its linked nodes. #define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __tree stores its end and parent nodes. #define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB -// Fix undefined behavior in how __hash_table stores it's pointer types +// Fix undefined behavior in how __hash_table stores its pointer types. #define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags
teemperor accepted this revision. teemperor added a comment. LGTM. Comment at: clang/utils/bash-autocomplete.sh:60 eval local path=${COMP_WORDS[0]} - flags=$( "$path" --autocomplete="$arg" 2>/dev/null ) + flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e 's/\t.*.\s*$//' ) # If clang is old that it does not support --autocomplete, ruiu wrote: > `\t.*.\s*` doesn't seem to make much sense to me. Isn't `\t.*` enough? Can you add some comment why we need the sed? Something like `# Filtering out the help texts of the flags as we can't display them in bash easily`. https://reviews.llvm.org/D35759 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34972: [CodeGen] Propagate dllexport to thunks
smeenai updated this revision to Diff 107795. smeenai edited the summary of this revision. smeenai added a comment. Add comment https://reviews.llvm.org/D34972 Files: lib/CodeGen/ItaniumCXXABI.cpp test/CodeGenCXX/dllexport-vtable-thunks.cpp Index: test/CodeGenCXX/dllexport-vtable-thunks.cpp === --- /dev/null +++ test/CodeGenCXX/dllexport-vtable-thunks.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple x86_64-windows-gnu -fdeclspec -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-windows-itanium -fdeclspec -emit-llvm -o - %s | FileCheck %s + +struct __declspec(dllexport) A { + virtual void m(); +}; +struct __declspec(dllexport) B { + virtual void m(); +}; +struct __declspec(dllexport) C : A, B { + virtual void m(); +}; +void C::m() {} +// CHECK: define dllexport void @_ZThn8_N1C1mEv + +struct Base { + virtual void m(); +}; +struct __declspec(dllexport) Derived : virtual Base { + virtual void m(); +}; +void Derived::m() {} +// CHECK: define dllexport void @_ZTv0_n24_N7Derived1mEv Index: lib/CodeGen/ItaniumCXXABI.cpp === --- lib/CodeGen/ItaniumCXXABI.cpp +++ lib/CodeGen/ItaniumCXXABI.cpp @@ -284,6 +284,14 @@ // linkage together with vtables when needed. if (ForVTable && !Thunk->hasLocalLinkage()) Thunk->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage); + +// Propagate dllexport storage, to enable the linker to generate import +// thunks as necessary (e.g. when a parent class has a key function and a +// child class doesn't, and the construction vtable for the parent in the +// child needs to reference the parent's thunks). +const CXXMethodDecl *MD = cast(GD.getDecl()); +if (MD->hasAttr()) + Thunk->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); } llvm::Value *performThisAdjustment(CodeGenFunction &CGF, Address This, Index: test/CodeGenCXX/dllexport-vtable-thunks.cpp === --- /dev/null +++ test/CodeGenCXX/dllexport-vtable-thunks.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple x86_64-windows-gnu -fdeclspec -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-windows-itanium -fdeclspec -emit-llvm -o - %s | FileCheck %s + +struct __declspec(dllexport) A { + virtual void m(); +}; +struct __declspec(dllexport) B { + virtual void m(); +}; +struct __declspec(dllexport) C : A, B { + virtual void m(); +}; +void C::m() {} +// CHECK: define dllexport void @_ZThn8_N1C1mEv + +struct Base { + virtual void m(); +}; +struct __declspec(dllexport) Derived : virtual Base { + virtual void m(); +}; +void Derived::m() {} +// CHECK: define dllexport void @_ZTv0_n24_N7Derived1mEv Index: lib/CodeGen/ItaniumCXXABI.cpp === --- lib/CodeGen/ItaniumCXXABI.cpp +++ lib/CodeGen/ItaniumCXXABI.cpp @@ -284,6 +284,14 @@ // linkage together with vtables when needed. if (ForVTable && !Thunk->hasLocalLinkage()) Thunk->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage); + +// Propagate dllexport storage, to enable the linker to generate import +// thunks as necessary (e.g. when a parent class has a key function and a +// child class doesn't, and the construction vtable for the parent in the +// child needs to reference the parent's thunks). +const CXXMethodDecl *MD = cast(GD.getDecl()); +if (MD->hasAttr()) + Thunk->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); } llvm::Value *performThisAdjustment(CodeGenFunction &CGF, Address This, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r308832 - clang/module.modulemap: Split out Clang_ToolingCore from Clang_Tooling.
Author: chapuni Date: Sat Jul 22 18:40:36 2017 New Revision: 308832 URL: http://llvm.org/viewvc/llvm-project?rev=308832&view=rev Log: clang/module.modulemap: Split out Clang_ToolingCore from Clang_Tooling. It cuts clangFormat's dependencies out of; Clang_Analysis Clang_C Clang_Diagnostics Clang_Driver Clang_Frontend Clang_Sema Clang_Serialization Clang_StaticAnalyzer_Core Clang_Tooling -> Clang_ToolingCore Now, the module Clang_Format depends on; Clang_AST Clang_Basic Clang_ToolingCore Modified: cfe/trunk/include/clang/module.modulemap Modified: cfe/trunk/include/clang/module.modulemap URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/module.modulemap?rev=308832&r1=308831&r2=308832&view=diff == --- cfe/trunk/include/clang/module.modulemap (original) +++ cfe/trunk/include/clang/module.modulemap Sat Jul 22 18:40:36 2017 @@ -139,3 +139,8 @@ module Clang_Tooling { // matchers (and thus the AST), which clang-format should not have. exclude header "Tooling/RefactoringCallbacks.h" } + +module Clang_ToolingCore { + requires cplusplus + umbrella "Tooling/Core" module * { export * } +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31372: Support Microsoft mangling of swift calling convention methods
rjmccall added a comment. This revision now requires changes to proceed. You can't just change the top-level mangling of the symbol because this is used as part of the function type mangling, and those can appear at more-or-less arbitrary positions. I cannot possibly imagine Microsoft actually officially adding mangling support for every extension we support in Clang. The closest you can reasonably expect is that they will add an official "vendor-extended" mangling. Until then, picking an arbitrary string and acknowledging that it is not stable and will not correctly demangle is a reasonable thing to do. The llvm_unreachable in this function is not an appropriate use of llvm_unreachable, by the way, unless there's something in the frontend that actually prevents creating such things on MS targets. The uses of unreachable in ItaniumMangle are (according to our beliefs, anyway) *actually* impossible to reach, like an Objective-C selector being mangled as part of an unresolved-name. A more acceptable approach when the mangling does not implement a case is to do something like what ItaniumMangle does on unsupported expression nodes: emit a (bad) diagnostic and continue. https://reviews.llvm.org/D31372 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH v3] [PPC64]: Add support for Swift calling convention
On 07/19/2017 10:26 AM, Adrian Prantl wrote: On Jun 21, 2017, at 11:32 PM, Andrew Jeffery wrote: For the tests I've extracted the int5 and int8 cases to cater for different alignments for different platform ABIs. For Linux on POWER the 5 and 8 element vectors must be naturally aligned with respect to the total "soft" vector size, despite being represented as an aggregate. Specifically, the patch caters for the following differences in supporting powerpc64le-unknown-linux: $ diff -u test/CodeGen/64bit-swiftcall.c test/CodeGen/ppc64-swiftcall.c --- test/CodeGen/64bit-swiftcall.c 2017-04-20 17:14:59.797963820 +0930 +++ test/CodeGen/ppc64-swiftcall.c 2017-04-20 17:15:11.621965118 +0930 @@ -1,7 +1,6 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -target-cpu core2 -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple arm64-apple-ios9 -target-cpu cyclone -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64le-unknown-linux -emit-llvm -o - %s | FileCheck %s -// REQUIRES: aarch64-registered-target,x86-registered-target +// REQUIRES: powerpc-registered-target #define SWIFTCALL __attribute__((swiftcall)) #define OUT __attribute__((swift_indirect_result)) @@ -370,8 +369,8 @@ TEST(int8) // CHECK-LABEL: define {{.*}} @return_int8() -// CHECK: [[RET:%.*]] = alloca [[REC:<8 x i32>]], align 16 +// CHECK: [[RET:%.*]] = alloca [[REC:<8 x i32>]], align 32 // CHECK: [[VAR:%.*]] = alloca [[REC]], align // CHECK: store // CHECK: load // CHECK: store @@ -414,8 +413,8 @@ TEST(int5) // CHECK-LABEL: define {{.*}} @return_int5() -// CHECK: [[RET:%.*]] = alloca [[REC:<5 x i32>]], align 16 +// CHECK: [[RET:%.*]] = alloca [[REC:<5 x i32>]], align 32 // CHECK: [[VAR:%.*]] = alloca [[REC]], align // CHECK: store // CHECK: load // CHECK: store Despite some duplication, the advantage of this approach over using pattern matching for alignment in 64bit-swiftcall.c is that we ensure each platform is using the expected alignment but without duplicating the entirety of 64bit-swiftcall.c. You could also write all in one file and use invoke FileCheck with --check-prefix=CHECK-PPC64 to have a second set of CHECK-lines in the same input file. -- adrian Signed-off-by: Andrew Jeffery --- Hello, The only change in v3 is rebasing it on top upstream HEAD, fixing a conflict in one of the lit REQUIRES lines. Ulrich, Hal, Bill: I've Cc'ed you as you were fingered by the blame output. As some background I sent the patch several months ago but it hasn't got much traction aside from a LGTM from Adrian (thanks!). I'm hoping it gets a bit more attention as without it we get build failures for Swift on POWER, which is in-turn blocking some CI efforts. Cheers, Andrew lib/Basic/Targets.cpp | 11 ++ lib/CodeGen/TargetInfo.cpp| 14 ++- test/CodeGen/64bit-swiftcall-extvec-agg-align16.c | 117 ++ test/CodeGen/64bit-swiftcall-extvec-agg-align32.c | 116 + test/CodeGen/64bit-swiftcall.c| 93 + 5 files changed, 258 insertions(+), 93 deletions(-) create mode 100644 test/CodeGen/64bit-swiftcall-extvec-agg-align16.c create mode 100644 test/CodeGen/64bit-swiftcall-extvec-agg-align32.c diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index e23a93e..54b5911 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -1753,6 +1753,17 @@ public: } return false; } + + CallingConvCheckResult checkCallingConvention(CallingConv CC) const override { +switch (CC) { +case CC_C: +case CC_Swift: +return CCCR_OK; +default: +break; +} +return CCCR_Warning; + } }; class DarwinPPC32TargetInfo : public DarwinTargetInfo { diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index 8d00e05..a82cd24 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -4179,7 +4179,7 @@ PPC32TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF, namespace { /// PPC64_SVR4_ABIInfo - The 64-bit PowerPC ELF (SVR4) ABI information. -class PPC64_SVR4_ABIInfo : public ABIInfo { +class PPC64_SVR4_ABIInfo : public SwiftABIInfo { public: enum ABIKind { ELFv1 = 0, @@ -4223,7 +4223,7 @@ private: public: PPC64_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT, ABIKind Kind, bool HasQPX, bool SoftFloatABI) - : ABIInfo(CGT), Kind(Kind), HasQPX(HasQPX), + : SwiftABIInfo(CGT), Kind(Kind), HasQPX(HasQPX), IsSoftFloatABI(SoftFloatABI) {} bool isPromotableTypeForABI(QualType Ty) const; @@ -4266,6 +4266,16 @@ public: Address EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty) const override; + + bool shouldPassIndirectlyForSwift(CharUnits totalSize, +ArrayRef scalars, +
r308844 - [Modules] Rework r274270. Let Clang targets depend on intrinsics_gen.
Author: chapuni Date: Sat Jul 22 22:09:44 2017 New Revision: 308844 URL: http://llvm.org/viewvc/llvm-project?rev=308844&view=rev Log: [Modules] Rework r274270. Let Clang targets depend on intrinsics_gen. This gets rid of almost LLVM targets unconditionally depending on intrinsic_gen. Clang's modules still have weird dependencies and hard to remove intrinsics_gen in better way. Then, it'd be better to give whole clang targets depend on intrinsic_gen. Modified: cfe/trunk/CMakeLists.txt Modified: cfe/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=308844&r1=308843&r2=308844&view=diff == --- cfe/trunk/CMakeLists.txt (original) +++ cfe/trunk/CMakeLists.txt Sat Jul 22 22:09:44 2017 @@ -413,6 +413,13 @@ add_subdirectory(include) get_property(CLANG_TABLEGEN_TARGETS GLOBAL PROPERTY CLANG_TABLEGEN_TARGETS) list(APPEND LLVM_COMMON_DEPENDS ${CLANG_TABLEGEN_TARGETS}) +# Force target to be built as soon as possible. Clang modules builds depend +# header-wise on it as they ship all headers from the umbrella folders. Building +# an entire module might include header, which depends on intrinsics_gen. +if(LLVM_ENABLE_MODULES AND NOT CLANG_BUILT_STANDALONE) + list(APPEND LLVM_COMMON_DEPENDS intrinsics_gen) +endif() + add_subdirectory(lib) add_subdirectory(tools) add_subdirectory(runtime) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits