Revert r122143 through r122140, which collectively broke the LLVMC tests on

the buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122149 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson
2010-12-18 07:37:18 +00:00
parent 3132780a2e
commit fffa863536
7 changed files with 32 additions and 32 deletions

View File

@@ -21,10 +21,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#define LLVMV_PATH_DEPRECATED_MSG(replacement) \ #define LLVMV_PATH_DEPRECATED_MSG \
"PathV1 has been deprecated and will be removed as soon as all LLVM and" \ "PathV1 is being deprecated, please use the PathV2 API."
" Clang clients have been moved over to PathV2. Please use `" #replacement \
"` from PathV2 instead."
namespace llvm { namespace llvm {
namespace sys { namespace sys {
@@ -267,20 +265,18 @@ namespace sys {
/// @brief Returns the last component of the path name. /// @brief Returns the last component of the path name.
LLVM_ATTRIBUTE_DEPRECATED( LLVM_ATTRIBUTE_DEPRECATED(
StringRef getLast() const, StringRef getLast() const,
LLVMV_PATH_DEPRECATED_MSG(path::filename)); LLVMV_PATH_DEPRECATED_MSG);
/// This function strips off the path and suffix of the file or directory /// This function strips off the path and suffix of the file or directory
/// name and returns just the basename. For example /a/foo.bar would cause /// name and returns just the basename. For example /a/foo.bar would cause
/// this function to return "foo". /// this function to return "foo".
/// @returns StringRef containing the basename of the path /// @returns StringRef containing the basename of the path
/// @brief Get the base name of the path /// @brief Get the base name of the path
LLVM_ATTRIBUTE_DEPRECATED(StringRef getBasename() const, StringRef getBasename() const;
LLVMV_PATH_DEPRECATED_MSG(path::stem));
/// This function strips off the suffix of the path beginning with the /// This function strips off the suffix of the path beginning with the
/// path separator ('/' on Unix, '\' on Windows) and returns the result. /// path separator ('/' on Unix, '\' on Windows) and returns the result.
LLVM_ATTRIBUTE_DEPRECATED(StringRef getDirname() const, StringRef getDirname() const;
LLVMV_PATH_DEPRECATED_MSG(path::parent_path));
/// This function strips off the path and basename(up to and /// This function strips off the path and basename(up to and
/// including the last dot) of the file or directory name and /// including the last dot) of the file or directory name and
@@ -288,8 +284,7 @@ namespace sys {
/// this function to return "bar". /// this function to return "bar".
/// @returns StringRef containing the suffix of the path /// @returns StringRef containing the suffix of the path
/// @brief Get the suffix of the path /// @brief Get the suffix of the path
LLVM_ATTRIBUTE_DEPRECATED(StringRef getSuffix() const, StringRef getSuffix() const;
LLVMV_PATH_DEPRECATED_MSG(path::extension));
/// Obtain a 'C' string for the path name. /// Obtain a 'C' string for the path name.
/// @returns a 'C' string containing the path name. /// @returns a 'C' string containing the path name.
@@ -313,14 +308,14 @@ namespace sys {
/// @brief Determine if the path is absolute. /// @brief Determine if the path is absolute.
LLVM_ATTRIBUTE_DEPRECATED( LLVM_ATTRIBUTE_DEPRECATED(
bool isAbsolute() const, bool isAbsolute() const,
LLVMV_PATH_DEPRECATED_MSG(path::is_absolute)); LLVMV_PATH_DEPRECATED_MSG);
/// This function determines if the path name is absolute, as opposed to /// This function determines if the path name is absolute, as opposed to
/// relative. /// relative.
/// @brief Determine if the path is absolute. /// @brief Determine if the path is absolute.
LLVM_ATTRIBUTE_DEPRECATED( LLVM_ATTRIBUTE_DEPRECATED(
static bool isAbsolute(const char *NameStart, unsigned NameLen), static bool isAbsolute(const char *NameStart, unsigned NameLen),
LLVMV_PATH_DEPRECATED_MSG(path::is_absolute)); LLVMV_PATH_DEPRECATED_MSG);
/// This function opens the file associated with the path name provided by /// This function opens the file associated with the path name provided by
/// the Path object and reads its magic number. If the magic number at the /// the Path object and reads its magic number. If the magic number at the

View File

@@ -32,7 +32,7 @@ using namespace llvmc;
namespace llvmc { namespace llvmc {
const std::string* LanguageMap::GetLanguage(const sys::Path& File) const { const std::string* LanguageMap::GetLanguage(const sys::Path& File) const {
StringRef suf = sys::path::extension(File.str()); StringRef suf = File.getSuffix();
LanguageMap::const_iterator Lang = LanguageMap::const_iterator Lang =
this->find(suf.empty() ? "*empty*" : suf); this->find(suf.empty() ? "*empty*" : suf);
if (Lang == this->end()) { if (Lang == this->end()) {

View File

@@ -43,7 +43,8 @@ namespace {
return 0; return 0;
} }
else if (SaveTemps == SaveTempsEnum::Obj && !OutputFilename.empty()) { else if (SaveTemps == SaveTempsEnum::Obj && !OutputFilename.empty()) {
tempDir = sys::path::parent_path(OutputFilename); tempDir = OutputFilename;
tempDir = tempDir.getDirname();
} }
else { else {
// SaveTemps == Cwd --> use current dir (leave tempDir empty). // SaveTemps == Cwd --> use current dir (leave tempDir empty).

View File

@@ -61,7 +61,7 @@ sys::Path Tool::OutFilename(const sys::Path& In,
Out.appendSuffix(OutputSuffix); Out.appendSuffix(OutputSuffix);
} }
else { else {
Out.set(sys::path::stem(In.str())); Out.set(In.getBasename());
Out.appendSuffix(OutputSuffix); Out.appendSuffix(OutputSuffix);
} }
} }
@@ -69,7 +69,7 @@ sys::Path Tool::OutFilename(const sys::Path& In,
if (IsJoin()) if (IsJoin())
Out = MakeTempFile(TempDir, "tmp", OutputSuffix); Out = MakeTempFile(TempDir, "tmp", OutputSuffix);
else else
Out = MakeTempFile(TempDir, sys::path::stem(In.str()), OutputSuffix); Out = MakeTempFile(TempDir, In.getBasename(), OutputSuffix);
} }
return Out; return Out;
} }

View File

@@ -449,7 +449,7 @@ static void LinkNamedMDNodes(Module *Dest, Module *Src,
const NamedMDNode *SrcNMD = I; const NamedMDNode *SrcNMD = I;
NamedMDNode *DestNMD = Dest->getOrInsertNamedMetadata(SrcNMD->getName()); NamedMDNode *DestNMD = Dest->getOrInsertNamedMetadata(SrcNMD->getName());
// Add Src elements into Dest node. // Add Src elements into Dest node.
for (unsigned i = 0, e = SrcNMD->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = SrcNMD->getNumOperands(); i != e; ++i)
DestNMD->addOperand(cast<MDNode>(MapValue(SrcNMD->getOperand(i), DestNMD->addOperand(cast<MDNode>(MapValue(SrcNMD->getOperand(i),
ValueMap, ValueMap,
true))); true)));
@@ -559,14 +559,14 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
// we are replacing may be a function (if a prototype, weak, etc) or a // we are replacing may be a function (if a prototype, weak, etc) or a
// global variable. // global variable.
GlobalVariable *NewDGV = GlobalVariable *NewDGV =
new GlobalVariable(*Dest, SGV->getType()->getElementType(), new GlobalVariable(*Dest, SGV->getType()->getElementType(),
SGV->isConstant(), NewLinkage, /*init*/0, SGV->isConstant(), NewLinkage, /*init*/0,
DGV->getName(), 0, false, DGV->getName(), 0, false,
SGV->getType()->getAddressSpace()); SGV->getType()->getAddressSpace());
// Propagate alignment, section, and visibility info. // Propagate alignment, section, and visibility info.
CopyGVAttributes(NewDGV, SGV); CopyGVAttributes(NewDGV, SGV);
DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDGV, DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDGV,
DGV->getType())); DGV->getType()));
// DGV will conflict with NewDGV because they both had the same // DGV will conflict with NewDGV because they both had the same
@@ -928,7 +928,7 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src,
CopyGVAttributes(NewDF, SF); CopyGVAttributes(NewDF, SF);
// Any uses of DF need to change to NewDF, with cast // Any uses of DF need to change to NewDF, with cast
DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDF, DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDF,
DGV->getType())); DGV->getType()));
// DF will conflict with NewDF because they both had the same. We must // DF will conflict with NewDF because they both had the same. We must
@@ -1017,7 +1017,7 @@ static bool LinkFunctionBody(Function *Dest, Function *Src,
Value *Old = MI->second; Value *Old = MI->second;
if (!isa<Instruction>(Old) && !isa<BasicBlock>(Old)) { if (!isa<Instruction>(Old) && !isa<BasicBlock>(Old)) {
Value *New = MapValue(Old, ValueMap, true); Value *New = MapValue(Old, ValueMap, true);
if (New != Old) if (New != Old)
I->setMetadata(MI->first, cast<MDNode>(New)); I->setMetadata(MI->first, cast<MDNode>(New));
} }
} }
@@ -1100,7 +1100,7 @@ static bool LinkAppendingVars(Module *M,
"Appending variables with different section name need to be linked!"); "Appending variables with different section name need to be linked!");
unsigned NewSize = T1->getNumElements() + T2->getNumElements(); unsigned NewSize = T1->getNumElements() + T2->getNumElements();
ArrayType *NewType = ArrayType::get(T1->getElementType(), ArrayType *NewType = ArrayType::get(T1->getElementType(),
NewSize); NewSize);
G1->setName(""); // Clear G1's name in case of a conflict! G1->setName(""); // Clear G1's name in case of a conflict!
@@ -1144,7 +1144,7 @@ static bool LinkAppendingVars(Module *M,
// getelementptr instructions to not use the Cast! // getelementptr instructions to not use the Cast!
G1->replaceAllUsesWith(ConstantExpr::getBitCast(NG, G1->replaceAllUsesWith(ConstantExpr::getBitCast(NG,
G1->getType())); G1->getType()));
G2->replaceAllUsesWith(ConstantExpr::getBitCast(NG, G2->replaceAllUsesWith(ConstantExpr::getBitCast(NG,
G2->getType())); G2->getType()));
// Remove the two globals from the module now... // Remove the two globals from the module now...
@@ -1301,9 +1301,10 @@ Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) {
// If the source library's module id is in the dependent library list of the // If the source library's module id is in the dependent library list of the
// destination library, remove it since that module is now linked in. // destination library, remove it since that module is now linked in.
const std::string &modId = Src->getModuleIdentifier(); sys::Path modId;
if (!modId.empty()) modId.set(Src->getModuleIdentifier());
Dest->removeLibrary(sys::path::stem(modId)); if (!modId.isEmpty())
Dest->removeLibrary(modId.getBasename());
return false; return false;
} }

