diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index 635f61b82135..d008b037b0e0 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -254,11 +254,31 @@ Retry: HandlePragmaPack(); return StmtEmpty(); + case tok::annot_pragma_msstruct: + ProhibitAttributes(Attrs); + HandlePragmaMSStruct(); + return StmtEmpty(); + case tok::annot_pragma_align: ProhibitAttributes(Attrs); HandlePragmaAlign(); return StmtEmpty(); + case tok::annot_pragma_weak: + ProhibitAttributes(Attrs); + HandlePragmaWeak(); + return StmtEmpty(); + + case tok::annot_pragma_weakalias: + ProhibitAttributes(Attrs); + HandlePragmaWeakAlias(); + return StmtEmpty(); + + case tok::annot_pragma_redefine_extname: + ProhibitAttributes(Attrs); + HandlePragmaRedefineExtname(); + return StmtEmpty(); + case tok::annot_pragma_fp_contract: ProhibitAttributes(Attrs); HandlePragmaFPContract(); diff --git a/clang/test/CodeGen/pragma-weak.c b/clang/test/CodeGen/pragma-weak.c index 7ad2b77d8e7e..2efc2ebc28d8 100644 --- a/clang/test/CodeGen/pragma-weak.c +++ b/clang/test/CodeGen/pragma-weak.c @@ -157,6 +157,15 @@ void PR10878() { SHA384Pad(0); } // CHECK: call void @SHA384Pad(i8* null) +// PR14046: Parse #pragma weak in function-local context +extern int PR14046e(void); +void PR14046f() { +#pragma weak PR14046e + PR14046e(); +} +// CHECK: declare extern_weak i32 @PR14046e() + + ///////////// TODO: stuff that still doesn't work // due to the fact that disparate TopLevelDecls cannot affect each other