[all-commits] [llvm/llvm-project] f18370: [lldb] Don't defend against internal LLVM errors i...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Tue Jan 14 01:01:53 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f18370fe0e7576fb9947e49d66f7a6962c6822ce
      https://github.com/llvm/llvm-project/commit/f18370fe0e7576fb9947e49d66f7a6962c6822ce
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2020-01-14 (Tue, 14 Jan 2020)

  Changed paths:
    M lldb/source/Expression/IRInterpreter.cpp

  Log Message:
  -----------
  [lldb] Don't defend against internal LLVM errors in IRInterpreter

Summary:
Whenever we cast an LLVM instruction to one of its subclasses, we do a double check if the RTTI
enum value actually allows us to cast the class. I don't see a way this can ever happen as even when
LLVM's RTTI system has some corrupt internal state (which we probably should not test in the first
place) we just reuse LLVM RTTI to do the second check.

This also means that if we ever make an actual programming error in this function (e.g., have a enum
value and then cast it to a different subclass), we just silently fall back to the JIT in our tests.

We also can't test this code in any reasonable way.

This removes the checks and uses `llvm::cast` instead which will raise a fatal error when casting fails.

Reviewers: labath, mib

Reviewed By: labath

Subscribers: abidh, JDevlieghere, lldb-commits

Tags: #lldb

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




More information about the All-commits mailing list