Files
revng-revng/lib/Pipes/IRHelpers.cpp
Ivan Krysak 7d235f4fd0 Enforce licence header consistency
Also do some basic cleanup: capitalize first letters, add `.`
at the end of the sentences, and so on.
2023-07-03 15:23:10 +00:00

24 lines
664 B
C++

/// \file IRHelpers.cpp
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/Instruction.h"
#include "revng/Pipes/IRHelpers.h"
std::optional<pipeline::Location<decltype(revng::ranks::Instruction)>>
getLocation(const llvm::Instruction *I) {
auto MaybeDebugLoc = I->getDebugLoc();
if (not MaybeDebugLoc or MaybeDebugLoc.getInlinedAt() == nullptr)
return std::nullopt;
using Location = pipeline::Location<decltype(revng::ranks::Instruction)>;
auto Result = Location::fromString(MaybeDebugLoc->getScope()->getName());
revng_assert(Result);
return Result;
}