[PATCH] D17347: Use LLVM_LIBRARY_VISIBILITY to prevent LLVM dynamic libraries from export symbols for SROA internals.

Owen Anderson via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 13:21:45 PST 2016


resistor created this revision.
resistor added reviewers: chandlerc, bogner.
resistor added a subscriber: llvm-commits.
resistor set the repository for this revision to rL LLVM.

Because the new pass manager exposes the pass types, member functions on those passes become exported symbols by default.  We can use LLVM_LIBRARY_VISIBILITY to restrict their linkage to be accessible within the LLVM dynamic library itself, but not exported from it.

Repository:
  rL LLVM

http://reviews.llvm.org/D17347

Files:
  include/llvm/Transforms/Scalar/SROA.h
  lib/Transforms/Scalar/SROA.cpp

Index: lib/Transforms/Scalar/SROA.cpp
===================================================================
--- lib/Transforms/Scalar/SROA.cpp
+++ lib/Transforms/Scalar/SROA.cpp
@@ -206,7 +206,7 @@
 /// for the slices used and we reflect that in this structure. The uses are
 /// stored, sorted by increasing beginning offset and with unsplittable slices
 /// starting at a particular offset before splittable slices.
-class llvm::sroa::AllocaSlices {
+class LLVM_LIBRARY_VISIBILITY llvm::sroa::AllocaSlices  {
 public:
   /// \brief Construct the slices of a particular alloca.
   AllocaSlices(const DataLayout &DL, AllocaInst &AI);
@@ -4274,7 +4274,7 @@
   static char ID;
 };
 
-char SROALegacyPass::ID = 0;
+char LLVM_LIBRARY_VISIBILITY SROALegacyPass::ID = 0;
 
 FunctionPass *llvm::createSROAPass() { return new SROALegacyPass(); }
 
Index: include/llvm/Transforms/Scalar/SROA.h
===================================================================
--- include/llvm/Transforms/Scalar/SROA.h
+++ include/llvm/Transforms/Scalar/SROA.h
@@ -112,16 +112,19 @@
 
   /// Helper used by both the public run method and by the legacy pass.
   PreservedAnalyses runImpl(Function &F, DominatorTree &RunDT,
-                            AssumptionCache &RunAC);
+                            AssumptionCache &RunAC) LLVM_LIBRARY_VISIBILITY;
 
-  bool presplitLoadsAndStores(AllocaInst &AI, sroa::AllocaSlices &AS);
+  bool presplitLoadsAndStores(AllocaInst &AI, sroa::AllocaSlices &AS)
+         LLVM_LIBRARY_VISIBILITY;
   AllocaInst *rewritePartition(AllocaInst &AI, sroa::AllocaSlices &AS,
-                               sroa::Partition &P);
-  bool splitAlloca(AllocaInst &AI, sroa::AllocaSlices &AS);
-  bool runOnAlloca(AllocaInst &AI);
-  void clobberUse(Use &U);
-  void deleteDeadInstructions(SmallPtrSetImpl<AllocaInst *> &DeletedAllocas);
-  bool promoteAllocas(Function &F);
+                               sroa::Partition &P) LLVM_LIBRARY_VISIBILITY;
+  bool splitAlloca(AllocaInst &AI, sroa::AllocaSlices &AS)
+         LLVM_LIBRARY_VISIBILITY;
+  bool runOnAlloca(AllocaInst &AI) LLVM_LIBRARY_VISIBILITY;
+  void clobberUse(Use &U) LLVM_LIBRARY_VISIBILITY;
+  void deleteDeadInstructions(SmallPtrSetImpl<AllocaInst *> &DeletedAllocas)
+         LLVM_LIBRARY_VISIBILITY;
+  bool promoteAllocas(Function &F) LLVM_LIBRARY_VISIBILITY;
 };
 
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17347.48233.patch
Type: text/x-patch
Size: 2343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160217/7c7b56e8/attachment.bin>


More information about the llvm-commits mailing list