Fix a potential null-pointer use, and fix the style of my new function.

Thanks, Anton!

llvm-svn: 95821
This commit is contained in:
Charles Davis 2010-02-10 23:26:12 +00:00
parent bbc0aa5166
commit 42b3842429
1 changed files with 2 additions and 2 deletions

View File

@ -83,10 +83,10 @@ static void HandleX86ForceAlignArgPointerAttr(Decl *D,
// do anything, either. It doesn't matter anyway, because there's nothing // do anything, either. It doesn't matter anyway, because there's nothing
// special about calling a force_align_arg_pointer function. // special about calling a force_align_arg_pointer function.
ValueDecl* VD = dyn_cast<ValueDecl>(D); ValueDecl* VD = dyn_cast<ValueDecl>(D);
if(VD->getType()->isFunctionPointerType()) if (VD && VD->getType()->isFunctionPointerType())
return; return;
// Attribute can only be applied to function types. // Attribute can only be applied to function types.
if(!isa<FunctionDecl>(D)) { if (!isa<FunctionDecl>(D)) {
S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
<< Attr.getName() << /* function */0; << Attr.getName() << /* function */0;
return; return;