diff options
author | Alejandro Álvarez Ayllón <alejandro.alvarez@sonarsource.com> | 2025-10-02 07:11:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-02 16:11:31 +0200 |
commit | b147019f8b11cd491f331bd707f764786792665e (patch) | |
tree | c71491d0dcca176d30e3247f072da4f9858d9a3e /llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp | |
parent | 706b79002e21b571888db7f275bf5ed00e7cce41 (diff) | |
download | llvm-b147019f8b11cd491f331bd707f764786792665e.zip llvm-b147019f8b11cd491f331bd707f764786792665e.tar.gz llvm-b147019f8b11cd491f331bd707f764786792665e.tar.bz2 |
[clang] Preserve `externs` following broken declarations (#161641)
Treat them as namespaces: if they are at the beginning of the line, they
are likely a good recovery point.
For instance, in
```cpp
1.3.0
extern "C" {
extern int foo();
extern "C++" {
namespace bar {
void baz();
};
}
}
namespace {}
```
Everything until `namespace`... is gone from the AST. Headers (like
libc's C++ `math.h`) can be included from an `extern "C"` context, and
they do an `extern "C++"` back again before including C++ headers (like
`__type_traits`).
However, a malformed declaration just before the include (as the orphan
`1.3.0` in the example) causes everything from these standard headers to
go missing. This patch updates the heuristic to try to recover from the
first `extern` keyword seen, pretty much as it is done for `namespace`.
CPP-4478
Diffstat (limited to 'llvm/lib/CodeGen/StackFrameLayoutAnalysisPass.cpp')
0 files changed, 0 insertions, 0 deletions