Created
June 6, 2014 18:05
-
-
Save apriori/871b01b9a7a774ba22f4 to your computer and use it in GitHub Desktop.
Another segfault in LibClang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main (main) where | |
import Control.Monad | |
import Control.Monad.Trans | |
import System.Environment | |
import Text.Printf | |
import qualified Data.Vector as DV(empty) | |
import Clang | |
import Clang.TranslationUnit(getCursor, withCreateIndex, withParse) | |
import Clang.Cursor | |
import Clang.String | |
import Clang.File as F | |
import qualified Data.Vector.Storable as DVS(mapM_) | |
test :: TranslationUnit s' -> Clang s () | |
test tu = getCursor tu >>= getChildren >>= DVS.mapM_ printInfo | |
where | |
printInfo :: Cursor s -> Clang s () | |
printInfo c = do | |
fileName <- getIncludedFile c >>= F.getName >>= unpack | |
liftIO $ putStrLn $ "FileName " ++ fileName | |
main :: IO () | |
main = do | |
(arg : args) <- getArgs | |
withCreateIndex False False $ \index -> | |
withParse index (Just arg) args DV.empty [TranslationUnit_None] test | |
return () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment