[llvm-commits] CVS: reopt/lib/Mapping/getLLVMinfo.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Wed Mar 31 10:32:00 PST 2004
Changes in directory reopt/lib/Mapping:
getLLVMinfo.cpp updated: 1.25 -> 1.26
---
Log message:
Make maybeFillInMapsForModule have better assertions.
Use 0 instead of NULL.
---
Diffs of the changes: (+11 -10)
Index: reopt/lib/Mapping/getLLVMinfo.cpp
diff -u reopt/lib/Mapping/getLLVMinfo.cpp:1.25 reopt/lib/Mapping/getLLVMinfo.cpp:1.26
--- reopt/lib/Mapping/getLLVMinfo.cpp:1.25 Tue Feb 10 13:17:25 2004
+++ reopt/lib/Mapping/getLLVMinfo.cpp Wed Mar 31 10:31:29 2004
@@ -57,7 +57,7 @@
static void maybeFillInMapsForModule (Module *M) {
// First time we see a given Module, we have to fill in the above tables.
- static Module *lastUsedModule = NULL;
+ static Module *lastUsedModule = 0;
if (lastUsedModule != M) {
unsigned f = 0;
for(Module::iterator FI=M->begin(), FE=M->end(); FE!=FI; ++FI){
@@ -86,10 +86,11 @@
unsigned getLLVMFunctionPositionInfo (Function *F) {
// Get pointer to the Module which contains F
Module *M = F->getParent ();
-
+ assert (M && "Can't get mapping info for a function without a module");
maybeFillInMapsForModule (M);
- assert (FunctionKey.find (F) != FunctionKey.end ());
+ assert (FunctionKey.find (F) != FunctionKey.end () &&
+ "Function was not found in mapping info tables");
return FunctionKey[F];
}
@@ -133,7 +134,7 @@
// Get pointer to the Module that contains BB.
Module *M = BB->getParent()->getParent();
- static Module *lastUsedModule = NULL;
+ static Module *lastUsedModule = 0;
if (lastUsedModule != M) {
// First time we see a given Module, create the table we use to
// look up addresses for BasicBlocks in that Module.
@@ -153,7 +154,7 @@
/// Otherwise, return false, and leave BB untouched.
///
bool getReverseBBMap(uint64_t addr, Module *M, BasicBlock* &bb) {
- static Module *lastUsedModule = NULL;
+ static Module *lastUsedModule = 0;
if (lastUsedModule != M) {
// First time we see a given Module, create the table we use to
// look up BasicBlocks for addresses in that module.
@@ -189,7 +190,7 @@
}
static void createBBmapRevFwdF(Module *M){
- static Module *lastUsedModule = NULL;
+ static Module *lastUsedModule = 0;
if (lastUsedModule == M) return; // Already did this module.
unsigned funNo = 0;
for(Module::iterator FI=M->begin(), FE=M->end(); FE!=FI; ++FI){
@@ -250,7 +251,7 @@
return false;
Module *M = F->getParent ();
- static Module *lastUsedModule = NULL;
+ static Module *lastUsedModule = 0;
if (lastUsedModule != M) {
int i = 0;
for (Module::iterator FI = M->begin (), FE = M->end (); FE != FI; ++FI) {
@@ -273,11 +274,11 @@
}
/// getRevFunction - Given an address and a Module, get the Function
-/// that maps to the address. Return NULL when it's an external
+/// that maps to the address. Return 0 when it's an external
/// function.
///
Function *getRevFunction(Module *M, uint64_t addr){
- static Module *lastUsedModule = NULL;
+ static Module *lastUsedModule = 0;
if (lastUsedModule != M) {
unsigned i = 0;
for(Module::iterator FI=M->begin(), FE=M->end();
@@ -292,7 +293,7 @@
if(revFunction.find(addr) != revFunction.end())
return revFunction[addr];
- return NULL;
+ return 0;
}
} // end namespace llvm
More information about the llvm-commits
mailing list