r215929 - Fix the rececl chain for redeclarations of predefined decls
Jordan Rose
jordan_rose at apple.com
Mon Aug 18 19:57:32 PDT 2014
Does this bring us closer to fixing PR19061? http://llvm.org/bugs/show_bug.cgi?id=19061
On Aug 18, 2014, at 12:32 , Ben Langmuir <blangmuir at apple.com> wrote:
> Author: benlangmuir
> Date: Mon Aug 18 14:32:45 2014
> New Revision: 215929
>
> URL: http://llvm.org/viewvc/llvm-project?rev=215929&view=rev
> Log:
> Fix the rececl chain for redeclarations of predefined decls
>
> Predefined decls like 'Protocol' in objc are not loaded from AST files,
> so we cannot rely on loading the canonical decl to complete the redecl
> chain for redeclarations of these decls. The broken redecl chain was
> non-circular, so looping over redecls() would hang.
>
> Added:
> cfe/trunk/test/Index/Inputs/declare-objc-predef.h
> cfe/trunk/test/Index/reparse-predef-objc-protocol.m
> Modified:
> cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>
> Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=215929&r1=215928&r2=215929&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
> +++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Mon Aug 18 14:32:45 2014
> @@ -2019,6 +2019,8 @@ void ASTDeclReader::mergeRedeclarable(Re
> T *D = static_cast<T*>(DBase);
> T *DCanon = D->getCanonicalDecl();
> if (D != DCanon &&
> + // IDs < NUM_PREDEF_DECL_IDS are not loaded from an AST file.
> + Redecl.getFirstID() >= NUM_PREDEF_DECL_IDS &&
> (!Reader.getContext().getLangOpts().Modules ||
> Reader.getOwningModuleFile(DCanon) == Reader.getOwningModuleFile(D))) {
> // All redeclarations between this declaration and its originally-canonical
>
> Added: cfe/trunk/test/Index/Inputs/declare-objc-predef.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Inputs/declare-objc-predef.h?rev=215929&view=auto
> ==============================================================================
> --- cfe/trunk/test/Index/Inputs/declare-objc-predef.h (added)
> +++ cfe/trunk/test/Index/Inputs/declare-objc-predef.h Mon Aug 18 14:32:45 2014
> @@ -0,0 +1,3 @@
> + at class Protocol;
> +typedef struct objc_class *Class
> + at class id;
>
> Added: cfe/trunk/test/Index/reparse-predef-objc-protocol.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/reparse-predef-objc-protocol.m?rev=215929&view=auto
> ==============================================================================
> --- cfe/trunk/test/Index/reparse-predef-objc-protocol.m (added)
> +++ cfe/trunk/test/Index/reparse-predef-objc-protocol.m Mon Aug 18 14:32:45 2014
> @@ -0,0 +1,9 @@
> +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 3 local %s -I %S/Inputs
> +#import "declare-objc-predef.h"
> +// PR20633
> +
> +// CHECK: declare-objc-predef.h:1:8: ObjCInterfaceDecl=Protocol:1:8 Extent=[1:1 - 1:16]
> +// CHECK: declare-objc-predef.h:1:8: ObjCClassRef=Protocol:1:8 Extent=[1:8 - 1:16]
> +// CHECK: declare-objc-predef.h:2:16: StructDecl=objc_class:2:16 Extent=[2:9 - 2:26]
> +// CHECK: declare-objc-predef.h:2:28: TypedefDecl=Class:2:28 (Definition) Extent=[2:1 - 2:33]
> +// CHECK: declare-objc-predef.h:2:16: TypeRef=struct objc_class:2:16 Extent=[2:16 - 2:26]
>
>
> _______________________________________________
> 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