klee
KLEEIRMetaData.h
Go to the documentation of this file.
1
//===-- KLEEIRMetaData.h ----------------------------------------*- C++ -*-===//
2
//
3
// The KLEE Symbolic Virtual Machine
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
10
#ifndef KLEE_KLEEIRMETADATA_H
11
#define KLEE_KLEEIRMETADATA_H
12
13
#include "llvm/IR/MDBuilder.h"
14
15
namespace
klee
{
16
18
class
KleeIRMetaData
:
public
llvm::MDBuilder {
19
20
llvm::LLVMContext &
Context
;
21
22
public
:
23
KleeIRMetaData
(llvm::LLVMContext &context)
24
:
llvm
::MDBuilder(context),
Context
(context) {}
25
27
llvm::MDNode *
createStringNode
(llvm::StringRef value) {
28
return
llvm::MDNode::get(
Context
, createString(value));
29
}
30
31
void
addAnnotation
(llvm::Instruction &inst, llvm::StringRef key,
32
llvm::StringRef value) {
33
inst.setMetadata(key,
createStringNode
(value));
34
}
35
37
static
bool
hasAnnotation
(
const
llvm::Instruction &inst, llvm::StringRef key,
38
llvm::StringRef value) {
39
auto
v = inst.getMetadata(key);
40
if
(!v)
41
return
false
;
42
auto
sv = llvm::dyn_cast<llvm::MDString>(v->getOperand(0));
43
if
(!sv)
44
return
false
;
45
46
return
sv->getString().equals(value);
47
}
48
};
49
}
50
51
#endif
/* KLEE_KLEEIRMETADATA_H */
klee::Context
Context - Helper class for storing global information about a KLEE run.
Definition:
Context.h:18
klee::KleeIRMetaData
Handles KLEE-specific LLVM IR meta-data.
Definition:
KLEEIRMetaData.h:18
klee::KleeIRMetaData::hasAnnotation
static bool hasAnnotation(const llvm::Instruction &inst, llvm::StringRef key, llvm::StringRef value)
Check if the instruction has the key/value meta data.
Definition:
KLEEIRMetaData.h:37
klee::KleeIRMetaData::Context
llvm::LLVMContext & Context
Definition:
KLEEIRMetaData.h:20
klee::KleeIRMetaData::KleeIRMetaData
KleeIRMetaData(llvm::LLVMContext &context)
Definition:
KLEEIRMetaData.h:23
klee::KleeIRMetaData::createStringNode
llvm::MDNode * createStringNode(llvm::StringRef value)
Return a string node reflecting the value.
Definition:
KLEEIRMetaData.h:27
klee::KleeIRMetaData::addAnnotation
void addAnnotation(llvm::Instruction &inst, llvm::StringRef key, llvm::StringRef value)
Definition:
KLEEIRMetaData.h:31
klee
Definition:
main.cpp:291
llvm
Definition:
CallPathManager.h:19
lib
Module
KLEEIRMetaData.h
Generated by
1.9.3