[clang] [clang-tools-extra] [clang][AST] Fix StmtProfile handling of GCCAsmStmt asm strings and clobbers (PR #201481)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 10 01:23:59 PDT 2026
ChuanqiXu9 wrote:
> > > I'm not much familiar with clang AST Visitor testing, but is there any unit or other tests for `clang/lib/AST`? If so, we better make test there as well. Apart from this, lgtm with nit
> >
> >
> > It is fine generally if we have lit test. But I didn't notice the lit test doesn't belong to clang itself. Yeah, it is better to have a lit test under clang. We wrote unit tests less than lit test.
>
> @vbvictor @ChuanqiXu9 Thanks for the review. I couldn't find any existing tests for `StmtProfile` and `VisitGCCAsmStmt`, so I'm not sure where the new test should be added. Could you suggest the appropriate place for it?
You can define two modules. And two headers. Two different GCCAsmStmt. And if we can diagnose it, it works as expected.
The shape may be:
```C++
// a.h
inline int func() { return 43; }
// a.v1.h
inline int func() { return 44; }
// a.cppm
module;
#include "a.h"
export module a;
export using ::func;
// b.cppm
module;
#include "a.v1.h"
export module b;
export using ::func;
// use.cc
import a;
import b;
int v = func(); // It should diagnose.
```
https://github.com/llvm/llvm-project/pull/201481
More information about the cfe-commits
mailing list