[PATCH] Use correct semantic DeclContext for local declarations of variables and functions with linkage

Richard Smith richard at metafoo.co.uk
Fri Aug 23 16:01:21 PDT 2013


Hi doug.gregor, eli.friedman,

This patch switches 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.

http://llvm-reviews.chandlerc.com/D1499

Files:
  test/CodeGenCXX/mangle.cpp
  test/CXX/drs/dr0xx.cpp
  test/CXX/dcl.decl/dcl.meaning/dcl.array/p3.cpp
  test/CXX/basic/basic.link/p7.cpp
  test/SemaCXX/extern-c.cpp
  test/SemaCXX/warn-unreachable.cpp
  test/SemaCXX/function-redecl.cpp
  test/SemaCXX/cxx0x-initializer-references.cpp
  test/Index/usrs.m
  include/clang/Sema/Lookup.h
  include/clang/Sema/Sema.h
  include/clang/AST/Decl.h
  include/clang/AST/DeclBase.h
  www/cxx_dr_status.html
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaCodeComplete.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaAccess.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaExpr.cpp
  lib/Serialization/ASTReaderDecl.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1499.1.patch
Type: text/x-patch
Size: 51052 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130823/2d35dd97/attachment.bin>


More information about the cfe-commits mailing list