[all-commits] [llvm/llvm-project] aa4558: [clang] Improve LLVM-style RTTI support in Externa...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Sun Dec 15 09:11:42 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: aa4558497ff6301881adf38960dd2f4d95aa8fc5
      https://github.com/llvm/llvm-project/commit/aa4558497ff6301881adf38960dd2f4d95aa8fc5
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2019-12-15 (Sun, 15 Dec 2019)

  Changed paths:
    M clang/include/clang/AST/ExternalASTSource.h
    M clang/include/clang/Sema/ExternalSemaSource.h
    M clang/include/clang/Sema/MultiplexExternalSemaSource.h
    M clang/lib/AST/ExternalASTSource.cpp
    M clang/lib/Sema/MultiplexExternalSemaSource.cpp
    M clang/lib/Sema/Sema.cpp

  Log Message:
  -----------
  [clang] Improve LLVM-style RTTI support in ExternalASTSource/ExternalSemaSource

Summary:
We currently have some very basic LLVM-style RTTI support in the ExternalASTSource class hierarchy
based on the `SemaSource` bool( to discriminate it form the ExternalSemaSource). As ExternalASTSource
is supposed to be subclassed we should have extendable LLVM-style RTTI in this class hierarchy to make life easier
for projects building on top of Clang.

Most notably the current RTTI implementation forces LLDB to implement RTTI for its
own ExternalASTSource class (ClangExternalASTSourceCommon) by keeping a global set of
ExternalASTSources that are known to be ClangExternalASTSourceCommon. Projects
using Clang currently have to dosimilar workarounds to get RTTI support for their subclasses.

This patch turns this into full-fledged LLVM-style RTTI based on a static `ID` variable similar to
other LLVM class hierarchies. Also removes the friend declaration from ExternalASTSource to
its child class that was only used to grant access to the `SemaSource` member.

Reviewers: aprantl, dblaikie, rjmccall

Reviewed By: aprantl

Subscribers: riccibruno, labath, lhames, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71397




More information about the All-commits mailing list