if (!(isa<llvm::PointerType>(V->getType()) &&
isa<llvm::ArrayType>(cast<llvm::PointerType>(V->getType())
->getElementType()))) {
- CGF.ErrorUnsupported(E, "variable-length array cast");
+ CGF.ErrorUnsupported(E, "variable-length array cast", true);
if (E->getType()->isVoidType())
return 0;
return llvm::UndefValue::get(CGF.ConvertType(E->getType()));
/// ErrorUnsupported - Print out an error that codegen doesn't support the
/// specified stmt yet.
-void CodeGenFunction::ErrorUnsupported(const Stmt *S, const char *Type) {
- CGM.ErrorUnsupported(S, Type);
+void CodeGenFunction::ErrorUnsupported(const Stmt *S, const char *Type,
+ bool OmitOnError) {
+ CGM.ErrorUnsupported(S, Type, OmitOnError);
}
unsigned CodeGenFunction::GetIDForAddrOfLabel(const LabelStmt *L) {
/// ErrorUnsupported - Print out an error that codegen doesn't support the
/// specified stmt yet.
- void ErrorUnsupported(const Stmt *S, const char *Type);
+ void ErrorUnsupported(const Stmt *S, const char *Type,
+ bool OmitOnError=false);
//===--------------------------------------------------------------------===//
// Helpers
/// ErrorUnsupported - Print out an error that codegen doesn't support the
/// specified stmt yet.
-void CodeGenModule::ErrorUnsupported(const Stmt *S, const char *Type) {
+void CodeGenModule::ErrorUnsupported(const Stmt *S, const char *Type,
+ bool OmitOnError) {
+ if (OmitOnError && getDiags().hasErrorOccurred())
+ return;
unsigned DiagID = getDiags().getCustomDiagID(Diagnostic::Error,
"cannot codegen this %0 yet");
SourceRange Range = S->getSourceRange();
/// ErrorUnsupported - Print out an error that codegen doesn't support the
/// specified decl yet.
-void CodeGenModule::ErrorUnsupported(const Decl *D, const char *Type) {
+void CodeGenModule::ErrorUnsupported(const Decl *D, const char *Type,
+ bool OmitOnError) {
+ if (OmitOnError && getDiags().hasErrorOccurred())
+ return;
unsigned DiagID = getDiags().getCustomDiagID(Diagnostic::Error,
"cannot codegen this %0 yet");
std::string Msg = Type;
const AnnotateAttr *AA, unsigned LineNo);
/// ErrorUnsupported - Print out an error that codegen doesn't support the
- /// specified stmt yet.
- void ErrorUnsupported(const Stmt *S, const char *Type);
+ /// specified stmt yet.
+ /// \param OmitOnError - If true, then this error should only be
+ /// emitted if no other errors have been reported.
+ void ErrorUnsupported(const Stmt *S, const char *Type,
+ bool OmitOnError=false);
/// ErrorUnsupported - Print out an error that codegen doesn't support the
/// specified decl yet.
- void ErrorUnsupported(const Decl *D, const char *Type);
+ /// \param OmitOnError - If true, then this error should only be
+ /// emitted if no other errors have been reported.
+ void ErrorUnsupported(const Decl *D, const char *Type,
+ bool OmitOnError=false);
private:
void SetFunctionAttributes(const FunctionDecl *FD,