[cfe-commits] r81731 - in /cfe/trunk: include/clang/Basic/DiagnosticFrontendKinds.td include/clang/Basic/TargetInfo.h tools/clang-cc/clang-cc.cpp

Daniel Dunbar daniel at zuster.org
Sun Sep 13 17:02:13 PDT 2009


Author: ddunbar
Date: Sun Sep 13 19:02:12 2009
New Revision: 81731

URL: http://llvm.org/viewvc/llvm-project?rev=81731&view=rev
Log:
Add -target-abi clang-cc option, currently unused.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
    cfe/trunk/include/clang/Basic/TargetInfo.h
    cfe/trunk/tools/clang-cc/clang-cc.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=81731&r1=81730&r2=81731&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Sun Sep 13 19:02:12 2009
@@ -11,6 +11,7 @@
 
 def err_fe_unknown_triple : Error<
   "unknown target triple '%0', please use -triple or -arch">;
+def err_fe_unknown_target_abi : Error<"unknown target ABI '%0'">;
 def err_fe_error_reading : Error<"error reading '%0'">;
 def err_fe_error_reading_stdin : Error<"error reading stdin">;
 def err_fe_error_backend : Error<"error in backend: %0">, DefaultFatal;

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=81731&r1=81730&r2=81731&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Sun Sep 13 19:02:12 2009
@@ -352,6 +352,13 @@
                                   llvm::StringMap<bool> &Features) const {
   }
 
+  /// setABI - Use the specific ABI.
+  ///
+  /// \return - False on error (invalid ABI name).
+  virtual bool setABI(const std::string &Name) {
+    return false;
+  }
+
   /// setFeatureEnabled - Enable or disable a specific target feature,
   /// the feature name must be valid.
   ///

Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=81731&r1=81730&r2=81731&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Sun Sep 13 19:02:12 2009
@@ -663,6 +663,10 @@
 NoElideConstructors("fno-elide-constructors",
                     llvm::cl::desc("Disable C++ copy constructor elision"));
 
+static llvm::cl::opt<std::string>
+TargetABI("target-abi",
+          llvm::cl::desc("Target a particular ABI type"));
+
 
 // It might be nice to add bounds to the CommandLine library directly.
 struct OptLevelParser : public llvm::cl::parser<unsigned> {
@@ -2242,6 +2246,15 @@
     return 1;
   }
 
+  // Set the target ABI if specified.
+  if (!TargetABI.empty()) {
+    if (!Target->setABI(TargetABI)) {
+      Diags.Report(FullSourceLoc(), diag::err_fe_unknown_target_abi)
+        << TargetABI;
+      return 1;
+    }
+  }
+
   if (!InheritanceViewCls.empty())  // C++ visualization?
     ProgAction = InheritanceView;
 





More information about the cfe-commits mailing list