diff --git a/clang/lib/CIR/CodeGen/CIRGenDebugInfo.h b/clang/lib/CIR/CodeGen/CIRGenDebugInfo.h new file mode 100644 index 000000000000..9aa503bf07e5 --- /dev/null +++ b/clang/lib/CIR/CodeGen/CIRGenDebugInfo.h @@ -0,0 +1,20 @@ +//===--- CIRGenDebugInfo.h - DebugInfo for CIRGen ---------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This is the source-level debug info generator for CIR translation. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENDEBUGINFO_H +#define LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENDEBUGINFO_H + +namespace cir { +class CIRGenDebugInfo {}; +} // namespace cir + +#endif // LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENDEBUGINFO_H diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h b/clang/lib/CIR/CodeGen/CIRGenFunction.h index c581e4ba9e35..0a401ca3ebef 100644 --- a/clang/lib/CIR/CodeGen/CIRGenFunction.h +++ b/clang/lib/CIR/CodeGen/CIRGenFunction.h @@ -15,6 +15,7 @@ #include "CIRGenBuilder.h" #include "CIRGenCall.h" +#include "CIRGenDebugInfo.h" #include "CIRGenModule.h" #include "CIRGenTBAA.h" #include "CIRGenTypeCache.h" @@ -524,6 +525,8 @@ class CIRGenFunction : public CIRGenTypeCache { /// delcs. DeclMapTy LocalDeclMap; + CIRGenDebugInfo *debugInfo = nullptr; + /// Whether llvm.stacksave has been called. Used to avoid /// calling llvm.stacksave for multiple VLAs in the same scope. /// TODO: Translate to MLIR @@ -585,10 +588,7 @@ class CIRGenFunction : public CIRGenTypeCache { const clang::LangOptions &getLangOpts() const { return CGM.getLangOpts(); } - // TODO: This is currently just a dumb stub. But we want to be able to clearly - // assert where we arne't doing things that we know we should and will crash - // as soon as we add a DebugInfo type to this class. - std::nullptr_t *getDebugInfo() { return nullptr; } + CIRGenDebugInfo *getDebugInfo() { return debugInfo; } void buildReturnOfRValue(mlir::Location loc, RValue RV, QualType Ty);