mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-19 21:01:36 +00:00
Update cheatsheets
This commit is contained in:
33
clang
Normal file
33
clang
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, common]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# clang
|
||||
|
||||
> Compiler for C, C++, and Objective-C source files. Can be used as a drop-in replacement for GCC.
|
||||
> More information: <https://clang.llvm.org/docs/ClangCommandLineReference.html>.
|
||||
|
||||
- Compile a source code file into an executable binary:
|
||||
|
||||
`clang {{input_source.c}} -o {{output_executable}}`
|
||||
|
||||
- Activate output of all errors and warnings:
|
||||
|
||||
`clang {{input_source.c}} -Wall -o {{output_executable}}`
|
||||
|
||||
- Include libraries located at a different path than the source file:
|
||||
|
||||
`clang {{input_source.c}} -o {{output_executable}} -I{{header_path}} -L{{library_path}} -l{{library_name}}`
|
||||
|
||||
- Compile source code into LLVM Intermediate Representation (IR):
|
||||
|
||||
`clang -S -emit-llvm {{file.c}} -o {{file.ll}}`
|
||||
|
||||
- Compile source code without linking:
|
||||
|
||||
`clang -c {{input_source.c}}`
|
||||
|
||||
- Optimize the compiled program for performance:
|
||||
|
||||
`clang {{path/to/source.c}} -O{{1|2|3|fast}}`
|
||||
Reference in New Issue
Block a user