Skip to content

Commit b64a5cc

Browse files
committed
Tidy comments; add docs helper
1 parent e2b6611 commit b64a5cc

File tree

4 files changed

+35
-11
lines changed

4 files changed

+35
-11
lines changed

cpp/src/reachability_analyzer.cpp

+5-9
Original file line numberDiff line numberDiff line change
@@ -351,16 +351,12 @@ void ReachabilityAnalyzer::findMacroDefns(clang::PreprocessingRecord &pr,
351351
}
352352

353353
// 1. The PreprocessingRecord only inlcudes the Macro expanded when typed into
354-
// the source,
355-
// not any subsequent macros expanded _inside a macro_.
356-
// 2. None of
357-
// SourceManager::{getFileLoc,getExpansionLoc,get(Immediate)SpellingLoc}()
358-
// enable
359-
// to go from the source _down_/expand the Macros, only to go from a fully
360-
// expanded location back up to the source.
354+
// the source, not any subsequent macros expanded _inside a macro_.
355+
// 2. None of getFileLoc, getExpansionLoc, get(Immediate)SpellingLoc, in
356+
// SourceManager::() enable to go from the source _down_/expand the macros,
357+
// only to go from a fully expanded location back up to the source.
361358
// 3. It seems difficult/not sensible to re-lex/pp the macro _definition_ to get
362-
// at the macros
363-
// it refers to.
359+
// at the macros it refers to.
364360
// Therefore, we add a PPCallback that records _all_ macro expansions, even
365361
// those that occur within a macro.
366362
void ReachabilityAnalyzer::ExecuteAction() {

cpp/src/reachability_analyzer.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class PPRecordNested : public clang::PPCallbacks {
144144
// 2|//-"hi"
145145
// ```
146146
//
147-
// Futhermore, it seems like the PreprocessingRecord is filled up first,
147+
// Furthermore, it seems like the PreprocessingRecord is filled up first,
148148
// before any user-defined callbacks are run. This means that adjusting the
149149
// source range for macros in HandleMacroDefine is too late.
150150
if (const auto num_tokens = macro_info->getNumTokens(); num_tokens > 0) {

cpp/test/run_test.py

-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ def __init__(self, carver):
112112
eprint("run './test/run_test.py make' first")
113113

114114
def run(self, input_rel_path):
115-
cwd = os.getcwd()
116115
completed = subprocess.run([self.carver, '-r=main', input_rel_path], capture_output=True, text=True)
117116
return completed.stdout if completed.stdout != None else completed.stderr
118117

etc/docs.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
# This is a helper script to build and run LLVM docs locally with an indexed
4+
# search feature, which is invaluable for developing on a specific version.
5+
6+
set -euo pipefail
7+
8+
# export PS4="\$LINENO: "
9+
# set -xv
10+
11+
mkdir -p build
12+
cd build
13+
addr=$(ip addr | grep eth0 | tail -n 1 | cut -d' ' -f6 | cut -d'/' -f1)
14+
[ -e Makefile ] || cmake \
15+
-DLLVM_ENABLE_PROJECTS='clang' \
16+
-DLLVM_ENABLE_DOXYGEN=ON \
17+
-DLLVM_DOXYGEN_EXTERNAL_SEARCH=ON \
18+
-DLLVM_DOXYGEN_SEARCHENGINE_URL="http://${addr}:8000/cgi-bin/doxysearch.cgi" \
19+
-DDOXYGEN_EXECUTABLE="/usr/local/bin/doxygen" \
20+
../llvm
21+
[ -d tools/clang/docs/doxygen ] || make doxygen-clang
22+
cd tools/clang/docs/doxygen
23+
mkdir -p cgi-bin
24+
[ -e cgi-bin/doxysearch.cgi ] || cp $HOME/doxygen-1.9.4/bin/doxysearch.cgi cgi-bin
25+
[ -d doxysearch.db ] || $HOME/doxygen-1.9.4/bin/doxyindexer searchdata.xml
26+
# update URL incase it's changed
27+
sed -i "s~172.*:~${addr}:~g" html/search/search.js
28+
python3 -m http.server --cgi &
29+
echo "http://${addr}:8000/html"

0 commit comments

Comments
 (0)