[cfe-commits] r89305 - in /cfe/trunk/lib/Driver: Driver.cpp HostInfo.cpp Tools.cpp

Daniel Dunbar daniel at zuster.org
Wed Nov 18 19:26:40 PST 2009


Author: ddunbar
Date: Wed Nov 18 21:26:40 2009
New Revision: 89305

URL: http://llvm.org/viewvc/llvm-project?rev=89305&view=rev
Log:
Use Option::matches instead of direct ID comparison.

Modified:
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/lib/Driver/HostInfo.cpp
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=89305&r1=89304&r2=89305&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Nov 18 21:26:40 2009
@@ -592,7 +592,7 @@
        it != ie; ++it) {
     Arg *A = *it;
 
-    if (A->getOption().getId() == options::OPT_arch) {
+    if (A->getOption().matches(options::OPT_arch)) {
       // Validate the option here; we don't save the type here because its
       // particular spelling may participate in other driver choices.
       llvm::Triple::ArchType Arch =
@@ -731,7 +731,7 @@
       // necessary.
       Inputs.push_back(std::make_pair(types::TY_Object, A));
 
-    } else if (A->getOption().getId() == options::OPT_x) {
+    } else if (A->getOption().matches(options::OPT_x)) {
       InputTypeArg = A;
       InputType = types::lookupTypeForTypeSpecifier(A->getValue(Args));
 
@@ -985,7 +985,7 @@
         // FIXME: Use iterator.
         for (ArgList::const_iterator it = C.getArgs().begin(),
                ie = C.getArgs().end(); it != ie; ++it) {
-          if ((*it)->isClaimed() && (*it)->getOption().matches(Opt.getId())) {
+          if ((*it)->isClaimed() && (*it)->getOption().matches(&Opt)) {
             DuplicateClaimed = true;
             break;
           }

Modified: cfe/trunk/lib/Driver/HostInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/HostInfo.cpp?rev=89305&r1=89304&r2=89305&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/HostInfo.cpp (original)
+++ cfe/trunk/lib/Driver/HostInfo.cpp Wed Nov 18 21:26:40 2009
@@ -122,7 +122,7 @@
     //
     // FIXME: Should this information be in llvm::Triple?
     if (Arg *A = Args.getLastArg(options::OPT_m32, options::OPT_m64)) {
-      if (A->getOption().getId() == options::OPT_m32) {
+      if (A->getOption().matches(options::OPT_m32)) {
         if (Arch == llvm::Triple::x86_64)
           Arch = llvm::Triple::x86;
         if (Arch == llvm::Triple::ppc64)
@@ -205,11 +205,11 @@
     if (Triple.getArch() == llvm::Triple::x86 ||
         Triple.getArch() == llvm::Triple::x86_64) {
       ArchName =
-        (A->getOption().getId() == options::OPT_m32) ? "i386" : "x86_64";
+        (A->getOption().matches(options::OPT_m32)) ? "i386" : "x86_64";
     } else if (Triple.getArch() == llvm::Triple::ppc ||
                Triple.getArch() == llvm::Triple::ppc64) {
       ArchName =
-        (A->getOption().getId() == options::OPT_m32) ? "powerpc" : "powerpc64";
+        (A->getOption().matches(options::OPT_m32)) ? "powerpc" : "powerpc64";
     }
   }
 
@@ -478,11 +478,11 @@
     if (Triple.getArch() == llvm::Triple::x86 ||
         Triple.getArch() == llvm::Triple::x86_64) {
       ArchName =
-        (A->getOption().getId() == options::OPT_m32) ? "i386" : "x86_64";
+        (A->getOption().matches(options::OPT_m32)) ? "i386" : "x86_64";
     } else if (Triple.getArch() == llvm::Triple::ppc ||
                Triple.getArch() == llvm::Triple::ppc64) {
       ArchName =
-        (A->getOption().getId() == options::OPT_m32) ? "powerpc" : "powerpc64";
+        (A->getOption().matches(options::OPT_m32)) ? "powerpc" : "powerpc64";
     }
   }
 

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=89305&r1=89304&r2=89305&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Nov 18 21:26:40 2009
@@ -81,8 +81,8 @@
         DepFile = Output.getFilename();
     } else if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
       DepFile = MF->getValue(Args);
-    } else if (A->getOption().getId() == options::OPT_M ||
-               A->getOption().getId() == options::OPT_MM) {
+    } else if (A->getOption().matches(options::OPT_M) ||
+               A->getOption().matches(options::OPT_MM)) {
       DepFile = "-";
     } else {
       DepFile = darwin::CC1::getDependencyFileName(Args, Inputs);
@@ -116,8 +116,8 @@
       CmdArgs.push_back(DepTarget);
     }
 
-    if (A->getOption().getId() == options::OPT_M ||
-        A->getOption().getId() == options::OPT_MD)
+    if (A->getOption().matches(options::OPT_M) ||
+        A->getOption().matches(options::OPT_MD))
       CmdArgs.push_back("-sys-header-deps");
   }
 
@@ -822,7 +822,7 @@
   // Manually translate -O to -O2 and -O4 to -O3; let clang reject
   // others.
   if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
-    if (A->getOption().getId() == options::OPT_O4)
+    if (A->getOption().matches(options::OPT_O4))
       CmdArgs.push_back("-O3");
     else if (A->getValue(Args)[0] == '\0')
       CmdArgs.push_back("-O2");





More information about the cfe-commits mailing list