summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Parse/Parser.cpp10
-rw-r--r--clang/test/Parser/altivec-non-type-vector.c7
-rw-r--r--clang/test/Parser/altivec-template-vector.cpp11
-rw-r--r--clang/test/Parser/altivec-typedef-vector.c7
4 files changed, 35 insertions, 0 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index b178b56e967c..c4f5f5d3c49d 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -1695,6 +1695,11 @@ Parser::TryAnnotateName(CorrectionCandidateCallback *CCC) {
break;
case Sema::NC_Type: {
+ if (TryAltiVecVectorToken())
+ // vector has been found as a type id when altivec is enabled but
+ // this is followed by a declaration specifier so this is really the
+ // altivec vector token. Leave it unannotated.
+ break;
SourceLocation BeginLoc = NameLoc;
if (SS.isNotEmpty())
BeginLoc = SS.getBeginLoc();
@@ -1736,6 +1741,11 @@ Parser::TryAnnotateName(CorrectionCandidateCallback *CCC) {
return ANK_Success;
case Sema::NC_NonType:
+ if (TryAltiVecVectorToken())
+ // vector has been found as a non-type id when altivec is enabled but
+ // this is followed by a declaration specifier so this is really the
+ // altivec vector token. Leave it unannotated.
+ break;
Tok.setKind(tok::annot_non_type);
setNonTypeAnnotation(Tok, Classification.getNonTypeDecl());
Tok.setLocation(NameLoc);
diff --git a/clang/test/Parser/altivec-non-type-vector.c b/clang/test/Parser/altivec-non-type-vector.c
new file mode 100644
index 000000000000..38e170da62a9
--- /dev/null
+++ b/clang/test/Parser/altivec-non-type-vector.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -target-feature +altivec -fsyntax-only %s
+
+int vector();
+
+void test() {
+ vector unsigned int v = {0};
+}
diff --git a/clang/test/Parser/altivec-template-vector.cpp b/clang/test/Parser/altivec-template-vector.cpp
new file mode 100644
index 000000000000..3b349e778e1f
--- /dev/null
+++ b/clang/test/Parser/altivec-template-vector.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -target-feature +altivec %s
+
+template <typename T> class vector {
+public:
+ vector(int) {}
+};
+
+void f() {
+ vector int v = {0};
+ vector<int> vi = {0};
+}
diff --git a/clang/test/Parser/altivec-typedef-vector.c b/clang/test/Parser/altivec-typedef-vector.c
new file mode 100644
index 000000000000..e94d332b5d79
--- /dev/null
+++ b/clang/test/Parser/altivec-typedef-vector.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -target-feature +altivec -fsyntax-only %s
+
+typedef int vector;
+
+void test() {
+ vector unsigned int v = {0};
+}