aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp33
1 files changed, 12 insertions, 21 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 446cf8d..77fc3a2 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -58,13 +58,6 @@
using namespace clang;
using namespace clang::CodeGen;
-// TODO: consider deprecating ClArrayBoundsPseudoFn; functionality is subsumed
-// by -fsanitize-annotate-debug-info
-static llvm::cl::opt<bool> ClArrayBoundsPseudoFn(
- "array-bounds-pseudofn", llvm::cl::Hidden, llvm::cl::Optional,
- llvm::cl::desc("Emit debug info that places array-bounds instrumentation "
- "in an inline function called __ubsan_check_array_bounds."));
-
static uint32_t getTypeAlignIfRequired(const Type *Ty, const ASTContext &Ctx) {
auto TI = Ctx.getTypeInfo(Ty);
if (TI.isAlignRequired())
@@ -4052,7 +4045,8 @@ llvm::DIType *CGDebugInfo::CreateTypeNode(QualType Ty, llvm::DIFile *Unit) {
return CreateType(cast<HLSLAttributedResourceType>(Ty), Unit);
case Type::HLSLInlineSpirv:
return CreateType(cast<HLSLInlineSpirvType>(Ty), Unit);
-
+ case Type::PredefinedSugar:
+ return getOrCreateType(cast<PredefinedSugarType>(Ty)->desugar(), Unit);
case Type::CountAttributed:
case Type::Auto:
case Type::Attributed:
@@ -6068,11 +6062,10 @@ void CGDebugInfo::EmitPseudoVariable(CGBuilderTy &Builder,
// ptr, in this case its debug info may not match the actual type of object
// being used as in the next instruction, so we will need to emit a pseudo
// variable for type-casted value.
- auto DeclareTypeMatches = [&](auto *DbgDeclare) {
+ auto DeclareTypeMatches = [&](llvm::DbgVariableRecord *DbgDeclare) {
return DbgDeclare->getVariable()->getType() == Type;
};
- if (any_of(llvm::findDbgDeclares(Var), DeclareTypeMatches) ||
- any_of(llvm::findDVRDeclares(Var), DeclareTypeMatches))
+ if (any_of(llvm::findDVRDeclares(Var), DeclareTypeMatches))
return;
}
@@ -6442,7 +6435,7 @@ CodeGenFunction::LexicalScope::~LexicalScope() {
static std::string SanitizerHandlerToCheckLabel(SanitizerHandler Handler) {
std::string Label;
switch (Handler) {
-#define SANITIZER_CHECK(Enum, Name, Version) \
+#define SANITIZER_CHECK(Enum, Name, Version, Msg) \
case Enum: \
Label = "__ubsan_check_" #Name; \
break;
@@ -6482,7 +6475,11 @@ llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo(
SanitizerHandler Handler) {
llvm::DILocation *CheckDebugLoc = Builder.getCurrentDebugLocation();
auto *DI = getDebugInfo();
- if (!DI)
+ if (!DI || !CheckDebugLoc)
+ return CheckDebugLoc;
+ const auto &AnnotateDebugInfo =
+ CGM.getCodeGenOpts().SanitizeAnnotateDebugInfo;
+ if (AnnotateDebugInfo.empty())
return CheckDebugLoc;
std::string Label;
@@ -6491,14 +6488,8 @@ llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo(
else
Label = SanitizerHandlerToCheckLabel(Handler);
- for (auto Ord : Ordinals) {
- // TODO: deprecate ClArrayBoundsPseudoFn
- if (((ClArrayBoundsPseudoFn && Ord == SanitizerKind::SO_ArrayBounds) ||
- CGM.getCodeGenOpts().SanitizeAnnotateDebugInfo.has(Ord)) &&
- CheckDebugLoc) {
- return DI->CreateSyntheticInlineAt(CheckDebugLoc, Label);
- }
- }
+ if (any_of(Ordinals, [&](auto Ord) { return AnnotateDebugInfo.has(Ord); }))
+ return DI->CreateSyntheticInlineAt(CheckDebugLoc, Label);
return CheckDebugLoc;
}