llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Prajwal Nadig (snprajwal)

<details>
<summary>Changes</summary>

Public API can never be defined in function bodies, since that would make the 
type function-local only. The symbol graph must not contain any such symbols as 
they cannot be used by a downstream consumer. Skip parsing function bodies in 
ExtractAPI. This also addresses cases where inlinable functions sometimes had 
their local types erroneously included in the symbol graph due to the 
definition being retained in the PCM file.

rdar://181241162

---
Full diff: https://github.com/llvm/llvm-project/pull/215373.diff


1 Files Affected:

- (modified) clang/lib/ExtractAPI/ExtractAPIConsumer.cpp (+3) 


``````````diff
diff --git a/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp 
b/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
index 85da480fb67a6..237decf2f0bd5 100644
--- a/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
+++ b/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
@@ -448,6 +448,9 @@ ExtractAPIAction::CreateASTConsumer(CompilerInstance &CI, 
StringRef InFile) {
 }
 
 bool ExtractAPIAction::PrepareToExecuteAction(CompilerInstance &CI) {
+  // Public API can never be inside function bodies, so skip parsing them.
+  CI.getFrontendOpts().SkipFunctionBodies = true;
+
   auto &Inputs = CI.getFrontendOpts().Inputs;
   if (Inputs.empty())
     return true;

``````````

</details>


https://github.com/llvm/llvm-project/pull/215373
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to