[IR] Don't allow DLL storage-class and local linkage
authorBen Dunbobbin <Ben.Dunbobbin@sony.com>
Thu, 29 Sep 2022 23:21:31 +0000 (00:21 +0100)
committerBen Dunbobbin <Ben.Dunbobbin@sony.com>
Thu, 29 Sep 2022 23:26:01 +0000 (00:26 +0100)
commit7eee2a2d4401813cd485ae708e8cb0f94469e037
treee7f241a8ee6c5a7df2cf74cfd72cdff62ff7b70c
parent0bfaa301e28dacc9b79ecdff12254439e2e8458a
[IR] Don't allow DLL storage-class and local linkage

Disallow this meaningless combination. Doing so simplifies analysis
of LLVM code w.r.t t DLL storage-class, and prevents mistakes with
DLL storage class.

- Change the assembler to reject DLL storage class on symbols with
  local linkage.
- Change the bitcode reader to clear the DLL Storage class when the
  linkage is local for auto-upgrading
- Update LangRef.

There is an existing restriction on non-default visibility and local
linkage which this is modelled on.

Differential Review: https://reviews.llvm.org/D134784
clang/lib/CodeGen/CodeGenModule.cpp
llvm/docs/LangRef.rst
llvm/include/llvm/IR/GlobalValue.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/test/Assembler/dll-storage-class-local-linkage.ll [new file with mode: 0644]
llvm/test/Transforms/GlobalOpt/alias-used-section.ll