Start of a Sema implementation for #pragma weak.  This isn't really the
right approach, but I'm still not sure what the best way to go about this is.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72912 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index a39ff47..18636a4 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -4414,3 +4414,33 @@
   CurContext->addDecl(Context, New);
   return DeclPtrTy::make(New);
 }
+
+void Sema::ActOnPragmaWeakID(IdentifierInfo* Name,
+                             SourceLocation PragmaLoc,
+                             SourceLocation NameLoc) {
+  Decl *PrevDecl = LookupName(TUScope, Name, LookupOrdinaryName);
+
+  // FIXME: This implementation is an ugly hack!
+  if (PrevDecl) {
+    PrevDecl->addAttr(::new (Context) WeakAttr());
+    return;
+  }
+  Diag(PragmaLoc, diag::err_unsupported_pragma_weak);
+  return;
+}
+
+void Sema::ActOnPragmaWeakAlias(IdentifierInfo* Name,
+                                IdentifierInfo* AliasName,
+                                SourceLocation PragmaLoc,
+                                SourceLocation NameLoc,
+                                SourceLocation AliasNameLoc) {
+  Decl *PrevDecl = LookupName(TUScope, Name, LookupOrdinaryName);
+
+  // FIXME: This implementation is an ugly hack!
+  if (PrevDecl) {
+    PrevDecl->addAttr(::new (Context) AliasAttr(AliasName->getName()));
+    return;
+  }
+  Diag(PragmaLoc, diag::err_unsupported_pragma_weak);
+  return;
+}