DeclContext *OldDC = ShadowedDecl->getDeclContext();
+ // Don't warn for this case:
+ //
+ // @code
+ // extern int bob;
+ // void f() {
+ // extern int bob;
+ // }
+ // @endcode
+ if (D->isExternC() && NewDC->isFunctionOrMethod())
+ if (VarDecl *shadowedVar = dyn_cast<VarDecl>(ShadowedDecl))
+ if (shadowedVar->isExternC())
+ return;
+
// Only warn about certain kinds of shadowing for class members.
if (NewDC && NewDC->isRecord()) {
// In particular, don't warn about shadowing non-class members.
void test5(int i);
void test6(void (*f)(int i)) {}
void test7(void *context, void (*callback)(void *context)) {}
+
+// rdar://8883302
+extern int bob;
+void rdar8883302() {
+ extern int bob; // don't warn for shadowing.
+}