Skip to content

Commit ebef5ee

Browse files
committed
Auto generate visibility macros for class members instead whole classes in TypeLoc.h
When compiling with MSVC dllexport instantiate lots members here are in unsupported context causing lots of compile errors, so its simpler to just export individual members that are out of line.
1 parent c6e27b3 commit ebef5ee

File tree

1 file changed

+32
-31
lines changed

1 file changed

+32
-31
lines changed

clang/include/clang/AST/TypeLoc.h

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "clang/Basic/LLVM.h"
2323
#include "clang/Basic/SourceLocation.h"
2424
#include "clang/Basic/Specifiers.h"
25+
#include "clang/Support/Compiler.h"
2526
#include "llvm/ADT/ArrayRef.h"
2627
#include "llvm/Support/Casting.h"
2728
#include "llvm/Support/Compiler.h"
@@ -122,11 +123,11 @@ class TypeLoc {
122123
explicit operator bool() const { return Ty; }
123124

124125
/// Returns the size of type source info data block for the given type.
125-
static unsigned getFullDataSizeForType(QualType Ty);
126+
CLANG_ABI static unsigned getFullDataSizeForType(QualType Ty);
126127

127128
/// Returns the alignment of type source info data block for
128129
/// the given type.
129-
static unsigned getLocalAlignmentForType(QualType Ty);
130+
CLANG_ABI static unsigned getLocalAlignmentForType(QualType Ty);
130131

131132
/// Get the type for which this source info wrapper provides
132133
/// information.
@@ -144,10 +145,10 @@ class TypeLoc {
144145
}
145146

146147
/// Get the begin source location.
147-
SourceLocation getBeginLoc() const;
148+
CLANG_ABI SourceLocation getBeginLoc() const;
148149

149150
/// Get the end source location.
150-
SourceLocation getEndLoc() const;
151+
CLANG_ABI SourceLocation getEndLoc() const;
151152

152153
/// Get the full source range.
153154
SourceRange getSourceRange() const LLVM_READONLY {
@@ -182,15 +183,15 @@ class TypeLoc {
182183
/// QualifiedTypeLoc
183184
/// AtomicTypeLoc
184185
/// AttributedTypeLoc, for those type attributes that behave as qualifiers
185-
TypeLoc findExplicitQualifierLoc() const;
186+
CLANG_ABI TypeLoc findExplicitQualifierLoc() const;
186187

187188
/// Get the typeloc of an AutoType whose type will be deduced for a variable
188189
/// with an initializer of this type. This looks through declarators like
189190
/// pointer types, but not through decltype or typedefs.
190-
AutoTypeLoc getContainedAutoTypeLoc() const;
191+
CLANG_ABI AutoTypeLoc getContainedAutoTypeLoc() const;
191192

192193
/// Get the SourceLocation of the template keyword (if any).
193-
SourceLocation getTemplateKeywordLoc() const;
194+
CLANG_ABI SourceLocation getTemplateKeywordLoc() const;
194195

195196
/// Initializes this to state that every location in this
196197
/// type is the given location.
@@ -218,7 +219,7 @@ class TypeLoc {
218219
}
219220

220221
/// Copies the other type loc into this one.
221-
void copy(TypeLoc other);
222+
CLANG_ABI void copy(TypeLoc other);
222223

223224
friend bool operator==(const TypeLoc &LHS, const TypeLoc &RHS) {
224225
return LHS.Ty == RHS.Ty && LHS.Data == RHS.Data;
@@ -230,21 +231,21 @@ class TypeLoc {
230231

231232
/// Find the location of the nullability specifier (__nonnull,
232233
/// __nullable, or __null_unspecifier), if there is one.
233-
SourceLocation findNullabilityLoc() const;
234+
CLANG_ABI SourceLocation findNullabilityLoc() const;
234235

235-
void dump() const;
236-
void dump(llvm::raw_ostream &, const ASTContext &) const;
236+
CLANG_ABI void dump() const;
237+
CLANG_ABI void dump(llvm::raw_ostream &, const ASTContext &) const;
237238

238239
private:
239240
static bool isKind(const TypeLoc&) {
240241
return true;
241242
}
242243

243-
static void initializeImpl(ASTContext &Context, TypeLoc TL,
244+
CLANG_ABI static void initializeImpl(ASTContext &Context, TypeLoc TL,
244245
SourceLocation Loc);
245-
static TypeLoc getNextTypeLocImpl(TypeLoc TL);
246-
static TypeLoc IgnoreParensImpl(TypeLoc TL);
247-
static SourceRange getLocalSourceRangeImpl(TypeLoc TL);
246+
CLANG_ABI static TypeLoc getNextTypeLocImpl(TypeLoc TL);
247+
CLANG_ABI static TypeLoc IgnoreParensImpl(TypeLoc TL);
248+
CLANG_ABI static SourceRange getLocalSourceRangeImpl(TypeLoc TL);
248249
};
249250

250251
inline TypeSourceInfo::TypeSourceInfo(QualType ty, size_t DataSize) : Ty(ty) {
@@ -551,7 +552,7 @@ class TypeSpecTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
551552
private:
552553
friend class TypeLoc;
553554

554-
static bool isKind(const TypeLoc &TL);
555+
CLANG_ABI static bool isKind(const TypeLoc &TL);
555556
};
556557

557558
struct BuiltinLocInfo {
@@ -642,7 +643,7 @@ class BuiltinTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
642643
getWrittenBuiltinSpecs().Width = static_cast<unsigned>(written);
643644
}
644645

645-
TypeSpecifierType getWrittenTypeSpec() const;
646+
CLANG_ABI TypeSpecifierType getWrittenTypeSpec() const;
646647

647648
bool hasWrittenTypeSpec() const {
648649
return getWrittenTypeSpec() != TST_unspecified;
@@ -732,7 +733,7 @@ class TagTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
732733
TagDecl *getDecl() const { return getTypePtr()->getDecl(); }
733734

734735
/// True if the tag was defined in this type specifier.
735-
bool isDefinition() const;
736+
CLANG_ABI bool isDefinition() const;
736737
};
737738

738739
/// Wrapper for source info for record types.
@@ -829,7 +830,7 @@ class ObjCTypeParamTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
829830
return llvm::ArrayRef(getProtocolLocArray(), getNumProtocols());
830831
}
831832

832-
void initializeLocal(ASTContext &Context, SourceLocation Loc);
833+
CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
833834

834835
unsigned getExtraLocalDataSize() const {
835836
if (!this->getNumProtocols()) return 0;
@@ -906,7 +907,7 @@ class AttributedTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
906907
return dyn_cast_or_null<T>(getAttr());
907908
}
908909

909-
SourceRange getLocalSourceRange() const;
910+
CLANG_ABI SourceRange getLocalSourceRange() const;
910911

911912
void initializeLocal(ASTContext &Context, SourceLocation loc) {
912913
setAttr(nullptr);
@@ -933,7 +934,7 @@ class BTFTagAttributedTypeLoc
933934
return dyn_cast_or_null<T>(getAttr());
934935
}
935936

936-
SourceRange getLocalSourceRange() const;
937+
CLANG_ABI SourceRange getLocalSourceRange() const;
937938

938939
void initializeLocal(ASTContext &Context, SourceLocation loc) {}
939940

@@ -1092,7 +1093,7 @@ class ObjCObjectTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
10921093
return SourceRange(start, end);
10931094
}
10941095

1095-
void initializeLocal(ASTContext &Context, SourceLocation Loc);
1096+
CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
10961097

10971098
unsigned getExtraLocalDataSize() const {
10981099
return this->getNumTypeArgs() * sizeof(TypeSourceInfo *)
@@ -1174,7 +1175,7 @@ class CountAttributedTypeLoc final
11741175
bool isCountInBytes() const { return getTypePtr()->isCountInBytes(); }
11751176
bool isOrNull() const { return getTypePtr()->isOrNull(); }
11761177

1177-
SourceRange getLocalSourceRange() const;
1178+
CLANG_ABI SourceRange getLocalSourceRange() const;
11781179
};
11791180

11801181
struct MacroQualifiedLocInfo {
@@ -1764,7 +1765,7 @@ class TemplateSpecializationTypeLoc :
17641765
getArgInfos(), Loc);
17651766
}
17661767

1767-
static void initializeArgLocs(ASTContext &Context,
1768+
CLANG_ABI static void initializeArgLocs(ASTContext &Context,
17681769
ArrayRef<TemplateArgument> Args,
17691770
TemplateArgumentLocInfo *ArgInfos,
17701771
SourceLocation Loc);
@@ -2075,7 +2076,7 @@ class TypeOfExprTypeLoc : public TypeofLikeTypeLoc<TypeOfExprTypeLoc,
20752076
// Reimplemented to account for GNU/C++ extension
20762077
// typeof unary-expression
20772078
// where there are no parentheses.
2078-
SourceRange getLocalSourceRange() const;
2079+
CLANG_ABI SourceRange getLocalSourceRange() const;
20792080
};
20802081

20812082
class TypeOfTypeLoc
@@ -2093,7 +2094,7 @@ class TypeOfTypeLoc
20932094
this->getLocalData()->UnmodifiedTInfo = TI;
20942095
}
20952096

2096-
void initializeLocal(ASTContext &Context, SourceLocation Loc);
2097+
CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
20972098
};
20982099

