[PATCH] D61716: [libclang] Expose AtomicType
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 9 04:50:45 PDT 2020
aaron.ballman added a comment.
I'm sorry about the delay in review, this did fall off my radar. Thank you for bringing it to my attention!
Looks mostly good to me, just a few small nits.
================
Comment at: clang/include/clang-c/Index.h:3953
+/**
+ * Gets the type contained by this atomic type
+ *
----------------
Missing a full stop at the end of the comment.
================
Comment at: clang/tools/c-index-test/c-index-test.c:1585
+ CXType VT = clang_Type_getValueType(T);
+ if (VT.kind != CXType_Invalid) {
+ PrintTypeAndTypeKind(VT, " [valuetype=%s] [valuetypekind=%s]");
----------------
Should elide braces here.
================
Comment at: clang/tools/libclang/CXType.cpp:1326-1329
+ const Type *TP = T.getTypePtrOrNull();
+
+ if (TP && TP->getTypeClass() == Type::Atomic)
+ return MakeCXType(cast<AtomicType>(TP)->getValueType(), GetTU(CT));
----------------
I would probably rewrite this function to:
```
QualType T = GetQualType(CT);
if (T.isNull() || !T->isAtomicType())
return MakeCXType(QualType(), GetTU(CT));
const auto *AT = T->castAs<AtomicType>();
return MakeCXType(AT->getValueType(), GetTU(CT));
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61716/new/
https://reviews.llvm.org/D61716
More information about the cfe-commits
mailing list