[cfe-commits] r46232 - in /cfe/trunk: Sema/SemaDeclObjC.cpp include/clang/AST/DeclObjC.h test/Sema/va-method-1.m test/Sema/va-method.m
Fariborz Jahanian
fjahanian at apple.com
Mon Jan 21 14:59:53 PST 2008
Author: fjahanian
Date: Mon Jan 21 16:59:53 2008
New Revision: 46232
URL: http://llvm.org/viewvc/llvm-project?rev=46232&view=rev
Log:
Elimate bogus warning when va_start is correctly used in
a method.
Added:
cfe/trunk/test/Sema/va-method-1.m
Modified:
cfe/trunk/Sema/SemaDeclObjC.cpp
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/test/Sema/va-method.m
Modified: cfe/trunk/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDeclObjC.cpp?rev=46232&r1=46231&r2=46232&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/Sema/SemaDeclObjC.cpp Mon Jan 21 16:59:53 2008
@@ -64,7 +64,7 @@
PI.Ident = PDecl->getIdentifier();
PI.IdentLoc = PDecl->getLocation(); // user vars have a real location.
PI.TypeInfo = PDecl->getType().getAsOpaquePtr();
- ActOnParamDeclarator(PI, FnBodyScope);
+ MDecl->setParamDecl(i, ActOnParamDeclarator(PI, FnBodyScope));
}
}
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=46232&r1=46231&r2=46232&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Mon Jan 21 16:59:53 2008
@@ -135,6 +135,9 @@
assert(i < getNumParams() && "Illegal param #");
return ParamInfo[i];
}
+ void setParamDecl(int i, ParmVarDecl *pDecl) {
+ ParamInfo[i] = pDecl;
+ }
void setMethodParams(ParmVarDecl **NewParamInfo, unsigned NumParams);
AttributeList *getMethodAttrs() const {return MethodAttrs;}
Added: cfe/trunk/test/Sema/va-method-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/va-method-1.m?rev=46232&view=auto
==============================================================================
--- cfe/trunk/test/Sema/va-method-1.m (added)
+++ cfe/trunk/test/Sema/va-method-1.m Mon Jan 21 16:59:53 2008
@@ -0,0 +1,17 @@
+// RUN: clang -fsyntax-only -verify %s
+
+#include <stdarg.h>
+
+ at interface NSObject @end
+ at interface XX : NSObject @end
+
+ at implementation XX
+- (void)encodeValuesOfObjCTypes:(const char *)types, ... {
+ va_list ap;
+ va_start(ap, types);
+ while (*types) ;
+ va_end(ap);
+}
+
+ at end
+
Modified: cfe/trunk/test/Sema/va-method.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/va-method.m?rev=46232&r1=46231&r2=46232&view=diff
==============================================================================
--- cfe/trunk/test/Sema/va-method.m (original)
+++ cfe/trunk/test/Sema/va-method.m Mon Jan 21 16:59:53 2008
@@ -8,7 +8,7 @@
@implementation XX
- (void)encodeValuesOfObjCTypes:(const char *)types, ... {
va_list ap;
- va_start(ap, types); // expected-warning {{second parameter of 'va_start' not last named argument}}
+ va_start(ap, types);
while (*types) ;
va_end(ap);
}
More information about the cfe-commits
mailing list