Index: include/clang/AST/DeclCXX.h =================================================================== --- include/clang/AST/DeclCXX.h +++ 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() && !IsDelegating; Index: lib/AST/DeclBase.cpp =================================================================== --- lib/AST/DeclBase.cpp +++ lib/AST/DeclBase.cpp @@ -955,10 +955,7 @@ static Decl::Kind getKind(const DeclContext *DC) { return DC->getDeclKind(); } int64_t Decl::getID() const { - Optional Out = getASTContext().getAllocator().identifyObject(this); - assert(Out && "Wrong allocator used"); - assert(*Out % alignof(Decl) == 0 && "Wrong alignment information"); - return *Out / alignof(Decl); + return getASTContext().getAllocator().identifyKnownAlignedObject(this); } const FunctionType *Decl::getFunctionType(bool BlocksToo) const { Index: lib/AST/DeclCXX.cpp =================================================================== --- lib/AST/DeclCXX.cpp +++ lib/AST/DeclCXX.cpp @@ -2246,6 +2246,11 @@ : Initializee(TInfo), Init(Init), LParenLoc(L), RParenLoc(R), IsDelegating(true), IsVirtual(false), IsWritten(false), SourceOrder(0) {} +int64_t CXXCtorInitializer::getID(const ASTContext &Context) const { + return Context.getAllocator() + .identifyKnownAlignedObject(this); +} + TypeLoc CXXCtorInitializer::getBaseClassLoc() const { if (isBaseInitializer()) return Initializee.get()->getTypeLoc(); Index: lib/AST/Stmt.cpp =================================================================== --- lib/AST/Stmt.cpp +++ lib/AST/Stmt.cpp @@ -303,10 +303,7 @@ } int64_t Stmt::getID(const ASTContext &Context) const { - Optional Out = Context.getAllocator().identifyObject(this); - assert(Out && "Wrong allocator used"); - assert(*Out % alignof(Stmt) == 0 && "Wrong alignment information"); - return *Out / alignof(Stmt); + return Context.getAllocator().identifyKnownAlignedObject(this); } CompoundStmt::CompoundStmt(ArrayRef Stmts, SourceLocation LB, Index: lib/StaticAnalyzer/Core/ExplodedGraph.cpp =================================================================== --- lib/StaticAnalyzer/Core/ExplodedGraph.cpp +++ lib/StaticAnalyzer/Core/ExplodedGraph.cpp @@ -284,10 +284,7 @@ } int64_t ExplodedNode::getID(ExplodedGraph *G) const { - Optional Out = G->getAllocator().identifyObject(this); - assert(Out && "Wrong allocator used"); - assert(*Out % alignof(ExplodedNode) == 0 && "Wrong alignment information"); - return *Out / alignof(ExplodedNode); + return G->getAllocator().identifyKnownAlignedObject(this); } bool ExplodedNode::isTrivial() const { Index: lib/StaticAnalyzer/Core/ProgramState.cpp =================================================================== --- lib/StaticAnalyzer/Core/ProgramState.cpp +++ lib/StaticAnalyzer/Core/ProgramState.cpp @@ -70,10 +70,7 @@ } int64_t ProgramState::getID() const { - Optional Out = getStateManager().Alloc.identifyObject(this); - assert(Out && "Wrong allocator used"); - assert(*Out % alignof(ProgramState) == 0 && "Wrong alignment information"); - return *Out / alignof(ProgramState); + return getStateManager().Alloc.identifyKnownAlignedObject(this); } ProgramStateManager::ProgramStateManager(ASTContext &Ctx,