From 84b8532ba51d80ed3a0613b9826a508153be433b Mon Sep 17 00:00:00 2001 From: yangdian Date: Sun, 25 Jun 2023 20:25:52 +0800 Subject: [PATCH] bugfix for cc1 failure --- clang/lib/AST/DeclPrinter.cpp | 16 +++++++++------- clang/lib/Frontend/FrontendOptions.cpp | 2 +- clang/test/BSC/Method/Linkage/queue.cbs | 2 +- .../Struct/struct_toplevel_func_not_found.cbs | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index efe5278fd36d..2c5b47342cef 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -1080,13 +1080,15 @@ void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) { FunctionNameStr += QT; } Out << ' ' + FunctionNameStr; - } else if (!Policy.PrintCanonicalTypes) - if (const auto* TSI = S->getTypeAsWritten()) - if (const auto *TST = - dyn_cast(TSI->getType())) - Args = TST->template_arguments(); - printTemplateArguments( - Args, S->getSpecializedTemplate()->getTemplateParameters()); + } else { + if (!Policy.PrintCanonicalTypes) + if (const auto* TSI = S->getTypeAsWritten()) + if (const auto *TST = + dyn_cast(TSI->getType())) + Args = TST->template_arguments(); + printTemplateArguments( + Args, S->getSpecializedTemplate()->getTemplateParameters()); + } } } diff --git a/clang/lib/Frontend/FrontendOptions.cpp b/clang/lib/Frontend/FrontendOptions.cpp index c9b66a666d26..b4c6b25013ac 100644 --- a/clang/lib/Frontend/FrontendOptions.cpp +++ b/clang/lib/Frontend/FrontendOptions.cpp @@ -33,6 +33,6 @@ InputKind FrontendOptions::getInputKindForExtension(StringRef Extension) { .Cases("cu", "cuh", Language::CUDA) .Case("hip", Language::HIP) .Cases("ll", "bc", Language::LLVM_IR) - .Case("bsc", Language::BSC) + .Cases("cbs", "hbs", Language::BSC) .Default(Language::Unknown); } diff --git a/clang/test/BSC/Method/Linkage/queue.cbs b/clang/test/BSC/Method/Linkage/queue.cbs index ade2c34591f8..d6d9f1d06ef4 100644 --- a/clang/test/BSC/Method/Linkage/queue.cbs +++ b/clang/test/BSC/Method/Linkage/queue.cbs @@ -6,5 +6,5 @@ #include "queue.hbs" -// CHECK: define dso_local void @_ZN_ZTS5queueisEmpty(%struct.queue* %this) #0 +// CHECK: define dso_local void @_ZN_ZTS5queueisEmpty void struct queue::isEmpty(struct queue* this) {} diff --git a/clang/test/BSC/Method/Struct/struct_toplevel_func_not_found.cbs b/clang/test/BSC/Method/Struct/struct_toplevel_func_not_found.cbs index 1086c2c0007c..79a79ffb0c86 100644 --- a/clang/test/BSC/Method/Struct/struct_toplevel_func_not_found.cbs +++ b/clang/test/BSC/Method/Struct/struct_toplevel_func_not_found.cbs @@ -7,6 +7,6 @@ void struct F::increase(struct F* this) { } int main() { - increase(); // expected-warning {{implicit declaration of function 'increase' is invalid in C99}} + increase(); // expected-error {{use of undeclared identifier 'increase'}} return 0; } \ No newline at end of file -- Gitee