Skip to content

Commit

Permalink
Merge pull request #513 from andreasfertig/fixIssue512
Browse files Browse the repository at this point in the history
Fixed #512: added missing PointerToIntegral conversion.
  • Loading branch information
andreasfertig authored Jan 20, 2023
2 parents 7dfa882 + 88ed37e commit a6dabbb
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 19 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,24 @@ jobs:
# environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
# }

# MSVC 2019
- {
name: "MSVC 2022 / LLVM 14 @ Windows Code Coverage & Debug",
os: windows-2022,
build_type: Release,
cxx: "clang-cl.exe",
llvm_version: "14.0.0",
llvm_config: "current/bin/llvm-config.exe",
coverage: "Yes",
static: "Yes",
debug: "Yes",
tidy: "No",
run_tests: "No",
bin_name: "insights.exe",
archive_name: "insights-windows",
upload: "No",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
}
# # MSVC 2019
# - {
# name: "MSVC 2022 / LLVM 14 @ Windows Code Coverage & Debug",
# os: windows-2022,
# build_type: Release,
# cxx: "clang-cl.exe",
# llvm_version: "14.0.0",
# llvm_config: "current/bin/llvm-config.exe",
# coverage: "Yes",
# static: "Yes",
# debug: "Yes",
# tidy: "No",
# run_tests: "No",
# bin_name: "insights.exe",
# archive_name: "insights-windows",
# upload: "No",
# environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
# }

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static std::string AccessToStringWithColon(const AccessSpecifier& access)

static std::string_view GetCastName(const CastKind castKind)
{
if(is{castKind}.any_of(CastKind::CK_BitCast, CastKind::CK_IntegralToPointer)) {
if(is{castKind}.any_of(CastKind::CK_BitCast, CastKind::CK_IntegralToPointer, CastKind::CK_PointerToIntegral)) {
return kwReinterpretCast;
}

Expand Down
1 change: 1 addition & 0 deletions InsightsUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "llvm/ADT/STLExtras.h"

#include <type_traits>
#include <utility>
//-----------------------------------------------------------------------------

Expand Down
10 changes: 10 additions & 0 deletions tests/Issue512.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
long long int charPtrToInt(const char* str)
{
long long int a = (long long int)str;
return a;
}

int main() {
const char* str = "123";
charPtrToInt(str);
}
14 changes: 14 additions & 0 deletions tests/Issue512.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
long long charPtrToInt(const char * str)
{
long long a = reinterpret_cast<long long>(str);
return a;
}


int main()
{
const char * str = "123";
charPtrToInt(str);
return 0;
}

0 comments on commit a6dabbb

Please sign in to comment.