[clang] [llvm] [InstallAPI] Report exports discovered in binary but not in interface (PR #86025)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 20 15:48:52 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 927308a52bc51ae786db1bd645ad5ef5889fdb2a b01001d6420bd21dbd332930c4aae82d00958016 -- clang/include/clang/InstallAPI/DylibVerifier.h clang/lib/InstallAPI/DylibVerifier.cpp clang/tools/clang-installapi/ClangInstallAPI.cpp llvm/lib/TextAPI/BinaryReader/DylibReader.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/include/clang/InstallAPI/DylibVerifier.h b/clang/include/clang/InstallAPI/DylibVerifier.h
index 20e31c87b7..49de24763f 100644
--- a/clang/include/clang/InstallAPI/DylibVerifier.h
+++ b/clang/include/clang/InstallAPI/DylibVerifier.h
@@ -130,10 +130,10 @@ private:
 
   /// Find matching dylib slice for target triple that is being parsed.
   void assignSlice(const Target &T);
-  
+
   /// Shared implementation for verifying exported symbols in dylib.
-  void visitSymbolInDylib(const Record &R, SymbolContext& SymCtx);
-  
+  void visitSymbolInDylib(const Record &R, SymbolContext &SymCtx);
+
   void visitGlobal(const GlobalRecord &R) override;
   void visitObjCInterface(const ObjCInterfaceRecord &R) override;
   void visitObjCCategory(const ObjCCategoryRecord &R) override;
diff --git a/clang/lib/InstallAPI/DylibVerifier.cpp b/clang/lib/InstallAPI/DylibVerifier.cpp
index 0cc6a4bad9..2f71cd1a80 100644
--- a/clang/lib/InstallAPI/DylibVerifier.cpp
+++ b/clang/lib/InstallAPI/DylibVerifier.cpp
@@ -524,8 +524,7 @@ static bool shouldIgnoreCpp(StringRef Name, bool IsWeakDef) {
   return (IsWeakDef &&
           (Name.starts_with("__ZTI") || Name.starts_with("__ZTS")));
 }
-void DylibVerifier::visitSymbolInDylib(const Record &R,
-    SymbolContext &SymCtx) {
+void DylibVerifier::visitSymbolInDylib(const Record &R, SymbolContext &SymCtx) {
   if (R.isUndefined()) {
     updateState(Result::Valid);
     return;
@@ -538,7 +537,8 @@ void DylibVerifier::visitSymbolInDylib(const Record &R,
   const StringRef SymbolName(SymCtx.SymbolName);
   // Allow zippered symbols with potentially mismatching availability
   // between macOS and macCatalyst in the final text file.
-  if (const Symbol *Sym = Exports->findSymbol(SymCtx.Kind, SymCtx.SymbolName, SymCtx.ObjCIFKind)) {
+  if (const Symbol *Sym = Exports->findSymbol(SymCtx.Kind, SymCtx.SymbolName,
+                                              SymCtx.ObjCIFKind)) {
     if (Sym->hasArchitecture(Ctx.Target.Arch)) {
       updateState(Result::Ignore);
       return;
@@ -551,7 +551,7 @@ void DylibVerifier::visitSymbolInDylib(const Record &R,
   }
 
   // All checks at the point classify as some kind of violation that should be
-  // reported. 
+  // reported.
   if (SymbolName.starts_with("$ld$")) {
     Ctx.emitDiag([&]() {
       Ctx.Diag->Report(diag::err_header_symbol_missing)
diff --git a/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp b/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp
index cf18e78bf6..2e36d4a8b9 100644
--- a/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp
+++ b/llvm/lib/TextAPI/BinaryReader/DylibReader.cpp
@@ -296,7 +296,7 @@ static Error readSymbols(MachOObjectFile *Obj, RecordsSlice &Slice,
     if (Flags & SymbolRef::SF_Undefined) {
       if (Opt.Undefineds)
         Linkage = RecordLinkage::Undefined;
-      else 
+      else
         continue;
       if (Flags & SymbolRef::SF_Weak)
         RecordFlags |= SymbolFlags::WeakReferenced;

``````````

</details>


https://github.com/llvm/llvm-project/pull/86025


More information about the cfe-commits mailing list