summaryrefslogtreecommitdiff
path: root/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorRobert Lytton <robert@xmos.com>2014-06-05 09:06:21 +0000
committerRobert Lytton <robert@xmos.com>2014-06-05 09:06:21 +0000
commit711cc4537903897eb50f2fdccb6858cc3e88e549 (patch)
treed1646dd8984552b1bb179741b95406c427785f46 /lib/CodeGen/TargetInfo.cpp
parenteafbf517b3cbdb05746652bff9f42b425cde44c2 (diff)
downloadclang-711cc4537903897eb50f2fdccb6858cc3e88e549.tar.gz
clang-711cc4537903897eb50f2fdccb6858cc3e88e549.tar.bz2
clang-711cc4537903897eb50f2fdccb6858cc3e88e549.tar.xz
XCore target: Fix 'typestring' binding qualifier to the array and not the type
Differential Revision: http://reviews.llvm.org/D3949 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210250 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TargetInfo.cpp')
-rw-r--r--lib/CodeGen/TargetInfo.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index c72d17281e..3421f160f9 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/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);
}