aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-24 22:40:36 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-24 22:40:36 +0000
commita98a28534e48e59d5f7d69adae121589e298dd43 (patch)
tree50205e7384e8a5238d940a7a21ad6751ae7f235c /lib/CodeGen
parentc7b5543ad32a5c265c02e71b2a6f9856440ed13f (diff)
For the purposes of building LLVM types, a forward-declared
enumeration type with a fixed underlying type is complete. Fixes <rdar://problem/10916155>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151403 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
index 03465199a0..2da6cf0f2d 100644
--- a/lib/CodeGen/CodeGenTypes.cpp
+++ b/lib/CodeGen/CodeGenTypes.cpp
@@ -199,8 +199,13 @@ bool CodeGenTypes::isFuncTypeArgumentConvertible(QualType Ty) {
// If it's a tagged type used by-value, but is just a forward decl, we can't
// convert it. Note that getDefinition()==0 is not the same as !isDefinition.
- if (TT->getDecl()->getDefinition() == 0)
+ // The exception is an enumeration type with a fixed underlying type; these
+ // can be converted even if they are forward declarations.
+ if (TT->getDecl()->getDefinition() == 0 &&
+ !(isa<EnumDecl>(TT->getDecl()) &&
+ cast<EnumDecl>(TT->getDecl())->isFixed())) {
return false;
+ }
// If this is an enum, then it is always safe to convert.
const RecordType *RT = dyn_cast<RecordType>(TT);