Skip to content

Commit f6a39c7

Browse files
committed
address comments
1 parent 6de3c49 commit f6a39c7

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

llvm/lib/Analysis/DXILResource.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -910,25 +910,23 @@ void DXILResourceCounterDirectionMap::populate(Module &M, DXILBindingMap &DBM) {
910910
ResourceCounterDirection::Invalid;
911911
std::get<ResourceCounterDirection>(*DupNext) =
912912
ResourceCounterDirection::Invalid;
913+
914+
// Raise an error for every invalid entry
915+
StringRef Message =
916+
"RWStructuredBuffers may increment or decrement their "
917+
"counters, but not both.";
918+
const Function *FFirst = std::get<const Function *>(*DupFirst);
919+
const CallInst *CIFirst = std::get<const CallInst *>(*DupFirst);
920+
const Function *FNext = std::get<const Function *>(*DupNext);
921+
const CallInst *CINext = std::get<const CallInst *>(*DupNext);
922+
M.getContext().diagnose(DiagnosticInfoGenericWithLoc(
923+
Message, *FFirst, CIFirst->getDebugLoc()));
924+
M.getContext().diagnose(DiagnosticInfoGenericWithLoc(
925+
Message, *FNext, CINext->getDebugLoc()));
913926
}
914927
}
915928
}
916929

917-
// Raise an error for every invalid entry
918-
for (const auto &Entry : DiagCounterDirs) {
919-
ResourceCounterDirection Dir = std::get<ResourceCounterDirection>(Entry);
920-
const Function *F = std::get<const Function *>(Entry);
921-
const CallInst *CI = std::get<const CallInst *>(Entry);
922-
923-
if (Dir != ResourceCounterDirection::Invalid)
924-
continue;
925-
926-
StringRef Message = "RWStructuredBuffers may increment or decrement their "
927-
"counters, but not both.";
928-
M.getContext().diagnose(
929-
DiagnosticInfoGenericWithLoc(Message, *F, CI->getDebugLoc()));
930-
}
931-
932930
// Copy the results into the final vec
933931
CounterDirections.clear();
934932
CounterDirections.reserve(DiagCounterDirs.size());

0 commit comments

Comments
 (0)