[cfe-commits] r59163 - in /cfe/trunk/lib/Sema: Sema.h SemaDecl.cpp
Chris Lattner
sabre at nondot.org
Wed Nov 12 13:17:52 PST 2008
Author: lattner
Date: Wed Nov 12 15:17:48 2008
New Revision: 59163
URL: http://llvm.org/viewvc/llvm-project?rev=59163&view=rev
Log:
make TryFixInvalidVariablyModifiedType a static function.
Modified:
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=59163&r1=59162&r2=59163&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Wed Nov 12 15:17:48 2008
@@ -1307,11 +1307,6 @@
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:
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=59163&r1=59162&r2=59163&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Nov 12 15:17:48 2008
@@ -2477,7 +2477,11 @@
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 @@
// 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;
More information about the cfe-commits
mailing list