View File

@@ -526,7 +526,7 @@ int main(int argc, char **argv, char **envp) {
initializeTarget(Registry); initializeTarget(Registry);
// Initial global variable above for convenience printing of program name. // Initial global variable above for convenience printing of program name.
progname = sys::path::stem(argv[0]); progname = sys::Path(argv[0]).getBasename();
// Parse the command line options // Parse the command line options
cl::ParseCommandLineOptions(argc, argv, "llvm linker\n"); cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
@@ -538,8 +538,11 @@ int main(int argc, char **argv, char **envp) {
OutputFilename = "a.exe"; OutputFilename = "a.exe";
// If there is no suffix add an "exe" one. // If there is no suffix add an "exe" one.
if (sys::path::extension(OutputFilename).empty()) sys::Path ExeFile( OutputFilename );
OutputFilename.append(".exe"); if (ExeFile.getSuffix() == "") {
ExeFile.appendSuffix("exe");
OutputFilename = ExeFile.str();
}
} }
#endif #endif

View File

@@ -523,7 +523,7 @@ int main(int argc, char **argv) {
errs().indent(ToolName.size()) << ": DLL Name : " << DLLName << '\n'; errs().indent(ToolName.size()) << ": DLL Name : " << DLLName << '\n';
} }
if (NoUser32 && sys::path::stem(DLLName) == "user32") { if (NoUser32 && sys::Path(DLLName).getBasename() == "user32") {
// Program is loading user32.dll, in the applications we are testing, // Program is loading user32.dll, in the applications we are testing,
// this only happens if an assert has fired. By now the message has // this only happens if an assert has fired. By now the message has
// already been printed, so simply close the program. // already been printed, so simply close the program.