Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CFG] Add an option to expand CXXDefaultInitExpr into aggregate initi…
…alization This is useful for clients that are relying on linearized CFGs for evaluating subexpressions and want the default initializer to be evaluated properly. The upcoming lifetime analysis is using this but it might also be useful for the static analyzer at some point. Differential Revision: https://reviews.llvm.org/D71642
- Loading branch information
Showing
6 changed files
with
68 additions
and
4 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
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
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,28 @@ | ||
// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -analyzer-config cfg-expand-default-aggr-inits=true %s > %t 2>&1 | ||
// RUN: FileCheck --input-file=%t %s | ||
|
||
static char a[] = "foobar"; | ||
|
||
struct StringRef { | ||
const char *member = nullptr; | ||
int len = 3; | ||
}; | ||
|
||
int main() { | ||
StringRef s{a}; | ||
(void)s; | ||
} | ||
|
||
// CHECK: [B1] | ||
// CHECK-NEXT: 1: a | ||
// CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, ArrayToPointerDecay, char *) | ||
// CHECK-NEXT: 3: [B1.2] (ImplicitCastExpr, NoOp, const char *) | ||
// CHECK-NEXT: 4: 3 | ||
// CHECK-NEXT: 5: | ||
// CHECK-NEXT: 6: {[B1.1]} | ||
// CHECK-NEXT: 7: StringRef s{a}; | ||
// CHECK-NEXT: 8: s | ||
// CHECK-NEXT: 9: (void)[B1.8] (CStyleCastExpr, ToVoid, void) | ||
// CHECK-NEXT: Preds (1): B2 | ||
// CHECK-NEXT: Succs (1): B0 | ||
|
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