Skip to content

Commit

Permalink
[clang] run clang-format on some CGObjC files (#126644)
Browse files Browse the repository at this point in the history
These files are relatively old and don't confront our formatting rules.
It's hard to change them without massive clang-format changes.

---------

Signed-off-by: Peter Rong <PeterRong@meta.com>
  • Loading branch information
DataCorrupted authored Feb 12, 2025
1 parent 6d7a84d commit 53c618c
Show file tree
Hide file tree
Showing 4 changed files with 1,310 additions and 1,496 deletions.
58 changes: 27 additions & 31 deletions clang/include/clang/AST/Mangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,29 @@
#include <optional>

namespace llvm {
class raw_ostream;
class raw_ostream;
}

namespace clang {
class ASTContext;
class BlockDecl;
class CXXConstructorDecl;
class CXXDestructorDecl;
class CXXMethodDecl;
class FunctionDecl;
struct MethodVFTableLocation;
class NamedDecl;
class ObjCMethodDecl;
class StringLiteral;
struct ThisAdjustment;
struct ThunkInfo;
class VarDecl;
class ASTContext;
class BlockDecl;
class CXXConstructorDecl;
class CXXDestructorDecl;
class CXXMethodDecl;
class FunctionDecl;
struct MethodVFTableLocation;
class NamedDecl;
class ObjCMethodDecl;
class StringLiteral;
struct ThisAdjustment;
struct ThunkInfo;
class VarDecl;

/// MangleContext - Context for tracking state which persists across multiple
/// calls to the C++ name mangler.
class MangleContext {
public:
enum ManglerKind {
MK_Itanium,
MK_Microsoft
};
enum ManglerKind { MK_Itanium, MK_Microsoft };

private:
virtual void anchor();
Expand All @@ -59,10 +56,10 @@ class MangleContext {
/// ASTContext.
bool IsAux = false;

llvm::DenseMap<const BlockDecl*, unsigned> GlobalBlockIds;
llvm::DenseMap<const BlockDecl*, unsigned> LocalBlockIds;
llvm::DenseMap<const NamedDecl*, uint64_t> AnonStructIds;
llvm::DenseMap<const FunctionDecl*, unsigned> FuncAnonStructSize;
llvm::DenseMap<const BlockDecl *, unsigned> GlobalBlockIds;
llvm::DenseMap<const BlockDecl *, unsigned> LocalBlockIds;
llvm::DenseMap<const NamedDecl *, uint64_t> AnonStructIds;
llvm::DenseMap<const FunctionDecl *, unsigned> FuncAnonStructSize;

public:
ManglerKind getKind() const { return Kind; }
Expand All @@ -73,7 +70,7 @@ class MangleContext {
ManglerKind Kind, bool IsAux = false)
: Context(Context), Diags(Diags), Kind(Kind), IsAux(IsAux) {}

virtual ~MangleContext() { }
virtual ~MangleContext() {}

ASTContext &getASTContext() const { return Context; }

Expand All @@ -82,10 +79,10 @@ class MangleContext {
virtual void startNewFunction() { LocalBlockIds.clear(); }

unsigned getBlockId(const BlockDecl *BD, bool Local) {
llvm::DenseMap<const BlockDecl *, unsigned> &BlockIds
= Local? LocalBlockIds : GlobalBlockIds;
llvm::DenseMap<const BlockDecl *, unsigned> &BlockIds =
Local ? LocalBlockIds : GlobalBlockIds;
std::pair<llvm::DenseMap<const BlockDecl *, unsigned>::iterator, bool>
Result = BlockIds.insert(std::make_pair(BD, BlockIds.size()));
Result = BlockIds.insert(std::make_pair(BD, BlockIds.size()));
return Result.first->second;
}

Expand Down Expand Up @@ -125,7 +122,7 @@ class MangleContext {
return false;
}

virtual void needsUniqueInternalLinkageNames() { }
virtual void needsUniqueInternalLinkageNames() {}

// FIXME: consider replacing raw_ostream & with something like SmallString &.
void mangleName(GlobalDecl GD, raw_ostream &);
Expand All @@ -143,10 +140,9 @@ class MangleContext {
virtual void mangleCXXRTTIName(QualType T, raw_ostream &,
bool NormalizeIntegers = false) = 0;
virtual void mangleStringLiteral(const StringLiteral *SL, raw_ostream &) = 0;
virtual void mangleMSGuidDecl(const MSGuidDecl *GD, raw_ostream&);
virtual void mangleMSGuidDecl(const MSGuidDecl *GD, raw_ostream &);

void mangleGlobalBlock(const BlockDecl *BD,
const NamedDecl *ID,
void mangleGlobalBlock(const BlockDecl *BD, const NamedDecl *ID,
raw_ostream &Out);
void mangleCtorBlock(const CXXConstructorDecl *CD, CXXCtorType CT,
const BlockDecl *BD, raw_ostream &Out);
Expand Down Expand Up @@ -314,6 +310,6 @@ class ASTNameGenerator {
class Implementation;
std::unique_ptr<Implementation> Impl;
};
}
} // namespace clang

#endif
Loading

0 comments on commit 53c618c

Please sign in to comment.