llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: kadir çetinkaya (kadircet) <details> <summary>Changes</summary> Emission status seems to be only used by cuda/openmp/hip compiles, to figure out when to emit diagnostics. Current logic emits "uknown" when definition is missing, so i extended that to skipped-function-bodies as well. --- Full diff: https://github.com/llvm/llvm-project/pull/100124.diff 2 Files Affected: - (modified) clang/lib/Sema/SemaDecl.cpp (+2-1) - (modified) clang/unittests/Tooling/ToolingTest.cpp (+5) ``````````diff diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index bb25a0b3a45ae..c04c66d8c445a 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -20148,7 +20148,8 @@ Sema::FunctionEmissionStatus Sema::getEmissionStatus(const FunctionDecl *FD, // be emitted, because (say) the definition could include "inline". const FunctionDecl *Def = FD->getDefinition(); - return Def && !isDiscardableGVALinkage( + // We can't compute linkage when we skip function bodies. + return Def && !Def->hasSkippedBody() && !isDiscardableGVALinkage( getASTContext().GetGVALinkageForFunction(Def)); }; diff --git a/clang/unittests/Tooling/ToolingTest.cpp b/clang/unittests/Tooling/ToolingTest.cpp index 2e3da2cd2a701..f41a44fa0922a 100644 --- a/clang/unittests/Tooling/ToolingTest.cpp +++ b/clang/unittests/Tooling/ToolingTest.cpp @@ -586,6 +586,11 @@ TEST(runToolOnCode, TestSkipFunctionBody) { EXPECT_FALSE(runToolOnCodeWithArgs( std::make_unique<SkipBodyAction>(), "template<typename T> int skipMeNot() { an_error_here }", Args2)); + + EXPECT_TRUE(runToolOnCodeWithArgs( + std::make_unique<SkipBodyAction>(), + "__inline __attribute__((__gnu_inline__)) void skipMe() {}", + {"--cuda-host-only", "-nocudainc", "-xcuda"})); } TEST(runToolOnCodeWithArgs, TestNoDepFile) { `````````` </details> https://github.com/llvm/llvm-project/pull/100124 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits