-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use fully-qualified namespaces for all Kompute objects
Even if they are already in the kp namespace. Add a script to make these changes automatically. Signed-off-by: Robert Quill <robert.quill@imgtec.com>
- Loading branch information
Showing
20 changed files
with
341 additions
and
299 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
# Run this from the src directory | ||
|
||
filepath="/path/to/file.txt" | ||
filename=$(basename "$filepath") | ||
|
||
# Get the class names from each .hpp file. | ||
# Assumes that the name of the header file is also the class name | ||
# and that the class name is a top-level class that belongs in the | ||
# kp namespace. | ||
for file in $(find . -name "*.hpp"); do | ||
class_name=$(basename "$file" .hpp) | ||
echo "$class_name" | ||
|
||
# Replace anything where the class name is used as a template argument | ||
find . \( -name "*.cpp" -o -name "*.hpp" \) -exec sed -i s/\<"$class_name"/\<kp::$class_name/g {} + | ||
|
||
# Replace anything where a member of the class is accessed using :: | ||
find . \( -name "*.cpp" -o -name "*.hpp" \) -exec sed -i "s/\(^\|[^:]\)\($class_name::\)/\1kp::\2/g" {} + | ||
done | ||
|
||
# Special cases | ||
find \( -name "*.cpp" -o -name "*.hpp" \) -exec sed -i 's/\(^\|[^:]\)\(TensorT<\)/\1kp::\2/g' {} + | ||
find \( -name "*.cpp" -o -name "*.hpp" \) -exec sed -i 's/\(^\|[^:]\)\(TensorTypes::\)/\1kp::Tensor::\2/g' {} + | ||
find \( -name "*.cpp" -o -name "*.hpp" \) -exec sed -i 's/\(^\|[^:]\)\(TensorDataTypes::\)/\1kp::Tensor::\2/g' {} + |
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
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
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
Oops, something went wrong.