[all-commits] [llvm/llvm-project] 683b30: [clang] Add -fc++-abi= flag for specifying which C...

Leonard Chan via All-commits all-commits at lists.llvm.org
Wed Oct 14 12:31:54 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 683b308c07bf827255fe1403056413f790e03729
      https://github.com/llvm/llvm-project/commit/683b308c07bf827255fe1403056413f790e03729
  Author: Leonard Chan <leonardchan at google.com>
  Date:   2020-10-14 (Wed, 14 Oct 2020)

  Changed paths:
    M clang/include/clang/AST/ASTContext.h
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/include/clang/Basic/LangOptions.h
    A clang/include/clang/Basic/TargetCXXABI.def
    M clang/include/clang/Basic/TargetCXXABI.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/CodeGen/ItaniumCXXABI.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    A clang/test/Frontend/invalid-cxx-abi.cpp

  Log Message:
  -----------
  [clang] Add -fc++-abi= flag for specifying which C++ ABI to use

This implements the flag proposed in RFC http://lists.llvm.org/pipermail/cfe-dev/2020-August/066437.html.

The goal is to add a way to override the default target C++ ABI through
a compiler flag. This makes it easier to test and transition between different
C++ ABIs through compile flags rather than build flags.

In this patch:
- Store `-fc++-abi=` in a LangOpt. This isn't stored in a
  CodeGenOpt because there are instances outside of codegen where Clang
  needs to know what the ABI is (particularly through
  ASTContext::createCXXABI), and we should be able to override the
  target default if the flag is provided at that point.
- Expose the existing ABIs in TargetCXXABI as values that can be passed
  through this flag.
  - Create a .def file for these ABIs to make it easier to check flag
    values.
  - Add an error for diagnosing bad ABI flag values.

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




More information about the All-commits mailing list