diff options
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 5 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 10 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 12 |
5 files changed, 23 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 229b05f93e0..88b8c9edefd 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -516,7 +516,7 @@ Value *ScalarExprEmitter::VisitImplicitCastExpr(const ImplicitCastExpr *E) { 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())); diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 09f31407731..ce0d7d8f898 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -192,8 +192,9 @@ const CGRecordLayout *CodeGenFunction::getCGRecordLayout(CodeGenTypes &CGT, /// 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) { diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 853f4453841..b3881538361 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -151,7 +151,8 @@ public: /// 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 diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 5b784aada3f..87f5c24b824 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -67,7 +67,10 @@ void CodeGenModule::Release() { /// 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(); @@ -78,7 +81,10 @@ void CodeGenModule::ErrorUnsupported(const Stmt *S, const char *Type) { /// 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; diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index b339ae9d674..70a91b6a997 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -194,12 +194,18 @@ public: 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, |