summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp')
-rw-r--r--contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp149
1 files changed, 73 insertions, 76 deletions
diff --git a/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp b/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp
index 4f920f9..1515db4 100644
--- a/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp
+++ b/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp
@@ -29,15 +29,15 @@ namespace {
/// Microsoft Visual C++ ABI.
class MicrosoftCXXNameMangler {
MangleContext &Context;
- llvm::raw_ostream &Out;
+ raw_ostream &Out;
ASTContext &getASTContext() const { return Context.getASTContext(); }
public:
- MicrosoftCXXNameMangler(MangleContext &C, llvm::raw_ostream &Out_)
+ MicrosoftCXXNameMangler(MangleContext &C, raw_ostream &Out_)
: Context(C), Out(Out_) { }
- void mangle(const NamedDecl *D, llvm::StringRef Prefix = "?");
+ void mangle(const NamedDecl *D, StringRef Prefix = "?");
void mangleName(const NamedDecl *ND);
void mangleFunctionEncoding(const FunctionDecl *FD);
void mangleVariableEncoding(const VarDecl *VD);
@@ -78,30 +78,30 @@ private:
class MicrosoftMangleContext : public MangleContext {
public:
MicrosoftMangleContext(ASTContext &Context,
- Diagnostic &Diags) : MangleContext(Context, Diags) { }
+ DiagnosticsEngine &Diags) : MangleContext(Context, Diags) { }
virtual bool shouldMangleDeclName(const NamedDecl *D);
- virtual void mangleName(const NamedDecl *D, llvm::raw_ostream &Out);
+ virtual void mangleName(const NamedDecl *D, raw_ostream &Out);
virtual void mangleThunk(const CXXMethodDecl *MD,
const ThunkInfo &Thunk,
- llvm::raw_ostream &);
+ raw_ostream &);
virtual void mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type,
const ThisAdjustment &ThisAdjustment,
- llvm::raw_ostream &);
+ raw_ostream &);
virtual void mangleCXXVTable(const CXXRecordDecl *RD,
- llvm::raw_ostream &);
+ raw_ostream &);
virtual void mangleCXXVTT(const CXXRecordDecl *RD,
- llvm::raw_ostream &);
+ raw_ostream &);
virtual void mangleCXXCtorVTable(const CXXRecordDecl *RD, int64_t Offset,
const CXXRecordDecl *Type,
- llvm::raw_ostream &);
- virtual void mangleCXXRTTI(QualType T, llvm::raw_ostream &);
- virtual void mangleCXXRTTIName(QualType T, llvm::raw_ostream &);
+ raw_ostream &);
+ virtual void mangleCXXRTTI(QualType T, raw_ostream &);
+ virtual void mangleCXXRTTIName(QualType T, raw_ostream &);
virtual void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type,
- llvm::raw_ostream &);
+ raw_ostream &);
virtual void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type,
- llvm::raw_ostream &);
+ raw_ostream &);
virtual void mangleReferenceTemporary(const clang::VarDecl *,
- llvm::raw_ostream &);
+ raw_ostream &);
};
}
@@ -154,7 +154,7 @@ bool MicrosoftMangleContext::shouldMangleDeclName(const NamedDecl *D) {
}
void MicrosoftCXXNameMangler::mangle(const NamedDecl *D,
- llvm::StringRef Prefix) {
+ StringRef Prefix) {
// MSVC doesn't mangle C++ names the same way it mangles extern "C" names.
// Therefore it's really important that we don't decorate the
// name with leading underscores or leading/trailing at signs. So, emit a
@@ -332,16 +332,13 @@ MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
case DeclarationName::ObjCZeroArgSelector:
case DeclarationName::ObjCOneArgSelector:
case DeclarationName::ObjCMultiArgSelector:
- assert(false && "Can't mangle Objective-C selector names here!");
- break;
+ llvm_unreachable("Can't mangle Objective-C selector names here!");
case DeclarationName::CXXConstructorName:
- assert(false && "Can't mangle constructors yet!");
- break;
+ llvm_unreachable("Can't mangle constructors yet!");
case DeclarationName::CXXDestructorName:
- assert(false && "Can't mangle destructors yet!");
- break;
+ llvm_unreachable("Can't mangle destructors yet!");
case DeclarationName::CXXConversionFunctionName:
// <operator-name> ::= ?B # (cast)
@@ -355,12 +352,10 @@ MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
case DeclarationName::CXXLiteralOperatorName:
// FIXME: Was this added in VS2010? Does MS even know how to mangle this?
- assert(false && "Don't know how to mangle literal operators yet!");
- break;
+ llvm_unreachable("Don't know how to mangle literal operators yet!");
case DeclarationName::CXXUsingDirective:
- assert(false && "Can't mangle a using directive name!");
- break;
+ llvm_unreachable("Can't mangle a using directive name!");
}
}
@@ -513,13 +508,11 @@ void MicrosoftCXXNameMangler::mangleOperatorName(OverloadedOperatorKind OO) {
case OO_Array_Delete: Out << "?_V"; break;
case OO_Conditional:
- assert(false && "Don't know how to mangle ?:");
- break;
+ llvm_unreachable("Don't know how to mangle ?:");
case OO_None:
case NUM_OVERLOADED_OPERATORS:
- assert(false && "Not an overloaded operator");
- break;
+ llvm_unreachable("Not an overloaded operator");
}
}
@@ -712,18 +705,17 @@ void MicrosoftCXXNameMangler::mangleType(const BuiltinType *T) {
case BuiltinType::Dependent:
case BuiltinType::UnknownAny:
case BuiltinType::BoundMember:
- assert(false &&
+ llvm_unreachable(
"Overloaded and dependent types shouldn't get to name mangling");
- break;
case BuiltinType::ObjCId: Out << "PAUobjc_object@@"; break;
case BuiltinType::ObjCClass: Out << "PAUobjc_class@@"; break;
case BuiltinType::ObjCSel: Out << "PAUobjc_selector@@"; break;
case BuiltinType::Char16:
case BuiltinType::Char32:
+ case BuiltinType::Half:
case BuiltinType::NullPtr:
- assert(false && "Don't know how to mangle this type");
- break;
+ llvm_unreachable("Don't know how to mangle this type");
}
}
@@ -869,7 +861,7 @@ void MicrosoftCXXNameMangler::mangleCallingConvention(const FunctionType *T,
CC = IsInstMethod ? getASTContext().getDefaultMethodCallConv() : CC_C;
switch (CC) {
default:
- assert(0 && "Unsupported CC for mangling");
+ llvm_unreachable("Unsupported CC for mangling");
case CC_Default:
case CC_C: Out << 'A'; break;
case CC_X86Pascal: Out << 'C'; break;
@@ -890,7 +882,7 @@ void MicrosoftCXXNameMangler::mangleThrowSpecification(
}
void MicrosoftCXXNameMangler::mangleType(const UnresolvedUsingType *T) {
- assert(false && "Don't know how to mangle UnresolvedUsingTypes yet!");
+ llvm_unreachable("Don't know how to mangle UnresolvedUsingTypes yet!");
}
// <type> ::= <union-type> | <struct-type> | <class-type> | <enum-type>
@@ -954,7 +946,7 @@ void MicrosoftCXXNameMangler::mangleType(const IncompleteArrayType *T) {
mangleType(static_cast<const ArrayType *>(T), false);
}
void MicrosoftCXXNameMangler::mangleExtraDimensions(QualType ElementTy) {
- llvm::SmallVector<llvm::APInt, 3> Dimensions;
+ SmallVector<llvm::APInt, 3> Dimensions;
for (;;) {
if (ElementTy->isConstantArrayType()) {
const ConstantArrayType *CAT =
@@ -962,10 +954,10 @@ void MicrosoftCXXNameMangler::mangleExtraDimensions(QualType ElementTy) {
Dimensions.push_back(CAT->getSize());
ElementTy = CAT->getElementType();
} else if (ElementTy->isVariableArrayType()) {
- assert(false && "Don't know how to mangle VLAs!");
+ llvm_unreachable("Don't know how to mangle VLAs!");
} else if (ElementTy->isDependentSizedArrayType()) {
// The dependent expression has to be folded into a constant (TODO).
- assert(false && "Don't know how to mangle dependent-sized arrays!");
+ llvm_unreachable("Don't know how to mangle dependent-sized arrays!");
} else if (ElementTy->isIncompleteArrayType()) continue;
else break;
}
@@ -999,12 +991,12 @@ void MicrosoftCXXNameMangler::mangleType(const MemberPointerType *T) {
}
void MicrosoftCXXNameMangler::mangleType(const TemplateTypeParmType *T) {
- assert(false && "Don't know how to mangle TemplateTypeParmTypes yet!");
+ llvm_unreachable("Don't know how to mangle TemplateTypeParmTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(
const SubstTemplateTypeParmPackType *T) {
- assert(false &&
+ llvm_unreachable(
"Don't know how to mangle SubstTemplateTypeParmPackTypes yet!");
}
@@ -1045,21 +1037,22 @@ void MicrosoftCXXNameMangler::mangleType(const LValueReferenceType *T) {
}
void MicrosoftCXXNameMangler::mangleType(const RValueReferenceType *T) {
- assert(false && "Don't know how to mangle RValueReferenceTypes yet!");
+ llvm_unreachable("Don't know how to mangle RValueReferenceTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const ComplexType *T) {
- assert(false && "Don't know how to mangle ComplexTypes yet!");
+ llvm_unreachable("Don't know how to mangle ComplexTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const VectorType *T) {
- assert(false && "Don't know how to mangle VectorTypes yet!");
+ llvm_unreachable("Don't know how to mangle VectorTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const ExtVectorType *T) {
- assert(false && "Don't know how to mangle ExtVectorTypes yet!");
+ llvm_unreachable("Don't know how to mangle ExtVectorTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const DependentSizedExtVectorType *T) {
- assert(false && "Don't know how to mangle DependentSizedExtVectorTypes yet!");
+ llvm_unreachable(
+ "Don't know how to mangle DependentSizedExtVectorTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const ObjCInterfaceType *T) {
@@ -1080,49 +1073,53 @@ void MicrosoftCXXNameMangler::mangleType(const BlockPointerType *T) {
}
void MicrosoftCXXNameMangler::mangleType(const InjectedClassNameType *T) {
- assert(false && "Don't know how to mangle InjectedClassNameTypes yet!");
+ llvm_unreachable("Don't know how to mangle InjectedClassNameTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const TemplateSpecializationType *T) {
- assert(false && "Don't know how to mangle TemplateSpecializationTypes yet!");
+ llvm_unreachable("Don't know how to mangle TemplateSpecializationTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const DependentNameType *T) {
- assert(false && "Don't know how to mangle DependentNameTypes yet!");
+ llvm_unreachable("Don't know how to mangle DependentNameTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(
const DependentTemplateSpecializationType *T) {
- assert(false &&
+ llvm_unreachable(
"Don't know how to mangle DependentTemplateSpecializationTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const PackExpansionType *T) {
- assert(false && "Don't know how to mangle PackExpansionTypes yet!");
+ llvm_unreachable("Don't know how to mangle PackExpansionTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const TypeOfType *T) {
- assert(false && "Don't know how to mangle TypeOfTypes yet!");
+ llvm_unreachable("Don't know how to mangle TypeOfTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const TypeOfExprType *T) {
- assert(false && "Don't know how to mangle TypeOfExprTypes yet!");
+ llvm_unreachable("Don't know how to mangle TypeOfExprTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const DecltypeType *T) {
- assert(false && "Don't know how to mangle DecltypeTypes yet!");
+ llvm_unreachable("Don't know how to mangle DecltypeTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const UnaryTransformType *T) {
- assert(false && "Don't know how to mangle UnaryTransformationTypes yet!");
+ llvm_unreachable("Don't know how to mangle UnaryTransformationTypes yet!");
}
void MicrosoftCXXNameMangler::mangleType(const AutoType *T) {
- assert(false && "Don't know how to mangle AutoTypes yet!");
+ llvm_unreachable("Don't know how to mangle AutoTypes yet!");
+}
+
+void MicrosoftCXXNameMangler::mangleType(const AtomicType *T) {
+ llvm_unreachable("Don't know how to mangle AtomicTypes yet!");
}
void MicrosoftMangleContext::mangleName(const NamedDecl *D,
- llvm::raw_ostream &Out) {
+ raw_ostream &Out) {
assert((isa<FunctionDecl>(D) || isa<VarDecl>(D)) &&
"Invalid mangleName() call, argument is not a variable or function!");
assert(!isa<CXXConstructorDecl>(D) && !isa<CXXDestructorDecl>(D) &&
@@ -1137,53 +1134,53 @@ void MicrosoftMangleContext::mangleName(const NamedDecl *D,
}
void MicrosoftMangleContext::mangleThunk(const CXXMethodDecl *MD,
const ThunkInfo &Thunk,
- llvm::raw_ostream &) {
- assert(false && "Can't yet mangle thunks!");
+ raw_ostream &) {
+ llvm_unreachable("Can't yet mangle thunks!");
}
void MicrosoftMangleContext::mangleCXXDtorThunk(const CXXDestructorDecl *DD,
CXXDtorType Type,
const ThisAdjustment &,
- llvm::raw_ostream &) {
- assert(false && "Can't yet mangle destructor thunks!");
+ raw_ostream &) {
+ llvm_unreachable("Can't yet mangle destructor thunks!");
}
void MicrosoftMangleContext::mangleCXXVTable(const CXXRecordDecl *RD,
- llvm::raw_ostream &) {
- assert(false && "Can't yet mangle virtual tables!");
+ raw_ostream &) {
+ llvm_unreachable("Can't yet mangle virtual tables!");
}
void MicrosoftMangleContext::mangleCXXVTT(const CXXRecordDecl *RD,
- llvm::raw_ostream &) {
+ raw_ostream &) {
llvm_unreachable("The MS C++ ABI does not have virtual table tables!");
}
void MicrosoftMangleContext::mangleCXXCtorVTable(const CXXRecordDecl *RD,
int64_t Offset,
const CXXRecordDecl *Type,
- llvm::raw_ostream &) {
+ raw_ostream &) {
llvm_unreachable("The MS C++ ABI does not have constructor vtables!");
}
void MicrosoftMangleContext::mangleCXXRTTI(QualType T,
- llvm::raw_ostream &) {
- assert(false && "Can't yet mangle RTTI!");
+ raw_ostream &) {
+ llvm_unreachable("Can't yet mangle RTTI!");
}
void MicrosoftMangleContext::mangleCXXRTTIName(QualType T,
- llvm::raw_ostream &) {
- assert(false && "Can't yet mangle RTTI names!");
+ raw_ostream &) {
+ llvm_unreachable("Can't yet mangle RTTI names!");
}
void MicrosoftMangleContext::mangleCXXCtor(const CXXConstructorDecl *D,
CXXCtorType Type,
- llvm::raw_ostream &) {
- assert(false && "Can't yet mangle constructors!");
+ raw_ostream &) {
+ llvm_unreachable("Can't yet mangle constructors!");
}
void MicrosoftMangleContext::mangleCXXDtor(const CXXDestructorDecl *D,
CXXDtorType Type,
- llvm::raw_ostream &) {
- assert(false && "Can't yet mangle destructors!");
+ raw_ostream &) {
+ llvm_unreachable("Can't yet mangle destructors!");
}
void MicrosoftMangleContext::mangleReferenceTemporary(const clang::VarDecl *,
- llvm::raw_ostream &) {
- assert(false && "Can't yet mangle reference temporaries!");
+ raw_ostream &) {
+ llvm_unreachable("Can't yet mangle reference temporaries!");
}
MangleContext *clang::createMicrosoftMangleContext(ASTContext &Context,
- Diagnostic &Diags) {
+ DiagnosticsEngine &Diags) {
return new MicrosoftMangleContext(Context, Diags);
}
OpenPOWER on IntegriCloud