Elimate bogus warning when va_start is correctly used in
a method. llvm-svn: 46232
This commit is contained in:
parent
c505c6792c
commit
7718e36e25
|
@ -64,7 +64,7 @@ void Sema::ObjCActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) {
|
||||||
PI.Ident = PDecl->getIdentifier();
|
PI.Ident = PDecl->getIdentifier();
|
||||||
PI.IdentLoc = PDecl->getLocation(); // user vars have a real location.
|
PI.IdentLoc = PDecl->getLocation(); // user vars have a real location.
|
||||||
PI.TypeInfo = PDecl->getType().getAsOpaquePtr();
|
PI.TypeInfo = PDecl->getType().getAsOpaquePtr();
|
||||||
ActOnParamDeclarator(PI, FnBodyScope);
|
MDecl->setParamDecl(i, ActOnParamDeclarator(PI, FnBodyScope));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,9 @@ public:
|
||||||
assert(i < getNumParams() && "Illegal param #");
|
assert(i < getNumParams() && "Illegal param #");
|
||||||
return ParamInfo[i];
|
return ParamInfo[i];
|
||||||
}
|
}
|
||||||
|
void setParamDecl(int i, ParmVarDecl *pDecl) {
|
||||||
|
ParamInfo[i] = pDecl;
|
||||||
|
}
|
||||||
void setMethodParams(ParmVarDecl **NewParamInfo, unsigned NumParams);
|
void setMethodParams(ParmVarDecl **NewParamInfo, unsigned NumParams);
|
||||||
|
|
||||||
AttributeList *getMethodAttrs() const {return MethodAttrs;}
|
AttributeList *getMethodAttrs() const {return MethodAttrs;}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
// RUN: clang -fsyntax-only -verify %s
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
@interface NSObject @end
|
||||||
|
@interface XX : NSObject @end
|
||||||
|
|
||||||
|
@implementation XX
|
||||||
|
- (void)encodeValuesOfObjCTypes:(const char *)types, ... {
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, types);
|
||||||
|
while (*types) ;
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
@implementation XX
|
@implementation XX
|
||||||
- (void)encodeValuesOfObjCTypes:(const char *)types, ... {
|
- (void)encodeValuesOfObjCTypes:(const char *)types, ... {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, types); // expected-warning {{second parameter of 'va_start' not last named argument}}
|
va_start(ap, types);
|
||||||
while (*types) ;
|
while (*types) ;
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue