aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-06-05 02:44:36 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-06-05 02:44:36 +0000
commitc49f19b6d39c5de71755a4be7c41f835c3e132f8 (patch)
tree5ba6650da96b3947505bc857f6fd821805982afb /lib/Sema/SemaDecl.cpp
parent9bff9a91fbd6213e2d042aadd8ede92bed6be666 (diff)
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
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index a39ff47cdb..18636a4ab1 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -4414,3 +4414,33 @@ Sema::DeclPtrTy Sema::ActOnFileScopeAsmDecl(SourceLocation Loc,
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;
+}