diff options
author | Robert Lytton <robert@xmos.com> | 2014-06-05 09:06:21 +0000 |
---|---|---|
committer | Robert Lytton <robert@xmos.com> | 2014-06-05 09:06:21 +0000 |
commit | 6adb20f72039661466047a9e7a9b6fd84c70a6b9 (patch) | |
tree | adc173b21907020c972f2b41c9e6fa9355085c6e /clang/lib/CodeGen/TargetInfo.cpp | |
parent | 5248f9f0a5bddd7e98a609c90c65ad0947addb91 (diff) | |
download | bcm5719-llvm-6adb20f72039661466047a9e7a9b6fd84c70a6b9.tar.gz bcm5719-llvm-6adb20f72039661466047a9e7a9b6fd84c70a6b9.zip |
XCore target: Fix 'typestring' binding qualifier to the array and not the type
Differential Revision: http://reviews.llvm.org/D3949
llvm-svn: 210250
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index c72d17281ed..3421f160f9b 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -6335,7 +6335,8 @@ static bool appendPointerType(SmallStringEnc &Enc, const PointerType *PT, } /// Appends array encoding to Enc before calling appendType for the element. -static bool appendArrayType(SmallStringEnc &Enc, const ArrayType *AT, +static bool appendArrayType(SmallStringEnc &Enc, QualType QT, + const ArrayType *AT, const CodeGen::CodeGenModule &CGM, TypeStringCache &TSC, StringRef NoSizeEnc) { if (AT->getSizeModifier() != ArrayType::Normal) @@ -6346,6 +6347,8 @@ static bool appendArrayType(SmallStringEnc &Enc, const ArrayType *AT, else Enc += NoSizeEnc; // Global arrays use "*", otherwise it is "". Enc += ':'; + // The Qualifiers should be attached to the type rather than the array. + appendQualifier(Enc, QT); if (!appendType(Enc, AT->getElementType(), CGM, TSC)) return false; Enc += ')'; @@ -6394,14 +6397,16 @@ static bool appendType(SmallStringEnc &Enc, QualType QType, QualType QT = QType.getCanonicalType(); + if (const ArrayType *AT = QT->getAsArrayTypeUnsafe()) + // The Qualifiers should be attached to the type rather than the array. + // Thus we don't call appendQualifier() here. + return appendArrayType(Enc, QT, AT, CGM, TSC, ""); + appendQualifier(Enc, QT); if (const BuiltinType *BT = QT->getAs<BuiltinType>()) return appendBuiltinType(Enc, BT); - if (const ArrayType *AT = QT->getAsArrayTypeUnsafe()) - return appendArrayType(Enc, AT, CGM, TSC, ""); - if (const PointerType *PT = QT->getAs<PointerType>()) return appendPointerType(Enc, PT, CGM, TSC); @@ -6437,8 +6442,9 @@ static bool getTypeString(SmallStringEnc &Enc, const Decl *D, QualType QT = VD->getType().getCanonicalType(); if (const ArrayType *AT = QT->getAsArrayTypeUnsafe()) { // Global ArrayTypes are given a size of '*' if the size is unknown. - appendQualifier(Enc, QT); - return appendArrayType(Enc, AT, CGM, TSC, "*"); + // The Qualifiers should be attached to the type rather than the array. + // Thus we don't call appendQualifier() here. + return appendArrayType(Enc, QT, AT, CGM, TSC, "*"); } return appendType(Enc, QT, CGM, TSC); } |