r241811 - [CodeCompletion] Don't crash on member inits of templated constructors.
Benjamin Kramer
benny.kra at gmail.com
Fri Jul 10 04:38:27 PDT 2015
> On 10.07.2015, at 05:22, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
>
> Removed the test in r241882. Benjamin, could you rework?
Reapplied the test in r241899 with a fix for msvc mode.
- Ben
>
> On Fri, Jul 10, 2015 at 3:37 AM Rafael EspĂndola <rafael.espindola at gmail.com> wrote:
> on the bots too:
>
> http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/13731
>
> On 9 July 2015 at 12:14, Reid Kleckner <rnk at google.com> wrote:
> > 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.kra at googlemail.com>
> > wrote:
> >>
> >> Author: d0k
> >> Date: Thu Jul 9 10:31:10 2015
> >> New Revision: 241811
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=241811&view=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=241811&r1=241810&r2=241811&view=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_cast<CXXConstructorDecl *>(ConstructorD);
> >> + if (!ConstructorD)
> >> + return;
> >> +
> >> + AdjustDeclIfTemplate(ConstructorD);
> >> +
> >> + CXXConstructorDecl *Constructor =
> >> dyn_cast<CXXConstructorDecl>(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=241811&r1=241810&r2=241811&view=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 X<int>, public Y {
> >>
> >> Z::Z() : ::X<int>(0), Virt(), b(), c() { }
> >>
> >> +struct PR23948 {
> >> + template<class size> PR23948()
> >> + :
> >> + {}
> >> +
> >> + template<class 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() : ::X<int>(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 at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list