Skip to content

Commit

Permalink
Fancy C++ types
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Aug 7, 2023
1 parent c0b54ae commit 45fd258
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@ internal fun parseName(fqn: CharSequence, delimiter: String, vararg splitDelimit

var name: Name? = null
for (part in parts) {
val localName = part.replace(")", "").replace("*", "")
if (localName.isNotEmpty()) {
name = Name(localName, name, delimiter)
}
name = Name(part, name, delimiter)
}

// Actually this should not occur, but otherwise the compiler won't let us return a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class CXXLanguageFrontend(language: Language<CXXLanguageFrontend>, ctx: Translat

val symbols: HashMap<String, String> = HashMap()
symbols.putAll(config.symbols)

includePaths.addAll(config.includePaths.map { it.toAbsolutePath().toString() })

config.compilationDatabase?.getIncludePaths(file)?.let { includePaths.addAll(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1590,6 +1590,6 @@ internal class CXXLanguageFrontendTest : BaseTest() {

val ptr = tu.variables["ptr"]
assertNotNull(ptr)
assertLocalName("__decltype(nullptr)", ptr.type)
assertLocalName("decltype(nullptr)", ptr.type)
}
}
4 changes: 2 additions & 2 deletions cpg-language-cxx/src/test/resources/cxx/fancy_types.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
typedef __decltype(nullptr) nullptr_t
typedef __decltype(nullptr) nullptr_t;

nullptr_t ptr;
nullptr_t ptr;

0 comments on commit 45fd258

Please sign in to comment.