[cfe-commits] r94434 - in /cfe/trunk: lib/CodeGen/CGDeclCXX.cpp test/CodeGenCXX/reference-init.cpp
Fariborz Jahanian
fjahanian at apple.com
Mon Jan 25 10:30:27 PST 2010
Author: fjahanian
Date: Mon Jan 25 12:30:26 2010
New Revision: 94434
URL: http://llvm.org/viewvc/llvm-project?rev=94434&view=rev
Log:
Fix a code gen. bug involving compiling global references.
(fixes radar 7574896).
Modified:
cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
cfe/trunk/test/CodeGenCXX/reference-init.cpp
Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=94434&r1=94433&r2=94434&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Mon Jan 25 12:30:26 2010
@@ -80,8 +80,8 @@
EmitDeclInit(*this, D, DeclPtr);
return;
}
-
- ErrorUnsupported(Init, "global variable that binds to a reference");
+ RValue RV = EmitReferenceBindingToExpr(Init, T, /*IsInitializer=*/true);
+ EmitStoreOfScalar(RV.getScalarVal(), DeclPtr, false, T);
}
void
Modified: cfe/trunk/test/CodeGenCXX/reference-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/reference-init.cpp?rev=94434&r1=94433&r2=94434&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/reference-init.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/reference-init.cpp Mon Jan 25 12:30:26 2010
@@ -14,3 +14,8 @@
int iarr[] = { 1 };
int test() { return f(iarr); }
}
+
+// radar 7574896
+struct Foo { int foo; };
+Foo& ignoreSetMutex = *(new Foo);
+
More information about the cfe-commits
mailing list