aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/DeclSpec.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-08-26 17:22:34 +0000
committerJohn McCall <rjmccall@apple.com>2010-08-26 17:22:34 +0000
commit9e46b8cfb3e6c6feab5664744f52f06a40f9566b (patch)
tree36f765282701a02191e3731237e36720c1dc65df /lib/Sema/DeclSpec.cpp
parent2d9e21f4675232a39a39611a5b4bb1f4914b2742 (diff)
Make sure we clear TypeSpecOwned when setting TypeSpecType to something when
it might previously have been a tag TST. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112196 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/DeclSpec.cpp')
-rw-r--r--lib/Sema/DeclSpec.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp
index 956775aa63..b46e8af9db 100644
--- a/lib/Sema/DeclSpec.cpp
+++ b/lib/Sema/DeclSpec.cpp
@@ -396,6 +396,7 @@ bool DeclSpec::SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc,
bool DeclSpec::SetTypeSpecError() {
TypeSpecType = TST_error;
+ TypeSpecOwned = false;
TSTLoc = SourceLocation();
return false;
}
@@ -544,6 +545,7 @@ void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) {
TypeSpecType = TST_int;
TypeSpecSign = TSS_unsigned;
TypeSpecWidth = TSW_short;
+ TypeSpecOwned = false;
}
}
@@ -573,6 +575,7 @@ void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) {
: diag::err_invalid_longlong_spec)
<< getSpecifierName((TST)TypeSpecType);
TypeSpecType = TST_int;
+ TypeSpecOwned = false;
}
break;
case TSW_long: // long double, long int
@@ -582,6 +585,7 @@ void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) {
Diag(D, TSWLoc, SrcMgr, diag::err_invalid_long_spec)
<< getSpecifierName((TST)TypeSpecType);
TypeSpecType = TST_int;
+ TypeSpecOwned = false;
}
break;
}
@@ -622,6 +626,8 @@ void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) {
ClearStorageClassSpecs();
}
+ assert(!TypeSpecOwned || isDeclRep((TST) TypeSpecType));
+
// Okay, now we can infer the real type.
// TODO: return "auto function" and other bad things based on the real type.