[llvm-commits] [llvm] r122086 - in /llvm/trunk: include/llvm/ADT/SmallString.h include/llvm/Support/Compiler.h include/llvm/Support/PathV1.h lib/CompilerDriver/Action.cpp

Michael J. Spencer bigcheesegs at gmail.com
Fri Dec 17 13:21:31 PST 2010


Author: mspencer
Date: Fri Dec 17 15:21:31 2010
New Revision: 122086

URL: http://llvm.org/viewvc/llvm-project?rev=122086&view=rev
Log:
Support/Path: Deprecate PathV1::isAbsolute.

Modified:
    llvm/trunk/include/llvm/ADT/SmallString.h
    llvm/trunk/include/llvm/Support/Compiler.h
    llvm/trunk/include/llvm/Support/PathV1.h
    llvm/trunk/lib/CompilerDriver/Action.cpp

Modified: llvm/trunk/include/llvm/ADT/SmallString.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallString.h?rev=122086&r1=122085&r2=122086&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallString.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallString.h Fri Dec 17 15:21:31 2010
@@ -27,6 +27,9 @@
   // Default ctor - Initialize to empty.
   SmallString() {}
 
+  // Initialize from a StringRef.
+  SmallString(StringRef S) : SmallVector<char, InternalLen>(S.begin(), S.end()) {}
+
   // Initialize with a range.
   template<typename ItTy>
   SmallString(ItTy S, ItTy E) : SmallVector<char, InternalLen>(S, E) {}

Modified: llvm/trunk/include/llvm/Support/Compiler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=122086&r1=122085&r2=122086&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Compiler.h (original)
+++ llvm/trunk/include/llvm/Support/Compiler.h Fri Dec 17 15:21:31 2010
@@ -15,6 +15,10 @@
 #ifndef LLVM_SUPPORT_COMPILER_H
 #define LLVM_SUPPORT_COMPILER_H
 
+#ifndef __has_feature
+# define __has_feature(x) 0
+#endif
+
 /// LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked
 /// into a shared library, then the class should be private to the library and
 /// not accessible from outside it.  Can also be used to mark variables and
@@ -107,4 +111,19 @@
 #define LLVM_ATTRIBUTE_NORETURN
 #endif
 
+// LLVM_ATTRIBUTE_DEPRECATED(decl, "message")
+#if __has_feature(attribute_deprecated_with_message)
+# define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \
+  decl __attribute__((deprecated(message)))
+#elif defined(__GNUC__)
+# define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \
+  decl __attribute__((deprecated))
+#elif defined(_MSC_VER)
+# define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \
+  __declspec(deprecated(message)) decl
+#else
+# define LLVM_ATTRIBUTE_DEPRECATED(decl, message) \
+  decl
+#endif
+
 #endif

Modified: llvm/trunk/include/llvm/Support/PathV1.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PathV1.h?rev=122086&r1=122085&r2=122086&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/PathV1.h (original)
+++ llvm/trunk/include/llvm/Support/PathV1.h Fri Dec 17 15:21:31 2010
@@ -15,11 +15,15 @@
 #define LLVM_SYSTEM_PATH_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/TimeValue.h"
 #include <set>
 #include <string>
 #include <vector>
 
+#define LLVMV_PATH_DEPRECATED_MSG \
+  "PathV1 is being deprecated, please use the PathV2 API."
+
 namespace llvm {
 namespace sys {
 
@@ -300,12 +304,12 @@
       /// This function determines if the path name is absolute, as opposed to
       /// relative.
       /// @brief Determine if the path is absolute.
-      bool isAbsolute() const;
+      LLVM_ATTRIBUTE_DEPRECATED(bool isAbsolute() const, LLVMV_PATH_DEPRECATED_MSG);
 
       /// This function determines if the path name is absolute, as opposed to
       /// relative.
       /// @brief Determine if the path is absolute.
-      static bool isAbsolute(const char *NameStart, unsigned NameLen);
+      LLVM_ATTRIBUTE_DEPRECATED(static bool isAbsolute(const char *NameStart, unsigned NameLen), LLVMV_PATH_DEPRECATED_MSG);
 
       /// 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

Modified: llvm/trunk/lib/CompilerDriver/Action.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/Action.cpp?rev=122086&r1=122085&r2=122086&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/Action.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/Action.cpp Fri Dec 17 15:21:31 2010
@@ -56,7 +56,7 @@
   int ExecuteProgram (const std::string& name, const StrVector& args) {
     sys::Path prog(name);
 
-    if (!prog.isAbsolute()) {
+    if (sys::path::is_relative(prog.str())) {
       prog = PrependMainExecutablePath(name, ProgramName,
                                        (void *)(intptr_t)&Main);
 





More information about the llvm-commits mailing list