// NOTE: VC++ treats enums as signed, avoid using the StorageClass enum
unsigned SClass : 2;
bool IsInline : 1;
+ bool IsImplicit : 1;
FunctionDecl(ContextDecl *CD, SourceLocation L,
IdentifierInfo *Id, QualType T,
StorageClass S, bool isInline, ScopedDecl *PrevDecl)
: ValueDecl(Function, CD, L, Id, T, PrevDecl),
ContextDecl(Function),
- ParamInfo(0), Body(0), DeclChain(0), SClass(S), IsInline(isInline) {}
+ ParamInfo(0), Body(0), DeclChain(0), SClass(S),
+ IsInline(isInline), IsImplicit(0) {}
virtual ~FunctionDecl();
public:
static FunctionDecl *Create(ASTContext &C, ContextDecl *CD, SourceLocation L,
Stmt *getBody() const { return Body; }
void setBody(Stmt *B) { Body = B; }
+ bool isImplicit() { return IsImplicit; }
+ void setImplicit() { IsImplicit = true; }
+
ScopedDecl *getDeclChain() const { return DeclChain; }
void setDeclChain(ScopedDecl *D) { DeclChain = D; }
"duplicate declaration of method '%0'")
DIAG(err_previous_declaration, ERROR,
"previous declaration is here")
+DIAG(err_previous_implicit_declaration, ERROR,
+ "previous implicit declaration is here")
DIAG(err_undeclared_protocol, ERROR,
"cannot find protocol declaration for '%0'")
DIAG(err_missing_sel_definition, ERROR,
// A function that has already been declared has been redeclared or defined
// with a different type- show appropriate diagnostic
- diag::kind PrevDiag = Old->getBody() ? diag::err_previous_definition :
- diag::err_previous_declaration;
+ diag::kind PrevDiag;
+ if (Old->getBody())
+ PrevDiag = diag::err_previous_definition;
+ else if (Old->isImplicit())
+ PrevDiag = diag::err_previous_implicit_declaration;
+ else
+ PrevDiag = diag::err_previous_declaration;
// TODO: CHECK FOR CONFLICTS, multiple decls with same name in one scope.
// TODO: This is totally simplistic. It should handle merging functions
while (S->getParent())
S = S->getParent();
- return dyn_cast<ScopedDecl>(static_cast<Decl*>(ActOnDeclarator(S, D, 0)));
+ FunctionDecl *FD =
+ dyn_cast<FunctionDecl>(static_cast<Decl*>(ActOnDeclarator(S, D, 0)));
+ FD->setImplicit();
+ return FD;
}
--- /dev/null
+// RUN: clang %s -verify -fsyntax-only
+
+typedef int int32_t;
+typedef unsigned char Boolean;
+
+void func() {
+ int32_t *vector[16];
+ const char compDesc[16 + 1];
+ int32_t compCount = 0;
+ if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-error{{previous implicit declaration is here}}
+ }
+ return ((void *)0);
+}
+Boolean _CFCalendarDecomposeAbsoluteTimeV(const char *componentDesc, int32_t **vector, int32_t count) { // expected-error{{conflicting types for '_CFCalendarDecomposeAbsoluteTimeV'}}
+ return 0;
+}
+