} else if (T->isEnumeralType()) {
S += 'i';
} else
- assert(0 && "@encode for type not implemented!");
+ assert(0 && "@encode for type not implemented!");
}
void ASTContext::getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT,
// The use of ellipsis agree...now check the argument types.
for (unsigned i = 0; i < lproto_nargs; i++)
- // C99 6.7.5.3p15: ...and each parameter declared with qualified type
- // is taken as having the unqualified version of it's declared type.
+ // C99 6.7.5.3p15: ...and each parameter declared with qualified type
+ // is taken as having the unqualified version of it's declared type.
if (!typesAreCompatible(lproto->getArgType(i).getUnqualifiedType(),
- rproto->getArgType(i).getUnqualifiedType()))
+ rproto->getArgType(i).getUnqualifiedType()))
return false;
return true;
}
// is an interface, we defer to objcTypesAreCompatible().
if (lcanon->isObjCInterfaceType() || rcanon->isObjCInterfaceType())
return objcTypesAreCompatible(lcanon, rcanon);
-
+
// C99 6.7.2.2p4: Each enumerated type shall be compatible with char,
// a signed integer type, or an unsigned integer type.
// FIXME: need to check the size and ensure it's the same.
class RewriteTest : public ASTConsumer {
Rewriter Rewrite;
Diagnostic &Diags;
- unsigned RewriteFailedDiag;
-
+ unsigned RewriteFailedDiag;
+
ASTContext *Context;
SourceManager *SM;
unsigned MainFileID;
CurMethodDecl = 0;
SuperStructDecl = 0;
BcLabelCount = 0;
-
+
// Get the ID and start/end of the main file.
MainFileID = SM->getMainFileID();
const llvm::MemoryBuffer *MainBuf = SM->getBuffer(MainFileID);
virtual void HandleTopLevelDecl(Decl *D);
void HandleDeclInMainFile(Decl *D);
RewriteTest(bool isHeader, Diagnostic &D) : Diags(D) {
- IsHeader = isHeader;
+ IsHeader = isHeader;
RewriteFailedDiag = Diags.getCustomDiagID(Diagnostic::Warning,
"rewriting sub-expression within a macro (may not be correct)");
- }
+ }
~RewriteTest();
// Syntactic Rewriting.
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
if (Stmt *Body = FD->getBody())
FD->setBody(RewriteFunctionBodyOrGlobalInitializer(Body));
-
+
if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
if (Stmt *Body = MD->getBody()) {
//Body->dump();
SourceLocation LocEnd = Method->getLocEnd();
if (SM->getLineNumber(LocEnd) > SM->getLineNumber(LocStart)) {
- Rewrite.InsertText(LocStart, "/* ", 3);
- Rewrite.ReplaceText(LocEnd, 1, ";*/ ", 4);
+ Rewrite.InsertText(LocStart, "/* ", 3);
+ Rewrite.ReplaceText(LocEnd, 1, ";*/ ", 4);
} else {
- Rewrite.InsertText(LocStart, "// ", 3);
+ Rewrite.InsertText(LocStart, "// ", 3);
}
}
if (Rewrite.ReplaceStmt(IV, Replacement)) {
// replacement failed.
SourceRange Range = IV->getSourceRange();
- if (!SilenceRewriteMacroWarning)
+ if (!SilenceRewriteMacroWarning)
Diags.Report(Context->getFullLoc(IV->getLocation()), RewriteFailedDiag,
- 0, 0, &Range, 1);
+ 0, 0, &Range, 1);
}
delete IV;
return Replacement;
if (Rewrite.ReplaceStmt(IV->getBase(), PE)) {
// replacement failed.
SourceRange Range = IV->getBase()->getSourceRange();
- if (!SilenceRewriteMacroWarning)
+ if (!SilenceRewriteMacroWarning)
Diags.Report(Context->getFullLoc(IV->getBase()->getLocStart()),
- RewriteFailedDiag, 0, 0, &Range, 1);
+ RewriteFailedDiag, 0, 0, &Range, 1);
}
delete IV->getBase();
return PE;
if (ObjCSelectorExpr *AtSelector = dyn_cast<ObjCSelectorExpr>(S))
return RewriteAtSelector(AtSelector);
-
+
if (ObjCStringLiteral *AtString = dyn_cast<ObjCStringLiteral>(S))
return RewriteObjCStringLiteral(AtString);
SourceRange Range = Exp->getSourceRange();
if (!SilenceRewriteMacroWarning)
Diags.Report(Context->getFullLoc(Exp->getAtLoc()), RewriteFailedDiag,
- 0, 0, &Range, 1);
+ 0, 0, &Range, 1);
}
// Replace this subexpr in the parent.
SourceRange Range = Exp->getSourceRange();
if (!SilenceRewriteMacroWarning)
Diags.Report(Context->getFullLoc(Exp->getAtLoc()), RewriteFailedDiag,
- 0, 0, &Range, 1);
+ 0, 0, &Range, 1);
}
delete Exp;
return SelExp;
SourceRange Range = Exp->getSourceRange();
if (!SilenceRewriteMacroWarning)
Diags.Report(Context->getFullLoc(Exp->getAtLoc()), RewriteFailedDiag,
- 0, 0, &Range, 1);
+ 0, 0, &Range, 1);
}
delete Exp;
return cast;
SourceRange Range = Exp->getSourceRange();
if (!SilenceRewriteMacroWarning)
Diags.Report(Context->getFullLoc(Exp->getLocStart()), RewriteFailedDiag,
- 0, 0, &Range, 1);
+ 0, 0, &Range, 1);
}
delete Exp;
SourceRange Range = Exp->getSourceRange();
if (!SilenceRewriteMacroWarning)
Diags.Report(Context->getFullLoc(Exp->getAtLoc()), RewriteFailedDiag,
- 0, 0, &Range, 1);
+ 0, 0, &Range, 1);
}
delete Exp;
return ProtoExp;
if (RCDecl && ObjCSynthesizedStructs.count(RCDecl)) {
Result = "\n struct ";
Result += RCDecl->getName();
- // Note: We don't name the field decl. This simplifies the "codegen" for
- // accessing a superclasses instance variables (and is similar to what gcc
- // does internally). The unnamed struct field feature is enabled with
- // -fms-extensions. If the struct definition were "inlined", we wouldn't
- // need to use this switch. That said, I don't want to inline the def.
+ // Note: We don't name the field decl. This simplifies the "codegen" for
+ // accessing a superclasses instance variables (and is similar to what gcc
+ // does internally). The unnamed struct field feature is enabled with
+ // -fms-extensions. If the struct definition were "inlined", we wouldn't
+ // need to use this switch. That said, I don't want to inline the def.
Result += ";\n";
// insert the super class structure definition.
endBuf += Lexer::MeasureTokenLength(LocEnd, *SM);
Result += " {\n struct ";
Result += RCDecl->getName();
- // Note: We don't name the field decl. This simplifies the "codegen" for
- // accessing a superclasses instance variables (and is similar to what gcc
- // does internally). The unnamed struct field feature is enabled with
- // -fms-extensions. If the struct definition were "inlined", we wouldn't
- // need to use this switch. That said, I don't want to inline the def.
+ // Note: We don't name the field decl. This simplifies the "codegen" for
+ // accessing a superclasses instance variables (and is similar to what gcc
+ // does internally). The unnamed struct field feature is enabled with
+ // -fms-extensions. If the struct definition were "inlined", we wouldn't
+ // need to use this switch. That said, I don't want to inline the def.
Result += ";\n};\n";
Rewrite.ReplaceText(LocStart, endBuf-startBuf,
Result.c_str(), Result.size());