Skip to content

Commit

Permalink
Reverting changes to diagnostic sink
Browse files Browse the repository at this point in the history
  • Loading branch information
venkataram-nv committed Sep 18, 2024
1 parent 52f1310 commit 8779f24
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions source/compiler-core/slang-diagnostic-sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static void _reduceLength(Index startIndex, const UnownedStringSlice& prefix, St
ioBuf = buf;
}

void sourceLocationNoteDiagnostic(DiagnosticSink* sink, SourceView* sourceView, SourceLoc sourceLoc, StringBuilder& sb)
static void _sourceLocationNoteDiagnostic(DiagnosticSink* sink, SourceView* sourceView, SourceLoc sourceLoc, StringBuilder& sb)
{
SourceFile* sourceFile = sourceView->getSourceFile();
if (!sourceFile)
Expand Down Expand Up @@ -461,7 +461,7 @@ static void formatDiagnostic(

if (sourceView && sink->isFlagSet(DiagnosticSink::Flag::SourceLocationLine) && diagnostic.loc.isValid())
{
sourceLocationNoteDiagnostic(sink, sourceView, sourceLoc, sb);
_sourceLocationNoteDiagnostic(sink, sourceView, sourceLoc, sb);
}

if (sourceView && sink->isFlagSet(DiagnosticSink::Flag::VerbosePath))
Expand Down
3 changes: 0 additions & 3 deletions source/compiler-core/slang-diagnostic-sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,6 @@ class DiagnosticsLookup : public RefObject
MemoryArena m_arena;
};

// Display source location
void sourceLocationNoteDiagnostic(DiagnosticSink* sink, SourceView* sourceView, SourceLoc sourceLoc, StringBuilder& sb);

}

#endif
7 changes: 3 additions & 4 deletions source/slang/slang-ir-loop-unroll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ void eliminateContinueBlocks(IRModule* module, IRLoop* loopInst)
// we will now introduce a breakable region for each iteration.

IRBuilder builder(module);
IRBuilderSourceLocRAII sourceLocationScope(&builder, loopInst->sourceLoc);

auto targetBlock = loopInst->getTargetBlock();

Expand All @@ -544,15 +545,13 @@ void eliminateContinueBlocks(IRModule* module, IRLoop* loopInst)
moveParams(innerBreakableRegionHeader, targetBlock);

builder.setInsertInto(innerBreakableRegionHeader);
auto innerLoop = builder.emitLoop(targetBlock, innerBreakableRegionBreakBlock, targetBlock);
innerLoop->sourceLoc = loopInst->sourceLoc;
builder.emitLoop(targetBlock, innerBreakableRegionBreakBlock, targetBlock);

continueBlock->replaceUsesWith(innerBreakableRegionBreakBlock);

builder.setInsertInto(innerBreakableRegionBreakBlock);
moveParams(innerBreakableRegionBreakBlock, continueBlock);
auto unconditionalBranch = builder.emitBranch(continueBlock);
unconditionalBranch->sourceLoc = loopInst->sourceLoc;
builder.emitBranch(continueBlock);

// If the original loop can be executed up to N times, the new loop may be executed
// upto N+1 times (although most insts are skipped in the last traversal)
Expand Down
6 changes: 3 additions & 3 deletions source/slang/slang-ir-ssa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ PhiInfo* addPhi(
RefPtr<PhiInfo> phiInfo = new PhiInfo();
context->phiInfos.add(phi, phiInfo);

phi->sourceLoc = var->sourceLoc;
phiInfo->phi = phi;
phiInfo->var = var;

Expand Down Expand Up @@ -678,6 +677,8 @@ IRInst* readVarRec(
SSABlockInfo* blockInfo,
IRVar* var)
{
IRBuilderSourceLocRAII sourceLocationScope(&context->builder, var->sourceLoc);

IRInst* val = nullptr;
if (!blockInfo->isSealed)
{
Expand Down Expand Up @@ -985,8 +986,7 @@ void IRBuilder::insertBlockAlongEdge(
// The edge block should branch (unconditionally)
// to the successor block.
builder.setInsertInto(edgeBlock);
auto unconditionalBranch = builder.emitBranch(succ);
unconditionalBranch->sourceLoc = edgeUse->getUser()->sourceLoc;
builder.emitBranch(succ);

// Insert the new block into the block list
// for the function.
Expand Down

0 comments on commit 8779f24

Please sign in to comment.