Permalink
Browse files

Push some common helper code down to llvm-base-types

  • Loading branch information...
1 parent af18902 commit 0fb30d9e522814394e8f86900d2b39981d8e4b4d @travitch committed Apr 26, 2012
Showing with 2 additions and 11 deletions.
  1. +2 −11 src/LLVM/Analysis/AccessPath.hs
@@ -22,7 +22,7 @@ import Control.DeepSeq
import Control.Exception
import Control.Failure hiding ( failure )
import qualified Control.Failure as F
-import Data.List ( foldl', stripPrefix )
+import Data.List ( foldl' )
import Data.Typeable
import Debug.Trace.LocationTH
@@ -155,19 +155,10 @@ accessPath i =
-- impossible, but it is pretty much always the case.
externalizeAccessPath :: AbstractAccessPath -> Maybe (String, [AccessType])
externalizeAccessPath accPath = do
- structName <- case stripPointerTypes bt of
- TypeStruct (Just name) _ _ -> return name
- _ -> Nothing
- let baseName = case stripPrefix "struct." structName of
- Nothing -> takeWhile (/='.') structName
- Just n' -> takeWhile (/='.') n'
+ baseName <- structTypeToName (stripPointerTypes bt)
return (baseName, abstractAccessPathComponents accPath)
where
bt = abstractAccessPathBaseType accPath
- stripPointerTypes t =
- case t of
- TypePointer t' _ -> stripPointerTypes t'
- _ -> t
-- Internal Helpers

0 comments on commit 0fb30d9

Please sign in to comment.