[PATCH] D71734: [Modules] Handle tag types and complain about bad merges in C/Objective-C mode

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 21 12:09:46 PDT 2021


vsapsai added inline comments.


================
Comment at: clang/lib/Serialization/ASTReaderDecl.cpp:818
+    // performance.
+    RecordDecl *Canon = static_cast<RecordDecl *>(RD->getCanonicalDecl());
+    if (RD == Canon || Canon->getODRHash() == RD->getODRHash())
----------------
During investigation of a different issue noticed there is no error for the following test case

```lang=c++
#if defined(FIRST)
typedef struct FW FW;
struct FW {
  int x;
};
#elif defined(SECOND)
struct FW {
  float a;
};
#else
struct FW fw;
#endif
```

And that is because `Canon` is a forward declaration from the typedef and we don't compare non-definition with definition.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71734/new/

https://reviews.llvm.org/D71734



More information about the cfe-commits mailing list