mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[docs][unittest][Go][StackProtector] Migrate deprecated DebugInfo::get to DILocation::get
This commit is contained in:
parent
2c841246e5
commit
0d6e89041d
@ -53,8 +53,11 @@ void LLVMSetMetadata2(LLVMValueRef Inst, unsigned KindID, LLVMMetadataRef MD) {
|
||||
void LLVMGoSetCurrentDebugLocation(LLVMBuilderRef Bref, unsigned Line,
|
||||
unsigned Col, LLVMMetadataRef Scope,
|
||||
LLVMMetadataRef InlinedAt) {
|
||||
if (!Scope)
|
||||
unwrap(Bref)->SetCurrentDebugLocation(DebugLoc());
|
||||
else
|
||||
unwrap(Bref)->SetCurrentDebugLocation(
|
||||
DebugLoc::get(Line, Col, Scope ? unwrap<MDNode>(Scope) : nullptr,
|
||||
DILocation::get(Scope->getContext(), Line, Col, unwrap<MDNode>(Scope),
|
||||
InlinedAt ? unwrap<MDNode>(InlinedAt) : nullptr));
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ We use a small helper function for this:
|
||||
else
|
||||
Scope = LexicalBlocks.back();
|
||||
Builder.SetCurrentDebugLocation(
|
||||
DebugLoc::get(AST->getLine(), AST->getCol(), Scope));
|
||||
DILocation::get(Scope->getContext(), AST->getLine(), AST->getCol(), Scope));
|
||||
}
|
||||
|
||||
This both tells the main ``IRBuilder`` where we are, but also what scope
|
||||
@ -400,7 +400,7 @@ argument allocas in ``FunctionAST::codegen``.
|
||||
true);
|
||||
|
||||
DBuilder->insertDeclare(Alloca, D, DBuilder->createExpression(),
|
||||
DebugLoc::get(LineNo, 0, SP),
|
||||
DILocation::get(SP->getContext(), LineNo, 0, SP),
|
||||
Builder.GetInsertBlock());
|
||||
|
||||
// Store the initial value into the alloca.
|
||||
|
@ -556,7 +556,9 @@ BasicBlock *StackProtector::CreateFailBB() {
|
||||
LLVMContext &Context = F->getContext();
|
||||
BasicBlock *FailBB = BasicBlock::Create(Context, "CallStackCheckFailBlk", F);
|
||||
IRBuilder<> B(FailBB);
|
||||
B.SetCurrentDebugLocation(DebugLoc::get(0, 0, F->getSubprogram()));
|
||||
if (F->getSubprogram())
|
||||
B.SetCurrentDebugLocation(
|
||||
DILocation::get(Context, 0, 0, F->getSubprogram()));
|
||||
if (Trip.isOSOpenBSD()) {
|
||||
FunctionCallee StackChkFail = M->getOrInsertFunction(
|
||||
"__stack_smash_handler", Type::getVoidTy(Context),
|
||||
|
@ -112,12 +112,12 @@ public:
|
||||
DINode::FlagZero, DISubprogram::SPFlagDefinition);
|
||||
|
||||
// Make some nested scopes.
|
||||
OutermostLoc = DebugLoc::get(3, 1, OurFunc);
|
||||
InBlockLoc = DebugLoc::get(4, 1, OurBlock);
|
||||
InlinedLoc = DebugLoc::get(10, 1, ToInlineFunc, InBlockLoc.get());
|
||||
OutermostLoc = DILocation::get(Ctx, 3, 1, OurFunc);
|
||||
InBlockLoc = DILocation::get(Ctx, 4, 1, OurBlock);
|
||||
InlinedLoc = DILocation::get(Ctx, 10, 1, ToInlineFunc, InBlockLoc.get());
|
||||
|
||||
// Make a scope that isn't nested within the others.
|
||||
NotNestedBlockLoc = DebugLoc::get(4, 1, AnotherBlock);
|
||||
NotNestedBlockLoc = DILocation::get(Ctx, 4, 1, AnotherBlock);
|
||||
|
||||
DIB.finalize();
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ protected:
|
||||
F->setSubprogram(SP);
|
||||
auto Scope = DIB.createLexicalBlockFile(SP, File, 0);
|
||||
DIB.finalize();
|
||||
DL = DebugLoc::get(3, 7, Scope);
|
||||
DL = DILocation::get(Ctx, 3, 7, Scope);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
|
@ -770,7 +770,7 @@ TEST_F(IRBuilderTest, DIBuilder) {
|
||||
CU, "bar", "", File, 1, Type, 1, DINode::FlagZero,
|
||||
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
|
||||
auto BadScope = DIB.createLexicalBlockFile(BarSP, File, 0);
|
||||
I->setDebugLoc(DebugLoc::get(2, 0, BadScope));
|
||||
I->setDebugLoc(DILocation::get(Ctx, 2, 0, BadScope));
|
||||
DIB.finalize();
|
||||
EXPECT_TRUE(verifyModule(*M));
|
||||
}
|
||||
@ -792,8 +792,8 @@ TEST_F(IRBuilderTest, createArtificialSubprogram) {
|
||||
F->setSubprogram(SP);
|
||||
AllocaInst *I = Builder.CreateAlloca(Builder.getInt8Ty());
|
||||
ReturnInst *R = Builder.CreateRetVoid();
|
||||
I->setDebugLoc(DebugLoc::get(3, 2, SP));
|
||||
R->setDebugLoc(DebugLoc::get(4, 2, SP));
|
||||
I->setDebugLoc(DILocation::get(Ctx, 3, 2, SP));
|
||||
R->setDebugLoc(DILocation::get(Ctx, 4, 2, SP));
|
||||
DIB.finalize();
|
||||
EXPECT_FALSE(verifyModule(*M));
|
||||
|
||||
@ -821,7 +821,8 @@ TEST_F(IRBuilderTest, createArtificialSubprogram) {
|
||||
DebugLoc DL = I->getDebugLoc();
|
||||
DenseMap<const MDNode *, MDNode *> IANodes;
|
||||
auto IA = DebugLoc::appendInlinedAt(DL, InlinedAtNode, Ctx, IANodes);
|
||||
auto NewDL = DebugLoc::get(DL.getLine(), DL.getCol(), DL.getScope(), IA);
|
||||
auto NewDL =
|
||||
DILocation::get(Ctx, DL.getLine(), DL.getCol(), DL.getScope(), IA);
|
||||
I->setDebugLoc(NewDL);
|
||||
EXPECT_FALSE(verifyModule(*M));
|
||||
|
||||
|
@ -486,13 +486,15 @@ protected:
|
||||
// Function body
|
||||
BasicBlock* Entry = BasicBlock::Create(C, "", OldFunc);
|
||||
IBuilder.SetInsertPoint(Entry);
|
||||
DebugLoc Loc = DebugLoc::get(3, 2, Subprogram);
|
||||
DebugLoc Loc = DILocation::get(Subprogram->getContext(), 3, 2, Subprogram);
|
||||
IBuilder.SetCurrentDebugLocation(Loc);
|
||||
AllocaInst* Alloca = IBuilder.CreateAlloca(IntegerType::getInt32Ty(C));
|
||||
IBuilder.SetCurrentDebugLocation(DebugLoc::get(4, 2, Subprogram));
|
||||
IBuilder.SetCurrentDebugLocation(
|
||||
DILocation::get(Subprogram->getContext(), 4, 2, Subprogram));
|
||||
Value* AllocaContent = IBuilder.getInt32(1);
|
||||
Instruction* Store = IBuilder.CreateStore(AllocaContent, Alloca);
|
||||
IBuilder.SetCurrentDebugLocation(DebugLoc::get(5, 2, Subprogram));
|
||||
IBuilder.SetCurrentDebugLocation(
|
||||
DILocation::get(Subprogram->getContext(), 5, 2, Subprogram));
|
||||
|
||||
// Create a local variable around the alloca
|
||||
auto *IntType = DBuilder.createBasicType("int", 32, dwarf::DW_ATE_signed);
|
||||
@ -515,8 +517,9 @@ protected:
|
||||
DBuilder.createAutoVariable(InlinedSP, "inlined", File, 5, StructType, true);
|
||||
auto *Scope = DBuilder.createLexicalBlock(
|
||||
DBuilder.createLexicalBlockFile(InlinedSP, File), File, 1, 1);
|
||||
auto InlinedDL =
|
||||
DebugLoc::get(9, 4, Scope, DebugLoc::get(5, 2, Subprogram));
|
||||
auto InlinedDL = DILocation::get(
|
||||
Subprogram->getContext(), 9, 4, Scope,
|
||||
DILocation::get(Subprogram->getContext(), 5, 2, Subprogram));
|
||||
IBuilder.SetCurrentDebugLocation(InlinedDL);
|
||||
DBuilder.insertDeclare(Alloca, InlinedVar, E, InlinedDL, Store);
|
||||
IBuilder.CreateStore(IBuilder.getInt32(2), Alloca);
|
||||
|
Loading…
Reference in New Issue
Block a user