llvm.org GIT mirror llvm / fffa863
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 Owen Anderson 9 years ago
7 changed file(s) with 32 addition(s) and 32 deletion(s). Raw diff Collapse all Expand all
2020 #include
2121 #include
2222
23 #define LLVMV_PATH_DEPRECATED_MSG(replacement) \
24 "PathV1 has been deprecated and will be removed as soon as all LLVM and" \
25 " Clang clients have been moved over to PathV2. Please use `" #replacement \
26 "` from PathV2 instead."
23 #define LLVMV_PATH_DEPRECATED_MSG \
24 "PathV1 is being deprecated, please use the PathV2 API."
2725
2826 namespace llvm {
2927 namespace sys {
266264 /// @brief Returns the last component of the path name.
267265 LLVM_ATTRIBUTE_DEPRECATED(
268266 StringRef getLast() const,
269 LLVMV_PATH_DEPRECATED_MSG(path::filename));
267 LLVMV_PATH_DEPRECATED_MSG);
270268
271269 /// This function strips off the path and suffix of the file or directory
272270 /// name and returns just the basename. For example /a/foo.bar would cause
273271 /// this function to return "foo".
274272 /// @returns StringRef containing the basename of the path
275273 /// @brief Get the base name of the path
276 LLVM_ATTRIBUTE_DEPRECATED(StringRef getBasename() const,
277 LLVMV_PATH_DEPRECATED_MSG(path::stem));
274 StringRef getBasename() const;
278275
279276 /// This function strips off the suffix of the path beginning with the
280277 /// path separator ('/' on Unix, '\' on Windows) and returns the result.
281 LLVM_ATTRIBUTE_DEPRECATED(StringRef getDirname() const,
282 LLVMV_PATH_DEPRECATED_MSG(path::parent_path));
278 StringRef getDirname() const;
283279
284280 /// This function strips off the path and basename(up to and
285281 /// including the last dot) of the file or directory name and
287283 /// this function to return "bar".
288284 /// @returns StringRef containing the suffix of the path
289285 /// @brief Get the suffix of the path
290 LLVM_ATTRIBUTE_DEPRECATED(StringRef getSuffix() const,
291 LLVMV_PATH_DEPRECATED_MSG(path::extension));
286 StringRef getSuffix() const;
292287
293288 /// Obtain a 'C' string for the path name.
294289 /// @returns a 'C' string containing the path name.
312307 /// @brief Determine if the path is absolute.
313308 LLVM_ATTRIBUTE_DEPRECATED(
314309 bool isAbsolute() const,
315 LLVMV_PATH_DEPRECATED_MSG(path::is_absolute));
310 LLVMV_PATH_DEPRECATED_MSG);
316311
317312 /// This function determines if the path name is absolute, as opposed to
318313 /// relative.
319314 /// @brief Determine if the path is absolute.
320315 LLVM_ATTRIBUTE_DEPRECATED(
321316 static bool isAbsolute(const char *NameStart, unsigned NameLen),
322 LLVMV_PATH_DEPRECATED_MSG(path::is_absolute));
317 LLVMV_PATH_DEPRECATED_MSG);
323318
324319 /// This function opens the file associated with the path name provided by
325320 /// the Path object and reads its magic number. If the magic number at the
3131 namespace llvmc {
3232
3333 const std::string* LanguageMap::GetLanguage(const sys::Path& File) const {
34 StringRef suf = sys::path::extension(File.str());
34 StringRef suf = File.getSuffix();
3535 LanguageMap::const_iterator Lang =
3636 this->find(suf.empty() ? "*empty*" : suf);
3737 if (Lang == this->end()) {
4242 return 0;
4343 }
4444 else if (SaveTemps == SaveTempsEnum::Obj && !OutputFilename.empty()) {
45 tempDir = sys::path::parent_path(OutputFilename);
45 tempDir = OutputFilename;
46 tempDir = tempDir.getDirname();
4647 }
4748 else {
4849 // SaveTemps == Cwd --> use current dir (leave tempDir empty).
6060 Out.appendSuffix(OutputSuffix);
6161 }
6262 else {
63 Out.set(sys::path::stem(In.str()));
63 Out.set(In.getBasename());
6464 Out.appendSuffix(OutputSuffix);
6565 }
6666 }
6868 if (IsJoin())
6969 Out = MakeTempFile(TempDir, "tmp", OutputSuffix);
7070 else
71 Out = MakeTempFile(TempDir, sys::path::stem(In.str()), OutputSuffix);
71 Out = MakeTempFile(TempDir, In.getBasename(), OutputSuffix);
7272 }
7373 return Out;
7474 }
448448 const NamedMDNode *SrcNMD = I;
449449 NamedMDNode *DestNMD = Dest->getOrInsertNamedMetadata(SrcNMD->getName());
450450 // Add Src elements into Dest node.
451 for (unsigned i = 0, e = SrcNMD->getNumOperands(); i != e; ++i)
451 for (unsigned i = 0, e = SrcNMD->getNumOperands(); i != e; ++i)
452452 DestNMD->addOperand(cast(MapValue(SrcNMD->getOperand(i),
453453 ValueMap,
454454 true)));
558558 // we are replacing may be a function (if a prototype, weak, etc) or a
559559 // global variable.
560560 GlobalVariable *NewDGV =
561 new GlobalVariable(*Dest, SGV->getType()->getElementType(),
562 SGV->isConstant(), NewLinkage, /*init*/0,
561 new GlobalVariable(*Dest, SGV->getType()->getElementType(),
562 SGV->isConstant(), NewLinkage, /*init*/0,
563563 DGV->getName(), 0, false,
564564 SGV->getType()->getAddressSpace());
565565
566566 // Propagate alignment, section, and visibility info.
567567 CopyGVAttributes(NewDGV, SGV);
568 DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDGV,
568 DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDGV,
569569 DGV->getType()));
570570
571571 // DGV will conflict with NewDGV because they both had the same
927927 CopyGVAttributes(NewDF, SF);
928928
929929 // Any uses of DF need to change to NewDF, with cast
930 DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDF,
930 DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDF,
931931 DGV->getType()));
932932
933933 // DF will conflict with NewDF because they both had the same. We must
10161016 Value *Old = MI->second;
10171017 if (!isa(Old) && !isa(Old)) {
10181018 Value *New = MapValue(Old, ValueMap, true);
1019 if (New != Old)
1019 if (New != Old)
10201020 I->setMetadata(MI->first, cast(New));
10211021 }
10221022 }
10991099 "Appending variables with different section name need to be linked!");
11001100
11011101 unsigned NewSize = T1->getNumElements() + T2->getNumElements();
1102 ArrayType *NewType = ArrayType::get(T1->getElementType(),
1102 ArrayType *NewType = ArrayType::get(T1->getElementType(),
11031103 NewSize);
11041104
11051105 G1->setName(""); // Clear G1's name in case of a conflict!
11431143 // getelementptr instructions to not use the Cast!
11441144 G1->replaceAllUsesWith(ConstantExpr::getBitCast(NG,
11451145 G1->getType()));
1146 G2->replaceAllUsesWith(ConstantExpr::getBitCast(NG,
1146 G2->replaceAllUsesWith(ConstantExpr::getBitCast(NG,
11471147 G2->getType()));
11481148
11491149 // Remove the two globals from the module now...
13001300
13011301 // If the source library's module id is in the dependent library list of the
13021302 // destination library, remove it since that module is now linked in.
1303 const std::string &modId = Src->getModuleIdentifier();
1304 if (!modId.empty())
1305 Dest->removeLibrary(sys::path::stem(modId));
1303 sys::Path modId;
1304 modId.set(Src->getModuleIdentifier());
1305 if (!modId.isEmpty())
1306 Dest->removeLibrary(modId.getBasename());
13061307
13071308 return false;
13081309 }
525525 initializeTarget(Registry);
526526
527527 // Initial global variable above for convenience printing of program name.
528 progname = sys::path::stem(argv[0]);
528 progname = sys::Path(argv[0]).getBasename();
529529
530530 // Parse the command line options
531531 cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
537537 OutputFilename = "a.exe";
538538
539539 // If there is no suffix add an "exe" one.
540 if (sys::path::extension(OutputFilename).empty())
541 OutputFilename.append(".exe");
540 sys::Path ExeFile( OutputFilename );
541 if (ExeFile.getSuffix() == "") {
542 ExeFile.appendSuffix("exe");
543 OutputFilename = ExeFile.str();
544 }
542545 }
543546 #endif
544547
522522 errs().indent(ToolName.size()) << ": DLL Name : " << DLLName << '\n';
523523 }
524524
525 if (NoUser32 && sys::path::stem(DLLName) == "user32") {
525 if (NoUser32 && sys::Path(DLLName).getBasename() == "user32") {
526526 // Program is loading user32.dll, in the applications we are testing,
527527 // this only happens if an assert has fired. By now the message has
528528 // already been printed, so simply close the program.