r308722 - Fixed failing assert in code completion.
Alex L via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 21 02:44:49 PDT 2017
Hans, can you please merge this to the LLVM 5.0 branch?
AFAIK It's a recent regression that should get fixed in LLVM 5.0.
Cheers,
Alex
On 21 July 2017 at 10:24, Ilya Biryukov via cfe-commits <
cfe-commits at lists.llvm.org> wrote:
> Author: ibiryukov
> Date: Fri Jul 21 02:24:00 2017
> New Revision: 308722
>
> URL: http://llvm.org/viewvc/llvm-project?rev=308722&view=rev
> Log:
> Fixed failing assert in code completion.
>
> Summary:
> The code was accessing uninstantiated default argument.
> This resulted in failing assertion at ParmVarDecl::getDefaultArg().
>
> Reviewers: erikjv, klimek, bkramer, krasimir
>
> Reviewed By: krasimir
>
> Subscribers: cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D35682
>
> Added:
> cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp
> Modified:
> cfe/trunk/lib/Sema/SemaCodeComplete.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaC
> odeComplete.cpp?rev=308722&r1=308721&r2=308722&view=diff
> ============================================================
> ==================
> --- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Jul 21 02:24:00 2017
> @@ -2401,10 +2401,7 @@ formatBlockPlaceholder(const PrintingPol
> static std::string GetDefaultValueString(const ParmVarDecl *Param,
> const SourceManager &SM,
> const LangOptions &LangOpts) {
> - const Expr *defaultArg = Param->getDefaultArg();
> - if (!defaultArg)
> - return "";
> - const SourceRange SrcRange = defaultArg->getSourceRange();
> + const SourceRange SrcRange = Param->getDefaultArgRange();
> CharSourceRange CharSrcRange = CharSourceRange::getTokenRange
> (SrcRange);
> bool Invalid = CharSrcRange.isInvalid();
> if (Invalid)
>
> Added: cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompl
> etion/uninstantiated_params.cpp?rev=308722&view=auto
> ============================================================
> ==================
> --- cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp (added)
> +++ cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp Fri Jul 21
> 02:24:00 2017
> @@ -0,0 +1,13 @@
> +template <class T>
> +struct unique_ptr {
> + typedef T* pointer;
> +
> + void reset(pointer ptr = pointer());
> +};
> +
> +void test() {
> + unique_ptr<int> x;
> + x.
> + // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:5 %s -o - |
> FileCheck -check-prefix=CHECK-CC1 %s
> + // CHECK-CC1: [#void#]reset({#<#unique_ptr<int>::pointer ptr =
> pointer()#>#})
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170721/aa8bd7a4/attachment.html>
More information about the cfe-commits
mailing list