[PATCH] D54457: [AST] Generate unique identifiers for CXXCtorInitializer objects.
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 3 14:18:43 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL348198: [AST] Generate unique identifiers for CXXCtorInitializer objects. (authored by dergachev, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D54457?vs=176470&id=176477#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54457/new/
https://reviews.llvm.org/D54457
Files:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/lib/AST/DeclCXX.cpp
Index: cfe/trunk/include/clang/AST/DeclCXX.h
===================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h
+++ cfe/trunk/include/clang/AST/DeclCXX.h
@@ -2315,6 +2315,9 @@
CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo,
SourceLocation L, Expr *Init, SourceLocation R);
+ /// \return Unique reproducible object identifier.
+ int64_t getID(const ASTContext &Context) const;
+
/// Determine whether this initializer is initializing a base class.
bool isBaseInitializer() const {
return Initializee.is<TypeSourceInfo*>() && !IsDelegating;
Index: cfe/trunk/lib/AST/DeclCXX.cpp
===================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp
+++ cfe/trunk/lib/AST/DeclCXX.cpp
@@ -2246,6 +2246,14 @@
: Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R),
IsDelegating(true), IsVirtual(false), IsWritten(false), SourceOrder(0) {}
+int64_t CXXCtorInitializer::getID(const ASTContext &Context) const {
+ Optional<int64_t> Out = Context.getAllocator().identifyObject(this);
+ assert(Out && "Wrong allocator used");
+ assert(*Out % alignof(CXXCtorInitializer) == 0 &&
+ "Wrong alignment information");
+ return *Out / alignof(CXXCtorInitializer);
+}
+
TypeLoc CXXCtorInitializer::getBaseClassLoc() const {
if (isBaseInitializer())
return Initializee.get<TypeSourceInfo*>()->getTypeLoc();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54457.176477.patch
Type: text/x-patch
Size: 1458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181203/61cc9f19/attachment.bin>
More information about the cfe-commits
mailing list