Skip to content

Commit 452f24a

Browse files
committed
Workaround GCC array bounds checking warning
Fixes #160, closes #163.
1 parent 4e0bf96 commit 452f24a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/libclang/libclang_parser.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ bool is_absolute(const std::string& file)
117117

118118
std::string get_full_path(const detail::cxstring& dir, const std::string& file)
119119
{
120-
if (is_absolute(file))
120+
if (file.empty())
121+
// empty file refers to directory
122+
return dir.std_str();
123+
else if (is_absolute(file))
121124
// absolute file
122125
return file;
123126
else if (dir[dir.length() - 1] != '/' && dir[dir.length() - 1] != '\\')
@@ -210,7 +213,6 @@ libclang_compile_config::libclang_compile_config(const libclang_compilation_data
210213
: libclang_compile_config(CPPAST_CLANG_BINARY, database, file)
211214
{}
212215

213-
214216
cppast::libclang_compile_config::libclang_compile_config(
215217
std::string clang_binary, const libclang_compilation_database& database,
216218
const std::string& file)
@@ -485,10 +487,13 @@ void libclang_compile_config::do_set_flags(cpp_standard standard, compile_flags
485487
}
486488

487489
// Add language flag for C or C++
488-
if (is_c_standard(standard)) {
490+
if (is_c_standard(standard))
491+
{
489492
add_flag("-xc");
490493
use_c_ = true;
491-
} else {
494+
}
495+
else
496+
{
492497
add_flag("-xc++");
493498
use_c_ = false;
494499
}

0 commit comments

Comments
 (0)