================
@@ -1112,6 +1297,12 @@ llvm::Expected<NewFunction>
getExtractedFunction(ExtractionZone &ExtZone,
ExtractedFunc.DefinitionQualifier =
ExtZone.EnclosingFunction->getQualifier();
ExtractedFunc.Constexpr = ExtZone.EnclosingFunction->getConstexprKind();
+ // A free function declared `static` has internal linkage: an extracted
+ // sibling should keep that, or it'd default to external linkage instead.
+ // For a method, this gets overridden just below by the more precise
+ // (and differently-meaning) CXXMethodDecl::isStatic().
+ ExtractedFunc.Static =
+ ExtZone.EnclosingFunction->getStorageClass() == SC_Static;
----------------
ArcsinX wrote:
We need to check canonical declaration here, but not current declaration to
support forward declaration of static function.
E.g.
```cpp
static void f();
void f() // no static here, but f is a static function
{
.....// code to extract here
}
```
https://github.com/llvm/llvm-project/pull/228465
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits