diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-12 21:17:48 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-12 21:17:48 +0000 |
commit | 1d353bae14855bfcfefa1df230d2e271d00ee919 (patch) | |
tree | 667ab1deadffb4bc2d1ee502e81610389c12913e /lib/Sema | |
parent | 116ed0aba32ceaa14bfbe259328c10e6383b055d (diff) |
make TryFixInvalidVariablyModifiedType a static function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59163 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/Sema.h | 5 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 8 |
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 5b66694e04..6a86a8ab78 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -1307,11 +1307,6 @@ public: void InitBuiltinVaListType(); - // Helper method to turn variable array types into - // constant array types in certain situations which would otherwise - // be errors - QualType TryFixInvalidVariablyModifiedType(QualType T); - //===--------------------------------------------------------------------===// // Extra semantic analysis beyond the C type system private: diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index bab55bf829..1a85bf4686 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2477,7 +2477,11 @@ void Sema::ActOnDefs(Scope *S, SourceLocation DeclStart, CollectIvars(Class, Context, Decls); } -QualType Sema::TryFixInvalidVariablyModifiedType(QualType T) { +/// TryToFixInvalidVariablyModifiedType - Helper method to turn variable array +/// types into constant array types in certain situations which would otherwise +/// be errors (for GCC compatibility). +static QualType TryToFixInvalidVariablyModifiedType(QualType T, + ASTContext &Context) { // This method tries to turn a variable array into a constant // array even when the size isn't an ICE. This is necessary // for compatibility with code that depends on gcc's buggy @@ -2532,7 +2536,7 @@ Sema::DeclTy *Sema::ActOnField(Scope *S, // C99 6.7.2.1p8: A member of a structure or union may have any type other // than a variably modified type. if (T->isVariablyModifiedType()) { - QualType FixedTy = TryFixInvalidVariablyModifiedType(T); + QualType FixedTy = TryToFixInvalidVariablyModifiedType(T, Context); if (!FixedTy.isNull()) { Diag(Loc, diag::warn_illegal_constant_array_size, Loc); T = FixedTy; |