[cfe-commits] r84913 - /cfe/trunk/lib/Sema/SemaDecl.cpp
John McCall
rjmccall at apple.com
Thu Oct 22 16:31:09 PDT 2009
Author: rjmccall
Date: Thu Oct 22 18:31:08 2009
New Revision: 84913
URL: http://llvm.org/viewvc/llvm-project?rev=84913&view=rev
Log:
Preserve source information for anonymous struct/union declarations.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=84913&r1=84912&r2=84913&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Oct 22 18:31:08 2009
@@ -1529,14 +1529,19 @@
Invalid = true;
}
+ // Mock up a declarator.
+ Declarator Dc(DS, Declarator::TypeNameContext);
+ DeclaratorInfo *DInfo = 0;
+ GetTypeForDeclarator(Dc, S, &DInfo);
+ assert(DInfo && "couldn't build declarator info for anonymous struct/union");
+
// Create a declaration for this anonymous struct/union.
NamedDecl *Anon = 0;
if (RecordDecl *OwningClass = dyn_cast<RecordDecl>(Owner)) {
Anon = FieldDecl::Create(Context, OwningClass, Record->getLocation(),
/*IdentifierInfo=*/0,
Context.getTypeDeclType(Record),
- // FIXME: Type source info.
- /*DInfo=*/0,
+ DInfo,
/*BitWidth=*/0, /*Mutable=*/false);
Anon->setAccess(AS_public);
if (getLangOptions().CPlusPlus)
@@ -1563,8 +1568,7 @@
Anon = VarDecl::Create(Context, Owner, Record->getLocation(),
/*IdentifierInfo=*/0,
Context.getTypeDeclType(Record),
- // FIXME: Type source info.
- /*DInfo=*/0,
+ DInfo,
SC);
}
Anon->setImplicit();
More information about the cfe-commits
mailing list