20992100
// decltype(expression) abc;
@@ -2197,7 +2198,7 @@ class UnaryTransformTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
21972198
setRParenLoc(Range.getEnd());
21982199
}
21992200

2200-
void initializeLocal(ASTContext &Context, SourceLocation Loc);
2201+
CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
22012202
};
22022203

22032204
class DeducedTypeLoc
@@ -2318,7 +2319,7 @@ class AutoTypeLoc
23182319
memcpy(Data, Loc.Data, size);
23192320
}
23202321

2321-
void initializeLocal(ASTContext &Context, SourceLocation Loc);
2322+
CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
23222323
};
23232324

23242325
class DeducedTemplateSpecializationTypeLoc
@@ -2387,7 +2388,7 @@ class ElaboratedTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
23872388
return getQualifierLoc().getSourceRange();
23882389
}
23892390

2390-
void initializeLocal(ASTContext &Context, SourceLocation Loc);
2391+
CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
23912392

23922393
TypeLoc getNamedTypeLoc() const { return getInnerTypeLoc(); }
23932394

@@ -2468,7 +2469,7 @@ class DependentNameTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
24682469
memcpy(Data, Loc.Data, size);
24692470
}
24702471

2471-
void initializeLocal(ASTContext &Context, SourceLocation Loc);
2472+
CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
24722473
};
24732474

24742475
struct DependentTemplateSpecializationLocInfo : DependentNameLocInfo {
@@ -2582,7 +2583,7 @@ class DependentTemplateSpecializationTypeLoc :
25822583
memcpy(Data, Loc.Data, size);
25832584
}
25842585

2585-
void initializeLocal(ASTContext &Context, SourceLocation Loc);
2586+
CLANG_ABI void initializeLocal(ASTContext &Context, SourceLocation Loc);
25862587

25872588
unsigned getExtraLocalDataSize() const {
25882589
return getNumArgs() * sizeof(TemplateArgumentLocInfo);

0 commit comments

Comments
 (0)