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 origin/main HEAD --extensions cpp -- 
clang/lib/CodeGen/CGObjCGNU.cpp clang/lib/Driver/ToolChains/Clang.cpp 
llvm/lib/MC/WasmObjectWriter.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index 1427cc40d..1c97b14e9 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -182,103 +182,106 @@ protected:
   const std::string ManglePublicSymbol(StringRef Name) {
     StringRef prefix = "._"
 
-    // Exported symbols in Emscripten must be a valid Javascript identifier.
-    auto triple = CGM.getTriple();
+        // Exported symbols in Emscripten must be a valid Javascript 
identifier.
+        auto triple = CGM.getTriple();
     if (triple.isOSBinFormatCOFF() || triple.isOSBinFormatWasm()) {
       prefix = "$_";
-    return (prefix + Name).str();
-  }
-
-  std::string SymbolForProtocol(Twine Name) {
-    return (ManglePublicSymbol("OBJC_PROTOCOL_") + Name).str();
-  }
+      return (prefix + Name).str();
+    }
 
-  std::string SymbolForProtocolRef(StringRef Name) {
-    return (ManglePublicSymbol("OBJC_REF_PROTOCOL_") + Name).str();
-  }
+    std::string SymbolForProtocol(Twine Name) {
+      return (ManglePublicSymbol("OBJC_PROTOCOL_") + Name).str();
+    }
 
+    std::string SymbolForProtocolRef(StringRef Name) {
+      return (ManglePublicSymbol("OBJC_REF_PROTOCOL_") + Name).str();
+    }
 
-  /// Helper function that generates a constant string and returns a pointer to
-  /// the start of the string.  The result of this function can be used 
anywhere
-  /// where the C code specifies const char*.
-  llvm::Constant *MakeConstantString(StringRef Str, StringRef Name = "") {
-    ConstantAddress Array =
-        CGM.GetAddrOfConstantCString(std::string(Str), Name);
-    return Array.getPointer();
-  }
+    /// Helper function that generates a constant string and returns a pointer
+    /// to the start of the string.  The result of this function can be used
+    /// anywhere where the C code specifies const char*.
+    llvm::Constant *MakeConstantString(StringRef Str, StringRef Name = "") {
+      ConstantAddress Array =
+          CGM.GetAddrOfConstantCString(std::string(Str), Name);
+      return Array.getPointer();
+    }
 
