aboutsummaryrefslogtreecommitdiffstats
path: root/bin/astdump
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2021-05-14 18:14:50 +0000
committerterminaldweller <thabogre@gmail.com>2021-05-14 18:14:50 +0000
commit6e528248414e330c9e25e81596ab47b8b8a5b701 (patch)
treee1aa41a7f3198eeac187e6177ec7d4a33db229d3 /bin/astdump
downloadscripts-6e528248414e330c9e25e81596ab47b8b8a5b701.tar.gz
scripts-6e528248414e330c9e25e81596ab47b8b8a5b701.zip
first commitmaster
Diffstat (limited to 'bin/astdump')
-rwxr-xr-xbin/astdump44
1 files changed, 44 insertions, 0 deletions
diff --git a/bin/astdump b/bin/astdump
new file mode 100755
index 0000000..668913d
--- /dev/null
+++ b/bin/astdump
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+INPUT="./testFuncs1.c"
+OUTPUT="./dump"
+OPTIONS="--"
+RUN="1"
+
+while [[ $# -gt 0 ]]
+do
+ passarg="$1"
+
+ case $passarg in
+ -i|--input)
+ INPUT="$2"
+ shift
+ ;;
+ -o|--output)
+ OUTPUT="$2"
+ shift
+ ;;
+ -op|--options)
+ OPTIONS="$2"
+ shift
+ ;;
+ -h|--help)
+ echo "the script simply dumps the AST of the input."
+ echo "-i|--input the input file full path."
+ echo "-o|--output the output fule full path."
+ echo "-op|--options extra options to pass to clang"
+ echo "-h|--help prints out the help."
+ RUN="0"
+ ;;
+ *)
+ echo $1 is not a valid argument...
+ RUN="0"
+ shift
+ esac
+ shift
+done
+
+if [[ "$RUN" == "1" ]]; then
+ "clang" -Xclang -ast-dump -fsyntax-only "$INPUT" "$OPTIONS" > "$OUTPUT"
+
+fi