[PATCH] D18635: Rework interface for bitset-using features to use a notion of class scope.

Peter Collingbourne via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 30 17:15:10 PDT 2016


pcc created this revision.
pcc added reviewers: rsmith, eugenis, aaron.ballman, cfe-commits.
pcc added subscribers: joker.eph, pete.

Bitsets, and the compiler features they rely on (vtable opt, CFI),
only have scope within the linkage unit. Therefore, only enable these
features for classes with linkage unit scope or internal linkage. A new flag,
-fdefault-class-scope=, controls which classes we infer linkage unit scope for.
By default, we infer scope from visibility or dllimport/dllexport attributes.

If the cross-DSO CFI mode is enabled, bitset checks are emitted even for
classes without linkage unit scope, as that mode uses a separate mechanism
to cause bitsets to be exported.

We also provide the [[clang::linkage_unit_scope]] and [[clang::global_scope]]
attributes, which allow users to override the compiler's scope inferences
on a per-class or per-namespace basis.

These attributes replace the whole-program-vtables blacklist, so remove the
-fwhole-program-vtables-blacklist flag.

Because __declspec(uuid()) now implies [[clang::no_linkage_unit_scope]], the
support for the special attr:uuid blacklist entry is removed.

http://reviews.llvm.org/D18635

Files:
  docs/ClassScope.rst
  docs/ControlFlowIntegrity.rst
  docs/UsersManual.rst
  docs/index.rst
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  include/clang/Frontend/CodeGenOptions.h
  include/clang/Sema/AttributeList.h
  include/clang/Sema/Sema.h
  lib/CodeGen/CGClass.cpp
  lib/CodeGen/CGVTables.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/CodeGen/MicrosoftCXXABI.cpp
  lib/Driver/SanitizerArgs.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaDeclCXX.cpp
  runtime/CMakeLists.txt
  runtime/vtables_blacklist.txt
  test/CodeGenCXX/bitset-blacklist.cpp
  test/CodeGenCXX/bitset-inference.cpp
  test/CodeGenCXX/bitsets.cpp
  test/CodeGenCXX/cfi-blacklist.cpp
  test/CodeGenCXX/cfi-cast.cpp
  test/CodeGenCXX/cfi-nvcall.cpp
  test/CodeGenCXX/cfi-stats.cpp
  test/Driver/default-class-scope.c
  test/Driver/fsanitize.c
  test/Driver/whole-program-vtables.c
  test/Frontend/default-class-scope.c
  test/SemaCXX/attr-linkage-unit-scope.cpp
  utils/TableGen/ClangAttrEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18635.52160.patch
Type: text/x-patch
Size: 47604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160331/4f585ac6/attachment-0001.bin>


More information about the cfe-commits mailing list