r283611 - Driver: use StringRef instead of raw pointer in lookupTypeForExtension() (NFC)

Mehdi Amini via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 7 14:41:00 PDT 2016


Author: mehdi_amini
Date: Fri Oct  7 16:41:00 2016
New Revision: 283611

URL: http://llvm.org/viewvc/llvm-project?rev=283611&view=rev
Log:
Driver: use StringRef instead of raw pointer in lookupTypeForExtension() (NFC)

Modified:
    cfe/trunk/include/clang/Driver/ToolChain.h
    cfe/trunk/include/clang/Driver/Types.h
    cfe/trunk/lib/Driver/ToolChain.cpp
    cfe/trunk/lib/Driver/ToolChains.cpp
    cfe/trunk/lib/Driver/ToolChains.h
    cfe/trunk/lib/Driver/Types.cpp

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=283611&r1=283610&r2=283611&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Oct  7 16:41:00 2016
@@ -233,7 +233,7 @@ public:
 
   /// LookupTypeForExtension - Return the default language type to use for the
   /// given extension.
-  virtual types::ID LookupTypeForExtension(const char *Ext) const;
+  virtual types::ID LookupTypeForExtension(StringRef Ext) const;
 
   /// IsBlocksDefault - Does this tool chain enable -fblocks by default.
   virtual bool IsBlocksDefault() const { return false; }

Modified: cfe/trunk/include/clang/Driver/Types.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.h?rev=283611&r1=283610&r2=283611&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Types.h (original)
+++ cfe/trunk/include/clang/Driver/Types.h Fri Oct  7 16:41:00 2016
@@ -13,6 +13,9 @@
 #include "clang/Driver/Phases.h"
 #include "llvm/ADT/SmallVector.h"
 
+namespace llvm {
+class StringRef;
+}
 namespace clang {
 namespace driver {
 namespace types {
@@ -79,7 +82,7 @@ namespace types {
 
   /// lookupTypeForExtension - Lookup the type to use for the file
   /// extension \p Ext.
-  ID lookupTypeForExtension(const char *Ext);
+  ID lookupTypeForExtension(llvm::StringRef Ext);
 
   /// lookupTypeForTypSpecifier - Lookup the type to use for a user
   /// specified type name.

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=283611&r1=283610&r2=283611&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Oct  7 16:41:00 2016
@@ -370,7 +370,7 @@ std::string ToolChain::GetLinkerPath() c
   return GetProgramPath(DefaultLinker);
 }
 
-types::ID ToolChain::LookupTypeForExtension(const char *Ext) const {
+types::ID ToolChain::LookupTypeForExtension(StringRef Ext) const {
   return types::lookupTypeForExtension(Ext);
 }
 

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=283611&r1=283610&r2=283611&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Oct  7 16:41:00 2016
@@ -54,7 +54,7 @@ MachO::MachO(const Driver &D, const llvm
 Darwin::Darwin(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
     : MachO(D, Triple, Args), TargetInitialized(false) {}
 
-types::ID MachO::LookupTypeForExtension(const char *Ext) const {
+types::ID MachO::LookupTypeForExtension(StringRef Ext) const {
   types::ID Ty = types::lookupTypeForExtension(Ext);
 
   // Darwin always preprocesses assembly files (unless -x is used explicitly).

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=283611&r1=283610&r2=283611&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Fri Oct  7 16:41:00 2016
@@ -312,7 +312,7 @@ public:
   /// @name ToolChain Implementation
   /// {
 
-  types::ID LookupTypeForExtension(const char *Ext) const override;
+  types::ID LookupTypeForExtension(StringRef Ext) const override;
 
   bool HasNativeLLVMSupport() const override;
 

Modified: cfe/trunk/lib/Driver/Types.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Types.cpp?rev=283611&r1=283610&r2=283611&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Types.cpp (original)
+++ cfe/trunk/lib/Driver/Types.cpp Fri Oct  7 16:41:00 2016
@@ -170,7 +170,7 @@ bool types::isCuda(ID Id) {
   }
 }
 
-types::ID types::lookupTypeForExtension(const char *Ext) {
+types::ID types::lookupTypeForExtension(llvm::StringRef Ext) {
   return llvm::StringSwitch<types::ID>(Ext)
            .Case("c", TY_C)
            .Case("C", TY_CXX)




More information about the cfe-commits mailing list