[ObjC] Add NSValue support for objc_boxed_expressions
Patch extends ObjCBoxedExpr to accept records (structs and unions):
typedef struct __attribute__((objc_boxable)) _Color {
int r, g, b;
} Color;
Color color;
NSValue *boxedColor = @(color); // [NSValue valueWithBytes:&color objCType:@encode(Color)];
llvm-svn: 240761
diff --git a/clang/lib/Frontend/MultiplexConsumer.cpp b/clang/lib/Frontend/MultiplexConsumer.cpp
index a53f4d2..91ee100 100644
--- a/clang/lib/Frontend/MultiplexConsumer.cpp
+++ b/clang/lib/Frontend/MultiplexConsumer.cpp
@@ -128,6 +128,8 @@
void DeclarationMarkedUsed(const Decl *D) override;
void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) override;
void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) override;
+ void AddedAttributeToRecord(const Attr *Attr,
+ const RecordDecl *Record) override;
private:
std::vector<ASTMutationListener*> Listeners;
@@ -226,6 +228,13 @@
for (auto *L : Listeners)
L->RedefinedHiddenDefinition(D, M);
}
+
+void MultiplexASTMutationListener::AddedAttributeToRecord(
+ const Attr *Attr,
+ const RecordDecl *Record) {
+ for (auto *L : Listeners)
+ L->AddedAttributeToRecord(Attr, Record);
+}
} // end namespace clang