Skip to content

Commit 71fbbb6

Browse files
committed
[IR] Move GlobalValue::getGUID() out of line (NFC)
Avoid including MD5.h in a core IR header.
1 parent 4d1ecf1 commit 71fbbb6

File tree

5 files changed

+9
-2
lines changed

5 files changed

+9
-2
lines changed

llvm/include/llvm/IR/GlobalValue.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "llvm/IR/Value.h"
2525
#include "llvm/Support/Casting.h"
2626
#include "llvm/Support/ErrorHandling.h"
27-
#include "llvm/Support/MD5.h"
2827
#include <cassert>
2928
#include <cstdint>
3029
#include <string>
@@ -588,7 +587,7 @@ class GlobalValue : public Constant {
588587

589588
/// Return a 64-bit global unique ID constructed from global value name
590589
/// (i.e. returned by getGlobalIdentifier()).
591-
static GUID getGUID(StringRef GlobalName) { return MD5Hash(GlobalName); }
590+
static GUID getGUID(StringRef GlobalName);
592591

593592
/// Return a 64-bit global unique ID constructed from global value name
594593
/// (i.e. returned by getGlobalIdentifier()).

llvm/lib/IR/Globals.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "llvm/IR/Module.h"
2222
#include "llvm/Support/Error.h"
2323
#include "llvm/Support/ErrorHandling.h"
24+
#include "llvm/Support/MD5.h"
2425
#include "llvm/TargetParser/Triple.h"
2526
using namespace llvm;
2627

@@ -71,6 +72,10 @@ void GlobalValue::copyAttributesFrom(const GlobalValue *Src) {
7172
removeSanitizerMetadata();
7273
}
7374

75+
GlobalValue::GUID GlobalValue::getGUID(StringRef GlobalName) {
76+
return MD5Hash(GlobalName);
77+
}
78+
7479
void GlobalValue::removeFromParent() {
7580
switch (getValueID()) {
7681
#define HANDLE_GLOBAL_VALUE(NAME) \

llvm/lib/Target/NVPTX/NVPTXCtorDtorLowering.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "llvm/IR/Value.h"
2323
#include "llvm/Pass.h"
2424
#include "llvm/Support/CommandLine.h"
25+
#include "llvm/Support/MD5.h"
2526
#include "llvm/Transforms/Utils/ModuleUtils.h"
2627

2728
using namespace llvm;

llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include "llvm/Support/Casting.h"
5454
#include "llvm/Support/CommandLine.h"
5555
#include "llvm/Support/Debug.h"
56+
#include "llvm/Support/MD5.h"
5657
#include "llvm/Support/RandomNumberGenerator.h"
5758
#include "llvm/Support/raw_ostream.h"
5859
#include "llvm/TargetParser/Triple.h"

llvm/lib/Transforms/Utils/ModuleUtils.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "llvm/IR/IRBuilder.h"
1919
#include "llvm/IR/MDBuilder.h"
2020
#include "llvm/IR/Module.h"
21+
#include "llvm/Support/MD5.h"
2122
#include "llvm/Support/raw_ostream.h"
2223
#include "llvm/Support/xxhash.h"
2324

0 commit comments

Comments
 (0)