-  /// Emits a linkonce_odr string, whose name is the prefix followed by the
-  /// string value.  This allows the linker to combine the strings between
-  /// different modules.  Used for EH typeinfo names, selector strings, and a
-  /// few other things.
-  llvm::Constant *ExportUniqueString(const std::string &Str,
-                                     const std::string &prefix,
-                                     bool Private=false) {
-    std::string name = prefix + Str;
-    auto *ConstStr = TheModule.getGlobalVariable(name);
-    if (!ConstStr) {
-      llvm::Constant *value = 
llvm::ConstantDataArray::getString(VMContext,Str);
-      auto *GV = new llvm::GlobalVariable(TheModule, value->getType(), true,
-              llvm::GlobalValue::LinkOnceODRLinkage, value, name);
-      GV->setComdat(TheModule.getOrInsertComdat(name));
-      if (Private)
-        GV->setVisibility(llvm::GlobalValue::HiddenVisibility);
-      ConstStr = GV;
+    /// Emits a linkonce_odr string, whose name is the prefix followed by the
+    /// string value.  This allows the linker to combine the strings between
+    /// different modules.  Used for EH typeinfo names, selector strings, and a
+    /// few other things.
+    llvm::Constant *ExportUniqueString(const std::string &Str,
+                                       const std::string &prefix,
+                                       bool Private = false) {
+      std::string name = prefix + Str;
+      auto *ConstStr = TheModule.getGlobalVariable(name);
+      if (!ConstStr) {
+        llvm::Constant *value =
+            llvm::ConstantDataArray::getString(VMContext, Str);
+        auto *GV = new llvm::GlobalVariable(
+            TheModule, value->getType(), true,
+            llvm::GlobalValue::LinkOnceODRLinkage, value, name);
+        GV->setComdat(TheModule.getOrInsertComdat(name));
+        if (Private)
+          GV->setVisibility(llvm::GlobalValue::HiddenVisibility);
+        ConstStr = GV;
+      }
+      return ConstStr;
     }
-    return ConstStr;
-  }
 
-  /// Returns a property name and encoding string.
-  llvm::Constant *MakePropertyEncodingString(const ObjCPropertyDecl *PD,
-                                             const Decl *Container) {
-    assert(!isRuntime(ObjCRuntime::GNUstep, 2));
-    if (isRuntime(ObjCRuntime::GNUstep, 1, 6)) {
-      std::string NameAndAttributes;
-      std::string TypeStr =
-        CGM.getContext().getObjCEncodingForPropertyDecl(PD, Container);
-      NameAndAttributes += '\0';
-      NameAndAttributes += TypeStr.length() + 3;
-      NameAndAttributes += TypeStr;
-      NameAndAttributes += '\0';
-      NameAndAttributes += PD->getNameAsString();
-      return MakeConstantString(NameAndAttributes);
+    /// Returns a property name and encoding string.
+    llvm::Constant *MakePropertyEncodingString(const ObjCPropertyDecl *PD,
+                                               const Decl *Container) {
+      assert(!isRuntime(ObjCRuntime::GNUstep, 2));
+      if (isRuntime(ObjCRuntime::GNUstep, 1, 6)) {
+        std::string NameAndAttributes;
+        std::string TypeStr =
+            CGM.getContext().getObjCEncodingForPropertyDecl(PD, Container);
+        NameAndAttributes += '\0';
+        NameAndAttributes += TypeStr.length() + 3;
+        NameAndAttributes += TypeStr;
+        NameAndAttributes += '\0';
+        NameAndAttributes += PD->getNameAsString();
+        return MakeConstantString(NameAndAttributes);
+      }
+      return MakeConstantString(PD->getNameAsString());
     }
-    return MakeConstantString(PD->getNameAsString());
-  }
 
-  /// Push the property attributes into two structure fields.
-  void PushPropertyAttributes(ConstantStructBuilder &Fields,
-      const ObjCPropertyDecl *property, bool isSynthesized=true, bool
-      isDynamic=true) {
-    int attrs = property->getPropertyAttributes();
-    // For read-only properties, clear the copy and retain flags
-    if (attrs & ObjCPropertyAttribute::kind_readonly) {
-      attrs &= ~ObjCPropertyAttribute::kind_copy;
-      attrs &= ~ObjCPropertyAttribute::kind_retain;
-      attrs &= ~ObjCPropertyAttribute::kind_weak;
-      attrs &= ~ObjCPropertyAttribute::kind_strong;
+    /// Push the property attributes into two structure fields.
+    void PushPropertyAttributes(
+        ConstantStructBuilder & Fields, const ObjCPropertyDecl *property,
+        bool isSynthesized = true, bool isDynamic = true) {
+      int attrs = property->getPropertyAttributes();
+      // For read-only properties, clear the copy and retain flags
+      if (attrs & ObjCPropertyAttribute::kind_readonly) {
+        attrs &= ~ObjCPropertyAttribute::kind_copy;
+        attrs &= ~ObjCPropertyAttribute::kind_retain;
+        attrs &= ~ObjCPropertyAttribute::kind_weak;
+        attrs &= ~ObjCPropertyAttribute::kind_strong;
+      }
+      // The first flags field has the same attribute values as clang uses
+      // internally
+      Fields.addInt(Int8Ty, attrs & 0xff);
+      attrs >>= 8;
+      attrs <<= 2;
+      // For protocol properties, synthesized and dynamic have no meaning, so 
we
+      // reuse these flags to indicate that this is a protocol property (both
+      // set has no meaning, as a property can't be both synthesized and
+      // dynamic)
+      attrs |= isSynthesized ? (1 << 0) : 0;
+      attrs |= isDynamic ? (1 << 1) : 0;
+      // The second field is the next four fields left shifted by two, with the
+      // low bit set to indicate whether the field is synthesized or dynamic.
+      Fields.addInt(Int8Ty, attrs & 0xff);
+      // Two padding fields
+      Fields.addInt(Int8Ty, 0);
+      Fields.addInt(Int8Ty, 0);
     }
-    // The first flags field has the same attribute values as clang uses 
internally
-    Fields.addInt(Int8Ty, attrs & 0xff);
-    attrs >>= 8;
-    attrs <<= 2;
-    // For protocol properties, synthesized and dynamic have no meaning, so we
-    // reuse these flags to indicate that this is a protocol property (both set
-    // has no meaning, as a property can't be both synthesized and dynamic)
-    attrs |= isSynthesized ? (1<<0) : 0;
-    attrs |= isDynamic ? (1<<1) : 0;
-    // The second field is the next four fields left shifted by two, with the
-    // low bit set to indicate whether the field is synthesized or dynamic.
-    Fields.addInt(Int8Ty, attrs & 0xff);
-    // Two padding fields
-    Fields.addInt(Int8Ty, 0);
-    Fields.addInt(Int8Ty, 0);
-  }
 
-  virtual llvm::Constant *GenerateCategoryProtocolList(const
-      ObjCCategoryDecl *OCD);
-  virtual ConstantArrayBuilder PushPropertyListHeader(ConstantStructBuilder 
&Fields,
-      int count) {
+    virtual llvm::Constant *GenerateCategoryProtocolList(
+        const ObjCCategoryDecl *OCD);
+    virtual ConstantArrayBuilder PushPropertyListHeader(
+        ConstantStructBuilder & Fields, int count) {
       // int count;
       Fields.addInt(IntTy, count);
       // int size; (only in GNUstep v2 ABI.
@@ -673,7 +676,7 @@ public:
   llvm::Constant *BuildByrefLayout(CodeGenModule &CGM, QualType T) override {
     return NULLPtr;
   }
-};
+  };
 
 /// Class representing the legacy GCC Objective-C ABI.  This is the default 
when
 /// -fobjc-nonfragile-abi is not specified.

``````````

</details>


https://github.com/llvm/llvm-project/pull/169043
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to