]> granicus.if.org Git - clang/commit
Switch the semantic DeclContext for a block-scope declaration of a function or
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 20 Sep 2013 01:15:31 +0000 (01:15 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 20 Sep 2013 01:15:31 +0000 (01:15 +0000)
commita41c97a5d1912ffd184381d269fd8e5a25ee5e59
treee0b7d59d5d757800919f91662bc9b749a692c3e1
parent8adf837adc65b55a3f74643c02c1ee077dc26f06
Switch the semantic DeclContext for a block-scope declaration of a function or
variable from being the function to being the enclosing namespace scope (in
C++) or the TU (in C). This allows us to fix a selection of related issues
where we would build incorrect redeclaration chains for such declarations, and
fail to notice type mismatches.

Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern,
which is only found when searching scopes, and not found when searching
DeclContexts. Such a declaration is only made visible in its DeclContext if
there are no non-LocalExtern declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191064 91177308-0d34-0410-b5e6-96231b3b80d8
24 files changed:
include/clang/AST/Decl.h
include/clang/AST/DeclBase.h
include/clang/Sema/Lookup.h
include/clang/Sema/Sema.h
lib/Sema/SemaAccess.cpp
lib/Sema/SemaCodeComplete.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaLookup.cpp
lib/Sema/SemaTemplateInstantiateDecl.cpp
lib/Serialization/ASTReaderDecl.cpp
test/CXX/basic/basic.link/p7.cpp [new file with mode: 0644]
test/CXX/dcl.decl/dcl.meaning/dcl.array/p3.cpp
test/CXX/drs/dr0xx.cpp
test/CodeGenCXX/mangle.cpp
test/Index/usrs.m
test/Sema/struct-decl.c
test/SemaCXX/blocks-1.cpp
test/SemaCXX/cxx0x-initializer-references.cpp
test/SemaCXX/extern-c.cpp
test/SemaCXX/function-redecl.cpp
test/SemaCXX/warn-unreachable.cpp
www/cxx_dr_status.html