stop calling II::getName() unnecesarily in sema

llvm-svn: 59609
This commit is contained in:
Chris Lattner 2008-11-19 08:23:25 +00:00
parent 6ef2bc4b42
commit 4bd8dd8568
10 changed files with 146 additions and 167 deletions

View File

@ -88,6 +88,7 @@ public:
/// push - Push the current alignment onto the stack, optionally
/// using the given \arg Name for the record, if non-zero,
void push(IdentifierInfo *Name) {
// FIXME: Why does this push 'Name' as an std::string??
Stack.push_back(std::make_pair(Alignment,
std::string(Name ? Name->getName() : "")));
}

View File

@ -98,9 +98,9 @@ Sema::CXXScopeTy *Sema::ActOnCXXNestedNameSpecifier(Scope *S,
DiagID = diag::err_undeclared_var_use;
if (DC)
Diag(IdLoc, DiagID, II.getName(), SS.getRange());
Diag(IdLoc, DiagID) << &II << SS.getRange();
else
Diag(IdLoc, DiagID, II.getName());
Diag(IdLoc, DiagID) << &II;
return 0;
}

View File

@ -716,9 +716,8 @@ Sema::CheckReturnStackAddr(Expr *RetValExp, QualType lhsType,
// Perform checking for returned stack addresses.
if (lhsType->isPointerType() || lhsType->isBlockPointerType()) {
if (DeclRefExpr *DR = EvalAddr(RetValExp))
Diag(DR->getLocStart(), diag::warn_ret_stack_addr,
DR->getDecl()->getIdentifier()->getName(),
RetValExp->getSourceRange());
Diag(DR->getLocStart(), diag::warn_ret_stack_addr)
<< DR->getDecl()->getIdentifier() << RetValExp->getSourceRange();
// Skip over implicit cast expressions when checking for block expressions.
if (ImplicitCastExpr *IcExpr =
@ -734,7 +733,7 @@ Sema::CheckReturnStackAddr(Expr *RetValExp, QualType lhsType,
// Check for a reference to the stack
if (DeclRefExpr *DR = EvalVal(RetValExp))
Diag(DR->getLocStart(), diag::warn_ret_stack_ref)
<< DR->getDecl()->getIdentifier()->getName()
<< DR->getDecl()->getIdentifier()
<< RetValExp->getSourceRange();
}
}

View File

@ -1127,8 +1127,8 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
CheckExtraCXXDefaultArguments(D);
if (R.getTypePtr()->isObjCInterfaceType()) {
Diag(D.getIdentifierLoc(), diag::err_statically_allocated_object,
D.getIdentifier()->getName());
Diag(D.getIdentifierLoc(), diag::err_statically_allocated_object)
<< D.getIdentifier();
InvalidDecl = true;
}
@ -2032,8 +2032,8 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
if (!FTI.hasPrototype) {
for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) {
if (FTI.ArgInfo[i].Param == 0) {
Diag(FTI.ArgInfo[i].IdentLoc, diag::ext_param_not_declared,
FTI.ArgInfo[i].Ident->getName());
Diag(FTI.ArgInfo[i].IdentLoc, diag::ext_param_not_declared)
<< FTI.ArgInfo[i].Ident;
// Implicitly declare the argument as type 'int' for lack of a better
// type.
DeclSpec DS;
@ -2129,9 +2129,9 @@ ScopedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc,
IdentifierInfo &II, Scope *S) {
// Extension in C99. Legal in C90, but warn about it.
if (getLangOptions().C99)
Diag(Loc, diag::ext_implicit_function_decl, II.getName());
Diag(Loc, diag::ext_implicit_function_decl) << &II;
else
Diag(Loc, diag::warn_implicit_function_decl, II.getName());
Diag(Loc, diag::warn_implicit_function_decl) << &II;
// FIXME: handle stuff like:
// void foo() { extern float X(); }
@ -2222,8 +2222,7 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagType, TagKind TK,
// A tag 'foo::bar' must already exist.
if (PrevDecl == 0) {
Diag(NameLoc, diag::err_not_tag_in_scope, Name->getName(),
SS.getRange());
Diag(NameLoc, diag::err_not_tag_in_scope) << Name << SS.getRange();
Name = 0;
goto CreateNewDecl;
}
@ -2245,7 +2244,7 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagType, TagKind TK,
// Make sure that this wasn't declared as an enum and now used as a
// struct or something similar.
if (PrevTagDecl->getTagKind() != Kind) {
Diag(KWLoc, diag::err_use_with_wrong_tag, Name->getName());
Diag(KWLoc, diag::err_use_with_wrong_tag) << Name;
Diag(PrevDecl->getLocation(), diag::err_previous_use);
// Recover by making this an anonymous redefinition.
Name = 0;
@ -2257,7 +2256,7 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagType, TagKind TK,
// Diagnose attempts to redefine a tag.
if (PrevTagDecl->isDefinition()) {
Diag(NameLoc, diag::err_redefinition, Name->getName());
Diag(NameLoc, diag::err_redefinition) << Name;
Diag(PrevDecl->getLocation(), diag::err_previous_definition);
// If this is a redefinition, recover by making this struct be
// anonymous, which will make any later references get the previous
@ -2279,7 +2278,7 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagType, TagKind TK,
if (isDeclInScope(PrevDecl, DC, S)) {
// The tag name clashes with a namespace name, issue an error and
// recover by making this tag be anonymous.
Diag(NameLoc, diag::err_redefinition_different_kind, Name->getName());
Diag(NameLoc, diag::err_redefinition_different_kind) << Name;
Diag(PrevDecl->getLocation(), diag::err_previous_definition);
Name = 0;
}
@ -2359,8 +2358,7 @@ Sema::DeclTy *Sema::ActOnTagStruct(Scope *S, TagDecl::TagKind Kind, TagKind TK,
// A tag 'foo::bar' must already exist.
if (PrevDecl == 0) {
Diag(NameLoc, diag::err_not_tag_in_scope, Name->getName(),
SS.getRange());
Diag(NameLoc, diag::err_not_tag_in_scope) << Name << SS.getRange();
Name = 0;
goto CreateNewDecl;
}
@ -2383,7 +2381,7 @@ Sema::DeclTy *Sema::ActOnTagStruct(Scope *S, TagDecl::TagKind Kind, TagKind TK,
// Make sure that this wasn't declared as an enum and now used as a
// struct or something similar.
if (PrevTagDecl->getTagKind() != Kind) {
Diag(KWLoc, diag::err_use_with_wrong_tag, Name->getName());
Diag(KWLoc, diag::err_use_with_wrong_tag) << Name;
Diag(PrevDecl->getLocation(), diag::err_previous_use);
// Recover by making this an anonymous redefinition.
Name = 0;
@ -2403,7 +2401,7 @@ Sema::DeclTy *Sema::ActOnTagStruct(Scope *S, TagDecl::TagKind Kind, TagKind TK,
// Diagnose attempts to redefine a tag.
if (RecordDecl* DefRecord =
cast<RecordDecl>(PrevTagDecl)->getDefinition(Context)) {
Diag(NameLoc, diag::err_redefinition, Name->getName());
Diag(NameLoc, diag::err_redefinition) << Name;
Diag(DefRecord->getLocation(), diag::err_previous_definition);
// If this is a redefinition, recover by making this struct be
// anonymous, which will make any later references get the previous
@ -2430,7 +2428,7 @@ Sema::DeclTy *Sema::ActOnTagStruct(Scope *S, TagDecl::TagKind Kind, TagKind TK,
if (isDeclInScope(PrevDecl, DC, S)) {
// The tag name clashes with a namespace name, issue an error and
// recover by making this tag be anonymous.
Diag(NameLoc, diag::err_redefinition_different_kind, Name->getName());
Diag(NameLoc, diag::err_redefinition_different_kind) << Name;
Diag(PrevDecl->getLocation(), diag::err_previous_definition);
Name = 0;
}
@ -2520,7 +2518,7 @@ void Sema::ActOnDefs(Scope *S, SourceLocation DeclStart,
// Check that ClassName is a valid class
ObjCInterfaceDecl *Class = getObjCInterfaceDecl(ClassName);
if (!Class) {
Diag(DeclStart, diag::err_undef_interface, ClassName->getName());
Diag(DeclStart, diag::err_undef_interface) << ClassName;
return;
}
// Collect the instance variables
@ -2802,7 +2800,7 @@ void Sema::ActOnFields(Scope* S,
if (IdentifierInfo *II = FD->getIdentifier()) {
// Detect duplicate member names.
if (!FieldIDs.insert(II)) {
Diag(FD->getLocation(), diag::err_duplicate_member, II->getName());
Diag(FD->getLocation(), diag::err_duplicate_member) << II;
// Find the previous decl.
SourceLocation PrevLoc;
for (unsigned i = 0; ; ++i) {
@ -2867,9 +2865,9 @@ Sema::DeclTy *Sema::ActOnEnumConstant(Scope *S, DeclTy *theEnumDecl,
"Received TagDecl when not in C++!");
if (!isa<TagDecl>(PrevDecl) && isDeclInScope(PrevDecl, CurContext, S)) {
if (isa<EnumConstantDecl>(PrevDecl))
Diag(IdLoc, diag::err_redefinition_of_enumerator, Id->getName());
Diag(IdLoc, diag::err_redefinition_of_enumerator) << Id;
else
Diag(IdLoc, diag::err_redefinition, Id->getName());
Diag(IdLoc, diag::err_redefinition) << Id;
Diag(PrevDecl->getLocation(), diag::err_previous_definition);
delete Val;
return 0;
@ -2885,8 +2883,7 @@ Sema::DeclTy *Sema::ActOnEnumConstant(Scope *S, DeclTy *theEnumDecl,
// C99 6.7.2.2p2: Make sure we have an integer constant expression.
SourceLocation ExpLoc;
if (!Val->isIntegerConstantExpr(EnumVal, Context, &ExpLoc)) {
Diag(ExpLoc, diag::err_enum_value_not_integer_constant_expr,
Id->getName());
Diag(ExpLoc, diag::err_enum_value_not_integer_constant_expr) << Id;
delete Val;
Val = 0; // Just forget about it.
} else {
@ -3200,7 +3197,7 @@ bool PragmaPackStack::pop(IdentifierInfo *Name) {
// Otherwise, find the named record.
for (unsigned i = Stack.size(); i != 0; ) {
--i;
if (strcmp(Stack[i].second.c_str(), Name->getName()) == 0) {
if (Name->isName(Stack[i].second.c_str())) {
// Found it, pop up to and including this record.
Alignment = Stack[i].first;
Stack.erase(Stack.begin() + i, Stack.end());

View File

@ -145,7 +145,7 @@ static void HandleExtVectorTypeAttr(Decl *d, const AttributeList &Attr,
QualType curType = tDecl->getUnderlyingType();
// check the attribute arguments.
if (Attr.getNumArgs() != 1) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "1";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
return;
}
Expr *sizeExpr = static_cast<Expr *>(Attr.getArg(0));
@ -200,7 +200,7 @@ static void HandleVectorSizeAttr(Decl *D, const AttributeList &Attr, Sema &S) {
// Check the attribute arugments.
if (Attr.getNumArgs() != 1) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "1";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
return;
}
Expr *sizeExpr = static_cast<Expr *>(Attr.getArg(0));
@ -262,7 +262,7 @@ static void HandleVectorSizeAttr(Decl *D, const AttributeList &Attr, Sema &S) {
static void HandlePackedAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() > 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -274,18 +274,17 @@ static void HandlePackedAttr(Decl *d, const AttributeList &Attr, Sema &S) {
if (!FD->getType()->isIncompleteType() &&
S.Context.getTypeAlign(FD->getType()) <= 8)
S.Diag(Attr.getLoc(), diag::warn_attribute_ignored_for_field_of_type)
<< Attr.getName()->getName() << FD->getType().getAsString();
<< Attr.getName() << FD->getType().getAsString();
else
FD->addAttr(new PackedAttr(1));
} else
S.Diag(Attr.getLoc(), diag::warn_attribute_ignored)
<< Attr.getName()->getName();
S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
}
static void HandleIBOutletAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() > 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -370,7 +369,7 @@ static void HandleNonNullAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleAliasAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 1) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "1";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
return;
}
@ -380,7 +379,7 @@ static void HandleAliasAttr(Decl *d, const AttributeList &Attr, Sema &S) {
if (Str == 0 || Str->isWide()) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string)
<< "alias" << "1";
<< "alias" << 1;
return;
}
@ -396,7 +395,7 @@ static void HandleAlwaysInlineAttr(Decl *d, const AttributeList &Attr,
Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -406,7 +405,7 @@ static void HandleAlwaysInlineAttr(Decl *d, const AttributeList &Attr,
static void HandleNoReturnAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -422,7 +421,7 @@ static void HandleNoReturnAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleUnusedAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -449,7 +448,7 @@ static void HandleConstructorAttr(Decl *d, const AttributeList &Attr, Sema &S) {
llvm::APSInt Idx(32);
if (!E->isIntegerConstantExpr(Idx, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int)
<< "constructor" << "1" << E->getSourceRange();
<< "constructor" << 1 << E->getSourceRange();
return;
}
priority = Idx.getZExtValue();
@ -479,7 +478,7 @@ static void HandleDestructorAttr(Decl *d, const AttributeList &Attr, Sema &S) {
llvm::APSInt Idx(32);
if (!E->isIntegerConstantExpr(Idx, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int)
<< "destructor" << "1" << E->getSourceRange();
<< "destructor" << 1 << E->getSourceRange();
return;
}
priority = Idx.getZExtValue();
@ -497,7 +496,7 @@ static void HandleDestructorAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleDeprecatedAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -507,7 +506,7 @@ static void HandleDeprecatedAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleVisibilityAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 1) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "1";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
return;
}
@ -517,7 +516,7 @@ static void HandleVisibilityAttr(Decl *d, const AttributeList &Attr, Sema &S) {
if (Str == 0 || Str->isWide()) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string)
<< "visibility" << "1";
<< "visibility" << 1;
return;
}
@ -545,28 +544,24 @@ static void HandleVisibilityAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleObjCGCAttr(Decl *d, const AttributeList &Attr, Sema &S) {
if (!Attr.getParameterName()) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string)
<< "objc_gc" << "1";
<< "objc_gc" << 1;
return;
}
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
<< "1";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
return;
}
const char *TypeStr = Attr.getParameterName()->getName();
unsigned TypeLen = Attr.getParameterName()->getLength();
ObjCGCAttr::GCAttrTypes type;
if (TypeLen == 4 && !memcmp(TypeStr, "weak", 4))
if (Attr.getParameterName()->isName("weak"))
type = ObjCGCAttr::Weak;
else if (TypeLen == 6 && !memcmp(TypeStr, "strong", 6))
else if (Attr.getParameterName()->isName("strong"))
type = ObjCGCAttr::Strong;
else {
S.Diag(Attr.getLoc(), diag::warn_attribute_type_not_supported)
<< "objc_gc" << TypeStr;
<< "objc_gc" << Attr.getParameterName();
return;
}
@ -576,25 +571,21 @@ static void HandleObjCGCAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleBlocksAttr(Decl *d, const AttributeList &Attr, Sema &S) {
if (!Attr.getParameterName()) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string)
<< "blocks" << "1";
<< "blocks" << 1;
return;
}
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
<< "1";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
return;
}
const char *TypeStr = Attr.getParameterName()->getName();
unsigned TypeLen = Attr.getParameterName()->getLength();
BlocksAttr::BlocksAttrTypes type;
if (TypeLen == 5 && !memcmp(TypeStr, "byref", 5))
if (Attr.getParameterName()->isName("byref"))
type = BlocksAttr::ByRef;
else {
S.Diag(Attr.getLoc(), diag::warn_attribute_type_not_supported)
<< "blocks" << TypeStr;
<< "blocks" << Attr.getParameterName();
return;
}
@ -615,7 +606,7 @@ static void HandleSentinelAttr(Decl *d, const AttributeList &Attr, Sema &S) {
llvm::APSInt Idx(32);
if (!E->isIntegerConstantExpr(Idx, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int)
<< "sentinel" << "1" << E->getSourceRange();
<< "sentinel" << 1 << E->getSourceRange();
return;
}
sentinel = Idx.getZExtValue();
@ -633,7 +624,7 @@ static void HandleSentinelAttr(Decl *d, const AttributeList &Attr, Sema &S) {
llvm::APSInt Idx(32);
if (!E->isIntegerConstantExpr(Idx, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int)
<< "sentinel" << "2" << E->getSourceRange();
<< "sentinel" << 2 << E->getSourceRange();
return;
}
nullPos = Idx.getZExtValue();
@ -670,7 +661,7 @@ static void HandleSentinelAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleWeakAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -680,7 +671,7 @@ static void HandleWeakAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleDLLImportAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -690,7 +681,7 @@ static void HandleDLLImportAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleDLLExportAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -700,7 +691,7 @@ static void HandleDLLExportAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleStdCallAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -710,7 +701,7 @@ static void HandleStdCallAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleFastCallAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -720,7 +711,7 @@ static void HandleFastCallAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleNothrowAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -730,7 +721,7 @@ static void HandleNothrowAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleConstAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -740,7 +731,7 @@ static void HandleConstAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandlePureAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -753,12 +744,12 @@ static void HandleFormatAttr(Decl *d, const AttributeList &Attr, Sema &S) {
if (!Attr.getParameterName()) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_string)
<< "format" << "1";
<< "format" << 1;
return;
}
if (Attr.getNumArgs() != 2) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "3";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 3;
return;
}
@ -812,13 +803,13 @@ static void HandleFormatAttr(Decl *d, const AttributeList &Attr, Sema &S) {
llvm::APSInt Idx(32);
if (!IdxExpr->isIntegerConstantExpr(Idx, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int)
<< "format" << "2" << IdxExpr->getSourceRange();
<< "format" << 2 << IdxExpr->getSourceRange();
return;
}
if (Idx.getZExtValue() < FirstIdx || Idx.getZExtValue() > NumArgs) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_out_of_bounds)
<< "format" << "2" << IdxExpr->getSourceRange();
<< "format" << 2 << IdxExpr->getSourceRange();
return;
}
@ -858,7 +849,7 @@ static void HandleFormatAttr(Decl *d, const AttributeList &Attr, Sema &S) {
llvm::APSInt FirstArg(32);
if (!FirstArgExpr->isIntegerConstantExpr(FirstArg, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_not_int)
<< "format" << "3" << FirstArgExpr->getSourceRange();
<< "format" << 3 << FirstArgExpr->getSourceRange();
return;
}
@ -872,8 +863,8 @@ static void HandleFormatAttr(Decl *d, const AttributeList &Attr, Sema &S) {
}
}
// strftime requires FirstArg to be 0 because it doesn't read from any variable
// the input is just the current time + the format string
// strftime requires FirstArg to be 0 because it doesn't read from any
// variable the input is just the current time + the format string.
if (is_strftime) {
if (FirstArg != 0) {
S.Diag(Attr.getLoc(), diag::err_format_strftime_third_parameter)
@ -883,7 +874,7 @@ static void HandleFormatAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// if 0 it disables parameter checking (to use with e.g. va_list)
} else if (FirstArg != 0 && FirstArg != NumArgs) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_out_of_bounds)
<< "format" << "3" << FirstArgExpr->getSourceRange();
<< "format" << 3 << FirstArgExpr->getSourceRange();
return;
}
@ -895,7 +886,7 @@ static void HandleTransparentUnionAttr(Decl *d, const AttributeList &Attr,
Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -932,7 +923,7 @@ static void HandleTransparentUnionAttr(Decl *d, const AttributeList &Attr,
static void HandleAnnotateAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() != 1) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "1";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
return;
}
Expr *argExpr = static_cast<Expr *>(Attr.getArg(0));
@ -951,7 +942,7 @@ static void HandleAnnotateAttr(Decl *d, const AttributeList &Attr, Sema &S) {
static void HandleAlignedAttr(Decl *d, const AttributeList &Attr, Sema &S) {
// check the attribute arguments.
if (Attr.getNumArgs() > 1) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "1";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
return;
}
@ -986,7 +977,7 @@ static void HandleModeAttr(Decl *D, const AttributeList &Attr, Sema &S) {
// Check that there aren't any arguments
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << "0";
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
return;
}
@ -1048,10 +1039,10 @@ static void HandleModeAttr(Decl *D, const AttributeList &Attr, Sema &S) {
QualType NewTy;
switch (DestWidth) {
case 0:
S.Diag(Attr.getLoc(), diag::err_unknown_machine_mode) << Name->getName();
S.Diag(Attr.getLoc(), diag::err_unknown_machine_mode) << Name;
return;
default:
S.Diag(Attr.getLoc(), diag::err_unsupported_machine_mode) <<Name->getName();
S.Diag(Attr.getLoc(), diag::err_unsupported_machine_mode) << Name;
return;
case 8:
assert(IntegerMode);

View File

@ -644,13 +644,13 @@ Sema::ActOnMemInitializer(DeclTy *ConstructorD,
// It didn't name a member, so see if it names a class.
TypeTy *BaseTy = isTypeName(*MemberOrBase, S, 0/*SS*/);
if (!BaseTy)
return Diag(IdLoc, diag::err_mem_init_not_member_or_class,
MemberOrBase->getName(), SourceRange(IdLoc, RParenLoc));
return Diag(IdLoc, diag::err_mem_init_not_member_or_class)
<< MemberOrBase << SourceRange(IdLoc, RParenLoc);
QualType BaseType = Context.getTypeDeclType((TypeDecl *)BaseTy);
if (!BaseType->isRecordType())
return Diag(IdLoc, diag::err_base_init_does_not_name_class,
BaseType.getAsString(), SourceRange(IdLoc, RParenLoc));
return Diag(IdLoc, diag::err_base_init_does_not_name_class)
<< BaseType.getAsString() << SourceRange(IdLoc, RParenLoc);
// C++ [class.base.init]p2:
// [...] Unless the mem-initializer-id names a nonstatic data
@ -697,8 +697,8 @@ Sema::ActOnMemInitializer(DeclTy *ConstructorD,
// a direct non-virtual base class and an inherited virtual base
// class, the mem-initializer is ill-formed.
if (DirectBaseSpec && VirtualBaseSpec)
return Diag(IdLoc, diag::err_base_init_direct_and_virtual,
MemberOrBase->getName(), SourceRange(IdLoc, RParenLoc));
return Diag(IdLoc, diag::err_base_init_direct_and_virtual)
<< MemberOrBase << SourceRange(IdLoc, RParenLoc);
return new CXXBaseOrMemberInitializer(BaseType, (Expr **)Args, NumArgs);
}

View File

@ -67,8 +67,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
// Check for another declaration kind with the same name.
Decl *PrevDecl = LookupDecl(ClassName, Decl::IDNS_Ordinary, TUScope);
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
Diag(ClassLoc, diag::err_redefinition_different_kind)
<< ClassName->getName();
Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName;
Diag(PrevDecl->getLocation(), diag::err_previous_definition);
}
@ -100,20 +99,20 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
// Check if a different kind of symbol declared in this scope.
PrevDecl = LookupDecl(SuperName, Decl::IDNS_Ordinary, TUScope);
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
Diag(SuperLoc, diag::err_redefinition_different_kind)
<< SuperName->getName();
Diag(SuperLoc, diag::err_redefinition_different_kind) << SuperName;
Diag(PrevDecl->getLocation(), diag::err_previous_definition);
}
else {
// Check that super class is previously defined
SuperClassEntry = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
if (!SuperClassEntry || SuperClassEntry->isForwardDecl()) {
if (!SuperClassEntry)
Diag(SuperLoc, diag::err_undef_superclass)
<< (SuperClassEntry ? SuperClassEntry->getName()
: SuperName->getName())
<< ClassName->getName() << SourceRange(AtInterfaceLoc, ClassLoc);
}
<< SuperName << ClassName << SourceRange(AtInterfaceLoc, ClassLoc);
else if (SuperClassEntry->isForwardDecl())
Diag(SuperLoc, diag::err_undef_superclass)
<< SuperClassEntry->getName() << ClassName
<< SourceRange(AtInterfaceLoc, ClassLoc);
}
IDecl->setSuperClass(SuperClassEntry);
IDecl->setSuperClassLoc(SuperLoc);
@ -147,8 +146,7 @@ Sema::DeclTy *Sema::ActOnCompatiblityAlias(SourceLocation AtLoc,
Diag(ADecl->getLocation(), diag::warn_previous_declaration);
}
else {
Diag(AliasLocation, diag::err_conflicting_aliasing_type)
<< AliasName->getName();
Diag(AliasLocation, diag::err_conflicting_aliasing_type) << AliasName;
Diag(ADecl->getLocation(), diag::err_previous_declaration);
}
return 0;
@ -157,7 +155,7 @@ Sema::DeclTy *Sema::ActOnCompatiblityAlias(SourceLocation AtLoc,
Decl *CDeclU = LookupDecl(ClassName, Decl::IDNS_Ordinary, TUScope);
ObjCInterfaceDecl *CDecl = dyn_cast_or_null<ObjCInterfaceDecl>(CDeclU);
if (CDecl == 0) {
Diag(ClassLocation, diag::warn_undef_interface) << ClassName->getName();
Diag(ClassLocation, diag::warn_undef_interface) << ClassName;
if (CDeclU)
Diag(CDeclU->getLocation(), diag::warn_previous_declaration);
return 0;
@ -189,8 +187,7 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
if (PDecl) {
// Protocol already seen. Better be a forward protocol declaration
if (!PDecl->isForwardDecl()) {
Diag(ProtocolLoc, diag::err_duplicate_protocol_def)
<< ProtocolName->getName();
Diag(ProtocolLoc, diag::err_duplicate_protocol_def) << ProtocolName;
// Just return the protocol we already had.
// FIXME: don't leak the objects passed in!
return PDecl;
@ -226,7 +223,7 @@ Sema::FindProtocolDeclaration(bool WarnOnDeclarations,
ObjCProtocolDecl *PDecl = ObjCProtocols[ProtocolId[i].first];
if (!PDecl) {
Diag(ProtocolId[i].second, diag::err_undeclared_protocol)
<< ProtocolId[i].first->getName();
<< ProtocolId[i].first;
continue;
}
@ -234,7 +231,7 @@ Sema::FindProtocolDeclaration(bool WarnOnDeclarations,
// case, do it.
if (WarnOnDeclarations && PDecl->isForwardDecl())
Diag(ProtocolId[i].second, diag::warn_undef_protocolref)
<< ProtocolId[i].first->getName();
<< ProtocolId[i].first;
Protocols.push_back(PDecl);
}
}
@ -400,7 +397,7 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
/// Check that class of this category is already completely declared.
if (!IDecl || IDecl->isForwardDecl())
Diag(ClassLoc, diag::err_undef_interface) << ClassName->getName();
Diag(ClassLoc, diag::err_undef_interface) << ClassName;
else {
/// Check for duplicate interface declaration for this category
ObjCCategoryDecl *CDeclChain;
@ -408,7 +405,7 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
CDeclChain = CDeclChain->getNextClassCategory()) {
if (CategoryName && CDeclChain->getIdentifier() == CategoryName) {
Diag(CategoryLoc, diag::warn_dup_category_def)
<< ClassName->getName() << CategoryName->getName();
<< ClassName << CategoryName;
break;
}
}
@ -437,7 +434,7 @@ Sema::DeclTy *Sema::ActOnStartCategoryImplementation(
ObjCCategoryImplDecl::Create(Context, AtCatImplLoc, CatName, IDecl);
/// Check that class of this category is already completely declared.
if (!IDecl || IDecl->isForwardDecl())
Diag(ClassLoc, diag::err_undef_interface) << ClassName->getName();
Diag(ClassLoc, diag::err_undef_interface) << ClassName;
/// TODO: Check that CatName, category name, is not used in another
// implementation.
@ -456,15 +453,14 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation(
// Check for another declaration kind with the same name.
Decl *PrevDecl = LookupDecl(ClassName, Decl::IDNS_Ordinary, TUScope);
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
Diag(ClassLoc, diag::err_redefinition_different_kind,
ClassName->getName());
Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName;
Diag(PrevDecl->getLocation(), diag::err_previous_definition);
}
else {
// Is there an interface declaration of this class; if not, warn!
IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
if (!IDecl)
Diag(ClassLoc, diag::warn_undef_interface) << ClassName->getName();
Diag(ClassLoc, diag::warn_undef_interface) << ClassName;
}
// Check that super class name is valid class name
@ -473,20 +469,19 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation(
// Check if a different kind of symbol declared in this scope.
PrevDecl = LookupDecl(SuperClassname, Decl::IDNS_Ordinary, TUScope);
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
Diag(SuperClassLoc, diag::err_redefinition_different_kind,
SuperClassname->getName());
Diag(SuperClassLoc, diag::err_redefinition_different_kind)
<< SuperClassname;
Diag(PrevDecl->getLocation(), diag::err_previous_definition);
}
else {
} else {
SDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
if (!SDecl)
Diag(SuperClassLoc, diag::err_undef_superclass,
SuperClassname->getName(), ClassName->getName());
Diag(SuperClassLoc, diag::err_undef_superclass)
<< SuperClassname << ClassName;
else if (IDecl && IDecl->getSuperClass() != SDecl) {
// This implementation and its interface do not have the same
// super class.
Diag(SuperClassLoc, diag::err_conflicting_super_class,
SDecl->getName());
Diag(SuperClassLoc, diag::err_conflicting_super_class)
<< SDecl->getName();
Diag(SDecl->getLocation(), diag::err_previous_definition);
}
}
@ -518,7 +513,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation(
// Check that there is no duplicate implementation of this class.
if (ObjCImplementations[ClassName])
// FIXME: Don't leak everything!
Diag(ClassLoc, diag::err_dup_implementation_class, ClassName->getName());
Diag(ClassLoc, diag::err_dup_implementation_class) << ClassName;
else // add it to the list.
ObjCImplementations[ClassName] = IMPDecl;
return IMPDecl;
@ -558,17 +553,17 @@ void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
if (Context.getCanonicalType(ImplIvar->getType()) !=
Context.getCanonicalType(ClsIvar->getType())) {
Diag(ImplIvar->getLocation(), diag::err_conflicting_ivar_type)
<< ImplIvar->getIdentifier()->getName();
<< ImplIvar->getIdentifier();
Diag(ClsIvar->getLocation(), diag::err_previous_definition)
<< ClsIvar->getIdentifier()->getName();
<< ClsIvar->getIdentifier();
}
// TODO: Two mismatched (unequal width) Ivar bitfields should be diagnosed
// as error.
else if (ImplIvar->getIdentifier() != ClsIvar->getIdentifier()) {
Diag(ImplIvar->getLocation(), diag::err_conflicting_ivar_name)
<< ImplIvar->getIdentifier()->getName();
<< ImplIvar->getIdentifier();
Diag(ClsIvar->getLocation(), diag::err_previous_definition)
<< ClsIvar->getIdentifier()->getName();
<< ClsIvar->getIdentifier();
return;
}
--numIvars;
@ -729,8 +724,7 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
// FIXME: Make an extension?
TypedefDecl *TDD = dyn_cast<TypedefDecl>(PrevDecl);
if (!TDD || !isa<ObjCInterfaceType>(TDD->getUnderlyingType())) {
Diag(AtClassLoc, diag::err_redefinition_different_kind,
IdentList[i]->getName());
Diag(AtClassLoc, diag::err_redefinition_different_kind) << IdentList[i];
Diag(PrevDecl->getLocation(), diag::err_previous_definition);
}
}
@ -1314,8 +1308,7 @@ Sema::DeclTy *Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
// Check that this is a previously declared 'ivar' in 'IDecl' interface
Ivar = IDecl->FindIvarDeclaration(PropertyIvar);
if (!Ivar) {
Diag(PropertyLoc, diag::error_missing_property_ivar_decl,
PropertyId->getName());
Diag(PropertyLoc, diag::error_missing_property_ivar_decl) << PropertyId;
return 0;
}
QualType PropType = Context.getCanonicalType(property->getType());

View File

@ -900,7 +900,7 @@ CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
// vec4.b is a float, vec4.xy is a vec2, vec4.rgb is a vec3, etc.
// vec4.hi, vec4.lo, vec4.e, and vec4.o all return vec2.
unsigned CompSize = SpecialComponent ? vecType->getNumElements() / 2
: strlen(CompName.getName());
: CompName.getLength();
if (CompSize == 1)
return vecType->getElementType();
@ -921,16 +921,11 @@ CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
// live?
static IdentifierInfo *constructSetterName(IdentifierTable &Idents,
const IdentifierInfo *Name) {
unsigned N = Name->getLength();
char *SelectorName = new char[3 + N];
memcpy(SelectorName, "set", 3);
memcpy(&SelectorName[3], Name->getName(), N);
llvm::SmallString<100> SelectorName;
SelectorName += "set";
SelectorName.append(Name->getName(), Name->getName()+Name->getLength());
SelectorName[3] = toupper(SelectorName[3]);
IdentifierInfo *Setter =
&Idents.get(SelectorName, &SelectorName[3 + N]);
delete[] SelectorName;
return Setter;
return &Idents.get(&SelectorName[0], &SelectorName[SelectorName.size()]);
}
Action::ExprResult Sema::
@ -967,7 +962,7 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
FieldDecl *MemberDecl = RDecl->getMember(&Member);
if (!MemberDecl)
return Diag(MemberLoc, diag::err_typecheck_no_member)
<< Member.getName() << BaseExpr->getSourceRange();
<< &Member << BaseExpr->getSourceRange();
// Figure out the type of the member; see C99 6.5.2.3p3
// FIXME: Handle address space modifiers
@ -991,7 +986,7 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
return new ObjCIvarRefExpr(IV, IV->getType(), MemberLoc, BaseExpr,
OpKind == tok::arrow);
return Diag(MemberLoc, diag::err_typecheck_member_reference_ivar)
<< IFTy->getDecl()->getName() << Member.getName()
<< IFTy->getDecl()->getName() << &Member
<< BaseExpr->getSourceRange();
}
@ -3106,9 +3101,8 @@ Sema::ExprResult Sema::ActOnBuiltinOffsetOf(SourceLocation BuiltinLoc,
RecordDecl *RD = RC->getDecl();
FieldDecl *MemberDecl = RD->getMember(OC.U.IdentInfo);
if (!MemberDecl)
return Diag(BuiltinLoc, diag::err_typecheck_no_member,
OC.U.IdentInfo->getName(),
SourceRange(OC.LocStart, OC.LocEnd));
return Diag(BuiltinLoc, diag::err_typecheck_no_member)
<< OC.U.IdentInfo << SourceRange(OC.LocStart, OC.LocEnd);
// FIXME: C++: Verify that MemberDecl isn't a static field.
// FIXME: Verify that MemberDecl isn't a bitfield.

View File

@ -96,7 +96,7 @@ Sema::ExprResult Sema::ParseObjCProtocolExpression(IdentifierInfo *ProtocolId,
SourceLocation RParenLoc) {
ObjCProtocolDecl* PDecl = ObjCProtocols[ProtocolId];
if (!PDecl) {
Diag(ProtoLoc, diag::err_undeclared_protocol) << ProtocolId->getName();
Diag(ProtoLoc, diag::err_undeclared_protocol) << ProtocolId;
return true;
}

View File

@ -756,26 +756,30 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, ExprTy *rex) {
getCurMethodDecl()->getResultType();
if (FnRetType->isVoidType()) {
if (RetValExp) // C99 6.8.6.4p1 (ext_ since GCC warns)
Diag(ReturnLoc, diag::ext_return_has_expr,
( getCurFunctionDecl() ?
getCurFunctionDecl()->getIdentifier()->getName() :
getCurMethodDecl()->getSelector().getName() ),
RetValExp->getSourceRange());
return new ReturnStmt(ReturnLoc, RetValExp);
} else {
if (!RetValExp) {
const char *funcName =
getCurFunctionDecl() ?
getCurFunctionDecl()->getIdentifier()->getName() :
getCurMethodDecl()->getSelector().getName().c_str();
if (getLangOptions().C99) // C99 6.8.6.4p1 (ext_ since GCC warns)
Diag(ReturnLoc, diag::ext_return_missing_expr, funcName);
else // C90 6.6.6.4p4
Diag(ReturnLoc, diag::warn_return_missing_expr, funcName);
return new ReturnStmt(ReturnLoc, (Expr*)0);
if (RetValExp) {// C99 6.8.6.4p1 (ext_ since GCC warns)
if (FunctionDecl *FD = getCurFunctionDecl())
Diag(ReturnLoc, diag::ext_return_has_expr)
<< FD->getIdentifier() << RetValExp->getSourceRange();
else
Diag(ReturnLoc, diag::ext_return_has_expr)
<< getCurMethodDecl()->getSelector().getName()
<< RetValExp->getSourceRange();
}
return new ReturnStmt(ReturnLoc, RetValExp);
}
if (!RetValExp) {
unsigned DiagID = diag::warn_return_missing_expr; // C90 6.6.6.4p4
// C99 6.8.6.4p1 (ext_ since GCC warns)
if (getLangOptions().C99) DiagID = diag::ext_return_missing_expr;
if (FunctionDecl *FD = getCurFunctionDecl())
Diag(ReturnLoc, DiagID) << FD->getIdentifier();
else
Diag(ReturnLoc, DiagID) << getCurMethodDecl()->getSelector().getName();
return new ReturnStmt(ReturnLoc, (Expr*)0);
}
// we have a non-void function with an expression, continue checking
QualType RetValType = RetValExp->getType();